Bug 1385929 - Part 2. Remove unecessary gfxContext::Save/Restore found by Part 1.
gfxContext::PushGroupAndCopyBackground & PushGroupForBlendBack do not change the
content of AzureState, we should remove gfxContext::Save in these two functions.
MozReview-Commit-ID: LUuC7bkqFba
--- a/gfx/thebes/gfxContext.cpp
+++ b/gfx/thebes/gfxContext.cpp
@@ -822,17 +822,16 @@ gfxContext::Paint(gfxFloat alpha)
mDT->FillRect(paintRect, PatternFromState(this),
DrawOptions(Float(alpha), GetOp()));
}
void
gfxContext::PushGroupForBlendBack(gfxContentType content, Float aOpacity, SourceSurface* aMask, const Matrix& aMaskTransform)
{
- Save();
mDT->PushLayer(content == gfxContentType::COLOR, aOpacity, aMask, aMaskTransform);
}
static gfxRect
GetRoundOutDeviceClipExtents(gfxContext* aCtx)
{
gfxContextMatrixAutoSaveRestore save(aCtx);
aCtx->SetMatrix(gfxMatrix());
@@ -848,30 +847,27 @@ gfxContext::PushGroupAndCopyBackground(g
if (mDT->GetFormat() != SurfaceFormat::B8G8R8X8) {
gfxRect clipRect = GetRoundOutDeviceClipExtents(this);
clipExtents = IntRect::Truncate(clipRect.x, clipRect.y, clipRect.width, clipRect.height);
}
bool pushOpaqueWithCopiedBG = (mDT->GetFormat() == SurfaceFormat::B8G8R8X8 ||
mDT->GetOpaqueRect().Contains(clipExtents)) &&
!mDT->GetUserData(&sDontUseAsSourceKey);
- Save();
-
if (pushOpaqueWithCopiedBG) {
mDT->PushLayer(true, aOpacity, aMask, aMaskTransform, IntRect(), true);
} else {
mDT->PushLayer(content == gfxContentType::COLOR, aOpacity, aMask, aMaskTransform, IntRect(), false);
}
}
void
gfxContext::PopGroupAndBlend()
{
mDT->PopLayer();
- Restore();
}
#ifdef MOZ_DUMP_PAINTING
void
gfxContext::WriteAsPNG(const char* aFile)
{
gfxUtils::WriteAsPNG(mDT, aFile);
}