Bug 1115819: Deal with failure to create a realized bitmap in SourceSurfaceD2D1::DrawTargetWillChange. r=jrmuizel
authorBas Schouten <bschouten@mozilla.com>
Thu, 08 Jan 2015 00:10:48 +0000
changeset 248371 633a1d06b192de3fd7584867389db2bc9a459b5e
parent 248370 6c8f62d7fd1cb82189e58ba5591b9e1769a187de
child 248372 8309d6ce7a3892c91600d7327359c538ecaa1ce1
push id4489
push userraliiev@mozilla.com
push dateMon, 23 Feb 2015 15:17:55 +0000
treeherdermozilla-beta@fd7c3dc24146 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjrmuizel
bugs1115819
milestone37.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1115819: Deal with failure to create a realized bitmap in SourceSurfaceD2D1::DrawTargetWillChange. r=jrmuizel
gfx/2d/SourceSurfaceD2D1.cpp
--- a/gfx/2d/SourceSurfaceD2D1.cpp
+++ b/gfx/2d/SourceSurfaceD2D1.cpp
@@ -103,17 +103,23 @@ SourceSurfaceD2D1::DrawTargetWillChange(
   RefPtr<ID2D1Bitmap1> oldBitmap = mRealizedBitmap;
 
   D2D1_BITMAP_PROPERTIES1 props;
   props.dpiX = 96;
   props.dpiY = 96;
   props.pixelFormat = D2DPixelFormat(mFormat);
   props.colorContext = nullptr;
   props.bitmapOptions = D2D1_BITMAP_OPTIONS_TARGET;
-  mDC->CreateBitmap(D2DIntSize(mSize), nullptr, 0, props, (ID2D1Bitmap1**)byRef(mRealizedBitmap));
+  HRESULT hr = mDC->CreateBitmap(D2DIntSize(mSize), nullptr, 0, props, (ID2D1Bitmap1**)byRef(mRealizedBitmap));
+
+  if (FAILED(hr)) {
+    gfxCriticalError() << "Failed to create bitmap to make DrawTarget copy. Size: " << mSize << " Code: " << hexa(hr);
+    MarkIndependent();
+    return;
+  }
 
   D2D1_POINT_2U point = D2D1::Point2U(0, 0);
   D2D1_RECT_U rect = D2D1::RectU(0, 0, mSize.width, mSize.height);
   mRealizedBitmap->CopyFromBitmap(&point, oldBitmap, &rect);
   mImage = mRealizedBitmap;
 
   DrawTargetD2D1::mVRAMUsageSS += mSize.width * mSize.height * BytesPerPixel(mFormat);