diff options
author | Julien Brianceau <jbrianceau@nds.com> | 2012-08-29 14:35:33 (GMT) |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-09-03 15:07:48 (GMT) |
commit | 3764c0ff08b2d427dd134343a23dabdf3edbbadc (patch) | |
tree | 68a2b3088d8d44ece679cd1c2bb0f22ecabb3e04 /src/gui/painting | |
parent | d8cc750c58d6e710c821868a2456c2b0a8b0dbbc (diff) | |
download | Qt-3764c0ff08b2d427dd134343a23dabdf3edbbadc.zip Qt-3764c0ff08b2d427dd134343a23dabdf3edbbadc.tar.gz Qt-3764c0ff08b2d427dd134343a23dabdf3edbbadc.tar.bz2 |
qpa: incorrect rendering when stretching and clipping
When using QBlittable with SourceOverScaledPixmapCapability, rendering
through clipAndDrawPixmap is incorrect when stretching: source pixmap
rectangle has to be corrected using scaling factor.
Change-Id: I80ad1c5ddc73a7b7394d0f5b412931c6279c175a
Reviewed-by: Jørgen Lind <jorgen.lind@nokia.com>
Diffstat (limited to 'src/gui/painting')
-rw-r--r-- | src/gui/painting/qpaintengine_blitter.cpp | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/src/gui/painting/qpaintengine_blitter.cpp b/src/gui/painting/qpaintengine_blitter.cpp index c2cab0c..d4eb619 100644 --- a/src/gui/painting/qpaintengine_blitter.cpp +++ b/src/gui/painting/qpaintengine_blitter.cpp @@ -330,11 +330,23 @@ void QBlitterPaintEnginePrivate::clipAndDrawPixmap(const QRectF &clip, const QRe return; QRectF source = sr; if (intersectedRect.size() != target.size()) { - qreal deltaTop = target.top() - intersectedRect.top(); - qreal deltaLeft = target.left() - intersectedRect.left(); - qreal deltaBottom = target.bottom() - intersectedRect.bottom(); - qreal deltaRight = target.right() - intersectedRect.right(); - source.adjust(-deltaLeft, -deltaTop, -deltaRight, -deltaBottom); + if (sr.size() == target.size()) { + // no resize + qreal deltaTop = target.top() - intersectedRect.top(); + qreal deltaLeft = target.left() - intersectedRect.left(); + qreal deltaBottom = target.bottom() - intersectedRect.bottom(); + qreal deltaRight = target.right() - intersectedRect.right(); + source.adjust(-deltaLeft, -deltaTop, -deltaRight, -deltaBottom); + } else { + // resize case + qreal hFactor = sr.size().width() / target.size().width(); + qreal vFactor = sr.size().height() / target.size().height(); + qreal deltaTop = (target.top() - intersectedRect.top()) * vFactor; + qreal deltaLeft = (target.left() - intersectedRect.left()) * hFactor; + qreal deltaBottom = (target.bottom() - intersectedRect.bottom()) * vFactor; + qreal deltaRight = (target.right() - intersectedRect.right()) * hFactor; + source.adjust(-deltaLeft, -deltaTop, -deltaRight, -deltaBottom); + } } pmData->unmarkRasterOverlay(intersectedRect); pmData->blittable()->drawPixmap(intersectedRect, pm, source); |