Bug 794200 - Draw tiles with no content before tiles with stale content. r=bgirard
authorChris Lord <chrislord.net@gmail.com>
Wed, 26 Sep 2012 21:41:41 +0100
changeset 108171 d4fc54501277097b71a60620dbc9155436e6aef3
parent 108170 4a080f2c3091466eb606dbf546fd8b44e6dc0d56
child 108172 49a7067b35fe4ce11e2994e18867f2383b58a20d
push id15421
push userchrislord.net@gmail.com
push dateWed, 26 Sep 2012 20:42:23 +0000
treeherdermozilla-inbound@2786b171b97f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbgirard
bugs794200
milestone18.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 794200 - Draw tiles with no content before tiles with stale content. r=bgirard When using progressive tile drawing, draw tiles that have no content before tiles that only have stale content.
gfx/layers/basic/BasicTiledThebesLayer.cpp
--- a/gfx/layers/basic/BasicTiledThebesLayer.cpp
+++ b/gfx/layers/basic/BasicTiledThebesLayer.cpp
@@ -245,28 +245,31 @@ BasicTiledThebesLayer::PaintThebes(gfxCo
     const FrameMetrics& metrics = parent->GetFrameMetrics();
     resolution.width *= metrics.mResolution.width;
     resolution.height *= metrics.mResolution.height;
   }
 
   // Force immediate tile painting when the layer has changed resolution.
   if (gfxPlatform::UseProgressiveTilePainting() &&
       mTiledBuffer.GetResolution() == resolution) {
+    // Paint tiles that have no content before tiles that only have stale content.
+    nsIntRegion staleRegion = mTiledBuffer.GetValidRegion();
+    staleRegion.And(staleRegion, regionToPaint);
+    if (!staleRegion.IsEmpty() && !staleRegion.Contains(regionToPaint)) {
+      regionToPaint.Sub(regionToPaint, staleRegion);
+    }
+
     nsIntRegionRectIterator it(regionToPaint);
     const nsIntRect* rect = it.Next();
     if (!rect)
       return;
 
-    // Currently we start painting from the first rect of the invalid
-    // region and convert that into a tile.
-    // TODO: Use a smart tile prioritization such as:
-    //         (1) Paint tiles that have no content first
-    //         (2) Then paint tiles that have stale content
-    //         (3) Order tiles using they position from relevant
-    //             user interaction events.
+    // Currently we start painting from the first rect of the paint
+    // region and convert that into a tile. We should order tiles using
+    // their position from relevant user interaction events.
     int paintTileStartX = mTiledBuffer.RoundDownToTileEdge(rect->x);
     int paintTileStartY = mTiledBuffer.RoundDownToTileEdge(rect->y);
 
     nsIntRegion maxPaint(
       nsIntRect(paintTileStartX, paintTileStartY,
                 mTiledBuffer.GetTileLength(), mTiledBuffer.GetTileLength()));
 
     if (!maxPaint.Contains(regionToPaint)) {