mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-19 08:15:31 +00:00
Bug 1574745 - Prepare CompositorOGL for native layers that are not located at (0, 0). r=mattwoodrow
Differential Revision: https://phabricator.services.mozilla.com/D42424 --HG-- extra : moz-landing-system : lando
This commit is contained in:
parent
77e2ee0c73
commit
c3ccb5e5ca
@ -959,6 +959,7 @@ class CompositingRenderTarget : public TextureSource {
|
||||
*/
|
||||
void ClearOnBind() { mClearOnBind = true; }
|
||||
|
||||
void SetOrigin(const gfx::IntPoint& aOrigin) { mOrigin = aOrigin; }
|
||||
const gfx::IntPoint& GetOrigin() const { return mOrigin; }
|
||||
gfx::IntRect GetRect() { return gfx::IntRect(GetOrigin(), GetSize()); }
|
||||
|
||||
|
@ -856,6 +856,7 @@ CompositorOGL::RenderTargetForNativeLayer(NativeLayer* aNativeLayer,
|
||||
MOZ_RELEASE_ASSERT(match != mRegisteredIOSurfaceRenderTargets.end(),
|
||||
"IOSurface has not been registered with this Compositor");
|
||||
RefPtr<CompositingRenderTargetOGL> rt = match->second;
|
||||
rt->SetOrigin(layerRect.TopLeft());
|
||||
|
||||
// Clip the render target to the invalid rect. This conserves memory bandwidth
|
||||
// and power.
|
||||
@ -879,7 +880,9 @@ Maybe<IntRect> CompositorOGL::BeginFrame(const nsIntRegion& aInvalidRegion,
|
||||
"frame still in progress (should have called EndFrame");
|
||||
|
||||
IntRect rect;
|
||||
if (mUseExternalSurfaceSize) {
|
||||
if (aNativeLayer && !mTarget) {
|
||||
rect = aNativeLayer->GetRect();
|
||||
} else if (mUseExternalSurfaceSize) {
|
||||
rect = IntRect(IntPoint(), mSurfaceSize);
|
||||
} else {
|
||||
rect = aRenderBounds;
|
||||
@ -966,7 +969,8 @@ Maybe<IntRect> CompositorOGL::BeginFrame(const nsIntRegion& aInvalidRegion,
|
||||
IntRegion clearRegion;
|
||||
clearRegion.Sub(*rtClip, aOpaqueRegion);
|
||||
if (!clearRegion.IsEmpty()) {
|
||||
IntRect clearRect = clearRegion.GetBounds();
|
||||
IntRect clearRect =
|
||||
clearRegion.GetBounds() - mCurrentRenderTarget->GetOrigin();
|
||||
ScopedGLState scopedScissorTestState(mGLContext, LOCAL_GL_SCISSOR_TEST,
|
||||
true);
|
||||
ScopedScissorRect autoScissorRect(mGLContext, clearRect.x,
|
||||
|
Loading…
Reference in New Issue
Block a user