mirror of
https://github.com/thorvg/thorvg.git
synced 2025-06-08 05:33:36 +00:00
svg_loader: fix vx and vy
If no viewbox is given, vx and vy were set to values corresponding to the svg's bounding box. This is now applied only if no viewbox and no width/height information is given. Otherwise, vx and vy are set to the default values (0, 0). @Issue: https://github.com/thorvg/thorvg/issues/1368
This commit is contained in:
parent
f089b77a45
commit
158e36f7c9
1 changed files with 9 additions and 3 deletions
|
@ -757,10 +757,16 @@ static unique_ptr<Scene> _sceneBuildHelper(const SvgNode* node, const Box& vBox,
|
|||
static void _applySvgViewFlag(const Scene* scene, float& vx, float& vy, float& vw, float& vh, float& w, float& h, SvgViewFlag viewFlag)
|
||||
{
|
||||
if (!((uint32_t)viewFlag & (uint32_t)SvgViewFlag::Viewbox)) {
|
||||
scene->bounds(&vx, &vy, &vw, &vh, false);
|
||||
float x, y;
|
||||
scene->bounds(&x, &y, &vw, &vh, false);
|
||||
if (!((uint32_t)viewFlag & (uint32_t)SvgViewFlag::Width) && !((uint32_t)viewFlag & (uint32_t)SvgViewFlag::Height)) {
|
||||
vx = x;
|
||||
vy = y;
|
||||
} else {
|
||||
if ((uint32_t)viewFlag & (uint32_t)SvgViewFlag::Width) vw = w;
|
||||
if ((uint32_t)viewFlag & (uint32_t)SvgViewFlag::Height) vh = h;
|
||||
}
|
||||
}
|
||||
if (!((uint32_t)viewFlag & (uint32_t)SvgViewFlag::Width)) w = vw;
|
||||
if (!((uint32_t)viewFlag & (uint32_t)SvgViewFlag::Height)) h = vh;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue