aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick
diff options
context:
space:
mode:
authorSanttu Lakkala <santtu.lakkala@nomovok.com>2015-05-29 18:40:56 +0300
committerGunnar Sletta <gunnar@sletta.org>2015-06-17 08:01:06 +0000
commit10ce105b25a03fbde1889ea767985d5009658a1d (patch)
treeb50447f3dd6bbe0cd2621c019735f709bbf82fc3 /src/quick
parent96336ab0effa9a659b4a35718635fe88b10ba6fc (diff)
QSGDefaultRectangleNode: Fix gradient position calculations
Change the gradient position calculations to consider full border, not just half of it, because the border is fully drawn inside the rectangle, not half outside, half inside. Task-number: QTBUG-36059 Change-Id: Ie7dec94d9f6e03ae07c612c6e3b1950781973dc7 Reviewed-by: Gunnar Sletta <gunnar@sletta.org>
Diffstat (limited to 'src/quick')
-rw-r--r--src/quick/scenegraph/qsgdefaultrectanglenode.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/quick/scenegraph/qsgdefaultrectanglenode.cpp b/src/quick/scenegraph/qsgdefaultrectanglenode.cpp
index 3e251a4051..f3f5c7f79f 100644
--- a/src/quick/scenegraph/qsgdefaultrectanglenode.cpp
+++ b/src/quick/scenegraph/qsgdefaultrectanglenode.cpp
@@ -323,11 +323,11 @@ void QSGDefaultRectangleNode::updateGeometry()
const QGradientStops &stops = m_gradient_stops;
int nextGradientStop = 0;
- float gradientPos = 0.5f * penWidth / height;
+ float gradientPos = penWidth / height;
while (nextGradientStop < stops.size() && stops.at(nextGradientStop).first <= gradientPos)
++nextGradientStop;
int lastGradientStop = stops.size() - 1;
- float lastGradientPos = 1.0f - 0.5f * penWidth / height;
+ float lastGradientPos = 1.0f - penWidth / height;
while (lastGradientStop >= nextGradientStop && stops.at(lastGradientStop).first >= lastGradientPos)
--lastGradientStop;
int gradientIntersections = (lastGradientStop - nextGradientStop + 1);
@@ -643,11 +643,11 @@ void QSGDefaultRectangleNode::updateGeometry()
for (int part = -1; part <= 1; part += 2) {
float y = (part == 1 ? innerRect.bottom() : innerRect.top());
float Y = (part == 1 ? outerRect.bottom() : outerRect.top());
- gradientPos = (y - innerRect.top() + 0.5f * penWidth) / height;
+ gradientPos = (y - innerRect.top() + penWidth) / height;
while (nextGradientStop <= lastGradientStop && stops.at(nextGradientStop).first <= gradientPos) {
// Insert vertices at gradient stops.
- float gy = (innerRect.top() - 0.5f * penWidth) + stops.at(nextGradientStop).first * height;
+ float gy = (innerRect.top() - penWidth) + stops.at(nextGradientStop).first * height;
fillColor = colorToColor4ub(stops.at(nextGradientStop).second);