mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-14 13:55:43 +00:00
Bug 664764. Part 2: Make PushGroupWithCachedSurface always return a valid context even if getting the cached surface fails. r=mattwoodrow
This commit is contained in:
parent
e4e1f658d5
commit
92d9988db2
@ -1357,24 +1357,28 @@ already_AddRefed<gfxContext>
|
||||
BasicLayerManager::PushGroupWithCachedSurface(gfxContext *aTarget,
|
||||
gfxASurface::gfxContentType aContent)
|
||||
{
|
||||
if (mCachedSurfaceInUse || !aTarget->IsCairo()) {
|
||||
// We can't cache Azure DrawTargets at this point.
|
||||
aTarget->PushGroup(aContent);
|
||||
nsRefPtr<gfxContext> result = aTarget;
|
||||
return result.forget();
|
||||
nsRefPtr<gfxContext> ctx;
|
||||
// We can't cache Azure DrawTargets at this point.
|
||||
if (!mCachedSurfaceInUse && aTarget->IsCairo()) {
|
||||
gfxContextMatrixAutoSaveRestore saveMatrix(aTarget);
|
||||
aTarget->IdentityMatrix();
|
||||
|
||||
nsRefPtr<gfxASurface> currentSurf = aTarget->CurrentSurface();
|
||||
gfxRect clip = aTarget->GetClipExtents();
|
||||
clip.RoundOut();
|
||||
|
||||
ctx = mCachedSurface.Get(aContent, clip, currentSurf);
|
||||
|
||||
if (ctx) {
|
||||
mCachedSurfaceInUse = true;
|
||||
/* Align our buffer for the original surface */
|
||||
ctx->SetMatrix(saveMatrix.Matrix());
|
||||
return ctx.forget();
|
||||
}
|
||||
}
|
||||
mCachedSurfaceInUse = true;
|
||||
|
||||
gfxContextMatrixAutoSaveRestore saveMatrix(aTarget);
|
||||
aTarget->IdentityMatrix();
|
||||
|
||||
nsRefPtr<gfxASurface> currentSurf = aTarget->CurrentSurface();
|
||||
gfxRect clip = aTarget->GetClipExtents();
|
||||
clip.RoundOut();
|
||||
|
||||
nsRefPtr<gfxContext> ctx = mCachedSurface.Get(aContent, clip, currentSurf);
|
||||
/* Align our buffer for the original surface */
|
||||
ctx->SetMatrix(saveMatrix.Matrix());
|
||||
ctx = aTarget;
|
||||
ctx->PushGroup(aContent);
|
||||
return ctx.forget();
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user