From aa755e9e763fd8106e333bed98dd97d85339a2d0 Mon Sep 17 00:00:00 2001 From: "pinkerton%netscape.com" Date: Fri, 10 Feb 2006 22:49:17 +0000 Subject: [PATCH] ensure that mPixelsToTwips is always integral. r=dbaron/sr=sfraser/a=asa. bug#120779 --- widget/src/mac/nsDeviceContextMac.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/widget/src/mac/nsDeviceContextMac.cpp b/widget/src/mac/nsDeviceContextMac.cpp index 605f321b4e0..b7f3306911b 100644 --- a/widget/src/mac/nsDeviceContextMac.cpp +++ b/widget/src/mac/nsDeviceContextMac.cpp @@ -109,10 +109,11 @@ NS_IMETHODIMP nsDeviceContextMac :: Init(nsNativeWidget aNativeWidget) if ( !sNumberOfScreens ) mScreenManager->GetNumberOfScreens(&sNumberOfScreens); - // get resolution + // get resolution. Ensure that mPixelsToTwips is integral or we + // run into serious rounding problems. double pix_inch = GetScreenResolution(); //Fix2X((**thepix).hRes); - mTwipsToPixels = pix_inch/(float)NSIntPointsToTwips(72); - mPixelsToTwips = 1.0f/mTwipsToPixels; + mPixelsToTwips = nscoord(NSIntPointsToTwips(72)/(float)pix_inch); + mTwipsToPixels = 1.0f/mPixelsToTwips; return DeviceContextImpl::Init(aNativeWidget); }