diff options
author | Samuel Rødal <sroedal@trolltech.com> | 2009-08-18 15:00:34 (GMT) |
---|---|---|
committer | Samuel Rødal <sroedal@trolltech.com> | 2009-09-08 10:18:45 (GMT) |
commit | 4feb4019cfc144cef4cd9177d52e52dee9ebdf32 (patch) | |
tree | bb9bce281070cc4296767fe9d75d0d19458299f5 /src/gui | |
parent | 7413c83bc6ea02e9f159d77d9f71a5c39d9bb0ef (diff) | |
download | Qt-4feb4019cfc144cef4cd9177d52e52dee9ebdf32.zip Qt-4feb4019cfc144cef4cd9177d52e52dee9ebdf32.tar.gz Qt-4feb4019cfc144cef4cd9177d52e52dee9ebdf32.tar.bz2 |
Fixed bug in drawImage() when fall-back code path is used.
We need to floor instead of round to prevent rectangles that are on the
edge from being shifted one pixel down / right.
Task-number: 258776
Reviewed-by: Kim
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/painting/qrasterizer.cpp | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/gui/painting/qrasterizer.cpp b/src/gui/painting/qrasterizer.cpp index fe90221..d514e71 100644 --- a/src/gui/painting/qrasterizer.cpp +++ b/src/gui/painting/qrasterizer.cpp @@ -691,14 +691,14 @@ static inline bool q16Dot16Compare(qreal p1, qreal p2) return FloatToQ16Dot16(p2 - p1) == 0; } -static inline qreal qRoundF(qreal v) +static inline qreal qFloorF(qreal v) { #ifdef QT_USE_MATH_H_FLOATS if (sizeof(qreal) == sizeof(float)) - return floorf(v + 0.5); + return floorf(v); else #endif - return floor(v + 0.5); + return floor(v); } void QRasterizer::rasterizeLine(const QPointF &a, const QPointF &b, qreal width, bool squareCap) @@ -758,10 +758,10 @@ void QRasterizer::rasterizeLine(const QPointF &a, const QPointF &b, qreal width, const qreal reciprocal = 1 / gridResolution; // snap to grid to prevent large slopes - pa.rx() = qRoundF(pa.rx() * gridResolution) * reciprocal; - pa.ry() = qRoundF(pa.ry() * gridResolution) * reciprocal; - pb.rx() = qRoundF(pb.rx() * gridResolution) * reciprocal; - pb.ry() = qRoundF(pb.ry() * gridResolution) * reciprocal; + pa.rx() = qFloorF(pa.rx() * gridResolution) * reciprocal; + pa.ry() = qFloorF(pa.ry() * gridResolution) * reciprocal; + pb.rx() = qFloorF(pb.rx() * gridResolution) * reciprocal; + pb.ry() = qFloorF(pb.ry() * gridResolution) * reciprocal; // old delta const QPointF d0 = a - b; |