From 865a952e997ffaffa13e3e51792d34cb2e702625 Mon Sep 17 00:00:00 2001 From: Markus Stange Date: Mon, 26 Aug 2019 00:58:44 +0000 Subject: [PATCH] Bug 1576499 - Turn aClipRectIn into a Maybe and rename it to aClipRect, now that aClipRectOut is gone. r=mattwoodrow Depends on D43372 Differential Revision: https://phabricator.services.mozilla.com/D43373 --HG-- extra : moz-landing-system : lando --- gfx/layers/Compositor.h | 4 ++-- gfx/layers/basic/BasicCompositor.cpp | 10 +++------- gfx/layers/basic/BasicCompositor.h | 2 +- gfx/layers/composite/LayerManagerComposite.cpp | 8 ++++---- gfx/layers/d3d11/CompositorD3D11.cpp | 6 +++--- gfx/layers/d3d11/CompositorD3D11.h | 2 +- gfx/layers/opengl/CompositorOGL.cpp | 2 +- gfx/layers/opengl/CompositorOGL.h | 2 +- 8 files changed, 16 insertions(+), 20 deletions(-) diff --git a/gfx/layers/Compositor.h b/gfx/layers/Compositor.h index 37163bf61937..4aa5fd5a364a 100644 --- a/gfx/layers/Compositor.h +++ b/gfx/layers/Compositor.h @@ -404,7 +404,7 @@ class Compositor : public TextureSourceProvider { * compositors where the performance for compositing the entire window is * sufficient. * - * aClipRectIn is the clip rect for the window in window space (optional). + * aClipRect is the clip rect for the window in window space (optional). * aRenderBounds bounding rect for rendering, in user space. * aOpaqueRegion is the area that contains opaque content. * @@ -413,7 +413,7 @@ class Compositor : public TextureSourceProvider { * is returned empty, composition should be aborted. */ virtual void BeginFrame(const nsIntRegion& aInvalidRegion, - const gfx::IntRect* aClipRectIn, + const Maybe& aClipRect, const gfx::IntRect& aRenderBounds, const nsIntRegion& aOpaqueRegion, NativeLayer* aNativeLayer, diff --git a/gfx/layers/basic/BasicCompositor.cpp b/gfx/layers/basic/BasicCompositor.cpp index c020a0b39113..a8c5464ff99f 100644 --- a/gfx/layers/basic/BasicCompositor.cpp +++ b/gfx/layers/basic/BasicCompositor.cpp @@ -887,7 +887,7 @@ bool BasicCompositor::BlitRenderTarget(CompositingRenderTarget* aSource, } void BasicCompositor::BeginFrame(const nsIntRegion& aInvalidRegion, - const IntRect* aClipRectIn, + const Maybe& aClipRect, const IntRect& aRenderBounds, const nsIntRegion& aOpaqueRegion, NativeLayer* aNativeLayer, @@ -1036,17 +1036,13 @@ void BasicCompositor::BeginFrame(const nsIntRegion& aInvalidRegion, *aRenderBoundsOut = rect; } - if (aClipRectIn) { - mRenderTarget->mDrawTarget->PushClipRect(Rect(*aClipRectIn)); - } else { - mRenderTarget->mDrawTarget->PushClipRect(Rect(rect)); - } + mRenderTarget->mDrawTarget->PushClipRect(Rect(aClipRect.valueOr(rect))); } void BasicCompositor::EndFrame() { Compositor::EndFrame(); - // Pop aClipRectIn/bounds rect + // Pop aClipRect/bounds rect mRenderTarget->mDrawTarget->PopClip(); if (StaticPrefs::nglayout_debug_widget_update_flashing()) { diff --git a/gfx/layers/basic/BasicCompositor.h b/gfx/layers/basic/BasicCompositor.h index 60e7c8508f94..d785aad64690 100644 --- a/gfx/layers/basic/BasicCompositor.h +++ b/gfx/layers/basic/BasicCompositor.h @@ -117,7 +117,7 @@ class BasicCompositor : public Compositor { void ClearRect(const gfx::Rect& aRect) override; void BeginFrame(const nsIntRegion& aInvalidRegion, - const gfx::IntRect* aClipRectIn, + const Maybe& aClipRect, const gfx::IntRect& aRenderBounds, const nsIntRegion& aOpaqueRegion, NativeLayer* aNativeLayer, gfx::IntRect* aRenderBoundsOut = nullptr) override; diff --git a/gfx/layers/composite/LayerManagerComposite.cpp b/gfx/layers/composite/LayerManagerComposite.cpp index 6f85914e95e0..fa8900023c69 100644 --- a/gfx/layers/composite/LayerManagerComposite.cpp +++ b/gfx/layers/composite/LayerManagerComposite.cpp @@ -988,9 +988,9 @@ bool LayerManagerComposite::Render(const nsIntRegion& aInvalidRegion, IntRect actualBounds; Maybe rootLayerClip = mRoot->GetClipRect().map( [](const ParentLayerIntRect& r) { return r.ToUnknownRect(); }); - mCompositor->BeginFrame( - aInvalidRegion, rootLayerClip ? &*rootLayerClip : nullptr, mRenderBounds, - aOpaqueRegion, mNativeLayerForEntireWindow, &actualBounds); + mCompositor->BeginFrame(aInvalidRegion, rootLayerClip, mRenderBounds, + aOpaqueRegion, mNativeLayerForEntireWindow, + &actualBounds); IntRect clipRect = rootLayerClip.valueOr(actualBounds); #if defined(MOZ_WIDGET_ANDROID) ScreenCoord offset = GetContentShiftForToolbar(); @@ -1227,7 +1227,7 @@ void LayerManagerComposite::RenderToPresentationSurface() { IntRect bounds = IntRect::Truncate(0, 0, scale * pageWidth, actualHeight); IntRect actualBounds; MOZ_ASSERT(mRoot->GetOpacity() == 1); - mCompositor->BeginFrame(invalid, nullptr, bounds, nsIntRegion(), nullptr, + mCompositor->BeginFrame(invalid, Nothing(), bounds, nsIntRegion(), nullptr, &actualBounds); // The Java side of Fennec sets a scissor rect that accounts for diff --git a/gfx/layers/d3d11/CompositorD3D11.cpp b/gfx/layers/d3d11/CompositorD3D11.cpp index 67609f55b72b..1a6fded86c08 100644 --- a/gfx/layers/d3d11/CompositorD3D11.cpp +++ b/gfx/layers/d3d11/CompositorD3D11.cpp @@ -1095,7 +1095,7 @@ void CompositorD3D11::DrawGeometry(const Geometry& aGeometry, } void CompositorD3D11::BeginFrame(const nsIntRegion& aInvalidRegion, - const IntRect* aClipRectIn, + const Maybe& aClipRect, const IntRect& aRenderBounds, const nsIntRegion& aOpaqueRegion, NativeLayer* aNativeLayer, @@ -1148,8 +1148,8 @@ void CompositorD3D11::BeginFrame(const nsIntRegion& aInvalidRegion, IntRect invalidRect = invalidRegionSafe.GetBounds(); IntRect clipRect = invalidRect; - if (aClipRectIn) { - clipRect.IntersectRect(clipRect, *aClipRectIn); + if (aClipRect) { + clipRect.IntersectRect(clipRect, *aClipRect); } if (clipRect.IsEmpty()) { diff --git a/gfx/layers/d3d11/CompositorD3D11.h b/gfx/layers/d3d11/CompositorD3D11.h index fca510ed6d90..5fb8aa42777d 100644 --- a/gfx/layers/d3d11/CompositorD3D11.h +++ b/gfx/layers/d3d11/CompositorD3D11.h @@ -93,7 +93,7 @@ class CompositorD3D11 : public Compositor { * Start a new frame. */ void BeginFrame(const nsIntRegion& aInvalidRegion, - const gfx::IntRect* aClipRectIn, + const Maybe& aClipRect, const gfx::IntRect& aRenderBounds, const nsIntRegion& aOpaqueRegion, NativeLayer* aNativeLayer, gfx::IntRect* aRenderBoundsOut = nullptr) override; diff --git a/gfx/layers/opengl/CompositorOGL.cpp b/gfx/layers/opengl/CompositorOGL.cpp index eb48996f5483..4826de59dfeb 100644 --- a/gfx/layers/opengl/CompositorOGL.cpp +++ b/gfx/layers/opengl/CompositorOGL.cpp @@ -869,7 +869,7 @@ CompositorOGL::RenderTargetForNativeLayer(NativeLayer* aNativeLayer, } void CompositorOGL::BeginFrame(const nsIntRegion& aInvalidRegion, - const IntRect* aClipRectIn, + const Maybe& aClipRect, const IntRect& aRenderBounds, const nsIntRegion& aOpaqueRegion, NativeLayer* aNativeLayer, diff --git a/gfx/layers/opengl/CompositorOGL.h b/gfx/layers/opengl/CompositorOGL.h index 34d103cb1070..f2ff7899cb1b 100644 --- a/gfx/layers/opengl/CompositorOGL.h +++ b/gfx/layers/opengl/CompositorOGL.h @@ -367,7 +367,7 @@ class CompositorOGL final : public Compositor { /* Start a new frame. */ void BeginFrame(const nsIntRegion& aInvalidRegion, - const gfx::IntRect* aClipRectIn, + const Maybe& aClipRect, const gfx::IntRect& aRenderBounds, const nsIntRegion& aOpaqueRegion, NativeLayer* aNativeLayer, gfx::IntRect* aRenderBoundsOut = nullptr) override;