aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick/items/qquickimage.cpp
diff options
context:
space:
mode:
authorJ-P Nurmi <jpnurmi@theqtcompany.com>2016-03-22 10:46:10 +0100
committerSimon Hausmann <simon.hausmann@theqtcompany.com>2016-03-24 19:40:28 +0000
commitfe10cee6265f068bf0da03895c0c7c5680dc36a5 (patch)
tree6408fc2204e324a3ad517e03e98f553cd540af97 /src/quick/items/qquickimage.cpp
parentfcbe8ba3fafd1f30f08e1e7e694eee4dcb32e1a1 (diff)
Fix Image.Pad on high DPI
Take device pixel ratio into account (pixWidth and pixHeight are scaled) while calculating source and target rects for QQuickImage::Pad. Change-Id: I4a8b4fc305d0af93921bca900c683927d6bfd0e3 Task-number: QTBUG-52043 Reviewed-by: Mitch Curtis <mitch.curtis@theqtcompany.com> Reviewed-by: Robin Burchell <robin.burchell@viroteck.net>
Diffstat (limited to 'src/quick/items/qquickimage.cpp')
-rw-r--r--src/quick/items/qquickimage.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/quick/items/qquickimage.cpp b/src/quick/items/qquickimage.cpp
index 20f4551af9..1e28af03c6 100644
--- a/src/quick/items/qquickimage.cpp
+++ b/src/quick/items/qquickimage.cpp
@@ -691,17 +691,17 @@ QSGNode *QQuickImage::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *)
break;
case Pad:
- qreal w = qMin(qreal(d->pix.width()), width());
- qreal h = qMin(qreal(d->pix.height()), height());
- qreal x = (d->pix.width() > width()) ? -xOffset : 0;
- qreal y = (d->pix.height() > height()) ? -yOffset : 0;
+ qreal w = qMin(qreal(pixWidth), width());
+ qreal h = qMin(qreal(pixHeight), height());
+ qreal x = (pixWidth > width()) ? -xOffset : 0;
+ qreal y = (pixHeight > height()) ? -yOffset : 0;
targetRect = QRectF(x + xOffset, y + yOffset, w, h);
sourceRect = QRectF(x, y, w, h);
break;
};
- qreal nsWidth = (hWrap == QSGTexture::Repeat) ? d->pix.width() / d->devicePixelRatio : d->pix.width();
- qreal nsHeight = (vWrap == QSGTexture::Repeat) ? d->pix.height() / d->devicePixelRatio : d->pix.height();
+ qreal nsWidth = (hWrap == QSGTexture::Repeat || d->fillMode == Pad) ? d->pix.width() / d->devicePixelRatio : d->pix.width();
+ qreal nsHeight = (vWrap == QSGTexture::Repeat || d->fillMode == Pad) ? d->pix.height() / d->devicePixelRatio : d->pix.height();
QRectF nsrect(sourceRect.x() / nsWidth,
sourceRect.y() / nsHeight,
sourceRect.width() / nsWidth,