Bug 410748 Control borders are not drawn correctly r+sr+a=roc

This commit is contained in:
masayuki%d-toybox.com 2008-01-12 17:30:28 +00:00
Родитель ceb0d68286
Коммит e0562335f6
3 изменённых файлов: 20 добавлений и 9 удалений

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

@ -141,9 +141,14 @@ struct THEBES_API gfxPoint {
gfxPoint operator/(const gfxFloat v) const {
return gfxPoint(x / v, y / v);
}
// Round() is *not* rounding to nearest integer if the values are negative.
// They are always rounding as floor(n + 0.5).
// See https://bugzilla.mozilla.org/show_bug.cgi?id=410748#c14
// And if you need similar method which is using NS_round(), you should
// create new |RoundAwayFromZero()| method.
gfxPoint& Round() {
x = NS_round(x);
y = NS_round(y);
x = NS_floor(x + 0.5);
y = NS_floor(y + 0.5);
return *this;
}
};

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

@ -115,10 +115,15 @@ struct THEBES_API gfxRect {
Outset(sides[0], sides[1], sides[2], sides[3]);
}
// Round the rectangle to integer coordinates; rounds to the neearest
// pixel centers. Suitable for most places where integral device coordinates
// Round the rectangle to integer coordinates.
// Suitable for most places where integral device coordinates
// are needed, but note that any translation should be applied first to
// avoid pixel rounding errors
// avoid pixel rounding errors.
// Note that this is *not* rounding to nearest integer if the values are negative.
// They are always rounding as floor(n + 0.5).
// See https://bugzilla.mozilla.org/show_bug.cgi?id=410748#c14
// If you need similar method which is using NS_round(), you should create
// new |RoundAwayFromZero()| method.
void Round();
// grabbing specific points

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

@ -76,10 +76,11 @@ gfxRect::Union(const gfxRect& aRect) const
void
gfxRect::Round()
{
gfxFloat x0 = NS_round(X());
gfxFloat y0 = NS_round(Y());
gfxFloat x1 = NS_round(XMost());
gfxFloat y1 = NS_round(YMost());
// Note that don't use NS_round here. See the comment for this method in gfxRect.h
gfxFloat x0 = NS_floor(X() + 0.5);
gfxFloat y0 = NS_floor(Y() + 0.5);
gfxFloat x1 = NS_floor(XMost() + 0.5);
gfxFloat y1 = NS_floor(YMost() + 0.5);
pos.x = x0;
pos.y = y0;