diff --git a/gfx/layers/client/ClientTiledThebesLayer.cpp b/gfx/layers/client/ClientTiledThebesLayer.cpp index 02374bf5fd2..4ff19ad8830 100644 --- a/gfx/layers/client/ClientTiledThebesLayer.cpp +++ b/gfx/layers/client/ClientTiledThebesLayer.cpp @@ -183,6 +183,17 @@ ClientTiledThebesLayer::BeginPaint() TILING_PRLOG_OBJ(("TILING 0x%p: Scroll offset %s\n", this, tmpstr.get()), mPaintData.mScrollOffset); } +bool +ClientTiledThebesLayer::UseFastPath() +{ + const FrameMetrics& parentMetrics = GetParent()->GetFrameMetrics(); + bool multipleTransactionsNeeded = gfxPrefs::UseProgressiveTilePainting() + || gfxPrefs::UseLowPrecisionBuffer() + || !parentMetrics.mCriticalDisplayPort.IsEmpty(); + bool isFixed = GetIsFixedPosition() || GetParent()->GetIsFixedPosition(); + return !multipleTransactionsNeeded || isFixed || parentMetrics.mDisplayPort.IsEmpty(); +} + void ClientTiledThebesLayer::EndPaint(bool aFinish) { @@ -222,8 +233,8 @@ ClientTiledThebesLayer::RenderLayer() TILING_PRLOG_OBJ(("TILING 0x%p: Initial visible region %s\n", this, tmpstr.get()), mVisibleRegion); TILING_PRLOG_OBJ(("TILING 0x%p: Initial valid region %s\n", this, tmpstr.get()), mValidRegion); - nsIntRegion invalidRegion = mVisibleRegion; - invalidRegion.Sub(invalidRegion, mValidRegion); + nsIntRegion invalidRegion; + invalidRegion.Sub(mVisibleRegion, mValidRegion); if (invalidRegion.IsEmpty()) { EndPaint(true); return; @@ -234,17 +245,8 @@ ClientTiledThebesLayer::RenderLayer() ToClientLayer(GetMaskLayer())->RenderLayer(); } - bool isFixed = GetIsFixedPosition() || GetParent()->GetIsFixedPosition(); - - // Fast path for no progressive updates, no low-precision updates and no - // critical display-port set, or no display-port set, or this is a fixed - // position layer/contained in a fixed position layer - const FrameMetrics& parentMetrics = GetParent()->GetFrameMetrics(); - if ((!gfxPrefs::UseProgressiveTilePainting() && - !gfxPrefs::UseLowPrecisionBuffer() && - parentMetrics.mCriticalDisplayPort.IsEmpty()) || - parentMetrics.mDisplayPort.IsEmpty() || - isFixed) { + // In some cases we can take a fast path and just be done with it. + if (UseFastPath()) { mValidRegion = mVisibleRegion; NS_ASSERTION(!ClientManager()->IsRepeatTransaction(), "Didn't paint our mask layer"); diff --git a/gfx/layers/client/ClientTiledThebesLayer.h b/gfx/layers/client/ClientTiledThebesLayer.h index 0fe80f91c0b..9f5b674ec6d 100644 --- a/gfx/layers/client/ClientTiledThebesLayer.h +++ b/gfx/layers/client/ClientTiledThebesLayer.h @@ -80,6 +80,12 @@ private: */ void BeginPaint(); + /** + * Determine if we can use a fast path to just do a single high-precision, + * non-progressive paint. + */ + bool UseFastPath(); + /** * When a paint ends, updates any data necessary to persist until the next * paint. If aFinish is true, this will cause the paint to be marked as