mirror of
https://github.com/thorvg/thorvg.git
synced 2025-06-14 12:04:29 +00:00
svg_loader: code refactoring
remove macro code that does not helpful. This just decrease readibility and increase LOC. Change-Id: I9f1b11318447b45a9f96e7b00c18141fd9e71f9a
This commit is contained in:
parent
9f6b5eb59e
commit
28ae7a4411
1 changed files with 17 additions and 42 deletions
|
@ -1004,12 +1004,6 @@ static SvgNode* _createPathNode(SvgLoaderData* loader, SvgNode* parent, const ch
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#define CIRCLE_DEF(Name, Field, Type) \
|
|
||||||
{ \
|
|
||||||
#Name, Type, sizeof(#Name), offsetof(SvgCircleNode, Field) \
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static constexpr struct
|
static constexpr struct
|
||||||
{
|
{
|
||||||
const char* tag;
|
const char* tag;
|
||||||
|
@ -1017,9 +1011,9 @@ static constexpr struct
|
||||||
int sz;
|
int sz;
|
||||||
size_t offset;
|
size_t offset;
|
||||||
} circleTags[] = {
|
} circleTags[] = {
|
||||||
CIRCLE_DEF(cx, cx, SvgParserLengthType::Horizontal),
|
{"cx", SvgParserLengthType::Horizontal, sizeof("cx"), offsetof(SvgCircleNode, cx)},
|
||||||
CIRCLE_DEF(cy, cy, SvgParserLengthType::Vertical),
|
{"cy", SvgParserLengthType::Vertical, sizeof("cy"), offsetof(SvgCircleNode, cy)},
|
||||||
CIRCLE_DEF(r, r, SvgParserLengthType::Other)
|
{"r", SvgParserLengthType::Other, sizeof("r"), offsetof(SvgCircleNode, r)}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -1063,12 +1057,6 @@ static SvgNode* _createCircleNode(SvgLoaderData* loader, SvgNode* parent, const
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#define ELLIPSE_DEF(Name, Field, Type) \
|
|
||||||
{ \
|
|
||||||
#Name, Type, sizeof(#Name), offsetof(SvgEllipseNode, Field) \
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static constexpr struct
|
static constexpr struct
|
||||||
{
|
{
|
||||||
const char* tag;
|
const char* tag;
|
||||||
|
@ -1076,10 +1064,10 @@ static constexpr struct
|
||||||
int sz;
|
int sz;
|
||||||
size_t offset;
|
size_t offset;
|
||||||
} ellipseTags[] = {
|
} ellipseTags[] = {
|
||||||
ELLIPSE_DEF(cx, cx, SvgParserLengthType::Horizontal),
|
{"cx", SvgParserLengthType::Horizontal, sizeof("cx"), offsetof(SvgEllipseNode, cx)},
|
||||||
ELLIPSE_DEF(cy, cy, SvgParserLengthType::Vertical),
|
{"cy", SvgParserLengthType::Vertical, sizeof("cy"), offsetof(SvgEllipseNode, cy)},
|
||||||
ELLIPSE_DEF(rx, rx, SvgParserLengthType::Horizontal),
|
{"rx", SvgParserLengthType::Horizontal, sizeof("rx"), offsetof(SvgEllipseNode, rx)},
|
||||||
ELLIPSE_DEF(ry, ry, SvgParserLengthType::Vertical)
|
{"ry", SvgParserLengthType::Vertical, sizeof("ry"), offsetof(SvgEllipseNode, ry)}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -1202,13 +1190,6 @@ static SvgNode* _createPolylineNode(SvgLoaderData* loader, SvgNode* parent, cons
|
||||||
return loader->svgParse->node;
|
return loader->svgParse->node;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#define RECT_DEF(Name, Field, Type) \
|
|
||||||
{ \
|
|
||||||
#Name, Type, sizeof(#Name), offsetof(SvgRectNode, Field) \
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static constexpr struct
|
static constexpr struct
|
||||||
{
|
{
|
||||||
const char* tag;
|
const char* tag;
|
||||||
|
@ -1216,12 +1197,12 @@ static constexpr struct
|
||||||
int sz;
|
int sz;
|
||||||
size_t offset;
|
size_t offset;
|
||||||
} rectTags[] = {
|
} rectTags[] = {
|
||||||
RECT_DEF(x, x, SvgParserLengthType::Horizontal),
|
{"x", SvgParserLengthType::Horizontal, sizeof("x"), offsetof(SvgRectNode, x)},
|
||||||
RECT_DEF(y, y, SvgParserLengthType::Vertical),
|
{"y", SvgParserLengthType::Vertical, sizeof("y"), offsetof(SvgRectNode, y)},
|
||||||
RECT_DEF(width, w, SvgParserLengthType::Horizontal),
|
{"width", SvgParserLengthType::Horizontal, sizeof("width"), offsetof(SvgRectNode, w)},
|
||||||
RECT_DEF(height, h, SvgParserLengthType::Vertical),
|
{"height", SvgParserLengthType::Vertical, sizeof("height"), offsetof(SvgRectNode, h)},
|
||||||
RECT_DEF(rx, rx, SvgParserLengthType::Horizontal),
|
{"rx", SvgParserLengthType::Horizontal, sizeof("rx"), offsetof(SvgRectNode, rx)},
|
||||||
RECT_DEF(ry, ry, SvgParserLengthType::Vertical)
|
{"ry", SvgParserLengthType::Vertical, sizeof("ry"), offsetof(SvgRectNode, ry)}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -1271,12 +1252,6 @@ static SvgNode* _createRectNode(SvgLoaderData* loader, SvgNode* parent, const ch
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#define LINE_DEF(Name, Field, Type) \
|
|
||||||
{ \
|
|
||||||
#Name, Type, sizeof(#Name), offsetof(SvgLineNode, Field) \
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static constexpr struct
|
static constexpr struct
|
||||||
{
|
{
|
||||||
const char* tag;
|
const char* tag;
|
||||||
|
@ -1284,10 +1259,10 @@ static constexpr struct
|
||||||
int sz;
|
int sz;
|
||||||
size_t offset;
|
size_t offset;
|
||||||
} lineTags[] = {
|
} lineTags[] = {
|
||||||
LINE_DEF(x1, x1, SvgParserLengthType::Horizontal),
|
{"x1", SvgParserLengthType::Horizontal, sizeof("x1"), offsetof(SvgLineNode, x1)},
|
||||||
LINE_DEF(y1, y1, SvgParserLengthType::Vertical),
|
{"y1", SvgParserLengthType::Vertical, sizeof("y1"), offsetof(SvgLineNode, y1)},
|
||||||
LINE_DEF(x2, x2, SvgParserLengthType::Horizontal),
|
{"x2", SvgParserLengthType::Horizontal, sizeof("x2"), offsetof(SvgLineNode, x2)},
|
||||||
LINE_DEF(y2, y2, SvgParserLengthType::Vertical)
|
{"y2", SvgParserLengthType::Vertical, sizeof("y2"), offsetof(SvgLineNode, y2)}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue