diff options
author | Kim Motoyoshi Kalland <kim.kalland@nokia.com> | 2009-07-20 13:49:15 (GMT) |
---|---|---|
committer | Kim Motoyoshi Kalland <kim.kalland@nokia.com> | 2009-07-21 13:54:46 (GMT) |
commit | 40649c420601bcc1f639fc8b337bfd7375d2b37e (patch) | |
tree | b192a98aea146c084fee0a17588702028237d8c6 /src/svg/qsvghandler.cpp | |
parent | 3c2ebb7f209035f85a35dbb05e76dd7e80238ecb (diff) | |
download | Qt-40649c420601bcc1f639fc8b337bfd7375d2b37e.zip Qt-40649c420601bcc1f639fc8b337bfd7375d2b37e.tar.gz Qt-40649c420601bcc1f639fc8b337bfd7375d2b37e.tar.bz2 |
Fixed inheritence of SVG 'use' element fill attributes.
Inheritence of fill attributes was implemented by copying attributes
from the parent node. This approach wouldn't work if the node is
referenced by a 'use' element. Now, only the fill attributes which have
been explicitly set are applied on the painter while drawing.
Reviewed-by: Tor Arne
Diffstat (limited to 'src/svg/qsvghandler.cpp')
-rw-r--r-- | src/svg/qsvghandler.cpp | 25 |
1 files changed, 5 insertions, 20 deletions
diff --git a/src/svg/qsvghandler.cpp b/src/svg/qsvghandler.cpp index 5f9d1dd..5857e1c 100644 --- a/src/svg/qsvghandler.cpp +++ b/src/svg/qsvghandler.cpp @@ -644,26 +644,19 @@ static void parseBrush(QSvgNode *node, QString opacity = attributes.value(QLatin1String("fill-opacity")).toString(); QString myId = someId(attributes); - QSvgFillStyle *inherited = - static_cast<QSvgFillStyle*>(node->parent()->styleProperty( - QSvgStyleProperty::FILL)); - QSvgFillStyle *prop = new QSvgFillStyle(QColor(Qt::black)); + QSvgFillStyle *prop = new QSvgFillStyle(0); //fill-rule attribute handling - Qt::FillRule f = Qt::WindingFill; if (!fillRule.isEmpty() && fillRule != QLatin1String("inherit")) { if (fillRule == QLatin1String("evenodd")) - f = Qt::OddEvenFill; - } else if (inherited) { - f = inherited->fillRule(); + prop->setFillRule(Qt::OddEvenFill); + else if (fillRule == QLatin1String("nonzero")) + prop->setFillRule(Qt::WindingFill); } //fill-opacity atttribute handling - qreal fillOpacity = 1.0; if (!opacity.isEmpty() && opacity != QLatin1String("inherit")) { - fillOpacity = qMin(qreal(1.0), qMax(qreal(0.0), toDouble(opacity))); - } else if (inherited) { - fillOpacity = inherited->fillOpacity(); + prop->setFillOpacity(qMin(qreal(1.0), qMax(qreal(0.0), toDouble(opacity)))); } //fill attribute handling @@ -685,15 +678,7 @@ static void parseBrush(QSvgNode *node, } else { prop->setBrush(QBrush(Qt::NoBrush)); } - } else if (inherited) { - if (inherited->style()) { - prop->setFillStyle(inherited->style()); - } else { - prop->setBrush(inherited->qbrush()); - } } - prop->setFillOpacity(fillOpacity); - prop->setFillRule(f); node->appendStyleProperty(prop,myId); } |