From: Julien Date: Thu, 30 Aug 2012 07:21:01 +0000 (+0200) Subject: qpa: incorrect rendering when stretching and clipping X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=a36efc37a1941a4b4cb239fa2ca0bc12ab7569ec;p=profile%2Fivi%2Fqtbase.git 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: I7026987f5c47094a4578c0da4ccb67a0241d64bd Reviewed-by: Sergio Ahumada Reviewed-by: Julien BRIANCEAU Reviewed-by: Jørgen Lind --- diff --git a/src/gui/painting/qpaintengine_blitter.cpp b/src/gui/painting/qpaintengine_blitter.cpp index ed087d8..d4e0a59 100644 --- a/src/gui/painting/qpaintengine_blitter.cpp +++ b/src/gui/painting/qpaintengine_blitter.cpp @@ -333,11 +333,23 @@ void QBlitterPaintEnginePrivate::clipAndDrawPixmap(const QRectF &clip, 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);