From 3c8ea4c9151045d95dd0b0df72f6f680ce57c1fc Mon Sep 17 00:00:00 2001 From: Kim Motoyoshi Kalland Date: Tue, 1 Nov 2011 12:53:13 +0100 Subject: Fixed Rectangle where the radius is less than half the border width. Task-number: QTBUG-21215 Change-Id: Ife6a8aa9070e3da49d02825507a00feb1ecf338f Reviewed-by: Yoann Lopes --- src/declarative/scenegraph/qsgdefaultrectanglenode.cpp | 16 ++++++++++++---- 1 file 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. -- cgit v1.2.3