소스 검색

LibGfx/Path: Round numerator in elliptical_arc_to

This avoids rounding problems which made Ladybird crash with some SVGs
on macOS/Clang.
Nicolas Ramz 1 년 전
부모
커밋
b3cbe0fdb9
1개의 변경된 파일1개의 추가작업 그리고 1개의 파일을 삭제
  1. 1 1
      Userland/Libraries/LibGfx/Path.cpp

+ 1 - 1
Userland/Libraries/LibGfx/Path.cpp

@@ -127,7 +127,7 @@ void Path::elliptical_arc_to(FloatPoint point, FloatSize radii, float x_axis_rot
     } else {
         double numerator = rx_sq * ry_sq - 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)