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
;
83 #include "nsSystemFontsOS2.h"
84 #include "gfxPDFSurface.h"
85 static nsSystemFontsOS2
*gSystemFonts
= nsnull
;
86 #elif defined(XP_BEOS)
87 #include "nsSystemFontsBeOS.h"
88 static nsSystemFontsBeOS
*gSystemFonts
= nsnull
;
90 #include "nsSystemFontsMac.h"
91 #include "gfxQuartzSurface.h"
92 #include "gfxImageSurface.h"
93 static nsSystemFontsMac
*gSystemFonts
= nsnull
;
94 #elif defined(MOZ_WIDGET_QT)
95 #include "nsSystemFontsQt.h"
96 static nsSystemFontsQt
*gSystemFonts
= nsnull
;
98 #error Need to declare gSystemFonts!
101 #if defined(MOZ_ENABLE_GTK2) && defined(MOZ_X11)
103 static int x11_error_handler (Display
*dpy
, XErrorEvent
*err
) {
104 NS_ASSERTION(PR_FALSE
, "X Error");
111 PRLogModuleInfo
* gThebesGFXLog
= nsnull
;
114 NS_IMPL_ISUPPORTS_INHERITED0(nsThebesDeviceContext
, DeviceContextImpl
)
116 nsThebesDeviceContext::nsThebesDeviceContext()
120 gThebesGFXLog
= PR_NewLogModule("thebesGfx");
123 PR_LOG(gThebesGFXLog
, PR_LOG_DEBUG
, ("#### Creating DeviceContext %p\n", this));
128 mPrintingScale
= 1.0f
;
130 mWidgetSurfaceCache
.Init();
133 SCRIPT_DIGITSUBSTITUTE sds
;
134 ScriptRecordDigitSubstitution(LOCALE_USER_DEFAULT
, &sds
);
138 nsThebesDeviceContext::~nsThebesDeviceContext()
143 nsThebesDeviceContext::Shutdown()
146 gSystemFonts
= nsnull
;
150 nsThebesDeviceContext::SetDPI()
153 PRBool dotsArePixels
= PR_TRUE
;
155 // PostScript, PDF and Mac (when printing) all use 72 dpi
156 if (mPrintingSurface
&&
157 (mPrintingSurface
->GetType() == gfxASurface::SurfaceTypePDF
||
158 mPrintingSurface
->GetType() == gfxASurface::SurfaceTypePS
||
159 mPrintingSurface
->GetType() == gfxASurface::SurfaceTypeQuartz
)) {
161 dotsArePixels
= PR_FALSE
;
163 // Get prefVal the value of the preference
165 // or -1 if we can't get it.
166 // If it's negative, use the default DPI setting
167 // If it's 0, force the use of the OS's set resolution. Set this if your
168 // X server has the correct DPI and it's less than 96dpi.
169 // If it's positive, we use it as the logical resolution
172 nsCOMPtr
<nsIPref
> prefs(do_GetService(NS_PREF_CONTRACTID
, &rv
));
173 if (NS_SUCCEEDED(rv
) && prefs
) {
174 rv
= prefs
->GetIntPref("layout.css.dpi", &prefDPI
);
180 #if defined(MOZ_ENABLE_GTK2)
181 GdkScreen
*screen
= gdk_screen_get_default();
182 gtk_settings_get_for_screen(screen
); // Make sure init is run so we have a resolution
183 PRInt32 OSVal
= PRInt32(round(gdk_screen_get_resolution(screen
)));
185 if (prefDPI
== 0) // Force the use of the OS dpi
187 else // Otherwise, the minimum dpi is 96dpi
188 dpi
= PR_MAX(OSVal
, 96);
190 #elif defined(XP_WIN)
191 // XXX we should really look at the widget if !dc but it is currently always null
192 HDC dc
= GetPrintHDC();
194 PRInt32 OSVal
= GetDeviceCaps(dc
, LOGPIXELSY
);
197 mPrintingScale
= float(OSVal
)/dpi
;
198 dotsArePixels
= PR_FALSE
;
200 dc
= GetDC((HWND
)nsnull
);
202 PRInt32 OSVal
= GetDeviceCaps(dc
, LOGPIXELSY
);
204 ReleaseDC((HWND
)nsnull
, dc
);
210 #elif defined(XP_OS2)
211 // get a printer DC if available, otherwise create a new (memory) DC
212 HDC dc
= GetPrintHDC();
213 PRBool doCloseDC
= PR_FALSE
;
214 if (dc
<= 0) { // test for NULLHANDLE/DEV_ERROR or HDC_ERROR
215 // create DC compatible with the screen
216 dc
= DevOpenDC((HAB
)1, OD_MEMORY
,"*",0L, NULL
, NULLHANDLE
);
220 // we do have a DC and we can query the DPI setting from it
222 if (DevQueryCaps(dc
, CAPS_VERTICAL_FONT_RES
, 1, &lDPI
))
227 if (dpi
< 0) // something didn't work before, fall back to hardcoded DPI value
229 #elif defined(XP_MACOSX)
231 // we probably want to actually get a real DPI here?
234 #elif defined(MOZ_WIDGET_QT)
235 // TODO: get real DPI here with Qt methods
238 #error undefined platform dpi
241 if (prefDPI
> 0 && !mPrintingSurface
)
245 NS_ASSERTION(dpi
!= -1, "no dpi set");
248 // First figure out the closest multiple of 96, which is the number of
249 // dev pixels per CSS pixel. Then, divide that into AppUnitsPerCSSPixel()
250 // to get the number of app units per dev pixel. The PR_MAXes are to
251 // make sure we don't end up dividing by zero.
252 PRUint32 roundedDPIScaleFactor
= (dpi
+ 48)/96;
253 #ifdef MOZ_WIDGET_GTK2
254 // be more conservative about activating scaling on GTK2, since the dpi
255 // information is more likely to be wrong
256 roundedDPIScaleFactor
= dpi
/96;
258 mAppUnitsPerDevNotScaledPixel
=
259 PR_MAX(1, AppUnitsPerCSSPixel() / PR_MAX(1, roundedDPIScaleFactor
));
261 /* set mAppUnitsPerDevPixel so we're using exactly 72 dpi, even
262 * though that means we have a non-integer number of device "pixels"
265 mAppUnitsPerDevNotScaledPixel
= (AppUnitsPerCSSPixel() * 96) / dpi
;
268 mAppUnitsPerInch
= NSIntPixelsToAppUnits(dpi
, mAppUnitsPerDevNotScaledPixel
);
270 UpdateScaledAppUnits();
276 nsThebesDeviceContext::Init(nsNativeWidget aWidget
)
283 #if defined(MOZ_ENABLE_GTK2) && defined(MOZ_X11)
284 if (getenv ("MOZ_X_SYNC")) {
285 PR_LOG (gThebesGFXLog
, PR_LOG_DEBUG
, ("+++ Enabling XSynchronize\n"));
286 XSynchronize (gdk_x11_get_default_xdisplay(), True
);
287 XSetErrorHandler(x11_error_handler
);
292 mScreenManager
= do_GetService("@mozilla.org/gfx/screenmanager;1");
298 nsThebesDeviceContext::CreateRenderingContext(nsIView
*aView
,
299 nsIRenderingContext
*&aContext
)
301 // This is currently only called by the caret code
302 NS_ENSURE_ARG_POINTER(aView
);
303 NS_PRECONDITION(aView
->HasWidget(), "View has no widget!");
305 nsCOMPtr
<nsIWidget
> widget
;
306 widget
= aView
->GetWidget();
308 return CreateRenderingContext(widget
, aContext
);
312 nsThebesDeviceContext::CreateRenderingContext(nsIWidget
*aWidget
,
313 nsIRenderingContext
*&aContext
)
318 nsCOMPtr
<nsIRenderingContext
> pContext
;
319 rv
= CreateRenderingContextInstance(*getter_AddRefs(pContext
));
320 if (NS_SUCCEEDED(rv
)) {
321 nsRefPtr
<gfxASurface
> surface(aWidget
->GetThebesSurface());
323 rv
= pContext
->Init(this, surface
);
325 rv
= NS_ERROR_FAILURE
;
327 if (NS_SUCCEEDED(rv
)) {
337 nsThebesDeviceContext::CreateRenderingContext(nsIRenderingContext
*&aContext
)
342 nsCOMPtr
<nsIRenderingContext
> pContext
;
343 rv
= CreateRenderingContextInstance(*getter_AddRefs(pContext
));
344 if (NS_SUCCEEDED(rv
)) {
345 if (mPrintingSurface
)
346 rv
= pContext
->Init(this, mPrintingSurface
);
348 rv
= NS_ERROR_FAILURE
;
350 if (NS_SUCCEEDED(rv
)) {
351 pContext
->Scale(mPrintingScale
, mPrintingScale
);
361 nsThebesDeviceContext::CreateRenderingContextInstance(nsIRenderingContext
*&aContext
)
363 nsCOMPtr
<nsIRenderingContext
> renderingContext
= new nsThebesRenderingContext();
364 if (!renderingContext
)
365 return NS_ERROR_OUT_OF_MEMORY
;
367 aContext
= renderingContext
;
374 nsThebesDeviceContext::SupportsNativeWidgets(PRBool
&aSupportsWidgets
)
376 aSupportsWidgets
= PR_TRUE
;
381 nsThebesDeviceContext::ClearCachedSystemFonts()
383 //clear our cache of stored system fonts
386 gSystemFonts
= nsnull
;
392 nsThebesDeviceContext::GetSystemFont(nsSystemFontID aID
, nsFont
*aFont
) const
395 #ifdef MOZ_ENABLE_GTK2
396 gSystemFonts
= new nsSystemFontsGTK2();
398 gSystemFonts
= new nsSystemFontsWin();
400 gSystemFonts
= new nsSystemFontsOS2();
401 #elif defined(XP_BEOS)
402 gSystemFonts
= new nsSystemFontsBeOS();
404 gSystemFonts
= new nsSystemFontsMac();
405 #elif defined(MOZ_WIDGET_QT)
406 gSystemFonts
= new nsSystemFontsQt();
408 #error Need to know how to create gSystemFonts, fix me!
413 gfxFontStyle fontStyle
;
414 nsresult rv
= gSystemFonts
->GetSystemFont(aID
, &fontName
, &fontStyle
);
415 NS_ENSURE_SUCCESS(rv
, rv
);
417 aFont
->name
= fontName
;
418 aFont
->style
= fontStyle
.style
;
419 aFont
->systemFont
= fontStyle
.systemFont
;
420 aFont
->variant
= NS_FONT_VARIANT_NORMAL
;
421 aFont
->familyNameQuirks
= fontStyle
.familyNameQuirks
;
422 aFont
->weight
= fontStyle
.weight
;
423 aFont
->decorations
= NS_FONT_DECORATION_NONE
;
424 aFont
->size
= NSFloatPixelsToAppUnits(fontStyle
.size
, UnscaledAppUnitsPerDevPixel());
425 //aFont->langGroup = fontStyle.langGroup;
426 aFont
->sizeAdjust
= fontStyle
.sizeAdjust
;
432 nsThebesDeviceContext::CheckFontExistence(const nsString
& aFaceName
)
438 nsThebesDeviceContext::GetDepth(PRUint32
& aDepth
)
440 nsCOMPtr
<nsIScreen
> primaryScreen
;
442 mScreenManager
->GetPrimaryScreen(getter_AddRefs(primaryScreen
));
443 primaryScreen
->GetColorDepth(reinterpret_cast<PRInt32
*>(&mDepth
));
451 nsThebesDeviceContext::GetPaletteInfo(nsPaletteInfo
& aPaletteInfo
)
453 aPaletteInfo
.isPaletteDevice
= PR_FALSE
;
454 aPaletteInfo
.sizePalette
= 0;
455 aPaletteInfo
.numReserved
= 0;
456 aPaletteInfo
.palette
= nsnull
;
462 nsThebesDeviceContext::ConvertPixel(nscolor aColor
, PRUint32
& aPixel
)
469 nsThebesDeviceContext::GetDeviceSurfaceDimensions(nscoord
&aWidth
, nscoord
&aHeight
)
471 if (mPrintingSurface
) {
472 // we have a printer device
477 ComputeFullAreaUsingScreen(&area
);
479 aHeight
= area
.height
;
486 nsThebesDeviceContext::GetRect(nsRect
&aRect
)
488 if (mPrintingSurface
) {
489 // we have a printer device
492 aRect
.width
= mWidth
;
493 aRect
.height
= mHeight
;
495 ComputeFullAreaUsingScreen ( &aRect
);
501 nsThebesDeviceContext::GetClientRect(nsRect
&aRect
)
503 if (mPrintingSurface
) {
504 // we have a printer device
507 aRect
.width
= mWidth
;
508 aRect
.height
= mHeight
;
511 ComputeClientRectUsingScreen(&aRect
);
517 nsThebesDeviceContext::PrepareNativeWidget(nsIWidget
* aWidget
, void** aOut
)
525 * below methods are for printing
528 nsThebesDeviceContext::InitForPrinting(nsIDeviceContextSpec
*aDevice
)
530 NS_ENSURE_ARG_POINTER(aDevice
);
532 mDeviceContextSpec
= aDevice
;
534 nsresult rv
= aDevice
->GetSurfaceForPrinter(getter_AddRefs(mPrintingSurface
));
536 return NS_ERROR_FAILURE
;
547 nsThebesDeviceContext::PrepareDocument(PRUnichar
* aTitle
,
548 PRUnichar
* aPrintToFileName
)
555 nsThebesDeviceContext::BeginDocument(PRUnichar
* aTitle
,
556 PRUnichar
* aPrintToFileName
,
560 static const PRUnichar kEmpty
[] = { '\0' };
563 rv
= mPrintingSurface
->BeginPrinting(nsDependentString(aTitle
? aTitle
: kEmpty
),
564 nsDependentString(aPrintToFileName
? aPrintToFileName
: kEmpty
));
566 if (NS_SUCCEEDED(rv
) && mDeviceContextSpec
)
567 rv
= mDeviceContextSpec
->BeginDocument(aTitle
, aPrintToFileName
, aStartPage
, aEndPage
);
574 nsThebesDeviceContext::EndDocument(void)
578 if (mPrintingSurface
) {
579 rv
= mPrintingSurface
->EndPrinting();
580 if (NS_SUCCEEDED(rv
))
581 mPrintingSurface
->Finish();
584 if (mDeviceContextSpec
)
585 mDeviceContextSpec
->EndDocument();
592 nsThebesDeviceContext::AbortDocument(void)
594 nsresult rv
= mPrintingSurface
->AbortPrinting();
596 if (mDeviceContextSpec
)
597 mDeviceContextSpec
->EndDocument();
604 nsThebesDeviceContext::BeginPage(void)
608 if (mDeviceContextSpec
)
609 rv
= mDeviceContextSpec
->BeginPage();
611 if (NS_FAILED(rv
)) return rv
;
613 /* We need to get a new surface for each page on the Mac */
615 mDeviceContextSpec
->GetSurfaceForPrinter(getter_AddRefs(mPrintingSurface
));
617 rv
= mPrintingSurface
->BeginPage();
623 nsThebesDeviceContext::EndPage(void)
625 nsresult rv
= mPrintingSurface
->EndPage();
627 /* We need to release the CGContextRef in the surface here, plus it's
628 not something you would want anyway, as these CGContextRefs are only good
631 mPrintingSurface
= nsnull
;
634 if (mDeviceContextSpec
)
635 mDeviceContextSpec
->EndPage();
640 /** End printing methods **/
643 nsThebesDeviceContext::ComputeClientRectUsingScreen(nsRect
* outRect
)
645 // we always need to recompute the clientRect
646 // because the window may have moved onto a different screen. In the single
647 // monitor case, we only need to do the computation if we haven't done it
648 // once already, and remember that we have because we're assured it won't change.
649 nsCOMPtr
<nsIScreen
> screen
;
650 FindScreen (getter_AddRefs(screen
));
652 PRInt32 x
, y
, width
, height
;
653 screen
->GetAvailRect(&x
, &y
, &width
, &height
);
655 // convert to device units
656 outRect
->y
= NSIntPixelsToAppUnits(y
, AppUnitsPerDevPixel());
657 outRect
->x
= NSIntPixelsToAppUnits(x
, AppUnitsPerDevPixel());
658 outRect
->width
= NSIntPixelsToAppUnits(width
, AppUnitsPerDevPixel());
659 outRect
->height
= NSIntPixelsToAppUnits(height
, AppUnitsPerDevPixel());
664 nsThebesDeviceContext::ComputeFullAreaUsingScreen(nsRect
* outRect
)
666 // if we have more than one screen, we always need to recompute the clientRect
667 // because the window may have moved onto a different screen. In the single
668 // monitor case, we only need to do the computation if we haven't done it
669 // once already, and remember that we have because we're assured it won't change.
670 nsCOMPtr
<nsIScreen
> screen
;
671 FindScreen ( getter_AddRefs(screen
) );
673 PRInt32 x
, y
, width
, height
;
674 screen
->GetRect ( &x
, &y
, &width
, &height
);
676 // convert to device units
677 outRect
->y
= NSIntPixelsToAppUnits(y
, AppUnitsPerDevPixel());
678 outRect
->x
= NSIntPixelsToAppUnits(x
, AppUnitsPerDevPixel());
679 outRect
->width
= NSIntPixelsToAppUnits(width
, AppUnitsPerDevPixel());
680 outRect
->height
= NSIntPixelsToAppUnits(height
, AppUnitsPerDevPixel());
682 mWidth
= outRect
->width
;
683 mHeight
= outRect
->height
;
692 // Determines which screen intersects the largest area of the given surface.
695 nsThebesDeviceContext::FindScreen(nsIScreen
** outScreen
)
698 mScreenManager
->ScreenForNativeWidget(mWidget
, outScreen
);
700 mScreenManager
->GetPrimaryScreen(outScreen
);
704 nsThebesDeviceContext::CalcPrintingSize()
706 if (!mPrintingSurface
)
709 PRBool inPoints
= PR_TRUE
;
712 switch (mPrintingSurface
->GetType()) {
713 case gfxASurface::SurfaceTypeImage
:
715 size
= reinterpret_cast<gfxImageSurface
*>(mPrintingSurface
.get())->GetSize();
718 #if defined(MOZ_ENABLE_GTK2) || defined(XP_WIN) || defined(XP_OS2)
719 case gfxASurface::SurfaceTypePDF
:
721 size
= reinterpret_cast<gfxPDFSurface
*>(mPrintingSurface
.get())->GetSize();
725 #ifdef MOZ_ENABLE_GTK2
726 case gfxASurface::SurfaceTypePS
:
728 size
= reinterpret_cast<gfxPSSurface
*>(mPrintingSurface
.get())->GetSize();
733 case gfxASurface::SurfaceTypeQuartz
:
734 inPoints
= PR_TRUE
; // this is really only true when we're printing
735 size
= reinterpret_cast<gfxQuartzSurface
*>(mPrintingSurface
.get())->GetSize();
740 case gfxASurface::SurfaceTypeWin32
:
741 case gfxASurface::SurfaceTypeWin32Printing
:
744 HDC dc
= GetPrintHDC();
746 dc
= GetDC((HWND
)mWidget
);
747 size
.width
= NSFloatPixelsToAppUnits(::GetDeviceCaps(dc
, HORZRES
)/mPrintingScale
, AppUnitsPerDevPixel());
748 size
.height
= NSFloatPixelsToAppUnits(::GetDeviceCaps(dc
, VERTRES
)/mPrintingScale
, AppUnitsPerDevPixel());
749 mDepth
= (PRUint32
)::GetDeviceCaps(dc
, BITSPIXEL
);
750 if (dc
!= (HDC
)GetPrintHDC())
751 ReleaseDC((HWND
)mWidget
, dc
);
757 case gfxASurface::SurfaceTypeOS2
:
760 // we already set the size in the surface constructor we set for
761 // printing, so just get those values here
762 size
= reinterpret_cast<gfxOS2Surface
*>(mPrintingSurface
.get())->GetSize();
763 // as they are in pixels we need to scale them to app units
764 size
.width
= NSFloatPixelsToAppUnits(size
.width
, AppUnitsPerDevPixel());
765 size
.height
= NSFloatPixelsToAppUnits(size
.height
, AppUnitsPerDevPixel());
766 // still need to get the depth from the device context
767 HDC dc
= GetPrintHDC();
769 if (DevQueryCaps(dc
, CAPS_COLOR_BITCOUNT
, 1, &value
))
772 mDepth
= 8; // default to 8bpp, should be enough for printers
777 NS_ASSERTION(0, "trying to print to unknown surface type");
781 mWidth
= NSToCoordRound(float(size
.width
) * AppUnitsPerInch() / 72);
782 mHeight
= NSToCoordRound(float(size
.height
) * AppUnitsPerInch() / 72);
784 mWidth
= NSToIntRound(size
.width
);
785 mHeight
= NSToIntRound(size
.height
);
789 PRBool
nsThebesDeviceContext::CheckDPIChange() {
790 PRInt32 oldDevPixels
= mAppUnitsPerDevNotScaledPixel
;
791 PRInt32 oldInches
= mAppUnitsPerInch
;
795 return oldDevPixels
!= mAppUnitsPerDevNotScaledPixel
||
796 oldInches
!= mAppUnitsPerInch
;
800 nsThebesDeviceContext::SetPixelScale(float aScale
)
803 NS_NOTREACHED("Invalid pixel scale value");
806 PRInt32 oldAppUnitsPerDevPixel
= mAppUnitsPerDevPixel
;
807 mPixelScale
= aScale
;
808 UpdateScaledAppUnits();
809 return oldAppUnitsPerDevPixel
!= mAppUnitsPerDevPixel
;
813 nsThebesDeviceContext::UpdateScaledAppUnits()
815 mAppUnitsPerDevPixel
= PR_MAX(1, PRInt32(float(mAppUnitsPerDevNotScaledPixel
) / mPixelScale
));
818 #if defined(XP_WIN) || defined(XP_OS2)
820 nsThebesDeviceContext::GetPrintHDC()
822 if (mPrintingSurface
) {
823 switch (mPrintingSurface
->GetType()) {
825 case gfxASurface::SurfaceTypeWin32
:
826 case gfxASurface::SurfaceTypeWin32Printing
:
827 return reinterpret_cast<gfxWindowsSurface
*>(mPrintingSurface
.get())->GetDC();
831 case gfxASurface::SurfaceTypeOS2
:
832 return GpiQueryDevice(reinterpret_cast<gfxOS2Surface
*>(mPrintingSurface
.get())->GetPS());
836 NS_ASSERTION(0, "invalid surface type in GetPrintHDC");