svg_loader: fixing svgs without viewbox attr

For svgs without any viewbox and width/height
whole image is drawn. Before it was forced
to set x=y=0.
This commit is contained in:
Mira Grudzinska 2023-04-01 17:14:04 +02:00 committed by Mira Grudzinska
parent 7b90d61e71
commit d60a7bec7e

View file

@ -757,9 +757,7 @@ 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(nullptr, nullptr, &vw, &vh, false);
vx = 0.0f;
vy = 0.0f;
scene->bounds(&vx, &vy, &vw, &vh, false);
if ((uint32_t)viewFlag & (uint32_t)SvgViewFlag::Width) vw = w;
if ((uint32_t)viewFlag & (uint32_t)SvgViewFlag::Height) vh = h;
}