Bug 984490 - Use the correct clip rect when determining whether to skip rendering a tile. r=nical, a=1.4+
authorBotond Ballo <botond@mozilla.com>
Wed, 02 Apr 2014 03:23:04 -0400
changeset 192545 4ce68ff00b859f9ed58c7b121041442936e332c6
parent 192544 89bbecef9a590ffac244492faa8cdec7215b99bd
child 192546 e277c405f06608811e058d09caa104696210cca4
push id474
push userasasaki@mozilla.com
push dateMon, 02 Jun 2014 21:01:02 +0000
treeherdermozilla-release@967f4cf1b31c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersnical, 1
bugs984490
milestone30.0a2
Bug 984490 - Use the correct clip rect when determining whether to skip rendering a tile. r=nical, a=1.4+
gfx/layers/Compositor.cpp
gfx/layers/Compositor.h
--- a/gfx/layers/Compositor.cpp
+++ b/gfx/layers/Compositor.cpp
@@ -97,16 +97,33 @@ Compositor::DrawDiagnostics(DiagnosticFl
   if (!ShouldDrawDiagnostics(aFlags)) {
     return;
   }
 
   DrawDiagnosticsInternal(aFlags, aVisibleRect,
                           aClipRect, aTransform);
 }
 
+gfx::Rect
+Compositor::ClipRectInLayersCoordinates(gfx::Rect aClip) const {
+  gfx::Rect result;
+  switch (mScreenRotation) {
+    case ROTATION_90:
+    case ROTATION_270:
+      result = gfx::Rect(aClip.y, aClip.x, aClip.height, aClip.width);
+      break;
+    case ROTATION_0:
+    case ROTATION_180:
+    default:
+      result = aClip;
+      break;
+  }
+  return result + GetCurrentRenderTarget()->GetOrigin();
+}
+
 void
 Compositor::DrawDiagnosticsInternal(DiagnosticFlags aFlags,
                                     const gfx::Rect& aVisibleRect,
                                     const gfx::Rect& aClipRect,
                                     const gfx::Matrix4x4& aTransform)
 {
 #ifdef MOZ_B2G
   int lWidth = 4;
--- a/gfx/layers/Compositor.h
+++ b/gfx/layers/Compositor.h
@@ -493,27 +493,19 @@ public:
     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.
-  gfx::Rect ClipRectInLayersCoordinates(gfx::Rect aClip) const {
-    switch (mScreenRotation) {
-      case ROTATION_90:
-      case ROTATION_270:
-        return gfx::Rect(aClip.y, aClip.x, aClip.height, aClip.width);
-      case ROTATION_0:
-      case ROTATION_180:
-      default:
-        return aClip;
-    }
-  }
+  // In addition, the clip rect needs to be offset by the rendering origin.
+  // This becomes important if intermediate surfaces are used.
+  gfx::Rect ClipRectInLayersCoordinates(gfx::Rect aClip) const;
 protected:
   void DrawDiagnosticsInternal(DiagnosticFlags aFlags,
                                const gfx::Rect& aVisibleRect,
                                const gfx::Rect& aClipRect,
                                const gfx::Matrix4x4& transform);
 
   bool ShouldDrawDiagnostics(DiagnosticFlags);