diff options
author | J-P Nurmi <jpnurmi@theqtcompany.com> | 2015-12-17 15:54:33 +0100 |
---|---|---|
committer | J-P Nurmi <jpnurmi@theqtcompany.com> | 2015-12-17 15:19:29 +0000 |
commit | 883b10ada42924b179a95eb4d9096c1018867e26 (patch) | |
tree | 71e719a1b637d2c9d504a09afaf6a7cbc953454a /src/controls | |
parent | 087b1029cbe301aca0ae52e1a7ddce0deacea1d8 (diff) |
QQuickPaddedRectangle: fix antialiasing issues
Use a transformation node to set the position of the rectangle node.
Change-Id: Ic9d8f03d0921236556d363cc66ff2fe66ce296e4
Reviewed-by: J-P Nurmi <jpnurmi@theqtcompany.com>
Diffstat (limited to 'src/controls')
-rw-r--r-- | src/controls/qquickpaddedrectangle.cpp | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/src/controls/qquickpaddedrectangle.cpp b/src/controls/qquickpaddedrectangle.cpp index ee66a5a5..9542ca5f 100644 --- a/src/controls/qquickpaddedrectangle.cpp +++ b/src/controls/qquickpaddedrectangle.cpp @@ -180,18 +180,31 @@ void QQuickPaddedRectangle::setBottomPadding(qreal padding, bool has) QSGNode *QQuickPaddedRectangle::updatePaintNode(QSGNode *node, UpdatePaintNodeData *data) { - QSGRectangleNode *rectangle = static_cast<QSGRectangleNode *>(QQuickRectangle::updatePaintNode(node, data)); - if (rectangle) { + QSGTransformNode *transformNode = static_cast<QSGTransformNode *>(node); + if (!transformNode) + transformNode = new QSGTransformNode; + + QSGRectangleNode *rectNode = static_cast<QSGRectangleNode *>(QQuickRectangle::updatePaintNode(transformNode->firstChild(), data)); + + if (rectNode) { + if (!transformNode->firstChild()) + transformNode->appendChildNode(rectNode); + qreal top = topPadding(); qreal left = leftPadding(); qreal right = rightPadding(); qreal bottom = bottomPadding(); + if (!qFuzzyIsNull(top) || !qFuzzyIsNull(left) || !qFuzzyIsNull(right) || !qFuzzyIsNull(bottom)) { - rectangle->setRect(boundingRect().adjusted(left, top, -right, -bottom)); - rectangle->update(); + QMatrix4x4 m; + m.translate(left, top); + transformNode->setMatrix(m); + + rectNode->setRect(boundingRect().adjusted(0, 0, -left-right, -top-bottom)); + rectNode->update(); } } - return rectangle; + return transformNode; } QT_END_NAMESPACE |