From af7e2ecd6197569c36a9d4a80bb4bb0920e4ab08 Mon Sep 17 00:00:00 2001 From: "sspitzer%netscape.com" Date: Wed, 26 Mar 2003 19:02:12 +0000 Subject: [PATCH] fix for blocker bug #199159 chrome not repainting, off by one errors in painting. a rounding problem in ConvertNativeRegionToAppRegion() thanks to roc for the fix. rs=sspitzer, a=loanpham git-svn-id: svn://10.0.0.236/trunk@140354 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/view/src/nsViewManager.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/mozilla/view/src/nsViewManager.cpp b/mozilla/view/src/nsViewManager.cpp index 3e1870bfa31..d8a22f3e64c 100644 --- a/mozilla/view/src/nsViewManager.cpp +++ b/mozilla/view/src/nsViewManager.cpp @@ -637,12 +637,15 @@ static void ConvertNativeRegionToAppRegion(nsIRegion* aIn, nsRegion* aOut, float p2t; context->GetDevUnitsToAppUnits(p2t); + // roc says: + // we mustn't introduce any off by one errors here, so stick to integer arithmetic + // this assumes that p2t is an integer, but if it isn't, all kinds of other stuff breaks anyway + int pt2i = (int)floor(p2t+0.5); PRUint32 i; for (i = 0; i < rects->mNumRects; i++) { const nsRegionRect& inR = rects->mRects[i]; - nsRect outR(inR.x, inR.y, inR.width, inR.height); - outR.ScaleRoundOut(p2t); + nsRect outR(inR.x*pt2i, inR.y*pt2i, inR.width*pt2i, inR.height*pt2i); aOut->Or(*aOut, outR); }