Skip to content
This repository has been archived by the owner on Aug 4, 2022. It is now read-only.

Commit

Permalink
Fix partial DOS line endings in nsRect.cpp, rs=khuey, no bug
Browse files Browse the repository at this point in the history
  • Loading branch information
zackw committed Apr 13, 2011
1 parent 8eae2aa commit 55b36c5
Showing 1 changed file with 11 additions and 12 deletions.
23 changes: 11 additions & 12 deletions gfx/src/nsRect.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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;
}

0 comments on commit 55b36c5

Please sign in to comment.