Bug 462911 - support NS_PRINTING in gfx / cairo. r=vlad
authorDoug Turner <dougt@meer.net>
Tue, 04 Nov 2008 07:43:45 -0800
changeset 21300 efb33730c654b6451c48bd679afd624d39495abe
parent 21299 6b381bed4a3c381b405c2e933325864482bd64c3
child 21301 c429b2529b2be347e0e2918d0d03e153c004791d
push idunknown
push userunknown
push dateunknown
reviewersvlad
bugs462911
milestone1.9.1b2pre
Bug 462911 - support NS_PRINTING in gfx / cairo. r=vlad
gfx/cairo/README
gfx/cairo/cairo/src/Makefile.in
gfx/cairo/cairo/src/cairo-win32-surface.c
gfx/cairo/disable-printing.patch
gfx/thebes/src/gfxWindowsSurface.cpp
--- a/gfx/cairo/README
+++ b/gfx/cairo/README
@@ -27,8 +27,11 @@ nonfatal-assertions.patch: Make assertio
 buggy-repeat.patch: Unconditionally turn on buggy-repeat handling to bandaid bug 413583.
 
 tmpfile_wince.patch: Make Windows CE use tmpfile() on windows mobile due to the lack of _open_osfhandle and no fs permissions.
 
 ==== pixman patches ====
 
 endian.patch: include cairo-platform.h for endian macros
 
+==== disable printing patch ====
+
+disable-printing.patch:  allows us to use NS_PRINTING to disable printing.
--- a/gfx/cairo/cairo/src/Makefile.in
+++ b/gfx/cairo/cairo/src/Makefile.in
@@ -142,18 +142,23 @@ PDF_CSRCS = \
 
 PS_CSRCS = cairo-ps-surface.c
 
 PDF_EXPORTS = cairo-pdf.h
 PS_EXPORTS = cairo-ps.h
 
 ifeq ($(MOZ_WIDGET_TOOLKIT),windows)
 CSRCS	+= 	cairo-win32-font.c \
-			cairo-win32-surface.c \
-			cairo-win32-printing-surface.c
+			cairo-win32-surface.c
+
+ifdef NS_PRINTING
+DEFINES += CAIRO_OMIT_WIN32_PRINTING
+CSRCS   += cairo-win32-printing-surface.c
+endif
+
 EXPORTS += cairo-win32.h
 CSRCS   += $(PSPDF_BASE_CSRCS) $(PDF_CSRCS)
 EXPORTS += $(PDF_EXPORTS)
 endif
 
 ifeq ($(MOZ_WIDGET_TOOLKIT),os2)
 DEFINES += -DOS2_USE_PLATFORM_ALLOC
 ifdef MOZ_OS2_HIGH_MEMORY
--- a/gfx/cairo/cairo/src/cairo-win32-surface.c
+++ b/gfx/cairo/cairo/src/cairo-win32-surface.c
@@ -1892,21 +1892,22 @@ cairo_win32_surface_get_dc (cairo_surfac
 	return winsurf->dc;
     }
 
     if (_cairo_surface_is_paginated (surface)) {
 	cairo_surface_t *target;
 
 	target = _cairo_paginated_surface_get_target (surface);
 
+#ifndef CAIRO_OMIT_WIN32_PRINTING
 	if (_cairo_surface_is_win32_printing (target)) {
 	    winsurf = (cairo_win32_surface_t *) target;
-
 	    return winsurf->dc;
 	}
+#endif
     }
 
     return NULL;
 }
 
 /**
  * cairo_win32_surface_get_image
  * @surface: a #cairo_surface_t
new file mode 100644
--- /dev/null
+++ b/gfx/cairo/disable-printing.patch
@@ -0,0 +1,27 @@
+diff --git a/gfx/cairo/cairo/src/cairo-win32-surface.c b/gfx/cairo/cairo/src/cairo-win32-surface.c
+--- a/gfx/cairo/cairo/src/cairo-win32-surface.c
++++ b/gfx/cairo/cairo/src/cairo-win32-surface.c
+@@ -1892,21 +1892,22 @@ cairo_win32_surface_get_dc (cairo_surfac
+ 	return winsurf->dc;
+     }
+ 
+     if (_cairo_surface_is_paginated (surface)) {
+ 	cairo_surface_t *target;
+ 
+ 	target = _cairo_paginated_surface_get_target (surface);
+ 
++#ifndef CAIRO_OMIT_WIN32_PRINTING
+ 	if (_cairo_surface_is_win32_printing (target)) {
+ 	    winsurf = (cairo_win32_surface_t *) target;
+-
+ 	    return winsurf->dc;
+ 	}
++#endif
+     }
+ 
+     return NULL;
+ }
+ 
+ /**
+  * cairo_win32_surface_get_image
+  * @surface: a #cairo_surface_t
--- a/gfx/thebes/src/gfxWindowsSurface.cpp
+++ b/gfx/thebes/src/gfxWindowsSurface.cpp
@@ -52,22 +52,23 @@ gfxWindowsSurface::gfxWindowsSurface(HWN
 }
 
 gfxWindowsSurface::gfxWindowsSurface(HDC dc, PRUint32 flags) :
     mOwnsDC(PR_FALSE), mForPrinting(PR_FALSE), mDC(dc), mWnd(nsnull)
 {
     if (flags & FLAG_TAKE_DC)
         mOwnsDC = PR_TRUE;
 
+#ifdef NS_PRINTING
     if (flags & FLAG_FOR_PRINTING) {
         Init(cairo_win32_printing_surface_create(mDC));
         mForPrinting = PR_TRUE;
-    } else {
+    } else
+#endif
         Init(cairo_win32_surface_create(mDC));
-    }
 }
 
 gfxWindowsSurface::gfxWindowsSurface(const gfxIntSize& size, gfxImageFormat imageFormat) :
     mOwnsDC(PR_FALSE), mForPrinting(PR_FALSE), mWnd(nsnull)
 {
     if (!CheckSurfaceSize(size))
         return;