From 692211670b377014c4dcf7b6819723bbeb2ffa66 Mon Sep 17 00:00:00 2001 From: Jens Bache-Wiig Date: Mon, 18 Nov 2013 16:20:34 +0100 Subject: Fix retina rendering issues with Qt Quick Controls We need to scale the texture size since it has twice the pixel count on retina macs. Task-number: QTBUG-34922 Change-Id: I38ff316016ccb1e609037598f7107d62b3ba4295 Reviewed-by: Gunnar Sletta --- src/controls/Private/qquickstyleitem.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/controls/Private/qquickstyleitem.cpp b/src/controls/Private/qquickstyleitem.cpp index a14a22d1..566a46f8 100644 --- a/src/controls/Private/qquickstyleitem.cpp +++ b/src/controls/Private/qquickstyleitem.cpp @@ -112,7 +112,7 @@ public: } void initialize(QSGTexture *texture, - const QRectF &bounds, + const QRectF &bounds, qreal devicePixelRatio, int left, int top, int right, int bottom) { delete m_material.texture(); @@ -127,6 +127,9 @@ public: QRectF tc = texture->normalizedTextureSubRect(); QSize ts = texture->textureSize(); + ts.setHeight(ts.height() / devicePixelRatio); + ts.setWidth(ts.width() / devicePixelRatio); + qreal invtw = tc.width() / ts.width(); qreal invth = tc.height() / ts.height(); @@ -1661,6 +1664,7 @@ QSGNode *QQuickStyleItem::updatePaintNode(QSGNode *node, UpdatePaintNodeData *) styleNode->initialize(window()->createTextureFromImage(m_image, QQuickWindow::TextureCanUseAtlas), boundingRect(), + window()->devicePixelRatio(), m_border.left(), m_border.top(), m_border.right(), m_border.bottom()); return styleNode; } -- cgit v1.2.1