summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/opengl/util/fragmentprograms_p.h38
-rw-r--r--src/svg/qsvghandler.cpp256
2 files changed, 195 insertions, 99 deletions
diff --git a/src/opengl/util/fragmentprograms_p.h b/src/opengl/util/fragmentprograms_p.h
index 07640c3..b02c600 100644
--- a/src/opengl/util/fragmentprograms_p.h
+++ b/src/opengl/util/fragmentprograms_p.h
@@ -1,7 +1,30 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtOpenGL module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
** contained in the Technology Preview License Agreement accompanying
** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
** additional rights. These rights are described in the Nokia Qt LGPL
** Exception version 1.1, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
** If you have questions regarding the use of this file, please contact
** Nokia at qt-info@nokia.com.
**
@@ -11,9 +34,24 @@
**
**
**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
#ifndef FRAGMENTPROGRAMS_H
#define FRAGMENTPROGRAMS_H
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
enum FragmentVariable {
VAR_BRUSH_TEXTURE,
VAR_LINEAR,
diff --git a/src/svg/qsvghandler.cpp b/src/svg/qsvghandler.cpp
index cdb6751..679bd5d 100644
--- a/src/svg/qsvghandler.cpp
+++ b/src/svg/qsvghandler.cpp
@@ -130,128 +130,186 @@ QSvgAttributes::QSvgAttributes(const QXmlStreamAttributes &xmlAttributes, QSvgHa
if (!style.isEmpty()) {
handler->parseCSStoXMLAttrs(style.toString(), &m_cssAttributes);
for (int j = 0; j < m_cssAttributes.count(); ++j) {
- const QSvgCssAttribute &attribute = m_cssAttributes.at(j );
+ const QSvgCssAttribute &attribute = m_cssAttributes.at(j);
QStringRef name = attribute.name;
QStringRef value = attribute.value;
+ if (name.isEmpty())
+ continue;
+
+ switch (name.at(0).unicode()) {
+
+ case 'c':
+ if (name == QLatin1String("color"))
+ color = value;
+ else if (name == QLatin1String("color-opacity"))
+ colorOpacity = value;
+ else if (name == QLatin1String("comp-op"))
+ compOp = value;
+ break;
+
+ case 'd':
+ if (name == QLatin1String("display"))
+ display = value;
+ break;
+
+ case 'f':
+ if (name == QLatin1String("fill"))
+ fill = value;
+ else if (name == QLatin1String("fill-rule"))
+ fillRule = value;
+ else if (name == QLatin1String("fill-opacity"))
+ fillOpacity = value;
+ else if (name == QLatin1String("font-family"))
+ fontFamily = value;
+ else if (name == QLatin1String("font-size"))
+ fontSize = value;
+ else if (name == QLatin1String("font-style"))
+ fontStyle = value;
+ else if (name == QLatin1String("font-weight"))
+ fontWeight = value;
+ else if (name == QLatin1String("font-variant"))
+ fontVariant = value;
+ break;
+
+ case 'o':
+ if (name == QLatin1String("opacity"))
+ opacity = value;
+ else if (name == QLatin1String("offset"))
+ offset = value;
+ 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;
+ else if (name == QLatin1String("stop-color"))
+ stopColor = value;
+ else if (name == QLatin1String("stop-opacity"))
+ stopOpacity = value;
+ break;
+
+ case 't':
+ if (name == QLatin1String("text-anchor"))
+ textAnchor = value;
+ else if (name == QLatin1String("transform"))
+ transform = value;
+ break;
+
+ case 'v':
+ if (name == QLatin1String("vector-effect"))
+ vectorEffect = value;
+ else if (name == QLatin1String("visibility"))
+ visibility = value;
+ break;
+
+ default:
+ break;
+ }
+ }
+ }
+
+ for (int i = 0; i < xmlAttributes.count(); ++i) {
+ const QXmlStreamAttribute &attribute = xmlAttributes.at(i);
+ QStringRef name = attribute.qualifiedName();
+ if (name.isEmpty())
+ continue;
+ QStringRef value = attribute.value();
+
+ switch (name.at(0).unicode()) {
+
+ case 'c':
if (name == QLatin1String("color"))
color = value;
- if (name == QLatin1String("color-opacity"))
+ else if (name == QLatin1String("color-opacity"))
colorOpacity = value;
+ else if (name == QLatin1String("comp-op"))
+ compOp = value;
+ break;
+
+ case 'd':
+ if (name == QLatin1String("display"))
+ display = value;
+ break;
+
+ case 'f':
if (name == QLatin1String("fill"))
fill = value;
- if (name == QLatin1String("fill-rule"))
+ else if (name == QLatin1String("fill-rule"))
fillRule = value;
- if (name == QLatin1String("fill-opacity"))
+ else if (name == QLatin1String("fill-opacity"))
fillOpacity = value;
+ else if (name == QLatin1String("font-family"))
+ fontFamily = value;
+ else if (name == QLatin1String("font-size"))
+ fontSize = value;
+ else if (name == QLatin1String("font-style"))
+ fontStyle = value;
+ else if (name == QLatin1String("font-weight"))
+ fontWeight = value;
+ else if (name == QLatin1String("font-variant"))
+ fontVariant = value;
+ break;
+
+ case 'o':
+ if (name == QLatin1String("opacity"))
+ opacity = value;
+ if (name == QLatin1String("offset"))
+ offset = value;
+ break;
+
+ case 's':
if (name == QLatin1String("stroke"))
stroke = value;
- if (name == QLatin1String("stroke-dasharray"))
+ else if (name == QLatin1String("stroke-dasharray"))
strokeDashArray = value;
- if (name == QLatin1String("stroke-dashoffset"))
+ else if (name == QLatin1String("stroke-dashoffset"))
strokeDashOffset = value;
- if (name == QLatin1String("stroke-linecap"))
+ else if (name == QLatin1String("stroke-linecap"))
strokeLineCap = value;
- if (name == QLatin1String("stroke-linejoin"))
+ else if (name == QLatin1String("stroke-linejoin"))
strokeLineJoin = value;
- if (name == QLatin1String("stroke-miterlimit"))
+ else if (name == QLatin1String("stroke-miterlimit"))
strokeMiterLimit = value;
- if (name == QLatin1String("stroke-opacity"))
+ else if (name == QLatin1String("stroke-opacity"))
strokeOpacity = value;
- if (name == QLatin1String("stroke-width"))
+ else if (name == QLatin1String("stroke-width"))
strokeWidth = value;
- if (name == QLatin1String("vector-effect"))
- vectorEffect = value;
- if (name == QLatin1String("font-family"))
- fontFamily = value;
- if (name == QLatin1String("font-size"))
- fontSize = value;
- if (name == QLatin1String("font-style"))
- fontStyle = value;
- if (name == QLatin1String("font-weight"))
- fontWeight = value;
- if (name == QLatin1String("font-variant"))
- fontVariant = value;
+ else if (name == QLatin1String("stop-color"))
+ stopColor = value;
+ else if (name == QLatin1String("stop-opacity"))
+ stopOpacity = value;
+ break;
+
+ case 't':
if (name == QLatin1String("text-anchor"))
textAnchor = value;
- if (name == QLatin1String("transform"))
+ else if (name == QLatin1String("transform"))
transform = value;
- if (name == QLatin1String("visibility"))
+ break;
+
+ case 'v':
+ if (name == QLatin1String("vector-effect"))
+ vectorEffect = value;
+ else if (name == QLatin1String("visibility"))
visibility = value;
- if (name == QLatin1String("opacity"))
- opacity = value;
- if (name == QLatin1String("comp-op"))
- compOp = value;
- if (name == QLatin1String("display"))
- display = value;
- if (name == QLatin1String("offset"))
- offset = value;
- if (name == QLatin1String("stop-color"))
- stopColor = value;
- if (name == QLatin1String("stop-opacity"))
- stopOpacity = value;
- }
- }
+ break;
- for (int i = 0; i < xmlAttributes.count(); ++i) {
- const QXmlStreamAttribute &attribute = xmlAttributes.at(i);
- QStringRef name = attribute.qualifiedName();
- QStringRef value = attribute.value();
- if (name == QLatin1String("color"))
- color = value;
- if (name == QLatin1String("color-opacity"))
- colorOpacity = value;
- if (name == QLatin1String("fill"))
- fill = value;
- if (name == QLatin1String("fill-rule"))
- fillRule = value;
- if (name == QLatin1String("fill-opacity"))
- fillOpacity = value;
- if (name == QLatin1String("stroke"))
- stroke = value;
- if (name == QLatin1String("stroke-dasharray"))
- strokeDashArray = value;
- if (name == QLatin1String("stroke-dashoffset"))
- strokeDashOffset = value;
- if (name == QLatin1String("stroke-linecap"))
- strokeLineCap = value;
- if (name == QLatin1String("stroke-linejoin"))
- strokeLineJoin = value;
- if (name == QLatin1String("stroke-miterlimit"))
- strokeMiterLimit = value;
- if (name == QLatin1String("stroke-opacity"))
- strokeOpacity = value;
- if (name == QLatin1String("stroke-width"))
- strokeWidth = value;
- if (name == QLatin1String("vector-effect"))
- vectorEffect = value;
- if (name == QLatin1String("font-family"))
- fontFamily = value;
- if (name == QLatin1String("font-size"))
- fontSize = value;
- if (name == QLatin1String("font-style"))
- fontStyle = value;
- if (name == QLatin1String("font-weight"))
- fontWeight = value;
- if (name == QLatin1String("font-variant"))
- fontVariant = value;
- if (name == QLatin1String("text-anchor"))
- textAnchor = value;
- if (name == QLatin1String("transform"))
- transform = value;
- if (name == QLatin1String("visibility"))
- visibility = value;
- if (name == QLatin1String("opacity"))
- opacity = value;
- if (name == QLatin1String("comp-op"))
- compOp = value;
- if (name == QLatin1String("display"))
- display = value;
- if (name == QLatin1String("offset"))
- offset = value;
- if (name == QLatin1String("stop-color"))
- stopColor = value;
- if (name == QLatin1String("stop-opacity"))
- stopOpacity = value;
+ default:
+ break;
+ }
}
}