Bug 726206 - check for failure in cairo _dwrite_draw_glyphs_to_gdi_surface_gdi. r=jrmuizel, a=ritu
authorLee Salzman <lsalzman@mozilla.com>
Thu, 12 May 2016 16:47:26 -0400
changeset 318872 fdf13c9edc864bebb7258816b4033af8b5dccc48
parent 318871 1890e3f14696a30a95b5107ba9d002a7dd274a51
child 318873 1645797a1315ad323dd3fe08e11ccb350350a1ce
push id9584
push usercbook@mozilla.com
push dateMon, 23 May 2016 11:36:15 +0000
treeherdermozilla-aurora@fdf13c9edc86 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjrmuizel, ritu
bugs726206
milestone48.0a2
Bug 726206 - check for failure in cairo _dwrite_draw_glyphs_to_gdi_surface_gdi. r=jrmuizel, a=ritu
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);