Bug 1385929 - Part 2. Remove unecessary gfxContext::Save/Restore found by Part 1. draft
authorcku <cku@mozilla.com>
Tue, 01 Aug 2017 20:38:15 +0800
changeset 619560 2f3271576996dbfcce2c6499a2016339b304131f
parent 619559 ce7aa4258091b2ec630b3fd29f065f41292524fd
child 640432 5a0bd7a74f11a0b893a65a04ecac0c9eaad696d3
push id71716
push userbmo:cku@mozilla.com
push dateWed, 02 Aug 2017 07:07:11 +0000
bugs1385929
milestone56.0a1
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
gfx/thebes/gfxContext.cpp
--- a/gfx/thebes/gfxContext.cpp
+++ b/gfx/thebes/gfxContext.cpp
@@ -825,17 +825,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());
@@ -851,30 +850,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);
 }