Bug 802143 - Clarify coordinate spaces in ReusableTileStoreOGL::DrawTiles. r=bgirard
authorChris Lord <chrislord.net@gmail.com>
Thu, 18 Oct 2012 12:59:17 +0100
changeset 110653 c2e53249351da4ee98c6340105094cc18bec3b63
parent 110652 b4d95f4228711c26d2c5ff297519af045c833b2e
child 110654 455b30bb6e18a7f2663bc6c0d0e4de8573014bc0
push id23704
push useremorley@mozilla.com
push dateThu, 18 Oct 2012 17:12:58 +0000
treeherdermozilla-central@3779eb3f036f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbgirard
bugs802143
milestone19.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 802143 - Clarify coordinate spaces in ReusableTileStoreOGL::DrawTiles. r=bgirard
gfx/layers/opengl/ReusableTileStoreOGL.cpp
--- a/gfx/layers/opengl/ReusableTileStoreOGL.cpp
+++ b/gfx/layers/opengl/ReusableTileStoreOGL.cpp
@@ -213,30 +213,30 @@ ReusableTileStoreOGL::DrawTiles(TiledThe
   // rendered.
   gfxRect contentBounds, displayPort;
   ContainerLayer* scrollableLayer = nullptr;
   for (ContainerLayer* parent = aLayer->GetParent(); parent; parent = parent->GetParent()) {
       const FrameMetrics& parentMetrics = parent->GetFrameMetrics();
       if (parentMetrics.IsScrollable())
         scrollableLayer = parent;
       if (!parentMetrics.mDisplayPort.IsEmpty() && scrollableLayer) {
-          // Get the display-port bounds
+          // Get the display-port bounds in screen-space.
           displayPort = gfxRect(parentMetrics.mDisplayPort.x,
                                 parentMetrics.mDisplayPort.y,
                                 parentMetrics.mDisplayPort.width,
                                 parentMetrics.mDisplayPort.height);
 
-          // Check the scale transform applied to the root layer to determine
+          // Calculate the scale transform applied to the root layer to determine
           // the content resolution.
           Layer* rootLayer = aLayer->Manager()->GetRoot();
           const gfx3DMatrix& rootTransform = rootLayer->GetTransform();
           float scaleX = rootTransform.GetXScale();
           float scaleY = rootTransform.GetYScale();
 
-          // Get the content document bounds
+          // Get the content document bounds, in screen-space.
           const FrameMetrics& metrics = scrollableLayer->GetFrameMetrics();
           const nsIntSize& contentSize = metrics.mContentRect.Size();
           gfx::Point scrollOffset =
             gfx::Point((metrics.mScrollOffset.x * metrics.LayersPixelsPerCSSPixel().width) / scaleX,
                        (metrics.mScrollOffset.y * metrics.LayersPixelsPerCSSPixel().height) / scaleY);
           const nsIntPoint& contentOrigin = metrics.mContentRect.TopLeft() -
             nsIntPoint(NS_lround(scrollOffset.x), NS_lround(scrollOffset.y));
           gfxRect contentRect = gfxRect(contentOrigin.x, contentOrigin.y,
@@ -264,25 +264,27 @@ ReusableTileStoreOGL::DrawTiles(TiledThe
     if (aResolution != tile->mResolution)
       transformedValidRegion.ScaleRoundOut(1.0f/scaleFactor.width,
                                            1.0f/scaleFactor.height);
     nsIntRegion tileRegion;
     tileRegion.Sub(tile->mTileRegion, transformedValidRegion);
 
     // Subtract the display-port from the tile region.
     if (!displayPort.IsEmpty()) {
+      // Transform the display-port from screen space to layer space.
       gfxRect transformedRenderBounds = transform.Inverse().TransformBounds(displayPort);
       tileRegion.Sub(tileRegion, nsIntRect(transformedRenderBounds.x,
                                            transformedRenderBounds.y,
                                            transformedRenderBounds.width,
                                            transformedRenderBounds.height));
     }
 
     // Intersect the tile region with the content area.
     if (!contentBounds.IsEmpty()) {
+      // Transform the content bounds from screen space to layer space.
       gfxRect transformedRenderBounds = transform.Inverse().TransformBounds(contentBounds);
       tileRegion.And(tileRegion, nsIntRect(transformedRenderBounds.x,
                                            transformedRenderBounds.y,
                                            transformedRenderBounds.width,
                                            transformedRenderBounds.height));
     }
 
     // If the tile region is empty, skip drawing.