Bug 1303534: Make sure to pop all clips before grappig the image for the top-level 'layer'. r=jrmuizel
MozReview-Commit-ID: 2nHV0v7MInD
--- 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 =