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)
QGradientStops stops;
if (d->gradient) {
QList<QSGGradientStop *> qxstops = d->gradient->m_stops;
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);
}
rectangle->setGradientStops(stops);