From 4877de3e8e60c3288efbca6c365ce1498ba0ab70 Mon Sep 17 00:00:00 2001 From: "pavlov%pavlov.net" Date: Fri, 10 Mar 2006 00:20:03 +0000 Subject: [PATCH] fixing bug 329455. patch from Yamashita Makoto . r=me --- widget/src/mac/Makefile.in | 12 +++++++++++ widget/src/mac/nsDeviceContextSpecX.cpp | 28 +++++++++++++++++++++++++ widget/src/mac/nsDeviceContextSpecX.h | 3 +++ 3 files changed, 43 insertions(+) diff --git a/widget/src/mac/Makefile.in b/widget/src/mac/Makefile.in index af4fd34e6b92..d95a943d2a8b 100644 --- a/widget/src/mac/Makefile.in +++ b/widget/src/mac/Makefile.in @@ -75,6 +75,14 @@ ifdef ACCESSIBILITY REQUIRES += accessibility endif +ifdef MOZ_ENABLE_CAIRO_GFX +REQUIRES += thebes cairo + +ifdef MOZ_ENABLE_GLITZ +REQUIRES += glitz glitzagl +endif +endif + GFX_LCPPSRCS = \ nsRepeater.cpp \ nsWatchTask.cpp \ @@ -137,6 +145,10 @@ EXTRA_DSO_LDOPTS += \ -lgkgfx \ $(NULL) +ifdef MOZ_ENABLE_CAIRO_GFX +EXTRA_DSO_LDOPTS += -lthebes +endif + GARBAGE += $(GFX_LCPPSRCS) include $(topsrcdir)/config/rules.mk diff --git a/widget/src/mac/nsDeviceContextSpecX.cpp b/widget/src/mac/nsDeviceContextSpecX.cpp index 0636881259ce..f4573ed5500c 100644 --- a/widget/src/mac/nsDeviceContextSpecX.cpp +++ b/widget/src/mac/nsDeviceContextSpecX.cpp @@ -48,6 +48,10 @@ #include "nsIPrintOptions.h" #include "nsIPrintSettingsX.h" +#ifdef MOZ_CAIRO_GFX +#include "gfxQuartzSurface.h" +#endif + /** ------------------------------------------------------- * Construct the nsDeviceContextSpecX * @update dc 12/02/98 @@ -199,3 +203,27 @@ NS_IMETHODIMP nsDeviceContextSpecX::GetPageRect(double* aTop, double* aLeft, dou *aBottom = pageRect.bottom, *aRight = pageRect.right; return NS_OK; } + +#ifdef MOZ_CAIRO_GFX +NS_IMETHODIMP nsDeviceContextSpecX::GetSurfaceForPrinter(gfxASurface **surface) +{ +#if 0 + // open this when cairo-mac / cairo-cocoa printing is ready + double top, left, bottom, right; + GetPageRect(&top, &left, &bottom, &right); + + nsRefPtr newSurface = new gfxQuartzSurface(gfxASurface::ImageFormatRGB24, right - left, bottom - top, PR_TRUE); + + if (newSurface) { + *surface = newSurface; + NS_ADDREF(*surface); + + return NS_OK; + } + NS_WARNING("GetSurfaceForPrinter failed to create gfxQuartzSurface."); +#endif + *surface = nsnull; + + return NS_ERROR_FAILURE; +} +#endif diff --git a/widget/src/mac/nsDeviceContextSpecX.h b/widget/src/mac/nsDeviceContextSpecX.h index 128d397aecf8..976eb0b3ee4b 100644 --- a/widget/src/mac/nsDeviceContextSpecX.h +++ b/widget/src/mac/nsDeviceContextSpecX.h @@ -55,6 +55,9 @@ public: nsDeviceContextSpecX(); NS_DECL_ISUPPORTS +#ifdef MOZ_CAIRO_GFX + NS_IMETHOD GetSurfaceForPrinter(gfxASurface **surface); +#endif /** * Initialize the nsDeviceContextSpecX for use. This will allocate a printrecord for use