diff --git a/gfx/src/nsRect.cpp b/gfx/src/nsRect.cpp index b33bfbf1045c..05ae2508c502 100644 --- a/gfx/src/nsRect.cpp +++ b/gfx/src/nsRect.cpp @@ -217,7 +217,7 @@ nsRect& nsRect::ExtendForScaling(float aXMult, float aYMult) NS_ASSERTION((IsFloatInteger(aXMult) || IsFloatInteger(1/aXMult)) && (IsFloatInteger(aYMult) || IsFloatInteger(1/aYMult)), "Multiplication factors must be integers or 1/integer"); - + // Scale rect by multiplier, snap outwards to integers and then unscale. // We round the results to the nearest integer to prevent floating point errors. if (aXMult < 1) { @@ -330,15 +330,14 @@ PRBool nsIntRect::UnionRect(const nsIntRect &aRect1, const nsIntRect &aRect2) return result; } -// scale the rect but round to smallest containing rect -nsIntRect& nsIntRect::ScaleRoundOut(float aXScale, float aYScale) -{ - nscoord right = NSToCoordCeil(float(XMost()) * aXScale); - nscoord bottom = NSToCoordCeil(float(YMost()) * aYScale); - x = NSToCoordFloor(float(x) * aXScale); - y = NSToCoordFloor(float(y) * aYScale); - width = (right - x); - height = (bottom - y); - return *this; +// scale the rect but round to smallest containing rect +nsIntRect& nsIntRect::ScaleRoundOut(float aXScale, float aYScale) +{ + nscoord right = NSToCoordCeil(float(XMost()) * aXScale); + nscoord bottom = NSToCoordCeil(float(YMost()) * aYScale); + x = NSToCoordFloor(float(x) * aXScale); + y = NSToCoordFloor(float(y) * aYScale); + width = (right - x); + height = (bottom - y); + return *this; } -