mirror of
https://github.com/thorvg/thorvg.git
synced 2025-07-23 22:58:44 +00:00
svg_loader: fixing grad overwritting
Gradient was mistakenly overwritten in files in which the <def> section existed, but grad was defined outside it.
This commit is contained in:
parent
92dbc8507e
commit
83ffe9f612
1 changed files with 14 additions and 8 deletions
|
@ -3265,18 +3265,24 @@ static void _updateGradient(SvgLoaderData* loader, SvgNode* node, Array<SvgStyle
|
|||
}
|
||||
} else {
|
||||
if (node->style->fill.paint.url) {
|
||||
if (node->style->fill.paint.gradient) {
|
||||
node->style->fill.paint.gradient->clear();
|
||||
free(node->style->fill.paint.gradient);
|
||||
auto newGrad = _gradientDup(loader, gradients, node->style->fill.paint.url);
|
||||
if (newGrad) {
|
||||
if (node->style->fill.paint.gradient) {
|
||||
node->style->fill.paint.gradient->clear();
|
||||
free(node->style->fill.paint.gradient);
|
||||
}
|
||||
node->style->fill.paint.gradient = newGrad;
|
||||
}
|
||||
node->style->fill.paint.gradient = _gradientDup(loader, gradients, node->style->fill.paint.url);
|
||||
}
|
||||
if (node->style->stroke.paint.url) {
|
||||
if (node->style->stroke.paint.gradient) {
|
||||
node->style->stroke.paint.gradient->clear();
|
||||
free(node->style->stroke.paint.gradient);
|
||||
auto newGrad = _gradientDup(loader, gradients, node->style->stroke.paint.url);
|
||||
if (newGrad) {
|
||||
if (node->style->stroke.paint.gradient) {
|
||||
node->style->stroke.paint.gradient->clear();
|
||||
free(node->style->stroke.paint.gradient);
|
||||
}
|
||||
node->style->stroke.paint.gradient = newGrad;
|
||||
}
|
||||
node->style->stroke.paint.gradient = _gradientDup(loader, gradients, node->style->stroke.paint.url);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue