mirror of
https://github.com/thorvg/thorvg.git
synced 2025-06-16 04:54:39 +00:00
svg_loader: code refactoring.
simplify the logic and remove unnecessary member data.
This commit is contained in:
parent
f82c274444
commit
9a9c0e7907
2 changed files with 2 additions and 7 deletions
|
@ -3479,7 +3479,8 @@ SvgLoader::~SvgLoader()
|
||||||
void SvgLoader::run(unsigned tid)
|
void SvgLoader::run(unsigned tid)
|
||||||
{
|
{
|
||||||
//According to the SVG standard the value of the width/height of the viewbox set to 0 disables rendering
|
//According to the SVG standard the value of the width/height of the viewbox set to 0 disables rendering
|
||||||
if (renderingDisabled) {
|
if ((viewFlag & SvgViewFlag::Viewbox) && (fabsf(vw) <= FLT_EPSILON || fabsf(vh) <= FLT_EPSILON)) {
|
||||||
|
TVGLOG("SVG", "The <viewBox> width and/or height set to 0 - rendering disabled.");
|
||||||
root = Scene::gen();
|
root = Scene::gen();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -3646,11 +3647,6 @@ bool SvgLoader::read()
|
||||||
{
|
{
|
||||||
if (!content || size == 0) return false;
|
if (!content || size == 0) return false;
|
||||||
|
|
||||||
if ((viewFlag & SvgViewFlag::Viewbox) && (fabsf(vw) <= FLT_EPSILON || fabsf(vh) <= FLT_EPSILON)) {
|
|
||||||
TVGLOG("SVG", "The <viewBox> width and/or height set to 0 - rendering disabled.");
|
|
||||||
renderingDisabled = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
//the loading has been already completed in header()
|
//the loading has been already completed in header()
|
||||||
if (root) return true;
|
if (root) return true;
|
||||||
|
|
||||||
|
|
|
@ -54,7 +54,6 @@ private:
|
||||||
SvgViewFlag viewFlag = SvgViewFlag::None;
|
SvgViewFlag viewFlag = SvgViewFlag::None;
|
||||||
AspectRatioAlign align = AspectRatioAlign::XMidYMid;
|
AspectRatioAlign align = AspectRatioAlign::XMidYMid;
|
||||||
AspectRatioMeetOrSlice meetOrSlice = AspectRatioMeetOrSlice::Meet;
|
AspectRatioMeetOrSlice meetOrSlice = AspectRatioMeetOrSlice::Meet;
|
||||||
bool renderingDisabled = false;
|
|
||||||
|
|
||||||
bool header();
|
bool header();
|
||||||
void clear();
|
void clear();
|
||||||
|
|
Loading…
Add table
Reference in a new issue