1 /* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /* ***** BEGIN LICENSE BLOCK *****
3 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
5 * The contents of this file are subject to the Mozilla Public License Version
6 * 1.1 (the "License"); you may not use this file except in compliance with
7 * the License. You may obtain a copy of the License at
8 * http://www.mozilla.org/MPL/
10 * Software distributed under the License is distributed on an "AS IS" basis,
11 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
12 * for the specific language governing rights and limitations under the
15 * The Original Code is thebes gfx
17 * The Initial Developer of the Original Code is
19 * Portions created by the Initial Developer are Copyright (C) 2005
20 * the Initial Developer. All Rights Reserved.
23 * Vladimir Vukicevic <vladimir@pobox.com>
24 * Stuart Parmenter <pavlov@pavlov.net>
26 * Alternatively, the contents of this file may be used under the terms of
27 * either the GNU General Public License Version 2 or later (the "GPL"), or
28 * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
29 * in which case the provisions of the GPL or the LGPL are applicable instead
30 * of those above. If you wish to allow use of your version of this file only
31 * under the terms of either the GPL or the LGPL, and not to allow others to
32 * use your version of this file under the terms of the MPL, indicate your
33 * decision by deleting the provisions above and replace them with the notice
34 * and other provisions required by the GPL or the LGPL. If you do not delete
35 * the provisions above, a recipient may use your version of this file under
36 * the terms of any one of the MPL, the GPL or the LGPL.
38 * ***** END LICENSE BLOCK ***** */
40 #include "nsIServiceManager.h"
44 #include "nsThebesDeviceContext.h"
45 #include "nsThebesRenderingContext.h"
48 #include "nsILookAndFeel.h"
50 #ifdef MOZ_ENABLE_GTK2
61 #include <pango/pango.h>
64 #include <pango/pangox.h>
66 #include <pango/pango-fontmap.h>
69 #include "gfxImageSurface.h"
71 #ifdef MOZ_ENABLE_GTK2
72 #include "nsSystemFontsGTK2.h"
73 #include "gfxPDFSurface.h"
74 #include "gfxPSSurface.h"
75 static nsSystemFontsGTK2
*gSystemFonts
= nsnull
;
77 #include "nsSystemFontsWin.h"
78 #include "gfxWindowsSurface.h"
79 #include "gfxPDFSurface.h"
80 static nsSystemFontsWin
*gSystemFonts
= nsnull
;
85 #include "nsSystemFontsOS2.h"
86 #include "gfxPDFSurface.h"
87 static nsSystemFontsOS2
*gSystemFonts
= nsnull
;
88 #elif defined(XP_BEOS)
89 #include "nsSystemFontsBeOS.h"
90 static nsSystemFontsBeOS
*gSystemFonts
= nsnull
;
92 #include "nsSystemFontsMac.h"
93 #include "gfxQuartzSurface.h"
94 #include "gfxImageSurface.h"
95 static nsSystemFontsMac
*gSystemFonts
= nsnull
;
96 #elif defined(MOZ_WIDGET_QT)
97 #include "nsSystemFontsQt.h"
98 static nsSystemFontsQt
*gSystemFonts
= nsnull
;
100 #error Need to declare gSystemFonts!
103 #if defined(MOZ_ENABLE_GTK2) && defined(MOZ_X11)
105 static int x11_error_handler (Display
*dpy
, XErrorEvent
*err
) {
106 NS_ASSERTION(PR_FALSE
, "X Error");
113 PRLogModuleInfo
* gThebesGFXLog
= nsnull
;
116 NS_IMPL_ISUPPORTS_INHERITED0(nsThebesDeviceContext
, DeviceContextImpl
)
118 nsThebesDeviceContext::nsThebesDeviceContext()
122 gThebesGFXLog
= PR_NewLogModule("thebesGfx");
125 PR_LOG(gThebesGFXLog
, PR_LOG_DEBUG
, ("#### Creating DeviceContext %p\n", this));
130 mPrintingScale
= 1.0f
;
132 mWidgetSurfaceCache
.Init();
134 #if defined(XP_WIN) && !defined(WINCE)
135 SCRIPT_DIGITSUBSTITUTE sds
;
136 ScriptRecordDigitSubstitution(LOCALE_USER_DEFAULT
, &sds
);
140 nsThebesDeviceContext::~nsThebesDeviceContext()
145 nsThebesDeviceContext::Shutdown()
148 gSystemFonts
= nsnull
;
152 nsThebesDeviceContext::IsPrinterSurface()
154 return(mPrintingSurface
!= NULL
);
158 nsThebesDeviceContext::SetDPI()
161 PRBool dotsArePixels
= PR_TRUE
;
163 // PostScript, PDF and Mac (when printing) all use 72 dpi
164 if (mPrintingSurface
&&
165 (mPrintingSurface
->GetType() == gfxASurface::SurfaceTypePDF
||
166 mPrintingSurface
->GetType() == gfxASurface::SurfaceTypePS
||
167 mPrintingSurface
->GetType() == gfxASurface::SurfaceTypeQuartz
)) {
169 dotsArePixels
= PR_FALSE
;
171 // Get prefVal the value of the preference
173 // or -1 if we can't get it.
174 // If it's negative, use the default DPI setting
175 // If it's 0, force the use of the OS's set resolution. Set this if your
176 // X server has the correct DPI and it's less than 96dpi.
177 // If it's positive, we use it as the logical resolution
180 nsCOMPtr
<nsIPref
> prefs(do_GetService(NS_PREF_CONTRACTID
, &rv
));
181 if (NS_SUCCEEDED(rv
) && prefs
) {
182 rv
= prefs
->GetIntPref("layout.css.dpi", &prefDPI
);
188 #if defined(MOZ_ENABLE_GTK2)
189 GdkScreen
*screen
= gdk_screen_get_default();
190 gtk_settings_get_for_screen(screen
); // Make sure init is run so we have a resolution
191 PRInt32 OSVal
= PRInt32(round(gdk_screen_get_resolution(screen
)));
193 if (prefDPI
== 0) // Force the use of the OS dpi
195 else // Otherwise, the minimum dpi is 96dpi
196 dpi
= PR_MAX(OSVal
, 96);
198 #elif defined(XP_WIN)
199 // XXX we should really look at the widget if !dc but it is currently always null
200 HDC dc
= GetPrintHDC();
202 PRInt32 OSVal
= GetDeviceCaps(dc
, LOGPIXELSY
);
205 mPrintingScale
= float(OSVal
)/dpi
;
206 dotsArePixels
= PR_FALSE
;
208 dc
= GetDC((HWND
)nsnull
);
210 PRInt32 OSVal
= GetDeviceCaps(dc
, LOGPIXELSY
);
212 ReleaseDC((HWND
)nsnull
, dc
);
218 #elif defined(XP_OS2)
219 // get a printer DC if available, otherwise create a new (memory) DC
220 HDC dc
= GetPrintHDC();
221 PRBool doCloseDC
= PR_FALSE
;
222 if (dc
<= 0) { // test for NULLHANDLE/DEV_ERROR or HDC_ERROR
223 // create DC compatible with the screen
224 dc
= DevOpenDC((HAB
)1, OD_MEMORY
,"*",0L, NULL
, NULLHANDLE
);
228 // we do have a DC and we can query the DPI setting from it
230 if (DevQueryCaps(dc
, CAPS_VERTICAL_FONT_RES
, 1, &lDPI
))
235 if (dpi
< 0) // something didn't work before, fall back to hardcoded DPI value
237 #elif defined(XP_MACOSX)
239 // we probably want to actually get a real DPI here?
242 #elif defined(MOZ_WIDGET_QT)
243 // TODO: get real DPI here with Qt methods
246 #error undefined platform dpi
249 if (prefDPI
> 0 && !mPrintingSurface
)
253 NS_ASSERTION(dpi
!= -1, "no dpi set");
256 // First figure out the closest multiple of 96, which is the number of
257 // dev pixels per CSS pixel. Then, divide that into AppUnitsPerCSSPixel()
258 // to get the number of app units per dev pixel. The PR_MAXes are to
259 // make sure we don't end up dividing by zero.
260 PRUint32 roundedDPIScaleFactor
= (dpi
+ 48)/96;
261 #ifdef MOZ_WIDGET_GTK2
262 // be more conservative about activating scaling on GTK2, since the dpi
263 // information is more likely to be wrong
264 roundedDPIScaleFactor
= dpi
/96;
266 mAppUnitsPerDevNotScaledPixel
=
267 PR_MAX(1, AppUnitsPerCSSPixel() / PR_MAX(1, roundedDPIScaleFactor
));
269 /* set mAppUnitsPerDevPixel so we're using exactly 72 dpi, even
270 * though that means we have a non-integer number of device "pixels"
273 mAppUnitsPerDevNotScaledPixel
= (AppUnitsPerCSSPixel() * 96) / dpi
;
276 mAppUnitsPerInch
= NSIntPixelsToAppUnits(dpi
, mAppUnitsPerDevNotScaledPixel
);
278 UpdateScaledAppUnits();
284 nsThebesDeviceContext::Init(nsNativeWidget aWidget
)
291 #if defined(MOZ_ENABLE_GTK2) && defined(MOZ_X11)
292 if (getenv ("MOZ_X_SYNC")) {
293 PR_LOG (gThebesGFXLog
, PR_LOG_DEBUG
, ("+++ Enabling XSynchronize\n"));
294 XSynchronize (gdk_x11_get_default_xdisplay(), True
);
295 XSetErrorHandler(x11_error_handler
);
300 mScreenManager
= do_GetService("@mozilla.org/gfx/screenmanager;1");
306 nsThebesDeviceContext::CreateRenderingContext(nsIView
*aView
,
307 nsIRenderingContext
*&aContext
)
309 // This is currently only called by the caret code
310 NS_ENSURE_ARG_POINTER(aView
);
311 NS_PRECONDITION(aView
->HasWidget(), "View has no widget!");
313 nsCOMPtr
<nsIWidget
> widget
;
314 widget
= aView
->GetWidget();
316 return CreateRenderingContext(widget
, aContext
);
320 nsThebesDeviceContext::CreateRenderingContext(nsIWidget
*aWidget
,
321 nsIRenderingContext
*&aContext
)
326 nsCOMPtr
<nsIRenderingContext
> pContext
;
327 rv
= CreateRenderingContextInstance(*getter_AddRefs(pContext
));
328 if (NS_SUCCEEDED(rv
)) {
329 nsRefPtr
<gfxASurface
> surface(aWidget
->GetThebesSurface());
331 rv
= pContext
->Init(this, surface
);
333 rv
= NS_ERROR_FAILURE
;
335 if (NS_SUCCEEDED(rv
)) {
345 nsThebesDeviceContext::CreateRenderingContext(nsIRenderingContext
*&aContext
)
350 nsCOMPtr
<nsIRenderingContext
> pContext
;
351 rv
= CreateRenderingContextInstance(*getter_AddRefs(pContext
));
352 if (NS_SUCCEEDED(rv
)) {
353 if (mPrintingSurface
)
354 rv
= pContext
->Init(this, mPrintingSurface
);
356 rv
= NS_ERROR_FAILURE
;
358 if (NS_SUCCEEDED(rv
)) {
359 pContext
->Scale(mPrintingScale
, mPrintingScale
);
369 nsThebesDeviceContext::CreateRenderingContextInstance(nsIRenderingContext
*&aContext
)
371 nsCOMPtr
<nsIRenderingContext
> renderingContext
= new nsThebesRenderingContext();
372 if (!renderingContext
)
373 return NS_ERROR_OUT_OF_MEMORY
;
375 aContext
= renderingContext
;
382 nsThebesDeviceContext::SupportsNativeWidgets(PRBool
&aSupportsWidgets
)
384 aSupportsWidgets
= PR_TRUE
;
389 nsThebesDeviceContext::ClearCachedSystemFonts()
391 //clear our cache of stored system fonts
394 gSystemFonts
= nsnull
;
400 nsThebesDeviceContext::GetSystemFont(nsSystemFontID aID
, nsFont
*aFont
) const
403 #ifdef MOZ_ENABLE_GTK2
404 gSystemFonts
= new nsSystemFontsGTK2();
406 gSystemFonts
= new nsSystemFontsWin();
408 gSystemFonts
= new nsSystemFontsOS2();
409 #elif defined(XP_BEOS)
410 gSystemFonts
= new nsSystemFontsBeOS();
412 gSystemFonts
= new nsSystemFontsMac();
413 #elif defined(MOZ_WIDGET_QT)
414 gSystemFonts
= new nsSystemFontsQt();
416 #error Need to know how to create gSystemFonts, fix me!
421 gfxFontStyle fontStyle
;
422 nsresult rv
= gSystemFonts
->GetSystemFont(aID
, &fontName
, &fontStyle
);
423 NS_ENSURE_SUCCESS(rv
, rv
);
425 aFont
->name
= fontName
;
426 aFont
->style
= fontStyle
.style
;
427 aFont
->systemFont
= fontStyle
.systemFont
;
428 aFont
->variant
= NS_FONT_VARIANT_NORMAL
;
429 aFont
->familyNameQuirks
= fontStyle
.familyNameQuirks
;
430 aFont
->weight
= fontStyle
.weight
;
431 aFont
->decorations
= NS_FONT_DECORATION_NONE
;
432 aFont
->size
= NSFloatPixelsToAppUnits(fontStyle
.size
, UnscaledAppUnitsPerDevPixel());
433 //aFont->langGroup = fontStyle.langGroup;
434 aFont
->sizeAdjust
= fontStyle
.sizeAdjust
;
440 nsThebesDeviceContext::CheckFontExistence(const nsString
& aFaceName
)
446 nsThebesDeviceContext::GetDepth(PRUint32
& aDepth
)
448 nsCOMPtr
<nsIScreen
> primaryScreen
;
450 mScreenManager
->GetPrimaryScreen(getter_AddRefs(primaryScreen
));
451 primaryScreen
->GetColorDepth(reinterpret_cast<PRInt32
*>(&mDepth
));
459 nsThebesDeviceContext::GetPaletteInfo(nsPaletteInfo
& aPaletteInfo
)
461 aPaletteInfo
.isPaletteDevice
= PR_FALSE
;
462 aPaletteInfo
.sizePalette
= 0;
463 aPaletteInfo
.numReserved
= 0;
464 aPaletteInfo
.palette
= nsnull
;
470 nsThebesDeviceContext::ConvertPixel(nscolor aColor
, PRUint32
& aPixel
)
477 nsThebesDeviceContext::GetDeviceSurfaceDimensions(nscoord
&aWidth
, nscoord
&aHeight
)
479 if (mPrintingSurface
) {
480 // we have a printer device
485 ComputeFullAreaUsingScreen(&area
);
487 aHeight
= area
.height
;
494 nsThebesDeviceContext::GetRect(nsRect
&aRect
)
496 if (mPrintingSurface
) {
497 // we have a printer device
500 aRect
.width
= mWidth
;
501 aRect
.height
= mHeight
;
503 ComputeFullAreaUsingScreen ( &aRect
);
509 nsThebesDeviceContext::GetClientRect(nsRect
&aRect
)
511 if (mPrintingSurface
) {
512 // we have a printer device
515 aRect
.width
= mWidth
;
516 aRect
.height
= mHeight
;
519 ComputeClientRectUsingScreen(&aRect
);
525 nsThebesDeviceContext::PrepareNativeWidget(nsIWidget
* aWidget
, void** aOut
)
533 * below methods are for printing
536 nsThebesDeviceContext::InitForPrinting(nsIDeviceContextSpec
*aDevice
)
538 NS_ENSURE_ARG_POINTER(aDevice
);
540 mDeviceContextSpec
= aDevice
;
542 nsresult rv
= aDevice
->GetSurfaceForPrinter(getter_AddRefs(mPrintingSurface
));
544 return NS_ERROR_FAILURE
;
555 nsThebesDeviceContext::PrepareDocument(PRUnichar
* aTitle
,
556 PRUnichar
* aPrintToFileName
)
563 nsThebesDeviceContext::BeginDocument(PRUnichar
* aTitle
,
564 PRUnichar
* aPrintToFileName
,
568 static const PRUnichar kEmpty
[] = { '\0' };
571 rv
= mPrintingSurface
->BeginPrinting(nsDependentString(aTitle
? aTitle
: kEmpty
),
572 nsDependentString(aPrintToFileName
? aPrintToFileName
: kEmpty
));
574 if (NS_SUCCEEDED(rv
) && mDeviceContextSpec
)
575 rv
= mDeviceContextSpec
->BeginDocument(aTitle
, aPrintToFileName
, aStartPage
, aEndPage
);
582 nsThebesDeviceContext::EndDocument(void)
586 if (mPrintingSurface
) {
587 rv
= mPrintingSurface
->EndPrinting();
588 if (NS_SUCCEEDED(rv
))
589 mPrintingSurface
->Finish();
592 if (mDeviceContextSpec
)
593 mDeviceContextSpec
->EndDocument();
600 nsThebesDeviceContext::AbortDocument(void)
602 nsresult rv
= mPrintingSurface
->AbortPrinting();
604 if (mDeviceContextSpec
)
605 mDeviceContextSpec
->EndDocument();
612 nsThebesDeviceContext::BeginPage(void)
616 if (mDeviceContextSpec
)
617 rv
= mDeviceContextSpec
->BeginPage();
619 if (NS_FAILED(rv
)) return rv
;
621 /* We need to get a new surface for each page on the Mac */
623 mDeviceContextSpec
->GetSurfaceForPrinter(getter_AddRefs(mPrintingSurface
));
625 rv
= mPrintingSurface
->BeginPage();
631 nsThebesDeviceContext::EndPage(void)
633 nsresult rv
= mPrintingSurface
->EndPage();
635 /* We need to release the CGContextRef in the surface here, plus it's
636 not something you would want anyway, as these CGContextRefs are only good
639 mPrintingSurface
= nsnull
;
642 if (mDeviceContextSpec
)
643 mDeviceContextSpec
->EndPage();
648 /** End printing methods **/
651 nsThebesDeviceContext::ComputeClientRectUsingScreen(nsRect
* outRect
)
653 // we always need to recompute the clientRect
654 // because the window may have moved onto a different screen. In the single
655 // monitor case, we only need to do the computation if we haven't done it
656 // once already, and remember that we have because we're assured it won't change.
657 nsCOMPtr
<nsIScreen
> screen
;
658 FindScreen (getter_AddRefs(screen
));
660 PRInt32 x
, y
, width
, height
;
661 screen
->GetAvailRect(&x
, &y
, &width
, &height
);
663 // convert to device units
664 outRect
->y
= NSIntPixelsToAppUnits(y
, AppUnitsPerDevPixel());
665 outRect
->x
= NSIntPixelsToAppUnits(x
, AppUnitsPerDevPixel());
666 outRect
->width
= NSIntPixelsToAppUnits(width
, AppUnitsPerDevPixel());
667 outRect
->height
= NSIntPixelsToAppUnits(height
, AppUnitsPerDevPixel());
672 nsThebesDeviceContext::ComputeFullAreaUsingScreen(nsRect
* outRect
)
674 // if we have more than one screen, we always need to recompute the clientRect
675 // because the window may have moved onto a different screen. In the single
676 // monitor case, we only need to do the computation if we haven't done it
677 // once already, and remember that we have because we're assured it won't change.
678 nsCOMPtr
<nsIScreen
> screen
;
679 FindScreen ( getter_AddRefs(screen
) );
681 PRInt32 x
, y
, width
, height
;
682 screen
->GetRect ( &x
, &y
, &width
, &height
);
684 // convert to device units
685 outRect
->y
= NSIntPixelsToAppUnits(y
, AppUnitsPerDevPixel());
686 outRect
->x
= NSIntPixelsToAppUnits(x
, AppUnitsPerDevPixel());
687 outRect
->width
= NSIntPixelsToAppUnits(width
, AppUnitsPerDevPixel());
688 outRect
->height
= NSIntPixelsToAppUnits(height
, AppUnitsPerDevPixel());
690 mWidth
= outRect
->width
;
691 mHeight
= outRect
->height
;
700 // Determines which screen intersects the largest area of the given surface.
703 nsThebesDeviceContext::FindScreen(nsIScreen
** outScreen
)
706 mScreenManager
->ScreenForNativeWidget(mWidget
, outScreen
);
708 mScreenManager
->GetPrimaryScreen(outScreen
);
712 nsThebesDeviceContext::CalcPrintingSize()
714 if (!mPrintingSurface
)
717 PRBool inPoints
= PR_TRUE
;
720 switch (mPrintingSurface
->GetType()) {
721 case gfxASurface::SurfaceTypeImage
:
723 size
= reinterpret_cast<gfxImageSurface
*>(mPrintingSurface
.get())->GetSize();
726 #if defined(MOZ_ENABLE_GTK2) || defined(XP_WIN) || defined(XP_OS2)
727 case gfxASurface::SurfaceTypePDF
:
729 size
= reinterpret_cast<gfxPDFSurface
*>(mPrintingSurface
.get())->GetSize();
733 #ifdef MOZ_ENABLE_GTK2
734 case gfxASurface::SurfaceTypePS
:
736 size
= reinterpret_cast<gfxPSSurface
*>(mPrintingSurface
.get())->GetSize();
741 case gfxASurface::SurfaceTypeQuartz
:
742 inPoints
= PR_TRUE
; // this is really only true when we're printing
743 size
= reinterpret_cast<gfxQuartzSurface
*>(mPrintingSurface
.get())->GetSize();
748 case gfxASurface::SurfaceTypeWin32
:
749 case gfxASurface::SurfaceTypeWin32Printing
:
752 HDC dc
= GetPrintHDC();
754 dc
= GetDC((HWND
)mWidget
);
755 size
.width
= NSFloatPixelsToAppUnits(::GetDeviceCaps(dc
, HORZRES
)/mPrintingScale
, AppUnitsPerDevPixel());
756 size
.height
= NSFloatPixelsToAppUnits(::GetDeviceCaps(dc
, VERTRES
)/mPrintingScale
, AppUnitsPerDevPixel());
757 mDepth
= (PRUint32
)::GetDeviceCaps(dc
, BITSPIXEL
);
758 if (dc
!= (HDC
)GetPrintHDC())
759 ReleaseDC((HWND
)mWidget
, dc
);
765 case gfxASurface::SurfaceTypeOS2
:
768 // we already set the size in the surface constructor we set for
769 // printing, so just get those values here
770 size
= reinterpret_cast<gfxOS2Surface
*>(mPrintingSurface
.get())->GetSize();
771 // as they are in pixels we need to scale them to app units
772 size
.width
= NSFloatPixelsToAppUnits(size
.width
, AppUnitsPerDevPixel());
773 size
.height
= NSFloatPixelsToAppUnits(size
.height
, AppUnitsPerDevPixel());
774 // still need to get the depth from the device context
775 HDC dc
= GetPrintHDC();
777 if (DevQueryCaps(dc
, CAPS_COLOR_BITCOUNT
, 1, &value
))
780 mDepth
= 8; // default to 8bpp, should be enough for printers
785 NS_ASSERTION(0, "trying to print to unknown surface type");
789 mWidth
= NSToCoordRound(float(size
.width
) * AppUnitsPerInch() / 72);
790 mHeight
= NSToCoordRound(float(size
.height
) * AppUnitsPerInch() / 72);
792 mWidth
= NSToIntRound(size
.width
);
793 mHeight
= NSToIntRound(size
.height
);
797 PRBool
nsThebesDeviceContext::CheckDPIChange() {
798 PRInt32 oldDevPixels
= mAppUnitsPerDevNotScaledPixel
;
799 PRInt32 oldInches
= mAppUnitsPerInch
;
803 return oldDevPixels
!= mAppUnitsPerDevNotScaledPixel
||
804 oldInches
!= mAppUnitsPerInch
;
808 nsThebesDeviceContext::SetPixelScale(float aScale
)
811 NS_NOTREACHED("Invalid pixel scale value");
814 PRInt32 oldAppUnitsPerDevPixel
= mAppUnitsPerDevPixel
;
815 mPixelScale
= aScale
;
816 UpdateScaledAppUnits();
817 return oldAppUnitsPerDevPixel
!= mAppUnitsPerDevPixel
;
821 nsThebesDeviceContext::UpdateScaledAppUnits()
823 mAppUnitsPerDevPixel
= PR_MAX(1, PRInt32(float(mAppUnitsPerDevNotScaledPixel
) / mPixelScale
));
826 #if defined(XP_WIN) || defined(XP_OS2)
828 nsThebesDeviceContext::GetPrintHDC()
830 if (mPrintingSurface
) {
831 switch (mPrintingSurface
->GetType()) {
833 case gfxASurface::SurfaceTypeWin32
:
834 case gfxASurface::SurfaceTypeWin32Printing
:
835 return reinterpret_cast<gfxWindowsSurface
*>(mPrintingSurface
.get())->GetDC();
839 case gfxASurface::SurfaceTypeOS2
:
840 return GpiQueryDevice(reinterpret_cast<gfxOS2Surface
*>(mPrintingSurface
.get())->GetPS());
844 NS_ASSERTION(0, "invalid surface type in GetPrintHDC");