зеркало из https://github.com/mozilla/pjs.git
Bug 410748 Control borders are not drawn correctly r+sr+a=roc
This commit is contained in:
Родитель
ceb0d68286
Коммит
e0562335f6
|
@ -141,9 +141,14 @@ struct THEBES_API gfxPoint {
|
||||||
gfxPoint operator/(const gfxFloat v) const {
|
gfxPoint operator/(const gfxFloat v) const {
|
||||||
return gfxPoint(x / v, y / v);
|
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() {
|
gfxPoint& Round() {
|
||||||
x = NS_round(x);
|
x = NS_floor(x + 0.5);
|
||||||
y = NS_round(y);
|
y = NS_floor(y + 0.5);
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -115,10 +115,15 @@ struct THEBES_API gfxRect {
|
||||||
Outset(sides[0], sides[1], sides[2], sides[3]);
|
Outset(sides[0], sides[1], sides[2], sides[3]);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Round the rectangle to integer coordinates; rounds to the neearest
|
// Round the rectangle to integer coordinates.
|
||||||
// pixel centers. Suitable for most places where integral device coordinates
|
// Suitable for most places where integral device coordinates
|
||||||
// are needed, but note that any translation should be applied first to
|
// 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();
|
void Round();
|
||||||
|
|
||||||
// grabbing specific points
|
// grabbing specific points
|
||||||
|
|
|
@ -76,10 +76,11 @@ gfxRect::Union(const gfxRect& aRect) const
|
||||||
void
|
void
|
||||||
gfxRect::Round()
|
gfxRect::Round()
|
||||||
{
|
{
|
||||||
gfxFloat x0 = NS_round(X());
|
// Note that don't use NS_round here. See the comment for this method in gfxRect.h
|
||||||
gfxFloat y0 = NS_round(Y());
|
gfxFloat x0 = NS_floor(X() + 0.5);
|
||||||
gfxFloat x1 = NS_round(XMost());
|
gfxFloat y0 = NS_floor(Y() + 0.5);
|
||||||
gfxFloat y1 = NS_round(YMost());
|
gfxFloat x1 = NS_floor(XMost() + 0.5);
|
||||||
|
gfxFloat y1 = NS_floor(YMost() + 0.5);
|
||||||
|
|
||||||
pos.x = x0;
|
pos.x = x0;
|
||||||
pos.y = y0;
|
pos.y = y0;
|
||||||
|
|
Загрузка…
Ссылка в новой задаче