summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTrond Kjernåsen <trond@trolltech.com>2010-03-01 14:08:26 (GMT)
committerTrond Kjernåsen <trond@trolltech.com>2010-03-01 14:16:39 (GMT)
commitd04f5336f769d9e5d2f9105e1da4a7d23ea91795 (patch)
tree5f9b296ffbce83b916502072ede069842dd7a527
parent5255c09fceddf5a1b79c6016f51c0d721c599c9b (diff)
downloadQt-d04f5336f769d9e5d2f9105e1da4a7d23ea91795.zip
Qt-d04f5336f769d9e5d2f9105e1da4a7d23ea91795.tar.gz
Qt-d04f5336f769d9e5d2f9105e1da4a7d23ea91795.tar.bz2
Fixed qDrawPixmaps() to draw on integer coordinates on Mac OS X.
For some reason, doing a QPainter::translate(-0.5, 0) and then QPainter::drawPixmap(0.5, 0, ...) doesn't result in a zero transformation on Mac OS X. This is a workaround where we calculate the device coords ourselves if it's only a simple translate operation. Task-number: QTBUG-8455 Reviewed-by: Kim
-rw-r--r--src/gui/painting/qdrawutil.cpp15
1 files changed, 11 insertions, 4 deletions
diff --git a/src/gui/painting/qdrawutil.cpp b/src/gui/painting/qdrawutil.cpp
index 5619a2e..35bf2bf 100644
--- a/src/gui/painting/qdrawutil.cpp
+++ b/src/gui/painting/qdrawutil.cpp
@@ -1361,14 +1361,21 @@ void qDrawPixmaps(QPainter *painter, const QDrawPixmaps::Data *drawingData, int
for (int i = 0; i < dataCount; ++i) {
QTransform transform = oldTransform;
- transform.translate(drawingData[i].point.x(), drawingData[i].point.y());
- transform.rotate(drawingData[i].rotation);
- painter->setOpacity(oldOpacity * drawingData[i].opacity);
+ qreal xOffset = 0;
+ qreal yOffset = 0;
+ if (drawingData[i].rotation == 0) {
+ xOffset = drawingData[i].point.x();
+ yOffset = drawingData[i].point.y();
+ } else {
+ transform.translate(drawingData[i].point.x(), drawingData[i].point.y());
+ transform.rotate(drawingData[i].rotation);
+ }
painter->setTransform(transform);
+ painter->setOpacity(oldOpacity * drawingData[i].opacity);
qreal w = drawingData[i].scaleX * drawingData[i].source.width();
qreal h = drawingData[i].scaleY * drawingData[i].source.height();
- painter->drawPixmap(QRectF(-0.5 * w, -0.5 * h, w, h), pixmap, drawingData[i].source);
+ painter->drawPixmap(QRectF(-0.5 * w + xOffset, -0.5 * h + yOffset, w, h), pixmap, drawingData[i].source);
}
painter->setOpacity(oldOpacity);