Bug 1303534: Make sure to pop all clips before grappig the image for the top-level 'layer'. r=jrmuizel draft
authorBas Schouten <bschouten@mozilla.com>
Tue, 27 Sep 2016 17:11:39 +0200
changeset 418015 a0c7dcc55840020380afe4f0817b3b06f20bef77
parent 417905 cde7a9badcab194e25adf5fc48a991f6fa41fb87
child 532236 a7a44c8eb17ff897d18b241524b64013309525b3
push id30564
push userbschouten@mozilla.com
push dateTue, 27 Sep 2016 15:12:02 +0000
reviewersjrmuizel
bugs1303534
milestone52.0a1
Bug 1303534: Make sure to pop all clips before grappig the image for the top-level 'layer'. r=jrmuizel MozReview-Commit-ID: 2nHV0v7MInD
gfx/2d/DrawTargetD2D1.cpp
--- a/gfx/2d/DrawTargetD2D1.cpp
+++ b/gfx/2d/DrawTargetD2D1.cpp
@@ -1431,32 +1431,32 @@ DrawTargetD2D1::GetDeviceSpaceClipRect(D
     }
   }
   return true;
 }
 
 already_AddRefed<ID2D1Image>
 DrawTargetD2D1::GetImageForLayerContent(bool aShouldPreserveContent)
 {
+  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) {
       D2D1_BITMAP_PROPERTIES1 props =