svg_loader: code refactoring.

simplify the logic and remove unnecessary member data.
This commit is contained in:
Hermet Park 2023-04-29 22:04:22 +09:00
parent f82c274444
commit 9a9c0e7907
2 changed files with 2 additions and 7 deletions

View file

@ -3479,7 +3479,8 @@ SvgLoader::~SvgLoader()
void SvgLoader::run(unsigned tid)
{
//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();
return;
}
@ -3646,11 +3647,6 @@ bool SvgLoader::read()
{
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()
if (root) return true;

View file

@ -54,7 +54,6 @@ private:
SvgViewFlag viewFlag = SvgViewFlag::None;
AspectRatioAlign align = AspectRatioAlign::XMidYMid;
AspectRatioMeetOrSlice meetOrSlice = AspectRatioMeetOrSlice::Meet;
bool renderingDisabled = false;
bool header();
void clear();