summaryrefslogtreecommitdiffstats
path: root/src/svg
diff options
context:
space:
mode:
authorAriya Hidayat <ariya.hidayat@nokia.com>2009-08-31 12:31:16 (GMT)
committerAriya Hidayat <ariya.hidayat@nokia.com>2009-08-31 12:49:57 (GMT)
commitfd8ced2fda546a4b5ef735a06cac42d1f989c1ae (patch)
tree9019dcee125c42c8887a0f72c8702892db6f147a /src/svg
parenta660e4f11356750bdb8ad0330ed3deed4319c49c (diff)
downloadQt-fd8ced2fda546a4b5ef735a06cac42d1f989c1ae.zip
Qt-fd8ced2fda546a4b5ef735a06cac42d1f989c1ae.tar.gz
Qt-fd8ced2fda546a4b5ef735a06cac42d1f989c1ae.tar.bz2
Group the stroke attributes for 3.5% speed-up in QSvgAttributes.
Reviewed-by: Kim
Diffstat (limited to 'src/svg')
-rw-r--r--src/svg/qsvghandler.cpp70
1 files changed, 38 insertions, 32 deletions
diff --git a/src/svg/qsvghandler.cpp b/src/svg/qsvghandler.cpp
index b8266f7..c06a1d4 100644
--- a/src/svg/qsvghandler.cpp
+++ b/src/svg/qsvghandler.cpp
@@ -179,22 +179,25 @@ QSvgAttributes::QSvgAttributes(const QXmlStreamAttributes &xmlAttributes, QSvgHa
break;
case 's':
- if (name == QLatin1String("stroke"))
- stroke = value;
- else if (name == QLatin1String("stroke-dasharray"))
- strokeDashArray = value;
- else if (name == QLatin1String("stroke-dashoffset"))
- strokeDashOffset = value;
- else if (name == QLatin1String("stroke-linecap"))
- strokeLineCap = value;
- else if (name == QLatin1String("stroke-linejoin"))
- strokeLineJoin = value;
- else if (name == QLatin1String("stroke-miterlimit"))
- strokeMiterLimit = value;
- else if (name == QLatin1String("stroke-opacity"))
- strokeOpacity = value;
- else if (name == QLatin1String("stroke-width"))
- strokeWidth = value;
+ if (name.length() > 5 && QStringRef(name.string(), name.position() + 1, 5) == QLatin1String("troke")) {
+ QStringRef strokeRef(name.string(), name.position() + 6, name.length() - 6);
+ if (name.isEmpty())
+ stroke = value;
+ else if (name == QLatin1String("-dasharray"))
+ strokeDashArray = value;
+ else if (name == QLatin1String("-dashoffset"))
+ strokeDashOffset = value;
+ else if (name == QLatin1String("-linecap"))
+ strokeLineCap = value;
+ else if (name == QLatin1String("-linejoin"))
+ strokeLineJoin = value;
+ else if (name == QLatin1String("-miterlimit"))
+ strokeMiterLimit = value;
+ else if (name == QLatin1String("-opacity"))
+ strokeOpacity = value;
+ else if (name == QLatin1String("-width"))
+ strokeWidth = value;
+ }
else if (name == QLatin1String("stop-color"))
stopColor = value;
else if (name == QLatin1String("stop-opacity"))
@@ -271,22 +274,25 @@ QSvgAttributes::QSvgAttributes(const QXmlStreamAttributes &xmlAttributes, QSvgHa
break;
case 's':
- if (name == QLatin1String("stroke"))
- stroke = value;
- else if (name == QLatin1String("stroke-dasharray"))
- strokeDashArray = value;
- else if (name == QLatin1String("stroke-dashoffset"))
- strokeDashOffset = value;
- else if (name == QLatin1String("stroke-linecap"))
- strokeLineCap = value;
- else if (name == QLatin1String("stroke-linejoin"))
- strokeLineJoin = value;
- else if (name == QLatin1String("stroke-miterlimit"))
- strokeMiterLimit = value;
- else if (name == QLatin1String("stroke-opacity"))
- strokeOpacity = value;
- else if (name == QLatin1String("stroke-width"))
- strokeWidth = value;
+ if (name.length() > 5 && QStringRef(name.string(), name.position() + 1, 5) == QLatin1String("troke")) {
+ QStringRef strokeRef(name.string(), name.position() + 6, name.length() - 6);
+ if (name.isEmpty())
+ stroke = value;
+ else if (name == QLatin1String("-dasharray"))
+ strokeDashArray = value;
+ else if (name == QLatin1String("-dashoffset"))
+ strokeDashOffset = value;
+ else if (name == QLatin1String("-linecap"))
+ strokeLineCap = value;
+ else if (name == QLatin1String("-linejoin"))
+ strokeLineJoin = value;
+ else if (name == QLatin1String("-miterlimit"))
+ strokeMiterLimit = value;
+ else if (name == QLatin1String("-opacity"))
+ strokeOpacity = value;
+ else if (name == QLatin1String("-width"))
+ strokeWidth = value;
+ }
else if (name == QLatin1String("stop-color"))
stopColor = value;
else if (name == QLatin1String("stop-opacity"))