summaryrefslogtreecommitdiffstats
path: root/src/gui/painting/qpainter.cpp
diff options
context:
space:
mode:
authorTrond Kjernåsen <trond@trolltech.com>2010-03-01 14:28:36 (GMT)
committerTrond Kjernåsen <trond@trolltech.com>2010-03-01 14:28:36 (GMT)
commita76c8424dab298c2fa36226f47bf7ac6f7e4014a (patch)
tree5dd2934be8fff08c77ea7b4be2869dc7905381ee /src/gui/painting/qpainter.cpp
parent6396e7a15079cb157caef319348a0bcd0b95a6a7 (diff)
downloadQt-a76c8424dab298c2fa36226f47bf7ac6f7e4014a.zip
Qt-a76c8424dab298c2fa36226f47bf7ac6f7e4014a.tar.gz
Qt-a76c8424dab298c2fa36226f47bf7ac6f7e4014a.tar.bz2
Fixed qDrawPixmaps() to draw on integer coordinates on Mac OS X.
This is the 4.7 port of d04f5336f769d9e5d2f9105e1da4a7d23ea91795. Task-number: related to QTBUG-8455 Reviewed-by: Kim
Diffstat (limited to 'src/gui/painting/qpainter.cpp')
-rw-r--r--src/gui/painting/qpainter.cpp13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/gui/painting/qpainter.cpp b/src/gui/painting/qpainter.cpp
index dc96c17..9d83718 100644
--- a/src/gui/painting/qpainter.cpp
+++ b/src/gui/painting/qpainter.cpp
@@ -8933,8 +8933,15 @@ void QPainter::drawPixmapFragments(const Fragment *fragments, int fragmentCount,
for (int i = 0; i < fragmentCount; ++i) {
QTransform transform = oldTransform;
- transform.translate(fragments[i].x, fragments[i].y);
- transform.rotate(fragments[i].rotation);
+ qreal xOffset = 0;
+ qreal yOffset = 0;
+ if (fragments[i].rotation == 0) {
+ xOffset = fragments[i].x;
+ yOffset = fragments[i].y;
+ } else {
+ transform.translate(fragments[i].x, fragments[i].y);
+ transform.rotate(fragments[i].rotation);
+ }
setOpacity(oldOpacity * fragments[i].opacity);
setTransform(transform);
@@ -8942,7 +8949,7 @@ void QPainter::drawPixmapFragments(const Fragment *fragments, int fragmentCount,
qreal h = fragments[i].scaleY * fragments[i].height;
QRectF sourceRect(fragments[i].sourceLeft, fragments[i].sourceTop,
fragments[i].width, fragments[i].height);
- drawPixmap(QRectF(-0.5 * w, -0.5 * h, w, h), pixmap, sourceRect);
+ drawPixmap(QRectF(-0.5 * w + xOffset, -0.5 * h + yOffset, w, h), pixmap, sourceRect);
}
setOpacity(oldOpacity);