summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorSuneel BS <suneel.b-s@nokia.com>2009-05-08 09:17:36 (GMT)
committerKim Motoyoshi Kalland <kim.kalland@nokia.com>2009-06-22 13:26:13 (GMT)
commit2dcb97ff789dd7a9b7534348ca49c96c09783055 (patch)
treec74ba42af8bd8d7a66d395978bf5e464f43b7a35 /src
parent51aba60ca75f6f094951d3ffaea803072db75d29 (diff)
downloadQt-2dcb97ff789dd7a9b7534348ca49c96c09783055.zip
Qt-2dcb97ff789dd7a9b7534348ca49c96c09783055.tar.gz
Qt-2dcb97ff789dd7a9b7534348ca49c96c09783055.tar.bz2
Fixed fill-rule for polygon SVG element.
Polygon element should apply the fill rule which is specified in its fill-rule attribute. Default fill rule is 'WindingFill' (nonzero). Modified and autotest added by Kim. Reviewed-by: Kim
Diffstat (limited to 'src')
-rw-r--r--src/svg/qsvggraphics.cpp5
-rw-r--r--src/svg/qsvggraphics_p.h5
-rw-r--r--src/svg/qsvgstyle.cpp3
3 files changed, 10 insertions, 3 deletions
diff --git a/src/svg/qsvggraphics.cpp b/src/svg/qsvggraphics.cpp
index 6782429..e09f382 100644
--- a/src/svg/qsvggraphics.cpp
+++ b/src/svg/qsvggraphics.cpp
@@ -198,9 +198,8 @@ QRectF QSvgPath::bounds() const
}
QSvgPolygon::QSvgPolygon(QSvgNode *parent, const QPolygonF &poly)
- : QSvgNode(parent), m_poly(poly)
+ : QSvgNode(parent), m_poly(poly), m_fillRule(Qt::WindingFill)
{
-
}
QRectF QSvgPolygon::bounds() const
@@ -217,7 +216,7 @@ QRectF QSvgPolygon::bounds() const
void QSvgPolygon::draw(QPainter *p, QSvgExtraStates &states)
{
- QT_SVG_DRAW_SHAPE(p->drawPolygon(m_poly));
+ QT_SVG_DRAW_SHAPE(p->drawPolygon(m_poly, m_fillRule));
}
diff --git a/src/svg/qsvggraphics_p.h b/src/svg/qsvggraphics_p.h
index 8a412c4..4a19c7e 100644
--- a/src/svg/qsvggraphics_p.h
+++ b/src/svg/qsvggraphics_p.h
@@ -155,8 +155,13 @@ public:
virtual void draw(QPainter *p, QSvgExtraStates &states);
virtual Type type() const;
virtual QRectF bounds() const;
+ void setFillRule(Qt::FillRule f)
+ {
+ m_fillRule = f;
+ }
private:
QPolygonF m_poly;
+ Qt::FillRule m_fillRule;
};
class QSvgPolyline : public QSvgNode
diff --git a/src/svg/qsvgstyle.cpp b/src/svg/qsvgstyle.cpp
index fa996f4..9d46649 100644
--- a/src/svg/qsvgstyle.cpp
+++ b/src/svg/qsvgstyle.cpp
@@ -107,6 +107,9 @@ static void recursivelySetFill(QSvgNode *node, Qt::FillRule f)
if (node->type() == QSvgNode::PATH) {
QSvgPath *path = static_cast<QSvgPath*>(node);
path->qpath()->setFillRule(f);
+ } else if (node->type() == QSvgNode::POLYGON) {
+ QSvgPolygon *polygon = static_cast<QSvgPolygon*>(node);
+ polygon->setFillRule(f);
} else if (node->type() == QSvgNode::G) {
QList<QSvgNode*> renderers = static_cast<QSvgG*>(node)->renderers();
foreach(QSvgNode *n, renderers) {