From 06fa33ccb8f4304ed84ecaf2af6f3ffaa84c067a Mon Sep 17 00:00:00 2001 From: "mkaply%us.ibm.com" Date: Fri, 26 Jan 2001 00:48:05 +0000 Subject: [PATCH] #61253 r=jkobal, a=blizzard Printing shouldn't be resolution dependent --- gfx/src/os2/nsDeviceContextOS2.cpp | 14 ++++++++++---- gfx/src/os2/nsDeviceContextOS2.h | 1 + 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/gfx/src/os2/nsDeviceContextOS2.cpp b/gfx/src/os2/nsDeviceContextOS2.cpp index e2c5fd7ba09f..955e4489903e 100644 --- a/gfx/src/os2/nsDeviceContextOS2.cpp +++ b/gfx/src/os2/nsDeviceContextOS2.cpp @@ -64,6 +64,7 @@ nsDeviceContextOS2 :: nsDeviceContextOS2() mCachedClientRect = PR_FALSE; mCachedFullRect = PR_FALSE; mSupportsRasterFonts = PR_FALSE; + mPelsPerMeter = 0; #ifdef XP_OS2 mPrintState = nsPrintState_ePreBeginDoc; #endif @@ -121,7 +122,7 @@ nsresult nsDeviceContextOS2::Init( nsNativeWidget aWidget) nsresult nsDeviceContextOS2::Init( nsNativeDeviceContext aContext, nsIDeviceContext *aOrigContext) { - float origscale, newscale; +// float origscale, newscale; float t2d, a2d; mPrintDC = (HDC)aContext; @@ -141,10 +142,13 @@ nsresult nsDeviceContextOS2::Init( nsNativeDeviceContext aContext, CommonInit( mPrintDC); - GetTwipsToDevUnits( newscale); - aOrigContext->GetTwipsToDevUnits( origscale); +// GetTwipsToDevUnits( newscale); +// aOrigContext->GetTwipsToDevUnits( origscale); - mPixelScale = newscale / origscale; +// mPixelScale = newscale / origscale; + + mPixelScale = (float)mPelsPerMeter / 3622.0f; /* This is ugly - it prevents different size printing on different */ + /* Resolutions */ aOrigContext->GetTwipsToDevUnits( t2d); aOrigContext->GetAppUnitsToDevUnits( a2d); @@ -182,6 +186,8 @@ void nsDeviceContextOS2 :: CommonInit(HDC aDC) mPixelsToTwips = 1.0f / mTwipsToPixels; + mPelsPerMeter = alArray[CAPS_VERTICAL_RESOLUTION]; + mDepth = alArray[CAPS_COLOR_BITCOUNT]; mPaletteInfo.isPaletteDevice = !!(alArray[CAPS_ADDITIONAL_GRAPHICS] & CAPS_PALETTE_MANAGER); diff --git a/gfx/src/os2/nsDeviceContextOS2.h b/gfx/src/os2/nsDeviceContextOS2.h index d671351ce39d..56ff63828956 100644 --- a/gfx/src/os2/nsDeviceContextOS2.h +++ b/gfx/src/os2/nsDeviceContextOS2.h @@ -98,6 +98,7 @@ protected: nsRect mClientRect; nsIDeviceContextSpec *mSpec; PRBool mSupportsRasterFonts; + PRUint32 mPelsPerMeter; nsCOMPtr mScreenManager; static PRUint32 sNumberOfScreens;