Bug 1483459 - Don't needlessly copy regions in ContainerLayer::GetIntermediateSurfaceRect. r=sotaro
authorNicolas Silva <nsilva@mozilla.com>
Tue, 21 Aug 2018 14:41:42 +0200
changeset 432818 cf82ec49ee1a6a33e4a860f345b63a10c94a04b6
parent 432817 bf68c78fb8597abea5a9c3583b840f7137194196
child 432819 3db3f0761004289cef06241977003539e2abef62
push id34488
push usernerli@mozilla.com
push dateWed, 22 Aug 2018 16:28:54 +0000
treeherdermozilla-central@d6e4d3e69d4c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssotaro
bugs1483459
milestone63.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 1483459 - Don't needlessly copy regions in ContainerLayer::GetIntermediateSurfaceRect. r=sotaro Differential Revision: https://phabricator.services.mozilla.com/D3876
gfx/layers/Layers.cpp
gfx/layers/Layers.h
--- a/gfx/layers/Layers.cpp
+++ b/gfx/layers/Layers.cpp
@@ -1078,16 +1078,24 @@ ContainerLayer::Creates3DContextWithExte
        child = child->GetNextSibling()) {
       if (child->Extend3DContext()) {
         return true;
       }
   }
   return false;
 }
 
+RenderTargetIntRect
+ContainerLayer::GetIntermediateSurfaceRect()
+{
+  NS_ASSERTION(mUseIntermediateSurface, "Must have intermediate surface");
+  LayerIntRect bounds = GetLocalVisibleRegion().GetBounds();
+  return RenderTargetIntRect::FromUnknownRect(bounds.ToUnknownRect());
+}
+
 bool
 ContainerLayer::HasMultipleChildren()
 {
   uint32_t count = 0;
   for (Layer* child = GetFirstChild(); child; child = child->GetNextSibling()) {
     const Maybe<ParentLayerIntRect>& clipRect = child->GetLocalClipRect();
     if (clipRect && clipRect->IsEmpty())
       continue;
--- a/gfx/layers/Layers.h
+++ b/gfx/layers/Layers.h
@@ -2218,21 +2218,17 @@ public:
 
   /**
    * Returns the rectangle covered by the intermediate surface,
    * in this layer's coordinate system.
    *
    * NOTE: Since this layer has an intermediate surface it follows
    *       that LayerPixel == RenderTargetPixel
    */
-  RenderTargetIntRect GetIntermediateSurfaceRect()
-  {
-    NS_ASSERTION(mUseIntermediateSurface, "Must have intermediate surface");
-    return RenderTargetIntRect::FromUnknownRect(GetLocalVisibleRegion().ToUnknownRegion().GetBounds());
-  }
+  RenderTargetIntRect GetIntermediateSurfaceRect();
 
   /**
    * Returns true if this container has more than one non-empty child
    */
   bool HasMultipleChildren();
 
   /**
    * Returns true if this container supports children with component alpha.