svg_loader: use designated fabsf() for float values.

fabs() is designed for double type,
but here it uses float type.
This commit is contained in:
Hermet Park 2020-10-12 20:17:42 +09:00 committed by JunsuChoi
parent db367d0c14
commit 36df183e12

View file

@ -83,11 +83,11 @@ void _pathAppendArcTo(vector<PathCommand>* cmds, vector<Point>* pts, Point* cur,
sy = cur->y; sy = cur->y;
//If start and end points are identical, then no arc is drawn //If start and end points are identical, then no arc is drawn
if ((fabs(x - sx) < (1.0f / 256.0f)) && (fabs(y - sy) < (1.0f / 256.0f))) return; if ((fabsf(x - sx) < (1.0f / 256.0f)) && (fabsf(y - sy) < (1.0f / 256.0f))) return;
//Correction of out-of-range radii, see F6.6.1 (step 2) //Correction of out-of-range radii, see F6.6.1 (step 2)
rx = fabs(rx); rx = fabsf(rx);
ry = fabs(ry); ry = fabsf(ry);
if ((rx < 0.5f) || (ry < 0.5f)) { if ((rx < 0.5f) || (ry < 0.5f)) {
Point p = {x, y}; Point p = {x, y};
cmds->push_back(PathCommand::LineTo); cmds->push_back(PathCommand::LineTo);
@ -182,7 +182,7 @@ void _pathAppendArcTo(vector<PathCommand>* cmds, vector<Point>* pts, Point* cur,
//(smaller than 90 degrees) //(smaller than 90 degrees)
//We add one extra segment because we want something //We add one extra segment because we want something
//Smaller than 90deg (i.e. not 90 itself) //Smaller than 90deg (i.e. not 90 itself)
segments = (int)(fabs(deltaTheta / M_PI_2)) + 1.0f; segments = (int)(fabsf(deltaTheta / M_PI_2)) + 1.0f;
delta = deltaTheta / segments; delta = deltaTheta / segments;
//http://www.stillhq.com/ctpfaq/2001/comp.text.pdf-faq-2001-04.txt (section 2.13) //http://www.stillhq.com/ctpfaq/2001/comp.text.pdf-faq-2001-04.txt (section 2.13)