diff options
author | Jerome Pasion <jerome.pasion@digia.com> | 2012-11-02 14:59:56 +0100 |
---|---|---|
committer | Jerome Pasion <jerome.pasion@digia.com> | 2012-11-02 15:02:08 +0100 |
commit | 47c45bb1e487b3823281683c1110d9269f144582 (patch) | |
tree | 4c687d46d9aa7d90f064a25e6c7f0241ae28e16d /src/quick/scenegraph/qsgdefaultrectanglenode.cpp | |
parent | 677be9a27770ff48dd771ec4fc1c66139aac4aa8 (diff) | |
parent | 7d94fa8e074ba816751c60bd0ad3c63b3c0b0a27 (diff) |
Merge branch 'master' of ssh://codereview.qt-project.org/qt/qtdeclarative into newdocs
Change-Id: Icced038fbdb309d8928213d3753a27fe5a6b1137
Diffstat (limited to 'src/quick/scenegraph/qsgdefaultrectanglenode.cpp')
-rw-r--r-- | src/quick/scenegraph/qsgdefaultrectanglenode.cpp | 26 |
1 files changed, 8 insertions, 18 deletions
diff --git a/src/quick/scenegraph/qsgdefaultrectanglenode.cpp b/src/quick/scenegraph/qsgdefaultrectanglenode.cpp index dab855064e..4d5094d526 100644 --- a/src/quick/scenegraph/qsgdefaultrectanglenode.cpp +++ b/src/quick/scenegraph/qsgdefaultrectanglenode.cpp @@ -342,9 +342,12 @@ void QSGDefaultRectangleNode::update() void QSGDefaultRectangleNode::updateGeometry() { - float penWidth = m_aligned ? float(qRound(m_pen_width)) : float(m_pen_width); float width = float(m_rect.width()); float height = float(m_rect.height()); + float penWidth = qMin(qMin(width, height) * 0.5f, float(m_pen_width)); + + if (m_aligned) + penWidth = qRound(penWidth); QSGGeometry *g = geometry(); g->setDrawingMode(GL_TRIANGLE_STRIP); @@ -377,14 +380,9 @@ void QSGDefaultRectangleNode::updateGeometry() float radius = qMin(qMin(width, height) * 0.5f, float(m_radius)); QRectF innerRect = m_rect; innerRect.adjust(radius, radius, -radius, -radius); - if (m_aligned && (int(penWidth) & 1)) { - // Pen width is odd, so add the offset as documented. - innerRect.moveLeft(innerRect.left() + qreal(0.5)); - innerRect.moveTop(innerRect.top() + qreal(0.5)); - } - float innerRadius = radius - penWidth * 0.5f; - float outerRadius = radius + penWidth * 0.5f; + float innerRadius = radius - penWidth * 1.0f; + float outerRadius = radius; float delta = qMin(width, height) * 0.5f; // Number of segments per corner, approximately one per 3 pixels. @@ -630,16 +628,8 @@ void QSGDefaultRectangleNode::updateGeometry() QRectF innerRect = m_rect; QRectF outerRect = m_rect; - if (penWidth) { - if (m_aligned && (int(penWidth) & 1)) { - // Pen width is odd, so add the offset as documented. - innerRect.moveLeft(innerRect.left() + qreal(0.5)); - innerRect.moveTop(innerRect.top() + qreal(0.5)); - outerRect = innerRect; - } - innerRect.adjust(0.5f * penWidth, 0.5f * penWidth, -0.5f * penWidth, -0.5f * penWidth); - outerRect.adjust(-0.5f * penWidth, -0.5f * penWidth, 0.5f * penWidth, 0.5f * penWidth); - } + if (penWidth) + innerRect.adjust(1.0f * penWidth, 1.0f * penWidth, -1.0f * penWidth, -1.0f * penWidth); float delta = qMin(width, height) * 0.5f; int innerVertexCount = 4 + gradientIntersections * 2; |