Bug 1089380 - Remove ClipRectInLayersCoordinates. r=mattwoodrow, a=lmandel
authorBenoit Girard <b56girard@gmail.com>
Fri, 31 Oct 2014 16:34:30 -0400
changeset 226017 1e8f0a8c4474
parent 226016 252c3ab238d0
child 226018 fea4ac1165f9
push id4107
push userryanvm@gmail.com
push date2014-11-10 21:30 +0000
treeherdermozilla-beta@1e8f0a8c4474 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmattwoodrow, lmandel
bugs1089380
milestone34.0
Bug 1089380 - Remove ClipRectInLayersCoordinates. r=mattwoodrow, a=lmandel
gfx/layers/Compositor.cpp
gfx/layers/Compositor.h
gfx/layers/composite/ContainerLayerComposite.cpp
gfx/layers/composite/TiledContentHost.cpp
--- a/gfx/layers/Compositor.cpp
+++ b/gfx/layers/Compositor.cpp
@@ -99,32 +99,16 @@ Compositor::DrawDiagnostics(DiagnosticFl
   if (!ShouldDrawDiagnostics(aFlags)) {
     return;
   }
 
   DrawDiagnosticsInternal(aFlags, aVisibleRect, aClipRect, aTransform,
                           aFlashCounter);
 }
 
-RenderTargetRect
-Compositor::ClipRectInLayersCoordinates(Layer* aLayer, RenderTargetIntRect aClip) const {
-  ContainerLayer* parent = aLayer->AsContainerLayer() ? aLayer->AsContainerLayer() : aLayer->GetParent();
-  while (!parent->UseIntermediateSurface() && parent->GetParent()) {
-    parent = parent->GetParent();
-  }
-
-  RenderTargetIntPoint renderTargetOffset = RenderTargetIntRect::FromUntyped(
-    parent->GetEffectiveVisibleRegion().GetBounds()).TopLeft();
-
-  RenderTargetRect result;
-  aClip = aClip + renderTargetOffset;
-  result = RenderTargetRect(aClip.x, aClip.y, aClip.width, aClip.height);
-  return result;
-}
-
 void
 Compositor::DrawDiagnosticsInternal(DiagnosticFlags aFlags,
                                     const gfx::Rect& aVisibleRect,
                                     const gfx::Rect& aClipRect,
                                     const gfx::Matrix4x4& aTransform,
                                     uint32_t aFlashCounter)
 {
 #ifdef MOZ_B2G
--- a/gfx/layers/Compositor.h
+++ b/gfx/layers/Compositor.h
@@ -482,25 +482,16 @@ public:
   ScreenRotation GetScreenRotation() const {
     return mScreenRotation;
   }
 
   void SetScreenRotation(ScreenRotation aRotation) {
     mScreenRotation = aRotation;
   }
 
-  // On b2g the clip rect is in the coordinate space of the physical screen
-  // independently of its rotation, while the coordinate space of the layers,
-  // on the other hand, depends on the screen orientation.
-  // This only applies to b2g as with other platforms, orientation is handled
-  // at the OS level rather than in Gecko.
-  // In addition, the clip rect needs to be offset by the rendering origin.
-  // This becomes important if intermediate surfaces are used.
-  RenderTargetRect ClipRectInLayersCoordinates(Layer* aLayer, RenderTargetIntRect aClip) const;
-
 protected:
   void DrawDiagnosticsInternal(DiagnosticFlags aFlags,
                                const gfx::Rect& aVisibleRect,
                                const gfx::Rect& aClipRect,
                                const gfx::Matrix4x4& transform,
                                uint32_t aFlashCounter);
 
   bool ShouldDrawDiagnostics(DiagnosticFlags);
--- a/gfx/layers/composite/ContainerLayerComposite.cpp
+++ b/gfx/layers/composite/ContainerLayerComposite.cpp
@@ -196,28 +196,16 @@ ContainerPrepare(ContainerT* aContainer,
 
     RenderTargetIntRect clipRect = layerToRender->GetLayer()->
         CalculateScissorRect(aClipRect);
     if (clipRect.IsEmpty()) {
       CULLING_LOG("Sublayer %p has an empty world clip rect\n", layerToRender->GetLayer());
       continue;
     }
 
-    RenderTargetRect quad = layerToRender->GetLayer()->
-      TransformRectToRenderTarget(LayerPixel::FromUntyped(
-        layerToRender->GetLayer()->GetEffectiveVisibleRegion().GetBounds()));
-
-    Compositor* compositor = aManager->GetCompositor();
-    if (!layerToRender->GetLayer()->AsContainerLayer() &&
-        !quad.Intersects(compositor->ClipRectInLayersCoordinates(layerToRender->GetLayer(), clipRect)) &&
-        !LayerHasCheckerboardingAPZC(layerToRender->GetLayer(), nullptr)) {
-      CULLING_LOG("Sublayer %p is clipped entirely\n", layerToRender->GetLayer());
-      continue;
-    }
-
     CULLING_LOG("Preparing sublayer %p\n", layerToRender->GetLayer());
 
     nsIntRegion savedVisibleRegion;
     bool restoreVisibleRegion = false;
     gfx::Matrix matrix;
     bool is2D = layerToRender->GetLayer()->GetBaseTransform().Is2D(&matrix);
     if (i + 1 < children.Length() &&
         is2D && !matrix.HasNonIntegerTranslation()) {
@@ -396,16 +384,17 @@ RenderIntermediate(ContainerT* aContaine
                    RefPtr<CompositingRenderTarget> surface)
 {
   Compositor* compositor = aManager->GetCompositor();
   RefPtr<CompositingRenderTarget> previousTarget = compositor->GetCurrentRenderTarget();
 
   if (!surface) {
     return;
   }
+
   compositor->SetRenderTarget(surface);
   // pre-render all of the layers into our temporary
   RenderLayers(aContainer, aManager, RenderTargetPixel::FromUntyped(aClipRect));
   // Unbind the current surface and rebind the previous one.
   compositor->SetRenderTarget(previousTarget);
 }
 
 template<class ContainerT> void
--- a/gfx/layers/composite/TiledContentHost.cpp
+++ b/gfx/layers/composite/TiledContentHost.cpp
@@ -456,25 +456,16 @@ TiledContentHost::RenderTile(const TileH
                              const nsIntSize& aTextureBounds)
 {
   if (aTile.IsPlaceholderTile()) {
     // This shouldn't ever happen, but let's fail semi-gracefully. No need
     // to warn, the texture update would have already caught this.
     return;
   }
 
-  nsIntRect screenBounds = aScreenRegion.GetBounds();
-  Rect layerQuad(screenBounds.x, screenBounds.y, screenBounds.width, screenBounds.height);
-  RenderTargetRect quad = RenderTargetRect::FromUnknown(aTransform.TransformBounds(layerQuad));
-
-  if (!quad.Intersects(mCompositor->ClipRectInLayersCoordinates(mLayer,
-      RenderTargetIntRect(aClipRect.x, aClipRect.y, aClipRect.width, aClipRect.height)))) {
-    return;
-  }
-
   if (aBackgroundColor) {
     aEffectChain.mPrimaryEffect = new EffectSolidColor(ToColor(*aBackgroundColor));
     nsIntRegionRectIterator it(aScreenRegion);
     for (const nsIntRect* rect = it.Next(); rect != nullptr; rect = it.Next()) {
       Rect graphicsRect(rect->x, rect->y, rect->width, rect->height);
       mCompositor->DrawQuad(graphicsRect, aClipRect, aEffectChain, 1.0, aTransform);
     }
   }