From 2f34d4e618f51342537cbfcaa1274fae98125f61 Mon Sep 17 00:00:00 2001 From: Chris Lord Date: Wed, 24 Oct 2012 15:49:03 +0100 Subject: [PATCH] Bug 803013 - Update valid region progressively with tiles. r=bgirard When updating tiles progressively, make sure the valid region is also updated progressively to avoid flickering. --- gfx/layers/basic/BasicTiledThebesLayer.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/gfx/layers/basic/BasicTiledThebesLayer.cpp b/gfx/layers/basic/BasicTiledThebesLayer.cpp index c3f2f249bd86..ef5361ecc5dc 100644 --- a/gfx/layers/basic/BasicTiledThebesLayer.cpp +++ b/gfx/layers/basic/BasicTiledThebesLayer.cpp @@ -411,7 +411,10 @@ BasicTiledThebesLayer::PaintThebes(gfxContext* aContext, transform.Invert(); // Store the old valid region, then clear it before painting. + // We clip the old valid region to the visible region, as it only gets + // used to decide stale content (currently valid and previously visible) nsIntRegion oldValidRegion = mTiledBuffer.GetValidRegion(); + oldValidRegion.And(oldValidRegion, mVisibleRegion); mTiledBuffer.ClearPaintedRegion(); // Make sure that tiles that fall outside of the visible region are @@ -454,8 +457,14 @@ BasicTiledThebesLayer::PaintThebes(gfxContext* aContext, // Keep track of what we're about to refresh. mValidRegion.Or(mValidRegion, regionToPaint); + // mValidRegion would have been altered by InvalidateRegion, but we still + // want to display stale content until it gets progressively updated. + // Create a region that includes stale content. + nsIntRegion validOrStale; + validOrStale.Or(mValidRegion, oldValidRegion); + // Paint the computed region and subtract it from the invalid region. - mTiledBuffer.PaintThebes(this, mValidRegion, regionToPaint, aCallback, aCallbackData); + mTiledBuffer.PaintThebes(this, validOrStale, regionToPaint, aCallback, aCallbackData); invalidRegion.Sub(invalidRegion, regionToPaint); } while (repeat); } else {