diff options
author | Ariya Hidayat <ariya.hidayat@nokia.com> | 2009-08-31 14:31:16 +0200 |
---|---|---|
committer | Ariya Hidayat <ariya.hidayat@nokia.com> | 2009-08-31 14:49:57 +0200 |
commit | fd8ced2fda546a4b5ef735a06cac42d1f989c1ae (patch) | |
tree | 9019dcee125c42c8887a0f72c8702892db6f147a /src/svg | |
parent | a660e4f11356750bdb8ad0330ed3deed4319c49c (diff) |
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.cpp | 70 |
1 files changed, 38 insertions, 32 deletions
diff --git a/src/svg/qsvghandler.cpp b/src/svg/qsvghandler.cpp index b8266f7138..c06a1d4d3e 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")) |