From f371e6bf46d76a003b4351094acca37630100449 Mon Sep 17 00:00:00 2001 From: "roc+%cs.cmu.edu" Date: Sat, 6 Sep 2003 17:28:42 +0000 Subject: [PATCH] Bug 211092. Don't force pixel->twip ratio to be an integer for print devices. r+sr=dbaron,a=asa git-svn-id: svn://10.0.0.236/trunk@146599 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/gfx/src/windows/nsDeviceContextWin.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/mozilla/gfx/src/windows/nsDeviceContextWin.cpp b/mozilla/gfx/src/windows/nsDeviceContextWin.cpp index 8f38f2328fa..ee4e27feffc 100644 --- a/mozilla/gfx/src/windows/nsDeviceContextWin.cpp +++ b/mozilla/gfx/src/windows/nsDeviceContextWin.cpp @@ -167,9 +167,6 @@ void nsDeviceContextWin :: CommonInit(HDC aDC) { int rasterCaps = ::GetDeviceCaps(aDC, RASTERCAPS); - mPixelsToTwips = NSToIntRound((float)NSIntPointsToTwips(72) / ((float)::GetDeviceCaps(aDC, LOGPIXELSY))); - mTwipsToPixels = 1.0 / mPixelsToTwips; - mDepth = (PRUint32)::GetDeviceCaps(aDC, BITSPIXEL); mPaletteInfo.isPaletteDevice = RC_PALETTE == (rasterCaps & RC_PALETTE); mPaletteInfo.sizePalette = (PRUint16)::GetDeviceCaps(aDC, SIZEPALETTE); @@ -178,8 +175,12 @@ void nsDeviceContextWin :: CommonInit(HDC aDC) mWidth = ::GetDeviceCaps(aDC, HORZRES); mHeight = ::GetDeviceCaps(aDC, VERTRES); + mPixelsToTwips = (float)NSIntPointsToTwips(72) / ((float)::GetDeviceCaps(aDC, LOGPIXELSY)); if (::GetDeviceCaps(aDC, TECHNOLOGY) == DT_RASDISPLAY) { + // Ensure that, for screens, pixels-to-twips is an integer + mPixelsToTwips = NSToIntRound(mPixelsToTwips); + // init the screen manager and compute our client rect based on the // screen objects. We'll save the result nsresult ignore; @@ -187,6 +188,7 @@ void nsDeviceContextWin :: CommonInit(HDC aDC) if ( !sNumberOfScreens ) mScreenManager->GetNumberOfScreens(&sNumberOfScreens); } // if this dc is not a print device + mTwipsToPixels = 1.0 / mPixelsToTwips; DeviceContextImpl::CommonInit(); }