mirror of
https://github.com/thorvg/thorvg.git
synced 2025-06-16 13:04:48 +00:00
svg: ++loc reduction
This commit is contained in:
parent
2e35f4eabb
commit
1c3b958d5b
2 changed files with 12 additions and 51 deletions
|
@ -3089,34 +3089,19 @@ static void _copyAttr(SvgNode* to, const SvgNode* from)
|
|||
//Copy node attribute
|
||||
switch (from->type) {
|
||||
case SvgNodeType::Circle: {
|
||||
to->node.circle.cx = from->node.circle.cx;
|
||||
to->node.circle.cy = from->node.circle.cy;
|
||||
to->node.circle.r = from->node.circle.r;
|
||||
to->node.circle = from->node.circle;
|
||||
break;
|
||||
}
|
||||
case SvgNodeType::Ellipse: {
|
||||
to->node.ellipse.cx = from->node.ellipse.cx;
|
||||
to->node.ellipse.cy = from->node.ellipse.cy;
|
||||
to->node.ellipse.rx = from->node.ellipse.rx;
|
||||
to->node.ellipse.ry = from->node.ellipse.ry;
|
||||
to->node.ellipse = from->node.ellipse;
|
||||
break;
|
||||
}
|
||||
case SvgNodeType::Rect: {
|
||||
to->node.rect.x = from->node.rect.x;
|
||||
to->node.rect.y = from->node.rect.y;
|
||||
to->node.rect.w = from->node.rect.w;
|
||||
to->node.rect.h = from->node.rect.h;
|
||||
to->node.rect.rx = from->node.rect.rx;
|
||||
to->node.rect.ry = from->node.rect.ry;
|
||||
to->node.rect.hasRx = from->node.rect.hasRx;
|
||||
to->node.rect.hasRy = from->node.rect.hasRy;
|
||||
to->node.rect = from->node.rect;
|
||||
break;
|
||||
}
|
||||
case SvgNodeType::Line: {
|
||||
to->node.line.x1 = from->node.line.x1;
|
||||
to->node.line.y1 = from->node.line.y1;
|
||||
to->node.line.x2 = from->node.line.x2;
|
||||
to->node.line.y2 = from->node.line.y2;
|
||||
to->node.line = from->node.line;
|
||||
break;
|
||||
}
|
||||
case SvgNodeType::Path: {
|
||||
|
|
|
@ -305,37 +305,23 @@ struct SvgUseNode
|
|||
|
||||
struct SvgEllipseNode
|
||||
{
|
||||
float cx;
|
||||
float cy;
|
||||
float rx;
|
||||
float ry;
|
||||
float cx, cy, rx, ry;
|
||||
};
|
||||
|
||||
struct SvgCircleNode
|
||||
{
|
||||
float cx;
|
||||
float cy;
|
||||
float r;
|
||||
float cx, cy, r;
|
||||
};
|
||||
|
||||
struct SvgRectNode
|
||||
{
|
||||
float x;
|
||||
float y;
|
||||
float w;
|
||||
float h;
|
||||
float rx;
|
||||
float ry;
|
||||
bool hasRx;
|
||||
bool hasRy;
|
||||
float x, y, w, h, rx, ry;
|
||||
bool hasRx, hasRy;
|
||||
};
|
||||
|
||||
struct SvgLineNode
|
||||
{
|
||||
float x1;
|
||||
float y1;
|
||||
float x2;
|
||||
float y2;
|
||||
float x1, y1, x2, y2;
|
||||
};
|
||||
|
||||
struct SvgImageNode
|
||||
|
@ -379,10 +365,7 @@ struct SvgTextNode
|
|||
|
||||
struct SvgLinearGradient
|
||||
{
|
||||
float x1;
|
||||
float y1;
|
||||
float x2;
|
||||
float y2;
|
||||
float x1, y1, x2, y2;
|
||||
bool isX1Percentage;
|
||||
bool isY1Percentage;
|
||||
bool isX2Percentage;
|
||||
|
@ -391,12 +374,7 @@ struct SvgLinearGradient
|
|||
|
||||
struct SvgRadialGradient
|
||||
{
|
||||
float cx;
|
||||
float cy;
|
||||
float fx;
|
||||
float fy;
|
||||
float r;
|
||||
float fr;
|
||||
float cx, cy, fx, fy, r, fr;
|
||||
bool isCxPercentage;
|
||||
bool isCyPercentage;
|
||||
bool isFxPercentage;
|
||||
|
@ -414,9 +392,7 @@ struct SvgComposite
|
|||
|
||||
struct SvgColor
|
||||
{
|
||||
uint8_t r;
|
||||
uint8_t g;
|
||||
uint8_t b;
|
||||
uint8_t r, g, b;
|
||||
};
|
||||
|
||||
struct SvgPaint
|
||||
|
|
Loading…
Add table
Reference in a new issue