summaryrefslogtreecommitdiffstats
path: root/src/svg/qsvgstyle.cpp
diff options
context:
space:
mode:
authorKim Motoyoshi Kalland <kim.kalland@nokia.com>2009-04-03 08:47:07 (GMT)
committerKim Motoyoshi Kalland <kim.kalland@nokia.com>2009-04-03 09:50:06 (GMT)
commit6c2dd295b2ca2f9125fe072d035a3784ce748718 (patch)
tree565f5ba97690df7891a598c699e50e741444911e /src/svg/qsvgstyle.cpp
parentd684546573785ce40fb5de2b8b3aad88e9958709 (diff)
downloadQt-6c2dd295b2ca2f9125fe072d035a3784ce748718.zip
Qt-6c2dd295b2ca2f9125fe072d035a3784ce748718.tar.gz
Qt-6c2dd295b2ca2f9125fe072d035a3784ce748718.tar.bz2
Removed usage of NaN in SVG gradients.
Since there is no way to find out if gradient stops have been added to a gradient, a gradient stop at NaN was earlier used in the SVG module to mark the gradient as empty. This could cause floating point exceptions. The usage of NaN has now been replaced by a boolean in QSvgGradientStyle. Duplicate entry "qxmlpatterns" was removed from auto.pro in the auto test directory. Task-number: 250146 Reviewed-by: Samuel
Diffstat (limited to 'src/svg/qsvgstyle.cpp')
-rw-r--r--src/svg/qsvgstyle.cpp13
1 files changed, 6 insertions, 7 deletions
diff --git a/src/svg/qsvgstyle.cpp b/src/svg/qsvgstyle.cpp
index 389f68f..4a40bed 100644
--- a/src/svg/qsvgstyle.cpp
+++ b/src/svg/qsvgstyle.cpp
@@ -231,7 +231,7 @@ void QSvgSolidColorStyle::revert(QPainter *p, QSvgExtraStates &)
}
QSvgGradientStyle::QSvgGradientStyle(QGradient *grad)
- : m_gradient(grad)
+ : m_gradient(grad), m_gradientStopsSet(false)
{
}
@@ -256,14 +256,13 @@ void QSvgGradientStyle::apply(QPainter *p, const QRectF &/*rect*/, QSvgNode *, Q
}
// If the gradient is marked as empty, insert transparent black
- QGradientStops stops = m_gradient->stops();
- if (stops.size() == 1 && qIsNaN(stops.at(0).first))
- m_gradient->setStops(QGradientStops() << QGradientStop(0.0, QColor(0, 0, 0, 0)));
-
- QGradient gradient = *m_gradient;
+ if (!m_gradientStopsSet) {
+ m_gradient->setColorAt(0.0, QColor(0, 0, 0, 0));
+ m_gradientStopsSet = true;
+ }
QBrush brush;
- brush = QBrush(gradient);
+ brush = QBrush(*m_gradient);
if (!m_matrix.isIdentity())
brush.setMatrix(m_matrix);