From 4bcd4b87952cdebff2afe393bdf4e82758018f73 Mon Sep 17 00:00:00 2001 From: Markus Stange Date: Fri, 30 Aug 2019 19:51:37 +0000 Subject: [PATCH] Bug 1574745 - Respect render target clip during DrawGeometry culling and overdraw pixel counting. r=mattwoodrow Differential Revision: https://phabricator.services.mozilla.com/D43869 --HG-- extra : moz-landing-system : lando --- gfx/layers/opengl/CompositorOGL.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/gfx/layers/opengl/CompositorOGL.cpp b/gfx/layers/opengl/CompositorOGL.cpp index 86a01532de2a..40a344a6ca53 100644 --- a/gfx/layers/opengl/CompositorOGL.cpp +++ b/gfx/layers/opengl/CompositorOGL.cpp @@ -1290,11 +1290,15 @@ void CompositorOGL::DrawGeometry(const Geometry& aGeometry, IntPoint offset = mCurrentRenderTarget->GetOrigin(); IntSize size = mCurrentRenderTarget->GetSize(); - Rect renderBound(mCurrentRenderTarget->GetRect()); - // Convert aClipRect into render target space. + // Convert aClipRect into render target space, and intersect it with the + // render target's clip. IntRect clipRect = aClipRect + mCurrentRenderTarget->GetClipSpaceOrigin(); - renderBound.IntersectRect(renderBound, Rect(clipRect)); + if (Maybe rtClip = mCurrentRenderTarget->GetClipRect()) { + clipRect = clipRect.Intersect(*rtClip); + } + + Rect renderBound(mCurrentRenderTarget->GetRect().Intersect(clipRect)); Rect destRect = aTransform.TransformAndClipBounds(aRect, renderBound); @@ -1333,10 +1337,6 @@ void CompositorOGL::DrawGeometry(const Geometry& aGeometry, clipRect = clipRect.Intersect(RoundedOut(maskBounds)); } - if (Maybe rtClip = mCurrentRenderTarget->GetClipRect()) { - clipRect = clipRect.Intersect(*rtClip); - } - // Move clipRect into device space. clipRect -= offset;