From 196f0e4ade1f783e846bf230352826a7cbe6afdd Mon Sep 17 00:00:00 2001 From: Bas Schouten Date: Mon, 4 Nov 2013 00:57:36 +0100 Subject: [PATCH] Bug 934286: Ifdef Mozilla specific cairo function usage. r=mattwoodrow --- gfx/2d/DrawTargetCairo.cpp | 16 ++++++++++++++++ gfx/2d/Makefile.in | 2 +- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/gfx/2d/DrawTargetCairo.cpp b/gfx/2d/DrawTargetCairo.cpp index e2f09ff7272..9c40c68881a 100644 --- a/gfx/2d/DrawTargetCairo.cpp +++ b/gfx/2d/DrawTargetCairo.cpp @@ -114,6 +114,7 @@ GetCairoSurfaceSize(cairo_surface_t* surface, IntSize& size) } #endif #ifdef CAIRO_HAS_WIN32_SURFACE +#ifdef MOZ2D_HAS_MOZ_CAIRO case CAIRO_SURFACE_TYPE_WIN32: case CAIRO_SURFACE_TYPE_WIN32_PRINTING: { @@ -121,6 +122,21 @@ GetCairoSurfaceSize(cairo_surface_t* surface, IntSize& size) size.height = cairo_win32_surface_get_height(surface); return true; } +#else + case CAIRO_SURFACE_TYPE_WIN32: + { + cairo_surface_t *img = cairo_win32_surface_get_image(surface); + + if (!img) { + // XXX - fix me + MOZ_ASSERT(false); + return true; + } + size.width = cairo_image_surface_get_width(img); + size.height = cairo_image_surface_get_height(img); + return true; + } +#endif #endif default: diff --git a/gfx/2d/Makefile.in b/gfx/2d/Makefile.in index 945ef95450f..5a82d62bb8b 100644 --- a/gfx/2d/Makefile.in +++ b/gfx/2d/Makefile.in @@ -5,7 +5,7 @@ VPATH = $(srcdir) $(srcdir)/unittest -DEFINES += -DMOZ_GFX -DUSE_CAIRO -DGFX2D_INTERNAL +DEFINES += -DMOZ_GFX -DUSE_CAIRO -DGFX2D_INTERNAL -DMOZ2D_HAS_MOZ_CAIRO ifeq ($(MOZ_WIDGET_TOOLKIT),$(findstring $(MOZ_WIDGET_TOOLKIT),android gtk2 gtk3 gonk qt)) DEFINES += -DMOZ_ENABLE_FREETYPE