Lines Matching refs:node
912 static void _postpone(Array<SvgNodeIdPair>& nodes, SvgNode *node, char* id) in _postpone() argument
914 nodes.push({node, id}); in _postpone()
956 SvgNode* node = loader->svgParse->node; in _attrParseSvgNode() local
957 SvgDocNode* doc = &(node->node.doc); in _attrParseSvgNode()
1027 static void _handleColorAttr(TVG_UNUSED SvgLoaderData* loader, SvgNode* node, const char* value) in _handleColorAttr() argument
1029 SvgStyleProperty* style = node->style; in _handleColorAttr()
1036 static void _handleFillAttr(TVG_UNUSED SvgLoaderData* loader, SvgNode* node, const char* value) in _handleFillAttr() argument
1038 SvgStyleProperty* style = node->style; in _handleFillAttr()
1044 static void _handleStrokeAttr(TVG_UNUSED SvgLoaderData* loader, SvgNode* node, const char* value) in _handleStrokeAttr() argument
1046 SvgStyleProperty* style = node->style; in _handleStrokeAttr()
1052 static void _handleStrokeOpacityAttr(TVG_UNUSED SvgLoaderData* loader, SvgNode* node, const char* v… in _handleStrokeOpacityAttr() argument
1054 node->style->stroke.flags = (node->style->stroke.flags | SvgStrokeFlags::Opacity); in _handleStrokeOpacityAttr()
1055 node->style->stroke.opacity = _toOpacity(value); in _handleStrokeOpacityAttr()
1058 static void _handleStrokeDashArrayAttr(SvgLoaderData* loader, SvgNode* node, const char* value) in _handleStrokeDashArrayAttr() argument
1060 node->style->stroke.flags = (node->style->stroke.flags | SvgStrokeFlags::Dash); in _handleStrokeDashArrayAttr()
1061 _parseDashArray(loader, value, &node->style->stroke.dash); in _handleStrokeDashArrayAttr()
1064 static void _handleStrokeDashOffsetAttr(SvgLoaderData* loader, SvgNode* node, const char* value) in _handleStrokeDashOffsetAttr() argument
1066 node->style->stroke.flags = (node->style->stroke.flags | SvgStrokeFlags::DashOffset); in _handleStrokeDashOffsetAttr()
1067 …node->style->stroke.dash.offset = _toFloat(loader->svgParse, value, SvgParserLengthType::Horizonta… in _handleStrokeDashOffsetAttr()
1070 static void _handleStrokeWidthAttr(SvgLoaderData* loader, SvgNode* node, const char* value) in _handleStrokeWidthAttr() argument
1072 node->style->stroke.flags = (node->style->stroke.flags | SvgStrokeFlags::Width); in _handleStrokeWidthAttr()
1073 node->style->stroke.width = _toFloat(loader->svgParse, value, SvgParserLengthType::Diagonal); in _handleStrokeWidthAttr()
1077 static void _handleStrokeLineCapAttr(TVG_UNUSED SvgLoaderData* loader, SvgNode* node, const char* v… in _handleStrokeLineCapAttr() argument
1079 node->style->stroke.flags = (node->style->stroke.flags | SvgStrokeFlags::Cap); in _handleStrokeLineCapAttr()
1080 node->style->stroke.cap = _toLineCap(value); in _handleStrokeLineCapAttr()
1084 static void _handleStrokeLineJoinAttr(TVG_UNUSED SvgLoaderData* loader, SvgNode* node, const char* … in _handleStrokeLineJoinAttr() argument
1086 node->style->stroke.flags = (node->style->stroke.flags | SvgStrokeFlags::Join); in _handleStrokeLineJoinAttr()
1087 node->style->stroke.join = _toLineJoin(value); in _handleStrokeLineJoinAttr()
1090 static void _handleStrokeMiterlimitAttr(SvgLoaderData* loader, SvgNode* node, const char* value) in _handleStrokeMiterlimitAttr() argument
1099 node->style->stroke.miterlimit, miterlimit); in _handleStrokeMiterlimitAttr()
1103 node->style->stroke.flags = (node->style->stroke.flags | SvgStrokeFlags::Miterlimit); in _handleStrokeMiterlimitAttr()
1104 node->style->stroke.miterlimit = miterlimit; in _handleStrokeMiterlimitAttr()
1107 static void _handleFillRuleAttr(TVG_UNUSED SvgLoaderData* loader, SvgNode* node, const char* value) in _handleFillRuleAttr() argument
1109 node->style->fill.flags = (node->style->fill.flags | SvgFillFlags::FillRule); in _handleFillRuleAttr()
1110 node->style->fill.fillRule = _toFillRule(value); in _handleFillRuleAttr()
1114 static void _handleOpacityAttr(TVG_UNUSED SvgLoaderData* loader, SvgNode* node, const char* value) in _handleOpacityAttr() argument
1116 node->style->flags = (node->style->flags | SvgStyleFlags::Opacity); in _handleOpacityAttr()
1117 node->style->opacity = _toOpacity(value); in _handleOpacityAttr()
1121 static void _handleFillOpacityAttr(TVG_UNUSED SvgLoaderData* loader, SvgNode* node, const char* val… in _handleFillOpacityAttr() argument
1123 node->style->fill.flags = (node->style->fill.flags | SvgFillFlags::Opacity); in _handleFillOpacityAttr()
1124 node->style->fill.opacity = _toOpacity(value); in _handleFillOpacityAttr()
1128 static void _handleTransformAttr(TVG_UNUSED SvgLoaderData* loader, SvgNode* node, const char* value) in _handleTransformAttr() argument
1130 node->transform = _parseTransformationMatrix(value); in _handleTransformAttr()
1134 static void _handleClipPathAttr(TVG_UNUSED SvgLoaderData* loader, SvgNode* node, const char* value) in _handleClipPathAttr() argument
1136 SvgStyleProperty* style = node->style; in _handleClipPathAttr()
1145 static void _handleMaskAttr(TVG_UNUSED SvgLoaderData* loader, SvgNode* node, const char* value) in _handleMaskAttr() argument
1147 SvgStyleProperty* style = node->style; in _handleMaskAttr()
1156 static void _handleMaskTypeAttr(TVG_UNUSED SvgLoaderData* loader, SvgNode* node, const char* value) in _handleMaskTypeAttr() argument
1158 node->node.mask.type = _toMaskType(value); in _handleMaskTypeAttr()
1162 static void _handleDisplayAttr(TVG_UNUSED SvgLoaderData* loader, SvgNode* node, const char* value) in _handleDisplayAttr() argument
1168 node->style->flags = (node->style->flags | SvgStyleFlags::Display); in _handleDisplayAttr()
1169 if (!strcmp(value, "none")) node->style->display = false; in _handleDisplayAttr()
1170 else node->style->display = true; in _handleDisplayAttr()
1174 static void _handlePaintOrderAttr(TVG_UNUSED SvgLoaderData* loader, SvgNode* node, const char* valu… in _handlePaintOrderAttr() argument
1176 node->style->flags = (node->style->flags | SvgStyleFlags::PaintOrder); in _handlePaintOrderAttr()
1177 node->style->paintOrder = _toPaintOrder(value); in _handlePaintOrderAttr()
1181 static void _handleCssClassAttr(SvgLoaderData* loader, SvgNode* node, const char* value) in _handleCssClassAttr() argument
1183 auto cssClass = &node->style->cssClass; in _handleCssClassAttr()
1191 if (auto cssNode = cssFindStyleNode(loader->cssStyle, *cssClass, node->type)) { in _handleCssClassAttr()
1193 cssCopyStyleAttr(node, cssNode); in _handleCssClassAttr()
1197 cssCopyStyleAttr(node, cssNode); in _handleCssClassAttr()
1200 if (!cssClassFound) _postpone(loader->nodesToStyle, node, *cssClass); in _handleCssClassAttr()
1204 typedef void (*styleMethod)(SvgLoaderData* loader, SvgNode* node, const char* value);
1241 SvgNode* node = loader->svgParse->node; in _parseStyleAttr() local
1262 if (importance || !(node->style->flagsImportance & styleTags[i].flag)) { in _parseStyleAttr()
1263 styleTags[i].tagHandler(loader, node, value); in _parseStyleAttr()
1264 node->style->flags = (node->style->flags | styleTags[i].flag); in _parseStyleAttr()
1266 } else if (!(node->style->flags & styleTags[i].flag)) { in _parseStyleAttr()
1267 styleTags[i].tagHandler(loader, node, value); in _parseStyleAttr()
1270 node->style->flagsImportance = (node->style->flags | styleTags[i].flag); in _parseStyleAttr()
1293 SvgNode* node = loader->svgParse->node; in _attrParseGNode() local
1298 node->transform = _parseTransformationMatrix(value); in _attrParseGNode()
1300 if (node->id && value) free(node->id); in _attrParseGNode()
1301 node->id = _copyId(value); in _attrParseGNode()
1303 _handleCssClassAttr(loader, node, value); in _attrParseGNode()
1305 _handleClipPathAttr(loader, node, value); in _attrParseGNode()
1307 _handleMaskAttr(loader, node, value); in _attrParseGNode()
1321 SvgNode* node = loader->svgParse->node; in _attrParseClipPathNode() local
1322 SvgClipNode* clip = &(node->node.clip); in _attrParseClipPathNode()
1327 node->transform = _parseTransformationMatrix(value); in _attrParseClipPathNode()
1329 if (node->id && value) free(node->id); in _attrParseClipPathNode()
1330 node->id = _copyId(value); in _attrParseClipPathNode()
1332 _handleCssClassAttr(loader, node, value); in _attrParseClipPathNode()
1345 SvgNode* node = loader->svgParse->node; in _attrParseMaskNode() local
1346 SvgMaskNode* mask = &(node->node.mask); in _attrParseMaskNode()
1351 node->transform = _parseTransformationMatrix(value); in _attrParseMaskNode()
1353 if (node->id && value) free(node->id); in _attrParseMaskNode()
1354 node->id = _copyId(value); in _attrParseMaskNode()
1356 _handleCssClassAttr(loader, node, value); in _attrParseMaskNode()
1371 SvgNode* node = loader->svgParse->node; in _attrParseCssStyleNode() local
1374 if (node->id && value) free(node->id); in _attrParseCssStyleNode()
1375 node->id = _copyId(value); in _attrParseCssStyleNode()
1386 SvgNode* node = loader->svgParse->node; in _attrParseSymbolNode() local
1387 SvgSymbolNode* symbol = &(node->node.symbol); in _attrParseSymbolNode()
1413 SvgNode* node = (SvgNode*)calloc(1, sizeof(SvgNode)); in _createNode() local
1415 if (!node) return nullptr; in _createNode()
1418 node->style = (SvgStyleProperty*)calloc(1, sizeof(SvgStyleProperty)); in _createNode()
1420 if (!node->style) { in _createNode()
1421 free(node); in _createNode()
1427 node->style->fill.paint.none = false; in _createNode()
1429 node->style->fill.opacity = 255; in _createNode()
1430 node->style->opacity = 255; in _createNode()
1432 node->style->fill.paint.curColor = false; in _createNode()
1433 node->style->curColorSet = false; in _createNode()
1435 node->style->fill.fillRule = FillRule::Winding; in _createNode()
1438 node->style->stroke.paint.none = true; in _createNode()
1440 node->style->stroke.opacity = 255; in _createNode()
1442 node->style->stroke.paint.curColor = false; in _createNode()
1444 node->style->stroke.width = 1; in _createNode()
1446 node->style->stroke.cap = StrokeCap::Butt; in _createNode()
1448 node->style->stroke.join = StrokeJoin::Miter; in _createNode()
1449 node->style->stroke.miterlimit = 4.0f; in _createNode()
1450 node->style->stroke.scale = 1.0; in _createNode()
1452 node->style->paintOrder = _toPaintOrder("fill stroke"); in _createNode()
1455 node->style->display = true; in _createNode()
1457 node->parent = parent; in _createNode()
1458 node->type = type; in _createNode()
1460 if (parent) parent->child.push(node); in _createNode()
1461 return node; in _createNode()
1467 if (loader->def && loader->doc->node.doc.defs) return loader->def; in _createDefsNode()
1468 SvgNode* node = _createNode(nullptr, SvgNodeType::Defs); in _createDefsNode() local
1470 loader->def = node; in _createDefsNode()
1471 loader->doc->node.doc.defs = node; in _createDefsNode()
1472 return node; in _createDefsNode()
1478 loader->svgParse->node = _createNode(parent, SvgNodeType::G); in _createGNode()
1479 if (!loader->svgParse->node) return nullptr; in _createGNode()
1482 return loader->svgParse->node; in _createGNode()
1488 loader->svgParse->node = _createNode(parent, SvgNodeType::Doc); in _createSvgNode()
1489 if (!loader->svgParse->node) return nullptr; in _createSvgNode()
1490 SvgDocNode* doc = &(loader->svgParse->node->node.doc); in _createSvgNode()
1508 return loader->svgParse->node; in _createSvgNode()
1514 loader->svgParse->node = _createNode(parent, SvgNodeType::Mask); in _createMaskNode()
1515 if (!loader->svgParse->node) return nullptr; in _createMaskNode()
1517 loader->svgParse->node->node.mask.userSpace = true; in _createMaskNode()
1518 loader->svgParse->node->node.mask.type = SvgMaskType::Luminance; in _createMaskNode()
1522 return loader->svgParse->node; in _createMaskNode()
1528 loader->svgParse->node = _createNode(parent, SvgNodeType::ClipPath); in _createClipPathNode()
1529 if (!loader->svgParse->node) return nullptr; in _createClipPathNode()
1531 loader->svgParse->node->style->display = false; in _createClipPathNode()
1532 loader->svgParse->node->node.clip.userSpace = true; in _createClipPathNode()
1536 return loader->svgParse->node; in _createClipPathNode()
1542 loader->svgParse->node = _createNode(parent, SvgNodeType::CssStyle); in _createCssStyleNode()
1543 if (!loader->svgParse->node) return nullptr; in _createCssStyleNode()
1547 return loader->svgParse->node; in _createCssStyleNode()
1553 loader->svgParse->node = _createNode(parent, SvgNodeType::Symbol); in _createSymbolNode()
1554 if (!loader->svgParse->node) return nullptr; in _createSymbolNode()
1556 loader->svgParse->node->node.symbol.align = AspectRatioAlign::XMidYMid; in _createSymbolNode()
1557 loader->svgParse->node->node.symbol.meetOrSlice = AspectRatioMeetOrSlice::Meet; in _createSymbolNode()
1558 loader->svgParse->node->node.symbol.overflowVisible = false; in _createSymbolNode()
1560 loader->svgParse->node->node.symbol.hasViewBox = false; in _createSymbolNode()
1561 loader->svgParse->node->node.symbol.hasWidth = false; in _createSymbolNode()
1562 loader->svgParse->node->node.symbol.hasHeight = false; in _createSymbolNode()
1563 loader->svgParse->node->node.symbol.vx = 0.0f; in _createSymbolNode()
1564 loader->svgParse->node->node.symbol.vy = 0.0f; in _createSymbolNode()
1568 return loader->svgParse->node; in _createSymbolNode()
1575 SvgNode* node = loader->svgParse->node; in _attrParsePathNode() local
1576 SvgPathNode* path = &(node->node.path); in _attrParsePathNode()
1585 _handleClipPathAttr(loader, node, value); in _attrParsePathNode()
1587 _handleMaskAttr(loader, node, value); in _attrParsePathNode()
1589 if (node->id && value) free(node->id); in _attrParsePathNode()
1590 node->id = _copyId(value); in _attrParsePathNode()
1592 _handleCssClassAttr(loader, node, value); in _attrParsePathNode()
1602 loader->svgParse->node = _createNode(parent, SvgNodeType::Path); in _createPathNode()
1604 if (!loader->svgParse->node) return nullptr; in _createPathNode()
1608 return loader->svgParse->node; in _createPathNode()
1631 SvgNode* node = loader->svgParse->node; in _attrParseCircleNode() local
1632 SvgCircleNode* circle = &(node->node.circle); in _attrParseCircleNode()
1647 _handleClipPathAttr(loader, node, value); in _attrParseCircleNode()
1649 _handleMaskAttr(loader, node, value); in _attrParseCircleNode()
1651 if (node->id && value) free(node->id); in _attrParseCircleNode()
1652 node->id = _copyId(value); in _attrParseCircleNode()
1654 _handleCssClassAttr(loader, node, value); in _attrParseCircleNode()
1664 loader->svgParse->node = _createNode(parent, SvgNodeType::Circle); in _createCircleNode()
1666 if (!loader->svgParse->node) return nullptr; in _createCircleNode()
1669 return loader->svgParse->node; in _createCircleNode()
1693 SvgNode* node = loader->svgParse->node; in _attrParseEllipseNode() local
1694 SvgEllipseNode* ellipse = &(node->node.ellipse); in _attrParseEllipseNode()
1707 if (node->id && value) free(node->id); in _attrParseEllipseNode()
1708 node->id = _copyId(value); in _attrParseEllipseNode()
1710 _handleCssClassAttr(loader, node, value); in _attrParseEllipseNode()
1714 _handleClipPathAttr(loader, node, value); in _attrParseEllipseNode()
1716 _handleMaskAttr(loader, node, value); in _attrParseEllipseNode()
1726 loader->svgParse->node = _createNode(parent, SvgNodeType::Ellipse); in _createEllipseNode()
1728 if (!loader->svgParse->node) return nullptr; in _createEllipseNode()
1731 return loader->svgParse->node; in _createEllipseNode()
1752 SvgNode* node = loader->svgParse->node; in _attrParsePolygonNode() local
1755 if (node->type == SvgNodeType::Polygon) polygon = &(node->node.polygon); in _attrParsePolygonNode()
1756 else polygon = &(node->node.polyline); in _attrParsePolygonNode()
1763 _handleClipPathAttr(loader, node, value); in _attrParsePolygonNode()
1765 _handleMaskAttr(loader, node, value); in _attrParsePolygonNode()
1767 if (node->id && value) free(node->id); in _attrParsePolygonNode()
1768 node->id = _copyId(value); in _attrParsePolygonNode()
1770 _handleCssClassAttr(loader, node, value); in _attrParsePolygonNode()
1780 loader->svgParse->node = _createNode(parent, SvgNodeType::Polygon); in _createPolygonNode()
1782 if (!loader->svgParse->node) return nullptr; in _createPolygonNode()
1785 return loader->svgParse->node; in _createPolygonNode()
1791 loader->svgParse->node = _createNode(parent, SvgNodeType::Polyline); in _createPolylineNode()
1793 if (!loader->svgParse->node) return nullptr; in _createPolylineNode()
1796 return loader->svgParse->node; in _createPolylineNode()
1821 SvgNode* node = loader->svgParse->node; in _attrParseRectNode() local
1822 SvgRectNode* rect = &(node->node.rect); in _attrParseRectNode()
1843 if (node->id && value) free(node->id); in _attrParseRectNode()
1844 node->id = _copyId(value); in _attrParseRectNode()
1846 _handleCssClassAttr(loader, node, value); in _attrParseRectNode()
1850 _handleClipPathAttr(loader, node, value); in _attrParseRectNode()
1852 _handleMaskAttr(loader, node, value); in _attrParseRectNode()
1863 loader->svgParse->node = _createNode(parent, SvgNodeType::Rect); in _createRectNode()
1865 if (!loader->svgParse->node) return nullptr; in _createRectNode()
1867 loader->svgParse->node->node.rect.hasRx = loader->svgParse->node->node.rect.hasRy = false; in _createRectNode()
1870 return loader->svgParse->node; in _createRectNode()
1894 SvgNode* node = loader->svgParse->node; in _attrParseLineNode() local
1895 SvgLineNode* line = &(node->node.line); in _attrParseLineNode()
1908 if (node->id && value) free(node->id); in _attrParseLineNode()
1909 node->id = _copyId(value); in _attrParseLineNode()
1911 _handleCssClassAttr(loader, node, value); in _attrParseLineNode()
1915 _handleClipPathAttr(loader, node, value); in _attrParseLineNode()
1917 _handleMaskAttr(loader, node, value); in _attrParseLineNode()
1927 loader->svgParse->node = _createNode(parent, SvgNodeType::Line); in _createLineNode()
1929 if (!loader->svgParse->node) return nullptr; in _createLineNode()
1932 return loader->svgParse->node; in _createLineNode()
1964 SvgNode* node = loader->svgParse->node; in _attrParseImageNode() local
1965 SvgImageNode* image = &(node->node.image); in _attrParseImageNode()
1981 if (node->id && value) free(node->id); in _attrParseImageNode()
1982 node->id = _copyId(value); in _attrParseImageNode()
1984 _handleCssClassAttr(loader, node, value); in _attrParseImageNode()
1988 _handleClipPathAttr(loader, node, value); in _attrParseImageNode()
1990 _handleMaskAttr(loader, node, value); in _attrParseImageNode()
1992 node->transform = _parseTransformationMatrix(value); in _attrParseImageNode()
2002 loader->svgParse->node = _createNode(parent, SvgNodeType::Image); in _createImageNode()
2004 if (!loader->svgParse->node) return nullptr; in _createImageNode()
2007 return loader->svgParse->node; in _createImageNode()
2011 static SvgNode* _getDefsNode(SvgNode* node) in _getDefsNode() argument
2013 if (!node) return nullptr; in _getDefsNode()
2015 while (node->parent != nullptr) { in _getDefsNode()
2016 node = node->parent; in _getDefsNode()
2019 if (node->type == SvgNodeType::Doc) return node->node.doc.defs; in _getDefsNode()
2020 if (node->type == SvgNodeType::Defs) return node; in _getDefsNode()
2026 static SvgNode* _findNodeById(SvgNode *node, const char* id) in _findNodeById() argument
2028 if (!node) return nullptr; in _findNodeById()
2031 if (node->id && !strcmp(node->id, id)) return node; in _findNodeById()
2033 if (node->child.count > 0) { in _findNodeById()
2034 auto child = node->child.data; in _findNodeById()
2035 for (uint32_t i = 0; i < node->child.count; ++i, ++child) { in _findNodeById()
2044 static SvgNode* _findParentById(SvgNode* node, char* id, SvgNode* doc) in _findParentById() argument
2046 SvgNode *parent = node->parent; in _findParentById()
2075 SvgNode *defs, *nodeFrom, *node = loader->svgParse->node; in _attrParseUseNode() local
2078 SvgUseNode* use = &(node->node.use); in _attrParseUseNode()
2094 defs = _getDefsNode(node); in _attrParseUseNode()
2097 if (!_findParentById(node, id, loader->doc)) { in _attrParseUseNode()
2098 _cloneNode(nodeFrom, node, 0); in _attrParseUseNode()
2108 _postpone(loader->cloneNodes, node, id); in _attrParseUseNode()
2119 loader->svgParse->node = _createNode(parent, SvgNodeType::Use); in _createUseNode()
2121 if (!loader->svgParse->node) return nullptr; in _createUseNode()
2123 loader->svgParse->node->node.use.isWidthSet = false; in _createUseNode()
2124 loader->svgParse->node->node.use.isHeightSet = false; in _createUseNode()
2127 return loader->svgParse->node; in _createUseNode()
2147 SvgNode* node = loader->svgParse->node; in _attrParseTextNode() local
2148 SvgTextNode* text = &(node->node.text); in _attrParseTextNode()
2167 _handleClipPathAttr(loader, node, value); in _attrParseTextNode()
2169 _handleMaskAttr(loader, node, value); in _attrParseTextNode()
2171 if (node->id && value) free(node->id); in _attrParseTextNode()
2172 node->id = _copyId(value); in _attrParseTextNode()
2174 _handleCssClassAttr(loader, node, value); in _attrParseTextNode()
2184 loader->svgParse->node = _createNode(parent, SvgNodeType::Text); in _createTextNode()
2185 if (!loader->svgParse->node) return nullptr; in _createTextNode()
2188 loader->svgParse->node->node.text.fontSize = 10.0f; in _createTextNode()
2189 loader->svgParse->node->node.text.fontFamily = nullptr; in _createTextNode()
2190 loader->svgParse->node->node.text.text = nullptr; in _createTextNode()
2194 return loader->svgParse->node; in _createTextNode()
3131 to->node.circle.cx = from->node.circle.cx; in _copyAttr()
3132 to->node.circle.cy = from->node.circle.cy; in _copyAttr()
3133 to->node.circle.r = from->node.circle.r; in _copyAttr()
3137 to->node.ellipse.cx = from->node.ellipse.cx; in _copyAttr()
3138 to->node.ellipse.cy = from->node.ellipse.cy; in _copyAttr()
3139 to->node.ellipse.rx = from->node.ellipse.rx; in _copyAttr()
3140 to->node.ellipse.ry = from->node.ellipse.ry; in _copyAttr()
3144 to->node.rect.x = from->node.rect.x; in _copyAttr()
3145 to->node.rect.y = from->node.rect.y; in _copyAttr()
3146 to->node.rect.w = from->node.rect.w; in _copyAttr()
3147 to->node.rect.h = from->node.rect.h; in _copyAttr()
3148 to->node.rect.rx = from->node.rect.rx; in _copyAttr()
3149 to->node.rect.ry = from->node.rect.ry; in _copyAttr()
3150 to->node.rect.hasRx = from->node.rect.hasRx; in _copyAttr()
3151 to->node.rect.hasRy = from->node.rect.hasRy; in _copyAttr()
3155 to->node.line.x1 = from->node.line.x1; in _copyAttr()
3156 to->node.line.y1 = from->node.line.y1; in _copyAttr()
3157 to->node.line.x2 = from->node.line.x2; in _copyAttr()
3158 to->node.line.y2 = from->node.line.y2; in _copyAttr()
3162 if (from->node.path.path) { in _copyAttr()
3163 if (to->node.path.path) free(to->node.path.path); in _copyAttr()
3164 to->node.path.path = strdup(from->node.path.path); in _copyAttr()
3169 if ((to->node.polygon.pts.count = from->node.polygon.pts.count)) { in _copyAttr()
3170 to->node.polygon.pts = from->node.polygon.pts; in _copyAttr()
3175 if ((to->node.polyline.pts.count = from->node.polyline.pts.count)) { in _copyAttr()
3176 to->node.polyline.pts = from->node.polyline.pts; in _copyAttr()
3181 to->node.image.x = from->node.image.x; in _copyAttr()
3182 to->node.image.y = from->node.image.y; in _copyAttr()
3183 to->node.image.w = from->node.image.w; in _copyAttr()
3184 to->node.image.h = from->node.image.h; in _copyAttr()
3185 if (from->node.image.href) { in _copyAttr()
3186 if (to->node.image.href) free(to->node.image.href); in _copyAttr()
3187 to->node.image.href = strdup(from->node.image.href); in _copyAttr()
3192 to->node.use.x = from->node.use.x; in _copyAttr()
3193 to->node.use.y = from->node.use.y; in _copyAttr()
3194 to->node.use.w = from->node.use.w; in _copyAttr()
3195 to->node.use.h = from->node.use.h; in _copyAttr()
3196 to->node.use.isWidthSet = from->node.use.isWidthSet; in _copyAttr()
3197 to->node.use.isHeightSet = from->node.use.isHeightSet; in _copyAttr()
3198 to->node.use.symbol = from->node.use.symbol; in _copyAttr()
3202 to->node.text.x = from->node.text.x; in _copyAttr()
3203 to->node.text.y = from->node.text.y; in _copyAttr()
3204 to->node.text.fontSize = from->node.text.fontSize; in _copyAttr()
3205 if (from->node.text.text) { in _copyAttr()
3206 if (to->node.text.text) free(to->node.text.text); in _copyAttr()
3207 to->node.text.text = strdup(from->node.text.text); in _copyAttr()
3209 if (from->node.text.fontFamily) { in _copyAttr()
3210 if (to->node.text.fontFamily) free(to->node.text.fontFamily); in _copyAttr()
3211 to->node.text.fontFamily = strdup(from->node.text.fontFamily); in _copyAttr()
3251 auto defs = _getDefsNode(nodeIdPair.node); in _clonePostponedNodes()
3254 if (!_findParentById(nodeIdPair.node, nodeIdPair.id, doc)) { in _clonePostponedNodes()
3255 _cloneNode(nodeFrom, nodeIdPair.node, 0); in _clonePostponedNodes()
3256 …if (nodeFrom && nodeFrom->type == SvgNodeType::Symbol && nodeIdPair.node->type == SvgNodeType::Use… in _clonePostponedNodes()
3257 nodeIdPair.node->node.use.symbol = nodeFrom; in _clonePostponedNodes()
3314 SvgNode *node = nullptr, *parent = nullptr; in _svgLoaderParserXmlOpen() local
3340 node = method(loader, nullptr, attrs, attrsLength, simpleXmlParseAttributes); in _svgLoaderParserXmlOpen()
3341 loader->doc = node; in _svgLoaderParserXmlOpen()
3350 node = method(loader, nullptr, attrs, attrsLength, simpleXmlParseAttributes); in _svgLoaderParserXmlOpen()
3351 loader->cssStyle = node; in _svgLoaderParserXmlOpen()
3352 loader->doc->node.doc.style = node; in _svgLoaderParserXmlOpen()
3356 node = method(loader, parent, attrs, attrsLength, simpleXmlParseAttributes); in _svgLoaderParserXmlOpen()
3360 if (!node) return; in _svgLoaderParserXmlOpen()
3361 if (node->type != SvgNodeType::Defs || !empty) { in _svgLoaderParserXmlOpen()
3362 loader->stack.push(node); in _svgLoaderParserXmlOpen()
3367 node = method(loader, parent, attrs, attrsLength, simpleXmlParseAttributes); in _svgLoaderParserXmlOpen()
3368 if (node && !empty) { in _svgLoaderParserXmlOpen()
3372 loader->currentGraphicsNode = node; in _svgLoaderParserXmlOpen()
3383 if (loader->def && loader->doc->node.doc.defs) { in _svgLoaderParserXmlOpen()
3384 loader->def->node.defs.gradients.push(gradient); in _svgLoaderParserXmlOpen()
3407 auto text = &loader->svgParse->node->node.text; in _svgLoaderParserText()
3421 SvgNode *node = nullptr; in _svgLoaderParserXmlCssStyle() local
3425 …if ((node = method(loader, loader->cssStyle, attrs, attrsLength, simpleXmlParseW3CAttribute))) nod… in _svgLoaderParserXmlCssStyle()
3427 …if ((node = method(loader, loader->cssStyle, attrs, attrsLength, simpleXmlParseW3CAttribute))) nod… in _svgLoaderParserXmlCssStyle()
3433 …if ((node = _createCssStyleNode(loader, loader->cssStyle, attrs, attrsLength, simpleXmlParseW3CAtt… in _svgLoaderParserXmlCssStyle()
3488 static void _inefficientNodeCheck(TVG_UNUSED SvgNode* node) in _inefficientNodeCheck() argument
3491 auto type = simpleXmlNodeTypeToString(node->type); in _inefficientNodeCheck()
3493 …if (!node->style->display && node->type != SvgNodeType::ClipPath) TVGLOG("SVG", "Inefficient eleme… in _inefficientNodeCheck()
3494 …if (node->style->opacity == 0) TVGLOG("SVG", "Inefficient elements used [Opacity is zero][Node Typ… in _inefficientNodeCheck()
3495 …if (node->style->fill.opacity == 0 && node->style->stroke.opacity == 0) TVGLOG("SVG", "Inefficient… in _inefficientNodeCheck()
3497 switch (node->type) { in _inefficientNodeCheck()
3499 …if (!node->node.path.path) TVGLOG("SVG", "Inefficient elements used [Empty path][Node Type : %s]",… in _inefficientNodeCheck()
3503 …if (node->node.ellipse.rx == 0 && node->node.ellipse.ry == 0) TVGLOG("SVG", "Inefficient elements … in _inefficientNodeCheck()
3508 …if (node->node.polygon.pts.count < 2) TVGLOG("SVG", "Inefficient elements used [Invalid Polygon][N… in _inefficientNodeCheck()
3512 …if (node->node.circle.r == 0) TVGLOG("SVG", "Inefficient elements used [Size is zero][Node Type : … in _inefficientNodeCheck()
3516 …if (node->node.rect.w == 0 && node->node.rect.h) TVGLOG("SVG", "Inefficient elements used [Size is… in _inefficientNodeCheck()
3520 …if (node->node.line.x1 == node->node.line.x2 && node->node.line.y1 == node->node.line.y2) TVGLOG("… in _inefficientNodeCheck()
3529 static void _updateStyle(SvgNode* node, SvgStyleProperty* parentStyle) in _updateStyle() argument
3531 _styleInherit(node->style, parentStyle); in _updateStyle()
3532 _inefficientNodeCheck(node); in _updateStyle()
3534 auto child = node->child.data; in _updateStyle()
3535 for (uint32_t i = 0; i < node->child.count; ++i, ++child) { in _updateStyle()
3536 _updateStyle(*child, node->style); in _updateStyle()
3570 static void _updateGradient(SvgLoaderData* loader, SvgNode* node, Array<SvgStyleGradient*>* gradien… in _updateGradient() argument
3572 if (node->child.count > 0) { in _updateGradient()
3573 auto child = node->child.data; in _updateGradient()
3574 for (uint32_t i = 0; i < node->child.count; ++i, ++child) { in _updateGradient()
3578 if (node->style->fill.paint.url) { in _updateGradient()
3579 auto newGrad = _gradientDup(loader, gradients, node->style->fill.paint.url); in _updateGradient()
3581 if (node->style->fill.paint.gradient) { in _updateGradient()
3582 node->style->fill.paint.gradient->clear(); in _updateGradient()
3583 free(node->style->fill.paint.gradient); in _updateGradient()
3585 node->style->fill.paint.gradient = newGrad; in _updateGradient()
3588 if (node->style->stroke.paint.url) { in _updateGradient()
3589 auto newGrad = _gradientDup(loader, gradients, node->style->stroke.paint.url); in _updateGradient()
3591 if (node->style->stroke.paint.gradient) { in _updateGradient()
3592 node->style->stroke.paint.gradient->clear(); in _updateGradient()
3593 free(node->style->stroke.paint.gradient); in _updateGradient()
3595 node->style->stroke.paint.gradient = newGrad; in _updateGradient()
3602 static void _updateComposite(SvgNode* node, SvgNode* root) in _updateComposite() argument
3604 if (node->style->clipPath.url && !node->style->clipPath.node) { in _updateComposite()
3605 SvgNode* findResult = _findNodeById(root, node->style->clipPath.url); in _updateComposite()
3606 if (findResult) node->style->clipPath.node = findResult; in _updateComposite()
3608 if (node->style->mask.url && !node->style->mask.node) { in _updateComposite()
3609 SvgNode* findResult = _findNodeById(root, node->style->mask.url); in _updateComposite()
3610 if (findResult) node->style->mask.node = findResult; in _updateComposite()
3612 if (node->child.count > 0) { in _updateComposite()
3613 auto child = node->child.data; in _updateComposite()
3614 for (uint32_t i = 0; i < node->child.count; ++i, ++child) { in _updateComposite()
3645 static void _freeNode(SvgNode* node) in _freeNode() argument
3647 if (!node) return; in _freeNode()
3649 auto child = node->child.data; in _freeNode()
3650 for (uint32_t i = 0; i < node->child.count; ++i, ++child) { in _freeNode()
3653 node->child.reset(); in _freeNode()
3655 free(node->id); in _freeNode()
3656 free(node->transform); in _freeNode()
3657 _freeNodeStyle(node->style); in _freeNode()
3658 switch (node->type) { in _freeNode()
3660 free(node->node.path.path); in _freeNode()
3664 free(node->node.polygon.pts.data); in _freeNode()
3668 free(node->node.polyline.pts.data); in _freeNode()
3672 _freeNode(node->node.doc.defs); in _freeNode()
3673 _freeNode(node->node.doc.style); in _freeNode()
3677 auto gradients = node->node.defs.gradients.data; in _freeNode()
3678 for (size_t i = 0; i < node->node.defs.gradients.count; ++i) { in _freeNode()
3683 node->node.defs.gradients.reset(); in _freeNode()
3687 free(node->node.image.href); in _freeNode()
3691 free(node->node.text.text); in _freeNode()
3692 free(node->node.text.fontFamily); in _freeNode()
3699 free(node); in _freeNode()
3709 SvgNode *node = nullptr; in _svgLoaderParserForValidCheckXmlOpen() local
3732 node = method(loader, nullptr, attrs, attrsLength, simpleXmlParseAttributes); in _svgLoaderParserForValidCheckXmlOpen()
3733 loader->doc = node; in _svgLoaderParserForValidCheckXmlOpen()
3734 loader->stack.push(node); in _svgLoaderParserForValidCheckXmlOpen()
3825 auto defs = loaderData.doc->node.doc.defs; in run()
3839 if (defs) _updateGradient(&loaderData, loaderData.doc, &defs->node.defs.gradients); in run()
3847 vx = loaderData.doc->node.doc.vx; in run()
3848 vy = loaderData.doc->node.doc.vy; in run()
3849 vw = loaderData.doc->node.doc.vw; in run()
3850 vh = loaderData.doc->node.doc.vh; in run()
3851 w = loaderData.doc->node.doc.w; in run()
3852 h = loaderData.doc->node.doc.h; in run()
3873 viewFlag = loaderData.doc->node.doc.viewFlag; in header()
3874 align = loaderData.doc->node.doc.align; in header()
3875 meetOrSlice = loaderData.doc->node.doc.meetOrSlice; in header()
3878 vx = loaderData.doc->node.doc.vx; in header()
3879 vy = loaderData.doc->node.doc.vy; in header()
3880 vw = loaderData.doc->node.doc.vw; in header()
3881 vh = loaderData.doc->node.doc.vh; in header()
3883 if (viewFlag & SvgViewFlag::Width) w = loaderData.doc->node.doc.w; in header()
3885 w = loaderData.doc->node.doc.vw; in header()
3887 w *= loaderData.doc->node.doc.w; in header()
3892 if (viewFlag & SvgViewFlag::Height) h = loaderData.doc->node.doc.h; in header()
3894 h = loaderData.doc->node.doc.vh; in header()
3896 h *= loaderData.doc->node.doc.h; in header()
3907 vw = w = loaderData.doc->node.doc.w; in header()
3911 w = loaderData.doc->node.doc.w; in header()
3916 vh = h = loaderData.doc->node.doc.h; in header()
3920 h = loaderData.doc->node.doc.h; in header()