Bug 1023882 - Part 1 - Small refactorings. r=Cwiiis

This commit is contained in:
Kartikaya Gupta 2014-06-11 12:42:44 -04:00
parent 5a4aed03f9
commit 08aa2460d4
2 changed files with 21 additions and 13 deletions

View File

@ -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");

View File

@ -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