mirror of
https://github.com/thorvg/thorvg.git
synced 2025-06-08 13:43:43 +00:00
SvgLoader: Support display=none feature
If display is none, scene does not create a child shape, and shape does not draw fills and strokes. Change-Id: I8af72c904be00107dff115429e27df7ba4cb83b6
This commit is contained in:
parent
6cfb3cdb6c
commit
27ca82c140
1 changed files with 7 additions and 5 deletions
|
@ -206,7 +206,7 @@ void _applyProperty(SvgNode* node, Shape* vg, float vx, float vy, float vw, floa
|
|||
SvgStyleProperty* style = node->style;
|
||||
|
||||
if (node->transform) vg->transform(*node->transform);
|
||||
if (node->type == SvgNodeType::Doc) return;
|
||||
if (node->type == SvgNodeType::Doc || !node->display) return;
|
||||
|
||||
//If fill property is nullptr then do nothing
|
||||
if (style->fill.paint.none) {
|
||||
|
@ -333,11 +333,13 @@ unique_ptr<Scene> _sceneBuildHelper(SvgNode* node, float vx, float vy, float vw,
|
|||
auto scene = Scene::gen();
|
||||
if (node->transform) scene->transform(*node->transform);
|
||||
node->style->opacity = (node->style->opacity * parentOpacity) / 255.0f;
|
||||
if (node->display) {
|
||||
for (auto child : node->child) {
|
||||
child->style->opacity = (child->style->opacity * node->style->opacity) / 255.0f;
|
||||
if (child->type == SvgNodeType::Doc || child->type == SvgNodeType::G) scene->push(_sceneBuildHelper(child, vx, vy, vw, vh, node->style->opacity));
|
||||
else scene->push(_shapeBuildHelper(child, vx, vy, vw, vh));
|
||||
}
|
||||
}
|
||||
return move(scene);
|
||||
}
|
||||
return nullptr;
|
||||
|
|
Loading…
Add table
Reference in a new issue