mirror of
https://github.com/thorvg/thorvg.git
synced 2025-06-14 12:04:29 +00:00
svg_loader: preserveAspectRatio fix
The default value should be xMidYMid, now it is.
This commit is contained in:
parent
bdda2586e9
commit
d1e7d60fc9
1 changed files with 2 additions and 6 deletions
|
@ -705,17 +705,13 @@ unique_ptr<Scene> svgSceneBuild(SvgNode* node, float vx, float vy, float vw, flo
|
|||
auto tvy = vy * scale;
|
||||
auto tvw = vw * scale;
|
||||
auto tvh = vh * scale;
|
||||
if (vw > vh) tvy -= (h - tvh) * 0.5f;
|
||||
else tvx -= (w - tvw) * 0.5f;
|
||||
tvx -= (w - tvw) * 0.5f;
|
||||
tvy -= (h - tvh) * 0.5f;
|
||||
docNode->translate(-tvx, -tvy);
|
||||
} else {
|
||||
//Align
|
||||
auto tvx = vx * sx;
|
||||
auto tvy = vy * sy;
|
||||
auto tvw = vw * sx;
|
||||
auto tvh = vh * sy;
|
||||
if (tvw > tvh) tvy -= (h - tvh) * 0.5f;
|
||||
else tvx -= (w - tvw) * 0.5f;
|
||||
Matrix m = {sx, 0, -tvx, 0, sy, -tvy, 0, 0, 1};
|
||||
docNode->transform(m);
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue