Bug 726206 - check for failure in cairo _dwrite_draw_glyphs_to_gdi_surface_gdi. r=jrmuizel
authorLee Salzman <lsalzman@mozilla.com>
Thu, 12 May 2016 16:47:26 -0400
changeset 297258 f22fc6d53a97e4b5c962687fa9c8924cd2a5bfe9
parent 297257 3967d009efc0ee734f4d2750d8fda2bbecca5d81
child 297259 052cbe57e1906ff2c59f785e219a6740d63d2154
push id30253
push usercbook@mozilla.com
push dateFri, 13 May 2016 09:59:43 +0000
treeherdermozilla-central@5a2deb5a9b09 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjrmuizel
bugs726206
milestone49.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 726206 - check for failure in cairo _dwrite_draw_glyphs_to_gdi_surface_gdi. r=jrmuizel
gfx/cairo/cairo/src/cairo-dwrite-font.cpp
--- a/gfx/cairo/cairo/src/cairo-dwrite-font.cpp
+++ b/gfx/cairo/cairo/src/cairo-dwrite-font.cpp
@@ -1129,24 +1129,32 @@ cairo_int_status_t
 				       DWRITE_GLYPH_RUN *run,
 				       COLORREF color,
 				       cairo_dwrite_scaled_font_t *scaled_font,
 				       const RECT &area)
 {
     IDWriteGdiInterop *gdiInterop;
     DWriteFactory::Instance()->GetGdiInterop(&gdiInterop);
     IDWriteBitmapRenderTarget *rt;
+    HRESULT rv;
 
     IDWriteRenderingParams *params =
         DWriteFactory::RenderingParams(scaled_font->rendering_mode);
 
-    gdiInterop->CreateBitmapRenderTarget(surface->dc, 
-					 area.right - area.left, 
-					 area.bottom - area.top, 
-					 &rt);
+    rv = gdiInterop->CreateBitmapRenderTarget(surface->dc,
+					      area.right - area.left,
+					      area.bottom - area.top,
+					      &rt);
+    if (FAILED(rv)) {
+	if (rv == E_OUTOFMEMORY) {
+	    return (cairo_int_status_t)CAIRO_STATUS_NO_MEMORY;
+	} else {
+	    return CAIRO_INT_STATUS_UNSUPPORTED;
+	}
+    }
 
     /**
      * We set the number of pixels per DIP to 1.0. This is because we always want
      * to draw in device pixels, and not device independent pixels. On high DPI
      * systems this value will be higher than 1.0 and automatically upscale
      * fonts, we don't want this since we do our own upscaling for various reasons.
      */
     rt->SetPixelsPerDip(1.0);