From 919ed46ccf619599f370e12fe7d2ee309ed6e357 Mon Sep 17 00:00:00 2001 From: "mkaply%us.ibm.com" Date: Tue, 2 Sep 2003 21:21:53 +0000 Subject: [PATCH] #190255 r=pedemonte, sr=blizzard (platform specific), a=mkaply OS/2 only - occasional pixel error when scrolling --- gfx/src/os2/nsDeviceContextOS2.cpp | 22 +++++++--------------- 1 file changed, 7 insertions(+), 15 deletions(-) diff --git a/gfx/src/os2/nsDeviceContextOS2.cpp b/gfx/src/os2/nsDeviceContextOS2.cpp index 31e4456b837c..7aa4ecf0fd69 100644 --- a/gfx/src/os2/nsDeviceContextOS2.cpp +++ b/gfx/src/os2/nsDeviceContextOS2.cpp @@ -151,16 +151,10 @@ nsresult nsDeviceContextOS2::Init( nsNativeDeviceContext aContext, long dpi; GFX (::DevQueryCaps(mPrintDC, CAPS_VERTICAL_FONT_RES, 1, &dpi), FALSE); - int pt2t = 72; - - // make p2t a nice round number - this prevents rounding problems -// mPixelsToTwips = float(NSToIntRound(float(NSIntPointsToTwips(pt2t)) / float(dpi))); -// mTwipsToPixels = 1.0f / mPixelsToTwips; - mTwipsToPixels = ((float)dpi) / (float)NSIntPointsToTwips(72); - mPixelsToTwips = 1.0f / mTwipsToPixels; - - GetTwipsToDevUnits( newscale); + mPixelsToTwips = NSToIntRound((float)NSIntPointsToTwips(72) / ((float)dpi)); + mTwipsToPixels = 1.0 / mPixelsToTwips; + GetTwipsToDevUnits(newscale); // On OS/2, origscale can be different based on the video resolution. // On 640x480, it's 1/15, on everything else it is 1/12. // For consistent printing, 1/15 is the correct value to use. @@ -170,8 +164,8 @@ nsresult nsDeviceContextOS2::Init( nsNativeDeviceContext aContext, mCPixelScale = newscale / origscale; - aOrigContext->GetTwipsToDevUnits( t2d); - aOrigContext->GetAppUnitsToDevUnits( a2d); + aOrigContext->GetTwipsToDevUnits(t2d); + aOrigContext->GetAppUnitsToDevUnits(a2d); mAppUnitsToDevUnits = (a2d / t2d) * mTwipsToPixels; mDevUnitsToAppUnits = 1.0f / mAppUnitsToDevUnits; @@ -605,10 +599,8 @@ nsDeviceContextOS2::SetDPI(PRInt32 aPrefDPI) int pt2t = 72; // make p2t a nice round number - this prevents rounding problems -// mPixelsToTwips = float(NSToIntRound(float(NSIntPointsToTwips(pt2t)) / float(mDpi))); -// mTwipsToPixels = 1.0f / mPixelsToTwips; - mTwipsToPixels = ((float)mDpi) / (float)NSIntPointsToTwips(72); - mPixelsToTwips = 1.0f / mTwipsToPixels; + mPixelsToTwips = float(NSToIntRound(float(NSIntPointsToTwips(pt2t)) / float(mDpi))); + mTwipsToPixels = 1.0f / mPixelsToTwips; // XXX need to reflow all documents return NS_OK;