loader svg: displaying SVG images without the specified viewBox attribute

If no viewBox attribute is given, the height and width attributes are used
to establish the viewBox size. However, this information was not available
inside the scene builder, even though it was needed.
This commit is contained in:
Mira Grudzinska 2021-04-14 01:19:33 +02:00 committed by JunsuChoi
parent f1feebf047
commit 332012dd6b
3 changed files with 3 additions and 8 deletions

View file

@ -2575,7 +2575,7 @@ void SvgLoader::run(unsigned tid)
_updateComposite(loaderData.doc, loaderData.doc);
if (defs) _updateComposite(loaderData.doc, defs);
}
root = svgSceneBuild(loaderData.doc);
root = svgSceneBuild(loaderData.doc, vx, vy, vw, vh);
};

View file

@ -398,15 +398,10 @@ static unique_ptr<Scene> _sceneBuildHelper(const SvgNode* node, float vx, float
/* External Class Implementation */
/************************************************************************/
unique_ptr<Scene> svgSceneBuild(SvgNode* node)
unique_ptr<Scene> svgSceneBuild(SvgNode* node, float vx, float vy, float vw, float vh)
{
if (!node || (node->type != SvgNodeType::Doc)) return nullptr;
auto vx = node->node.doc.vx;
auto vy = node->node.doc.vy;
auto vw = node->node.doc.vw;
auto vh = node->node.doc.vh;
unique_ptr<Scene> root;
auto docNode = _sceneBuildHelper(node, vx, vy, vw, vh);
float x, y, w, h;

View file

@ -25,6 +25,6 @@
#include "tvgCommon.h"
unique_ptr<Scene> svgSceneBuild(SvgNode* node);
unique_ptr<Scene> svgSceneBuild(SvgNode* node, float vx, float vy, float vw, float vh);
#endif //_TVG_SVG_SCENE_BUILDER_H_