Bug 1303534: Make sure to pop all clips before grappig the image for the top-level 'layer'. r=jrmuizel a=ritu FIREFOX_50_0b4_BUILD1 FIREFOX_50_0b4_RELEASE
authorBas Schouten <bschouten@mozilla.com>
Tue, 27 Sep 2016 17:11:39 +0200
changeset 422462 f4b45ea3c0c836e5a457c8009bff423447e54803
parent 422461 5247dff49fb71083d1f2e4f13f5edacb6f0fd2c1
child 422463 379b19526d6a16356ab24c41d4d473225887b0f2
push id31738
push userbmo:giles@thaumas.net
push dateFri, 07 Oct 2016 20:30:41 +0000
reviewersjrmuizel, ritu
bugs1303534
milestone50.0
Bug 1303534: Make sure to pop all clips before grappig the image for the top-level 'layer'. r=jrmuizel a=ritu MozReview-Commit-ID: 2nHV0v7MInD
gfx/2d/DrawTargetD2D1.cpp
--- a/gfx/2d/DrawTargetD2D1.cpp
+++ b/gfx/2d/DrawTargetD2D1.cpp
@@ -1382,32 +1382,32 @@ DrawTargetD2D1::GetDeviceSpaceClipRect(D
     }
   }
   return true;
 }
 
 already_AddRefed<ID2D1Image>
 DrawTargetD2D1::GetImageForLayerContent()
 {
+  PopAllClips();
+
   if (!CurrentLayer().mCurrentList) {
     RefPtr<ID2D1Bitmap> tmpBitmap;
     HRESULT hr = mDC->CreateBitmap(D2DIntSize(mSize), D2D1::BitmapProperties(D2DPixelFormat(mFormat)), getter_AddRefs(tmpBitmap));
     if (FAILED(hr)) {
       gfxCriticalError(CriticalLog::DefaultOptions(Factory::ReasonableSurfaceSize(mSize))) << "[D2D1.1] 6CreateBitmap failure " << mSize << " Code: " << hexa(hr) << " format " << (int)mFormat;
       // For now, crash in this scenario; this should happen because tmpBitmap is
       // null and CopyFromBitmap call below dereferences it.
       // return;
     }
     mDC->Flush();
 
     tmpBitmap->CopyFromBitmap(nullptr, mBitmap, nullptr);
     return tmpBitmap.forget();
   } else {
-    PopAllClips();
-
     RefPtr<ID2D1CommandList> list = CurrentLayer().mCurrentList;
     mDC->CreateCommandList(getter_AddRefs(CurrentLayer().mCurrentList));
     mDC->SetTarget(CurrentTarget());
     list->Close();
 
     RefPtr<ID2D1Bitmap1> tmpBitmap;
     if (mDidComplexBlendWithListInList) {
       mDC->CreateBitmap(mBitmap->GetPixelSize(), nullptr, 0, &D2D1::BitmapProperties1(D2D1_BITMAP_OPTIONS_TARGET, D2D1::PixelFormat(DXGI_FORMAT_B8G8R8A8_UNORM, D2D1_ALPHA_MODE_PREMULTIPLIED)), getter_AddRefs(tmpBitmap));