Bug 759749 - Bail if fallback CreateBitmap call in SourceSurfaceD2DTarget::GetBitmap fails. r=Bas, a=lsblakk
authorJim Mathies <jmathies@mozilla.com>
Wed, 22 Jan 2014 14:12:08 -0600
changeset 175098 00262fd30bb02d7e298e99053ddcd78906601554
parent 175097 e5785687c13ade03c5ce85f56be0bebfd6a85d46
child 175099 afff6fa4e0364889430f4b79eb0c5bdc8d5a7fa3
push id3224
push userlsblakk@mozilla.com
push dateTue, 04 Feb 2014 01:06:49 +0000
treeherdermozilla-beta@60c04d0987f1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersBas, lsblakk
bugs759749
milestone28.0a2
Bug 759749 - Bail if fallback CreateBitmap call in SourceSurfaceD2DTarget::GetBitmap fails. r=Bas, a=lsblakk
gfx/2d/SourceSurfaceD2DTarget.cpp
--- a/gfx/2d/SourceSurfaceD2DTarget.cpp
+++ b/gfx/2d/SourceSurfaceD2DTarget.cpp
@@ -138,19 +138,24 @@ SourceSurfaceD2DTarget::GetBitmap(ID2D1R
     return nullptr;
   }
 
   D2D1_BITMAP_PROPERTIES props = D2D1::BitmapProperties(D2DPixelFormat(mFormat));
   hr = aRT->CreateSharedBitmap(IID_IDXGISurface, surf, &props, byRef(mBitmap));
 
   if (FAILED(hr)) {
     // This seems to happen for FORMAT_A8 sometimes...
-    aRT->CreateBitmap(D2D1::SizeU(desc.Width, desc.Height),
-                      D2D1::BitmapProperties(D2DPixelFormat(mFormat)),
-                      byRef(mBitmap));
+    hr = aRT->CreateBitmap(D2D1::SizeU(desc.Width, desc.Height),
+                           D2D1::BitmapProperties(D2DPixelFormat(mFormat)),
+                           byRef(mBitmap));
+
+    if (FAILED(hr)) {
+      gfxWarning() << "Failed in CreateBitmap. Code: " << hr;
+      return nullptr;
+    }
 
     RefPtr<ID2D1RenderTarget> rt;
 
     if (mDrawTarget) {
       rt = mDrawTarget->mRT;
     }
 
     if (!rt) {