Bug 382595: Lines across embedded svg when scrolling. Followup rounding fix. r+sr=roc

This commit is contained in:
sharparrow1@yahoo.com 2007-07-08 22:04:01 -07:00
Родитель 4383f3d7e9
Коммит 0b4640e466
3 изменённых файлов: 9 добавлений и 9 удалений

Просмотреть файл

@ -165,9 +165,9 @@ struct NS_GFX nsRect {
// Scale by aScale, converting coordinates to integers so that the result
// is the larges integer-coordinate rectangle contained in the unrounded result
nsRect& ScaleRoundIn(float aScale);
// Scale by aScale, converting coordinates to integers so that the result
// contains the same pixel centers as the unrounded result
nsRect& ScaleRoundPreservingCenters(float aScale);
// Scale by the inverse of aScale, converting coordinates to integers so that
// the result contains the same pixel centers as the unrounded result
nsRect& ScaleRoundPreservingCentersInverse(float aScale);
// Helpers for accessing the vertices
nsPoint TopLeft() const { return nsPoint(x, y); }

Просмотреть файл

@ -204,12 +204,12 @@ nsRect& nsRect::ScaleRoundIn(float aScale)
return *this;
}
nsRect& nsRect::ScaleRoundPreservingCenters(float aScale)
nsRect& nsRect::ScaleRoundPreservingCentersInverse(float aScale)
{
nscoord right = NSToCoordRound(float(XMost()) * aScale);
nscoord bottom = NSToCoordRound(float(YMost()) * aScale);
x = NSToCoordRound(float(x) * aScale);
y = NSToCoordRound(float(y) * aScale);
nscoord right = NSToCoordRound(float(XMost()) / aScale);
nscoord bottom = NSToCoordRound(float(YMost()) / aScale);
x = NSToCoordRound(float(x) / aScale);
y = NSToCoordRound(float(y) / aScale);
width = (right - x);
height = (bottom - y);
return *this;

Просмотреть файл

@ -358,7 +358,7 @@ nsRect nsView::CalcWidgetBounds(nsWindowType aType)
}
nsRect newBounds(viewBounds);
newBounds.ScaleRoundPreservingCenters(1.0f / p2a);
newBounds.ScaleRoundPreservingCentersInverse(p2a);
nsPoint roundedOffset(NSIntPixelsToAppUnits(newBounds.x, p2a),
NSIntPixelsToAppUnits(newBounds.y, p2a));