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 324480 f32bd5cf50d3f09effa4eb2567d53292a57f7ecb
parent 324479 0b564c3446576a9a43531817d9d41cb35d20c424
child 324481 14ca527ef1cc93f67abd0da87ff7616b12852665
push id6028
push userryanvm@gmail.com
push dateThu, 26 May 2016 13:40:52 +0000
treeherdermozilla-beta@5564b762402e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjrmuizel, ritu
bugs726206
milestone47.0
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);