diff options
author | Samuel Rødal <sroedal@trolltech.com> | 2009-05-07 11:12:39 (GMT) |
---|---|---|
committer | Samuel Rødal <sroedal@trolltech.com> | 2009-05-07 11:25:48 (GMT) |
commit | 20d88b4d390e2e11079f62ab9f472c30f7c5b11d (patch) | |
tree | afd34f0369b76b5d25572f5f42bd7600d9ab12fc /src/gui | |
parent | 27aae6a5bb4858897547f2f436bc1cdf2e8bfbd4 (diff) | |
download | Qt-20d88b4d390e2e11079f62ab9f472c30f7c5b11d.zip Qt-20d88b4d390e2e11079f62ab9f472c30f7c5b11d.tar.gz Qt-20d88b4d390e2e11079f62ab9f472c30f7c5b11d.tar.bz2 |
Fixed some inconsistencies for image drawing on non-integer coords.
The fix for 1x1 source rect image drawing in change
ffbb3c1a2aee4134dce80cd144a26bf32865b698 was incorrect for transforms
with type >= TxScale. The aliased coordinate delta needs to be applied
in device coordinates, not in logical coordinates.
Also specialize the non-antialiased TxScale case by simply calling
fillRect_normalized directly, avoiding having to scan convert the
rectangle manually.
Task-number: 251561
Reviewed-by: Trond
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/painting/qpaintengine_raster.cpp | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/src/gui/painting/qpaintengine_raster.cpp b/src/gui/painting/qpaintengine_raster.cpp index cbfd5e3..847904b 100644 --- a/src/gui/painting/qpaintengine_raster.cpp +++ b/src/gui/painting/qpaintengine_raster.cpp @@ -2575,9 +2575,10 @@ void QRasterPaintEngine::drawImage(const QRectF &r, const QImage &img, const QRe if (!aa && sr.size() == QSize(1, 1)) { // as fillRect will apply the aliased coordinate delta we need to // subtract it here as we don't use it for image drawing - const QRectF targetRect = r.translated(-aliasedCoordinateDelta, - -aliasedCoordinateDelta); - fillRect(targetRect, QColor::fromRgba(img.pixel(sr.x(), sr.y()))); + QTransform old = s->matrix; + s->matrix = s->matrix * QTransform::fromTranslate(-aliasedCoordinateDelta, -aliasedCoordinateDelta); + fillRect(r, QColor::fromRgba(img.pixel(sr.x(), sr.y()))); + s->matrix = old; return; } @@ -2611,6 +2612,18 @@ void QRasterPaintEngine::drawImage(const QRectF &r, const QImage &img, const QRe return; d->image_filler_xform.setupMatrix(copy, s->flags.bilinear); + if (!aa && s->matrix.type() == QTransform::TxScale) { + QRectF rr = s->matrix.mapRect(r); + + const int x1 = qRound(rr.x()); + const int y1 = qRound(rr.y()); + const int x2 = qRound(rr.right()); + const int y2 = qRound(rr.bottom()); + + fillRect_normalized(QRect(x1, y1, x2-x1, y2-y1), &d->image_filler_xform, d); + return; + } + #ifdef QT_FAST_SPANS ensureState(); if (s->flags.tx_noshear || s->matrix.type() == QTransform::TxScale) { |