Bug 1316750, part 3 - Add special case code to handle CAIRO_SURFACE_TYPE_WIN32 in PrintTarget::GetReferenceDrawTarget. r=edwin
authorJonathan Watt <jwatt@jwatt.org>
Tue, 15 Nov 2016 23:12:09 +0000
changeset 439450 ba22cd08d1236504e79bc55cccd7a99fa2a7761d
parent 439449 8fedd88f64885a8ec64e587f185d557ff718d2cc
child 439451 fe64a3cfb7f03798a474a2e6882ec50333c08714
push id36000
push userbmo:gasolin@mozilla.com
push dateWed, 16 Nov 2016 01:30:27 +0000
reviewersedwin
bugs1316750
milestone53.0a1
Bug 1316750, part 3 - Add special case code to handle CAIRO_SURFACE_TYPE_WIN32 in PrintTarget::GetReferenceDrawTarget. r=edwin
gfx/thebes/PrintTarget.cpp
--- a/gfx/thebes/PrintTarget.cpp
+++ b/gfx/thebes/PrintTarget.cpp
@@ -8,16 +8,17 @@
 #include "cairo.h"
 #ifdef CAIRO_HAS_QUARTZ_SURFACE
 #include "cairo-quartz.h"
 #endif
 #ifdef CAIRO_HAS_WIN32_SURFACE
 #include "cairo-win32.h"
 #endif
 #include "mozilla/gfx/2D.h"
+#include "mozilla/gfx/HelpersCairo.h"
 #include "mozilla/gfx/Logging.h"
 
 namespace mozilla {
 namespace gfx {
 
 PrintTarget::PrintTarget(cairo_surface_t* aCairoSurface, const IntSize& aSize)
   : mCairoSurface(aCairoSurface)
   , mSize(aSize)
@@ -94,16 +95,20 @@ PrintTarget::GetReferenceDrawTarget(Draw
 {
   if (!mRefDT) {
     const IntSize size(1, 1);
 
     cairo_surface_t* similar;
     switch (cairo_surface_get_type(mCairoSurface)) {
 #ifdef CAIRO_HAS_WIN32_SURFACE
     case CAIRO_SURFACE_TYPE_WIN32:
+      similar = cairo_win32_surface_create_with_dib(
+        CairoContentToCairoFormat(cairo_surface_get_content(mCairoSurface)),
+        size.width, size.height);
+      break;
 #endif
 #ifdef CAIRO_HAS_QUARTZ_SURFACE
     case CAIRO_SURFACE_TYPE_QUARTZ:
       similar = cairo_quartz_surface_create_cg_layer(
                   mCairoSurface, cairo_surface_get_content(mCairoSurface),
                   size.width, size.height);
       break;
 #endif