diff options
author | Laszlo Agocs <laszlo.p.agocs@nokia.com> | 2011-04-04 11:50:16 (GMT) |
---|---|---|
committer | Laszlo Agocs <laszlo.p.agocs@nokia.com> | 2011-04-04 11:51:40 (GMT) |
commit | eb20a7341827b5590fbd891ca1b82ea7ba37d679 (patch) | |
tree | f68cfd45b7dea935da019d9c72cf21a182523d20 | |
parent | ae99d577f788d57a3f4a37ee300872556c57b77c (diff) | |
download | Qt-eb20a7341827b5590fbd891ca1b82ea7ba37d679.zip Qt-eb20a7341827b5590fbd891ca1b82ea7ba37d679.tar.gz Qt-eb20a7341827b5590fbd891ca1b82ea7ba37d679.tar.bz2 |
Fix QGradient stop with NaN position on Symbian.
The qbrush autotest was failing on Symbian, because gradient stops
with NaN position cannot be inserted on Symbian. This is caused by
the pos > 1 || pos < 0 check in setColorAt() which is incorrect
on ARM as NaN > 1 will evaluate to true.
Task-number: QTBUG-17874
Reviewed-by: Samuel Rødal
-rw-r--r-- | src/gui/painting/qbrush.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/gui/painting/qbrush.cpp b/src/gui/painting/qbrush.cpp index dc61e34..8f965c2 100644 --- a/src/gui/painting/qbrush.cpp +++ b/src/gui/painting/qbrush.cpp @@ -49,6 +49,7 @@ #include "qdebug.h" #include <QtCore/qcoreapplication.h> #include "private/qstylehelper_p.h" +#include <QtCore/qnumeric.h> QT_BEGIN_NAMESPACE @@ -1360,13 +1361,14 @@ QGradient::QGradient() void QGradient::setColorAt(qreal pos, const QColor &color) { - if (pos > 1 || pos < 0) { + if ((pos > 1 || pos < 0) && !qIsNaN(pos)) { qWarning("QGradient::setColorAt: Color position must be specified in the range 0 to 1"); return; } int index = 0; - while (index < m_stops.size() && m_stops.at(index).first < pos) ++index; + if (!qIsNaN(pos)) + while (index < m_stops.size() && m_stops.at(index).first < pos) ++index; if (index < m_stops.size() && m_stops.at(index).first == pos) m_stops[index].second = color; |