Bug 1576499 - Turn aClipRectIn into a Maybe and rename it to aClipRect, now that aClipRectOut is gone. r=mattwoodrow
authorMarkus Stange <mstange@themasta.com>
Mon, 26 Aug 2019 00:58:44 +0000
changeset 554270 f55c80b421a9f843a27771767b119e036bd023b1
parent 554269 11dda086945d583b6fba3a3eb92fc63451c39c14
child 554271 03bdb2c6d8ce971bab73a2a09b1f9e94e84df8fc
push id2165
push userffxbld-merge
push dateMon, 14 Oct 2019 16:30:58 +0000
treeherdermozilla-release@0eae18af659f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmattwoodrow
bugs1576499
milestone70.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
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
gfx/layers/Compositor.h
gfx/layers/basic/BasicCompositor.cpp
gfx/layers/basic/BasicCompositor.h
gfx/layers/composite/LayerManagerComposite.cpp
gfx/layers/d3d11/CompositorD3D11.cpp
gfx/layers/d3d11/CompositorD3D11.h
gfx/layers/opengl/CompositorOGL.cpp
gfx/layers/opengl/CompositorOGL.h
--- a/gfx/layers/Compositor.h
+++ b/gfx/layers/Compositor.h
@@ -399,26 +399,26 @@ class Compositor : public TextureSourceP
 
   /**
    * Start a new frame.
    *
    * aInvalidRect is the invalid region of the screen; it can be ignored for
    * 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.
    *
    * If aRenderBoundsOut is non-null, it will be set to the render bounds
    * actually used by the compositor in window space. If aRenderBoundsOut
    * is returned empty, composition should be aborted.
    */
   virtual void BeginFrame(const nsIntRegion& aInvalidRegion,
-                          const gfx::IntRect* aClipRectIn,
+                          const Maybe<gfx::IntRect>& aClipRect,
                           const gfx::IntRect& aRenderBounds,
                           const nsIntRegion& aOpaqueRegion,
                           NativeLayer* aNativeLayer,
                           gfx::IntRect* aRenderBoundsOut = nullptr) = 0;
 
   /**
    * Notification that we've finished issuing draw commands for normal
    * layers (as opposed to the diagnostic overlay which comes after).
--- a/gfx/layers/basic/BasicCompositor.cpp
+++ b/gfx/layers/basic/BasicCompositor.cpp
@@ -882,17 +882,17 @@ bool BasicCompositor::BlitRenderTarget(C
           ->mDrawTarget->Snapshot();
   mRenderTarget->mDrawTarget->DrawSurface(
       surface, Rect(Point(), Size(aDestSize)), Rect(Point(), Size(aSourceSize)),
       DrawSurfaceOptions(), DrawOptions(1.0f, CompositionOp::OP_SOURCE));
   return true;
 }
 
 void BasicCompositor::BeginFrame(const nsIntRegion& aInvalidRegion,
-                                 const IntRect* aClipRectIn,
+                                 const Maybe<IntRect>& aClipRect,
                                  const IntRect& aRenderBounds,
                                  const nsIntRegion& aOpaqueRegion,
                                  NativeLayer* aNativeLayer,
                                  IntRect* aRenderBoundsOut /* = nullptr */) {
   if (mIsPendingEndRemoteDrawing) {
     // Force to end previous remote drawing.
     TryToEndRemoteDrawing(/* aForceToEnd */ true);
     MOZ_ASSERT(!mIsPendingEndRemoteDrawing);
@@ -1031,27 +1031,23 @@ void BasicCompositor::BeginFrame(const n
 
   gfxUtils::ClipToRegion(mRenderTarget->mDrawTarget,
                          mInvalidRegion.ToUnknownRegion());
 
   if (aRenderBoundsOut) {
     *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()) {
     float r = float(rand()) / float(RAND_MAX);
     float g = float(rand()) / float(RAND_MAX);
     float b = float(rand()) / float(RAND_MAX);
     // We're still clipped to mInvalidRegion, so just fill the bounds.
     mRenderTarget->mDrawTarget->FillRect(
--- a/gfx/layers/basic/BasicCompositor.h
+++ b/gfx/layers/basic/BasicCompositor.h
@@ -112,17 +112,17 @@ class BasicCompositor : public Composito
   void DrawQuad(const gfx::Rect& aRect, const gfx::IntRect& aClipRect,
                 const EffectChain& aEffectChain, gfx::Float aOpacity,
                 const gfx::Matrix4x4& aTransform,
                 const gfx::Rect& aVisibleRect) override;
 
   void ClearRect(const gfx::Rect& aRect) override;
 
   void BeginFrame(const nsIntRegion& aInvalidRegion,
-                  const gfx::IntRect* aClipRectIn,
+                  const Maybe<gfx::IntRect>& aClipRect,
                   const gfx::IntRect& aRenderBounds,
                   const nsIntRegion& aOpaqueRegion, NativeLayer* aNativeLayer,
                   gfx::IntRect* aRenderBoundsOut = nullptr) override;
   void NormalDrawingDone() override;
   void EndFrame() override;
 
   bool SupportsPartialTextureUpdate() override { return true; }
   bool CanUseCanvasLayerForSize(const gfx::IntSize& aSize) override {
--- a/gfx/layers/composite/LayerManagerComposite.cpp
+++ b/gfx/layers/composite/LayerManagerComposite.cpp
@@ -983,19 +983,19 @@ bool LayerManagerComposite::Render(const
     mNativeLayerForEntireWindow->SetOpaqueRegion(
         mCompositor->GetWidget()->GetOpaqueWidgetRegion().ToUnknownRegion());
 #endif
   }
 
   IntRect actualBounds;
   Maybe<IntRect> 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();
   ScopedCompositorRenderOffset scopedOffset(mCompositor->AsCompositorOGL(),
                                             ScreenPoint(0.0f, offset));
 #endif
 
   if (actualBounds.IsEmpty()) {
@@ -1222,17 +1222,17 @@ void LayerManagerComposite::RenderToPres
   mRoot->ComputeEffectiveTransforms(matrix);
   nsIntRegion opaque;
   PostProcessLayers(opaque);
 
   nsIntRegion invalid;
   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
   // chrome such as the URL bar. Override that so that the entire frame buffer
   // is cleared.
   ScopedScissorRect scissorRect(egl, 0, 0, actualWidth, actualHeight);
   egl->fClearColor(0.0, 0.0, 0.0, 0.0);
   egl->fClear(LOCAL_GL_COLOR_BUFFER_BIT);
--- a/gfx/layers/d3d11/CompositorD3D11.cpp
+++ b/gfx/layers/d3d11/CompositorD3D11.cpp
@@ -1090,17 +1090,17 @@ void CompositorD3D11::DrawGeometry(const
 
   if (restoreBlendMode) {
     mContext->OMSetBlendState(mAttachments->mPremulBlendState, sBlendFactor,
                               0xFFFFFFFF);
   }
 }
 
 void CompositorD3D11::BeginFrame(const nsIntRegion& aInvalidRegion,
-                                 const IntRect* aClipRectIn,
+                                 const Maybe<IntRect>& aClipRect,
                                  const IntRect& aRenderBounds,
                                  const nsIntRegion& aOpaqueRegion,
                                  NativeLayer* aNativeLayer,
                                  IntRect* aRenderBoundsOut) {
   MOZ_RELEASE_ASSERT(!aNativeLayer, "Unexpected native layer on this platform");
 
   // Don't composite if we are minimised. Other than for the sake of efficency,
   // this is important because resizing our buffers when mimised will fail and
@@ -1143,18 +1143,18 @@ void CompositorD3D11::BeginFrame(const n
     invalidRegionSafe = rect;
   } else {
     invalidRegionSafe.And(aInvalidRegion, rect);
   }
 
   IntRect invalidRect = invalidRegionSafe.GetBounds();
 
   IntRect clipRect = invalidRect;
-  if (aClipRectIn) {
-    clipRect.IntersectRect(clipRect, *aClipRectIn);
+  if (aClipRect) {
+    clipRect.IntersectRect(clipRect, *aClipRect);
   }
 
   if (clipRect.IsEmpty()) {
     CancelFrame();
     *aRenderBoundsOut = IntRect();
     return;
   }
 
--- a/gfx/layers/d3d11/CompositorD3D11.h
+++ b/gfx/layers/d3d11/CompositorD3D11.h
@@ -88,17 +88,17 @@ class CompositorD3D11 : public Composito
                 const EffectChain& aEffectChain, gfx::Float aOpacity,
                 const gfx::Matrix4x4& aTransform,
                 const gfx::Rect& aVisibleRect) override;
 
   /**
    * Start a new frame.
    */
   void BeginFrame(const nsIntRegion& aInvalidRegion,
-                  const gfx::IntRect* aClipRectIn,
+                  const Maybe<gfx::IntRect>& aClipRect,
                   const gfx::IntRect& aRenderBounds,
                   const nsIntRegion& aOpaqueRegion, NativeLayer* aNativeLayer,
                   gfx::IntRect* aRenderBoundsOut = nullptr) override;
 
   void NormalDrawingDone() override;
 
   /**
    * Flush the current frame to the screen.
--- a/gfx/layers/opengl/CompositorOGL.cpp
+++ b/gfx/layers/opengl/CompositorOGL.cpp
@@ -864,17 +864,17 @@ CompositorOGL::RenderTargetForNativeLaye
 
   return rt.forget();
 #else
   MOZ_CRASH("Unexpected native layer on this platform");
 #endif
 }
 
 void CompositorOGL::BeginFrame(const nsIntRegion& aInvalidRegion,
-                               const IntRect* aClipRectIn,
+                               const Maybe<IntRect>& aClipRect,
                                const IntRect& aRenderBounds,
                                const nsIntRegion& aOpaqueRegion,
                                NativeLayer* aNativeLayer,
                                IntRect* aRenderBoundsOut) {
   AUTO_PROFILER_LABEL("CompositorOGL::BeginFrame", GRAPHICS);
 
   MOZ_ASSERT(!mFrameInProgress,
              "frame still in progress (should have called EndFrame");
--- a/gfx/layers/opengl/CompositorOGL.h
+++ b/gfx/layers/opengl/CompositorOGL.h
@@ -362,17 +362,17 @@ class CompositorOGL final : public Compo
   /*
    * Clear aRect on current render target.
    */
   void ClearRect(const gfx::Rect& aRect) override;
 
   /* Start a new frame.
    */
   void BeginFrame(const nsIntRegion& aInvalidRegion,
-                  const gfx::IntRect* aClipRectIn,
+                  const Maybe<gfx::IntRect>& aClipRect,
                   const gfx::IntRect& aRenderBounds,
                   const nsIntRegion& aOpaqueRegion, NativeLayer* aNativeLayer,
                   gfx::IntRect* aRenderBoundsOut = nullptr) override;
 
   ShaderConfigOGL GetShaderConfigFor(
       Effect* aEffect, TextureSourceOGL* aSourceMask = nullptr,
       gfx::CompositionOp aOp = gfx::CompositionOp::OP_OVER,
       bool aColorMatrix = false, bool aDEAAEnabled = false) const;