mirror of
https://github.com/thorvg/thorvg.git
synced 2025-06-15 04:24:28 +00:00
svg_loader: code refactoring.
leave to shape to handle non-effective values. Change-Id: I4193653710498e0ea31b0ff88fd8f0f8f0238e0e
This commit is contained in:
parent
231b3779b1
commit
ca6417ec8d
1 changed files with 6 additions and 6 deletions
|
@ -229,9 +229,9 @@ void _applyProperty(SvgNode* node, Shape* vg, float vx, float vy, float vw, floa
|
||||||
if (node->transform) {
|
if (node->transform) {
|
||||||
float tx = 0, ty = 0, s = 0, z = 0;
|
float tx = 0, ty = 0, s = 0, z = 0;
|
||||||
_getTransformationData(node->transform, &tx, &ty, &s, &z);
|
_getTransformationData(node->transform, &tx, &ty, &s, &z);
|
||||||
if (!(fabsf(s - 1) <= FLT_EPSILON)) vg->scale(s);
|
vg->scale(s);
|
||||||
if (!(fmod(fabsf(z), 360.0) <= FLT_EPSILON)) vg->rotate(fmod(z, 360.0));
|
vg->rotate(z);
|
||||||
if (!(fabsf(tx) <= FLT_EPSILON) && !(fabsf(ty) <= FLT_EPSILON)) vg->translate(tx, ty);
|
vg->translate(tx, ty);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (node->type == SvgNodeType::Doc) return;
|
if (node->type == SvgNodeType::Doc) return;
|
||||||
|
@ -362,9 +362,9 @@ unique_ptr<Scene> _sceneBuildHelper(SvgNode* node, float vx, float vy, float vw,
|
||||||
if (node->transform) {
|
if (node->transform) {
|
||||||
float tx = 0, ty = 0, s = 0, z = 0;
|
float tx = 0, ty = 0, s = 0, z = 0;
|
||||||
_getTransformationData(node->transform, &tx, &ty, &s, &z);
|
_getTransformationData(node->transform, &tx, &ty, &s, &z);
|
||||||
if (!(fabsf(s - 1) <= FLT_EPSILON)) scene->scale(s);
|
scene->scale(s);
|
||||||
if (!(fmod(fabsf(z), 360.0) <= FLT_EPSILON)) scene->rotate(fmod(z, 360.0));
|
scene->rotate(z);
|
||||||
if (!(fabsf(tx) <= FLT_EPSILON) && !(fabsf(ty) <= FLT_EPSILON)) scene->translate(tx, ty);
|
scene->translate(tx, ty);
|
||||||
}
|
}
|
||||||
node->style->opacity = (node->style->opacity * parentOpacity) / 255.0f;
|
node->style->opacity = (node->style->opacity * parentOpacity) / 255.0f;
|
||||||
for (auto child : node->child) {
|
for (auto child : node->child) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue