mirror of
https://github.com/thorvg/thorvg.git
synced 2025-06-15 20:44:52 +00:00
svg_loader: removed unused variable
The gradient values passed to the scene builder are always given as percentages, so there is no need to mark/check that.
This commit is contained in:
parent
a4d2a99c03
commit
0497ac894e
3 changed files with 9 additions and 19 deletions
|
@ -1661,7 +1661,6 @@ static SvgStyleGradient* _cloneGradient(SvgStyleGradient* from)
|
||||||
grad->id = from->id ? _copyId(from->id->c_str()) : nullptr;
|
grad->id = from->id ? _copyId(from->id->c_str()) : nullptr;
|
||||||
grad->ref = from->ref ? _copyId(from->ref->c_str()) : nullptr;
|
grad->ref = from->ref ? _copyId(from->ref->c_str()) : nullptr;
|
||||||
grad->spread = from->spread;
|
grad->spread = from->spread;
|
||||||
grad->usePercentage = from->usePercentage;
|
|
||||||
grad->userSpace = from->userSpace;
|
grad->userSpace = from->userSpace;
|
||||||
|
|
||||||
if (from->transform) {
|
if (from->transform) {
|
||||||
|
@ -2063,8 +2062,6 @@ static SvgStyleGradient* _createRadialGradient(SvgLoaderData* loader, const char
|
||||||
radialTags[i].tagRecalc(loader, grad->radial, grad->userSpace);
|
radialTags[i].tagRecalc(loader, grad->radial, grad->userSpace);
|
||||||
}
|
}
|
||||||
|
|
||||||
grad->usePercentage = true;
|
|
||||||
|
|
||||||
return loader->svgParse->styleGrad;
|
return loader->svgParse->styleGrad;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2241,8 +2238,6 @@ static SvgStyleGradient* _createLinearGradient(SvgLoaderData* loader, const char
|
||||||
linear_tags[i].tagRecalc(loader, grad->linear, grad->userSpace);
|
linear_tags[i].tagRecalc(loader, grad->linear, grad->userSpace);
|
||||||
}
|
}
|
||||||
|
|
||||||
grad->usePercentage = true;
|
|
||||||
|
|
||||||
return loader->svgParse->styleGrad;
|
return loader->svgParse->styleGrad;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -266,7 +266,6 @@ struct SvgStyleGradient
|
||||||
Matrix* transform = nullptr;
|
Matrix* transform = nullptr;
|
||||||
Array<Fill::ColorStop> stops;
|
Array<Fill::ColorStop> stops;
|
||||||
bool userSpace = false;
|
bool userSpace = false;
|
||||||
bool usePercentage = false;
|
|
||||||
|
|
||||||
~SvgStyleGradient()
|
~SvgStyleGradient()
|
||||||
{
|
{
|
||||||
|
|
|
@ -46,12 +46,10 @@ static unique_ptr<LinearGradient> _applyLinearGradientProperty(SvgStyleGradient*
|
||||||
int stopCount = 0;
|
int stopCount = 0;
|
||||||
auto fillGrad = LinearGradient::gen();
|
auto fillGrad = LinearGradient::gen();
|
||||||
|
|
||||||
if (g->usePercentage) {
|
|
||||||
g->linear->x1 = g->linear->x1 * rw + rx;
|
g->linear->x1 = g->linear->x1 * rw + rx;
|
||||||
g->linear->y1 = g->linear->y1 * rh + ry;
|
g->linear->y1 = g->linear->y1 * rh + ry;
|
||||||
g->linear->x2 = g->linear->x2 * rw + rx;
|
g->linear->x2 = g->linear->x2 * rw + rx;
|
||||||
g->linear->y2 = g->linear->y2 * rh + ry;
|
g->linear->y2 = g->linear->y2 * rh + ry;
|
||||||
}
|
|
||||||
|
|
||||||
if (g->transform) {
|
if (g->transform) {
|
||||||
//Calc start point
|
//Calc start point
|
||||||
|
@ -109,13 +107,11 @@ static unique_ptr<RadialGradient> _applyRadialGradientProperty(SvgStyleGradient*
|
||||||
radius = sqrtf(pow(min, 2) + pow(min, 2)) / sqrtf(2.0f);
|
radius = sqrtf(pow(min, 2) + pow(min, 2)) / sqrtf(2.0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (g->usePercentage) {
|
|
||||||
g->radial->cx = g->radial->cx * rw + rx;
|
g->radial->cx = g->radial->cx * rw + rx;
|
||||||
g->radial->cy = g->radial->cy * rh + ry;
|
g->radial->cy = g->radial->cy * rh + ry;
|
||||||
g->radial->r = g->radial->r * radius;
|
g->radial->r = g->radial->r * radius;
|
||||||
g->radial->fx = g->radial->fx * rw + rx;
|
g->radial->fx = g->radial->fx * rw + rx;
|
||||||
g->radial->fy = g->radial->fy * rh + ry;
|
g->radial->fy = g->radial->fy * rh + ry;
|
||||||
}
|
|
||||||
|
|
||||||
//TODO: Radial gradient transformation - all tests possible after rx/ry implementation
|
//TODO: Radial gradient transformation - all tests possible after rx/ry implementation
|
||||||
if (g->transform) {
|
if (g->transform) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue