Bug 907926 - Avoid calling CurrentSurface when we can. r=Bas

This commit is contained in:
Matt Woodrow
2013-09-19 17:23:30 +12:00
parent 8039f14c81
commit 9f7e0ec88f
2 changed files with 11 additions and 10 deletions

View File

@@ -175,9 +175,9 @@ public:
{
const nsIntRegion& visibleRegion = mLayer->GetEffectiveVisibleRegion();
const nsIntRect& bounds = visibleRegion.GetBounds();
nsRefPtr<gfxASurface> currentSurface = mTarget->CurrentSurface();
if (mTarget->IsCairo()) {
nsRefPtr<gfxASurface> currentSurface = mTarget->CurrentSurface();
const gfxRect& targetOpaqueRect = currentSurface->GetOpaqueRect();
// Try to annotate currentSurface with a region of pixels that have been
@@ -322,15 +322,17 @@ BasicLayerManager::PopGroupToSourceWithCachedSurface(gfxContext *aTarget, gfxCon
{
if (!aTarget)
return;
nsRefPtr<gfxASurface> current = aPushed->CurrentSurface();
if (aTarget->IsCairo() && mCachedSurface.IsSurface(current)) {
gfxContextMatrixAutoSaveRestore saveMatrix(aTarget);
aTarget->IdentityMatrix();
aTarget->SetSource(current);
mCachedSurfaceInUse = false;
} else {
aTarget->PopGroupToSource();
if (aTarget->IsCairo()) {
nsRefPtr<gfxASurface> current = aPushed->CurrentSurface();
if (mCachedSurface.IsSurface(current)) {
gfxContextMatrixAutoSaveRestore saveMatrix(aTarget);
aTarget->IdentityMatrix();
aTarget->SetSource(current);
mCachedSurfaceInUse = false;
return;
}
}
aTarget->PopGroupToSource();
}
void