Bug 1101248: Properly check return values of creation functions in DrawTargetD2D1::Init. r=BenWa
authorBas Schouten <bschouten@mozilla.com>
Mon, 24 Nov 2014 19:44:48 +0000
changeset 217171 49ec38b3777bdea5479f9a9ce5b46c90f0c7dc75
parent 217170 f86a92a28ec9bc027a5b955a0cc7ec18ab84c0fc
child 217172 017788319d00d50e94e88dcaaafb3263d3412252
push id52241
push userbschouten@mozilla.com
push dateMon, 24 Nov 2014 19:45:03 +0000
treeherdermozilla-inbound@2b63fa9da201 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersBenWa
bugs1101248
milestone36.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 1101248: Properly check return values of creation functions in DrawTargetD2D1::Init. r=BenWa
gfx/2d/DrawTargetD2D1.cpp
--- a/gfx/2d/DrawTargetD2D1.cpp
+++ b/gfx/2d/DrawTargetD2D1.cpp
@@ -811,27 +811,32 @@ DrawTargetD2D1::Init(const IntSize &aSiz
   }
 
   D2D1_BITMAP_PROPERTIES1 props;
   props.dpiX = 96;
   props.dpiY = 96;
   props.pixelFormat = D2DPixelFormat(aFormat);
   props.colorContext = nullptr;
   props.bitmapOptions = D2D1_BITMAP_OPTIONS_TARGET;
-  mDC->CreateBitmap(D2DIntSize(aSize), nullptr, 0, props, (ID2D1Bitmap1**)byRef(mBitmap));
+  hr = mDC->CreateBitmap(D2DIntSize(aSize), nullptr, 0, props, (ID2D1Bitmap1**)byRef(mBitmap));
 
   if (FAILED(hr)) {
-    gfxWarning() << *this << ": Error " << hexa(hr) << " failed to create new CommandList.";
+    gfxCriticalError() << *this << ": Error " << hexa(hr) << " failed to create new Bitmap. Size: " << aSize;
     return false;
   }
 
   props.pixelFormat.alphaMode = D2D1_ALPHA_MODE_PREMULTIPLIED;
   props.pixelFormat.format = DXGI_FORMAT_B8G8R8A8_UNORM;
 
-  mDC->CreateBitmap(D2DIntSize(aSize), nullptr, 0, props, (ID2D1Bitmap1**)byRef(mTempBitmap));
+  hr = mDC->CreateBitmap(D2DIntSize(aSize), nullptr, 0, props, (ID2D1Bitmap1**)byRef(mTempBitmap));
+
+  if (FAILED(hr)) {
+    gfxCriticalError() << *this << ": Error " << hexa(hr) << " failed to create new TempBitmap. Size: " << aSize;
+    return false;
+  }
 
   mDC->SetTarget(mBitmap);
 
   mDC->BeginDraw();
 
   mDC->Clear();
 
   mFormat = aFormat;