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 <sergio.ahumada@nokia.com>
Reviewed-by: Julien BRIANCEAU <jbrianceau@nds.com>
Reviewed-by: Jørgen Lind <jorgen.lind@nokia.com>
This commit is contained in:
Julien 2012-08-30 09:21:01 +02:00 committed by Qt by Nokia
parent ec57b20b65
commit a36efc37a1

View File

@ -333,11 +333,23 @@ void QBlitterPaintEnginePrivate::clipAndDrawPixmap(const QRectF &clip,
return; return;
QRectF source = sr; QRectF source = sr;
if (intersectedRect.size() != target.size()) { if (intersectedRect.size() != target.size()) {
qreal deltaTop = target.top() - intersectedRect.top(); if (sr.size() == target.size()) {
qreal deltaLeft = target.left() - intersectedRect.left(); // no resize
qreal deltaBottom = target.bottom() - intersectedRect.bottom(); qreal deltaTop = target.top() - intersectedRect.top();
qreal deltaRight = target.right() - intersectedRect.right(); qreal deltaLeft = target.left() - intersectedRect.left();
source.adjust(-deltaLeft, -deltaTop, -deltaRight, -deltaBottom); 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->unmarkRasterOverlay(intersectedRect);
pmData->blittable()->drawPixmap(intersectedRect, pm, source); pmData->blittable()->drawPixmap(intersectedRect, pm, source);