summaryrefslogtreecommitdiffstats
path: root/src/svg/qsvghandler.cpp
diff options
context:
space:
mode:
authorJanne Anttila <janne.anttila@digia.com>2009-09-07 09:55:37 (GMT)
committerJanne Anttila <janne.anttila@digia.com>2009-09-07 09:55:37 (GMT)
commitf27ed1a26d0b68594f13f79be4806b40e489ce14 (patch)
tree1c58a8a813c9f398a36098b6517eadbe2f47498c /src/svg/qsvghandler.cpp
parent1cac9a68bab207cab3fd3790baec4569a0acd385 (diff)
parent6b7330ee075a62138f005492a6448059106554af (diff)
downloadQt-f27ed1a26d0b68594f13f79be4806b40e489ce14.zip
Qt-f27ed1a26d0b68594f13f79be4806b40e489ce14.tar.gz
Qt-f27ed1a26d0b68594f13f79be4806b40e489ce14.tar.bz2
Merge branch '4.6' of git@scm.dev.troll.no:qt/qt into 4.6
Diffstat (limited to 'src/svg/qsvghandler.cpp')
-rw-r--r--src/svg/qsvghandler.cpp23
1 files changed, 13 insertions, 10 deletions
diff --git a/src/svg/qsvghandler.cpp b/src/svg/qsvghandler.cpp
index e2c3d92..35b8595 100644
--- a/src/svg/qsvghandler.cpp
+++ b/src/svg/qsvghandler.cpp
@@ -810,24 +810,27 @@ static bool resolveColor(const QStringRef &colorStr, QColor &color, QSvgHandler
case 'r':
{
- // starts with "rgb("
- if (colorStrTr == QLatin1String("rgb(")) {
+ // starts with "rgb(", ends with ")" and consists of at least 7 characters "rgb(,,)"
+ if (colorStrTr.length() >= 7 && colorStrTr.at(colorStrTr.length() - 1) == QLatin1Char(')')
+ && QStringRef(colorStrTr.string(), colorStrTr.position(), 4) == QLatin1String("rgb(")) {
const QChar *s = colorStrTr.constData() + 4;
QVector<qreal> compo = parseNumbersList(s);
//1 means that it failed after reaching non-parsable
//character which is going to be "%"
if (compo.size() == 1) {
- const QChar *s = colorStrTr.constData() + 4;
+ s = colorStrTr.constData() + 4;
compo = parsePercentageList(s);
- compo[0] *= (qreal)2.55;
- compo[1] *= (qreal)2.55;
- compo[2] *= (qreal)2.55;
+ for (int i = 0; i < compo.size(); ++i)
+ compo[i] *= (qreal)2.55;
}
- color = QColor(int(compo[0]),
- int(compo[1]),
- int(compo[2]));
- return true;
+ if (compo.size() == 3) {
+ color = QColor(int(compo[0]),
+ int(compo[1]),
+ int(compo[2]));
+ return true;
+ }
+ return false;
}
}
break;