svg: ++loc reduction

This commit is contained in:
Hermet Park 2025-01-14 21:03:59 +09:00
parent 2e35f4eabb
commit 1c3b958d5b
2 changed files with 12 additions and 51 deletions

View file

@ -3089,34 +3089,19 @@ static void _copyAttr(SvgNode* to, const SvgNode* from)
//Copy node attribute //Copy node attribute
switch (from->type) { switch (from->type) {
case SvgNodeType::Circle: { case SvgNodeType::Circle: {
to->node.circle.cx = from->node.circle.cx; to->node.circle = from->node.circle;
to->node.circle.cy = from->node.circle.cy;
to->node.circle.r = from->node.circle.r;
break; break;
} }
case SvgNodeType::Ellipse: { case SvgNodeType::Ellipse: {
to->node.ellipse.cx = from->node.ellipse.cx; to->node.ellipse = from->node.ellipse;
to->node.ellipse.cy = from->node.ellipse.cy;
to->node.ellipse.rx = from->node.ellipse.rx;
to->node.ellipse.ry = from->node.ellipse.ry;
break; break;
} }
case SvgNodeType::Rect: { case SvgNodeType::Rect: {
to->node.rect.x = from->node.rect.x; to->node.rect = from->node.rect;
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;
break; break;
} }
case SvgNodeType::Line: { case SvgNodeType::Line: {
to->node.line.x1 = from->node.line.x1; to->node.line = from->node.line;
to->node.line.y1 = from->node.line.y1;
to->node.line.x2 = from->node.line.x2;
to->node.line.y2 = from->node.line.y2;
break; break;
} }
case SvgNodeType::Path: { case SvgNodeType::Path: {

View file

@ -305,37 +305,23 @@ struct SvgUseNode
struct SvgEllipseNode struct SvgEllipseNode
{ {
float cx; float cx, cy, rx, ry;
float cy;
float rx;
float ry;
}; };
struct SvgCircleNode struct SvgCircleNode
{ {
float cx; float cx, cy, r;
float cy;
float r;
}; };
struct SvgRectNode struct SvgRectNode
{ {
float x; float x, y, w, h, rx, ry;
float y; bool hasRx, hasRy;
float w;
float h;
float rx;
float ry;
bool hasRx;
bool hasRy;
}; };
struct SvgLineNode struct SvgLineNode
{ {
float x1; float x1, y1, x2, y2;
float y1;
float x2;
float y2;
}; };
struct SvgImageNode struct SvgImageNode
@ -379,10 +365,7 @@ struct SvgTextNode
struct SvgLinearGradient struct SvgLinearGradient
{ {
float x1; float x1, y1, x2, y2;
float y1;
float x2;
float y2;
bool isX1Percentage; bool isX1Percentage;
bool isY1Percentage; bool isY1Percentage;
bool isX2Percentage; bool isX2Percentage;
@ -391,12 +374,7 @@ struct SvgLinearGradient
struct SvgRadialGradient struct SvgRadialGradient
{ {
float cx; float cx, cy, fx, fy, r, fr;
float cy;
float fx;
float fy;
float r;
float fr;
bool isCxPercentage; bool isCxPercentage;
bool isCyPercentage; bool isCyPercentage;
bool isFxPercentage; bool isFxPercentage;
@ -414,9 +392,7 @@ struct SvgComposite
struct SvgColor struct SvgColor
{ {
uint8_t r; uint8_t r, g, b;
uint8_t g;
uint8_t b;
}; };
struct SvgPaint struct SvgPaint