1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 08:17:45 +00:00

LibGfx/Path: Round numerator in elliptical_arc_to

This avoids rounding problems which made Ladybird crash with some SVGs
on macOS/Clang.
This commit is contained in:
Nicolas Ramz 2023-11-15 10:39:26 +01:00 committed by Andreas Kling
parent eedd978974
commit b3cbe0fdb9

View file

@ -127,7 +127,7 @@ void Path::elliptical_arc_to(FloatPoint point, FloatSize radii, float x_axis_rot
} else { } else {
double numerator = rx_sq * ry_sq - rx_sq * y1p_sq - ry_sq * x1p_sq; double numerator = rx_sq * ry_sq - rx_sq * y1p_sq - ry_sq * x1p_sq;
double denominator = rx_sq * y1p_sq + ry_sq * x1p_sq; double denominator = rx_sq * y1p_sq + ry_sq * x1p_sq;
multiplier = AK::sqrt(numerator / denominator); multiplier = AK::sqrt(AK::max(0., numerator) / denominator);
} }
if (large_arc == sweep) if (large_arc == sweep)