summaryrefslogtreecommitdiffstats
path: root/src/svg
diff options
context:
space:
mode:
authorThierry Bastian <thierry.bastian@nokia.com>2009-08-14 15:04:42 (GMT)
committerThierry Bastian <thierry.bastian@nokia.com>2009-08-14 15:05:50 (GMT)
commit3c8f4512df30dee4a867a498fff6d2b27b881e4b (patch)
treef6cec8256c40fe72514cfbd304f1eb85bd916e4d /src/svg
parent533807d5c06be28694665fc889ec1942c59ab705 (diff)
downloadQt-3c8f4512df30dee4a867a498fff6d2b27b881e4b.zip
Qt-3c8f4512df30dee4a867a498fff6d2b27b881e4b.tar.gz
Qt-3c8f4512df30dee4a867a498fff6d2b27b881e4b.tar.bz2
QVariant: more work on avoinding conversion between float and doubles
we call QVariant::toReal instead of toDouble when needed
Diffstat (limited to 'src/svg')
-rw-r--r--src/svg/qsvghandler.cpp7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/svg/qsvghandler.cpp b/src/svg/qsvghandler.cpp
index 3b5bd0d..5e07181 100644
--- a/src/svg/qsvghandler.cpp
+++ b/src/svg/qsvghandler.cpp
@@ -1740,14 +1740,13 @@ static void parseOpacity(QSvgNode *node,
const QSvgAttributes &attributes,
QSvgHandler *)
{
- QString value = attributes.value(QLatin1String("opacity")).toString();
- value = value.trimmed();
+ const QString value = attributes.value(QLatin1String("opacity")).toString().trimmed();
bool ok = false;
- qreal op = value.toDouble(&ok);
+ qreal op = value.toReal(&ok);
if (ok) {
- QSvgOpacityStyle *opacity = new QSvgOpacityStyle(qMin(qreal(1.0), qMax(qreal(0.0), op)));
+ QSvgOpacityStyle *opacity = new QSvgOpacityStyle(qBound(qreal(0.0), op, qreal(1.0)));
node->appendStyleProperty(opacity, someId(attributes));
}
}