aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlan Alpert <alan.alpert@nokia.com>2011-04-27 10:46:24 +1000
committerAlan Alpert <alan.alpert@nokia.com>2011-04-28 09:53:26 +1000
commit6e2e4894159da51ab3413b8a0bb9c8ba615f0b7c (patch)
treea06a58b5c11cbb449ba0d455ded2f04a088985f3
parent2b92c8c08f0e17b73bf3a00f416c679ecbf3fca5 (diff)
Sort gradient stops for the convenience of the scenegraph
The scenegraph gradients require sorted graident stops, whereas QML does not. Gradient stops are now sorted at the point they are passed into the scenegraph. Change-Id: I499dd00dc78e60dfc2053f2ee3691e61e0cf2a5d Task-number: QTBUG-18494 Reviewed-by: Martin Jones (cherry picked from commit 8cbd68b29224eed19f6ca6ec8186766c69a35c83)
-rw-r--r--src/declarative/items/qsgrectangle.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/declarative/items/qsgrectangle.cpp b/src/declarative/items/qsgrectangle.cpp
index 247d6336b2..cba6527759 100644
--- a/src/declarative/items/qsgrectangle.cpp
+++ b/src/declarative/items/qsgrectangle.cpp
@@ -267,8 +267,12 @@ QSGNode *QSGRectangle::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *da
QGradientStops stops;
if (d->gradient) {
QList<QSGGradientStop *> qxstops = d->gradient->m_stops;
- for (int i = 0; i < qxstops.size(); ++i)
- stops.append(QGradientStop(qxstops.at(i)->position(), qxstops.at(i)->color()));
+ for (int i = 0; i < qxstops.size(); ++i){
+ int j = 0;
+ while (j < stops.size() && stops.at(j).first < qxstops[i]->position())
+ j++;
+ stops.insert(j, QGradientStop(qxstops.at(i)->position(), qxstops.at(i)->color()));
+ }
}
rectangle->setGradientStops(stops);