common_shape: fixed arc api to draw rectangles lower than 0.

Absolute value is used to calculate number of bezier curves used
to approximate arc.

Change-Id: Idedd7fd73590d569417fc646fc7febdaaab65857
This commit is contained in:
Michal Szczecinski 2020-08-11 12:11:06 +02:00 committed by Hermet Park
parent 9893af979f
commit 2c9610bf6a

View file

@ -167,7 +167,7 @@ Result Shape::appendArc(float cx, float cy, float radius, float startAngle, floa
startAngle = (startAngle * M_PI) / 180; startAngle = (startAngle * M_PI) / 180;
sweep = sweep * M_PI / 180; sweep = sweep * M_PI / 180;
auto nCurves = ceil(sweep / M_PI_HALF); auto nCurves = ceil(abs(sweep / M_PI_HALF));
auto fract = fmod(sweep, M_PI_HALF); auto fract = fmod(sweep, M_PI_HALF);
fract = (fract < std::numeric_limits<float>::epsilon()) ? M_PI_HALF : fract; fract = (fract < std::numeric_limits<float>::epsilon()) ? M_PI_HALF : fract;