mirror of
https://github.com/thorvg/thorvg.git
synced 2025-06-08 13:43:43 +00:00
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:
parent
f1feebf047
commit
332012dd6b
3 changed files with 3 additions and 8 deletions
|
@ -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);
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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_
|
||||
|
|
Loading…
Add table
Reference in a new issue