diff options
author | Kim Motoyoshi Kalland <kim.kalland@nokia.com> | 2011-11-01 12:53:13 +0100 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2011-11-01 14:31:38 +0100 |
commit | 3c8ea4c9151045d95dd0b0df72f6f680ce57c1fc (patch) | |
tree | 6cc57ee924a66e46d46a7c35e903d36d291b00fd | |
parent | 0755302f0b3723ecccc78cedf394f264beef860f (diff) |
Fixed Rectangle where the radius is less than half the border width.
Task-number: QTBUG-21215
Change-Id: Ife6a8aa9070e3da49d02825507a00feb1ecf338f
Reviewed-by: Yoann Lopes <yoann.lopes@nokia.com>
-rw-r--r-- | src/declarative/scenegraph/qsgdefaultrectanglenode.cpp | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/src/declarative/scenegraph/qsgdefaultrectanglenode.cpp b/src/declarative/scenegraph/qsgdefaultrectanglenode.cpp index fbd8e0e7ed..922459063d 100644 --- a/src/declarative/scenegraph/qsgdefaultrectanglenode.cpp +++ b/src/declarative/scenegraph/qsgdefaultrectanglenode.cpp @@ -333,13 +333,21 @@ void QSGDefaultRectangleNode::updateGeometry() qreal c = 1 - part; qreal s = part; for (int i = 0; i <= segments; ++i) { - qreal y = (part ? innerRect.bottom() : innerRect.top()) - innerRadius * c; // current inner y-coordinate. - qreal lx = innerRect.left() - innerRadius * s; // current inner left x-coordinate. - qreal rx = innerRect.right() + innerRadius * s; // current inner right x-coordinate. + qreal y, lx, rx; + if (innerRadius > 0) { + y = (part ? innerRect.bottom() : innerRect.top()) - innerRadius * c; // current inner y-coordinate. + lx = innerRect.left() - innerRadius * s; // current inner left x-coordinate. + rx = innerRect.right() + innerRadius * s; // current inner right x-coordinate. + gradientPos = ((part ? innerRect.height() : 0) + radius - innerRadius * c) / (innerRect.height() + 2 * radius); + } else { + y = (part ? innerRect.bottom() + innerRadius : innerRect.top() - innerRadius); // current inner y-coordinate. + lx = innerRect.left() - innerRadius; // current inner left x-coordinate. + rx = innerRect.right() + innerRadius; // current inner right x-coordinate. + gradientPos = ((part ? innerRect.height() + innerRadius : -innerRadius) + radius) / (innerRect.height() + 2 * radius); + } qreal Y = (part ? innerRect.bottom() : innerRect.top()) - outerRadius * c; // current outer y-coordinate. qreal lX = innerRect.left() - outerRadius * s; // current outer left x-coordinate. qreal rX = innerRect.right() + outerRadius * s; // current outer right x-coordinate. - gradientPos = ((part ? innerRect.height() : 0) + radius - innerRadius * c) / (innerRect.height() + 2 * radius); while (nextGradientStop <= lastGradientStop && stops.at(nextGradientStop).first <= gradientPos) { // Insert vertices at gradient stops. |