diff --git a/Tests/images/imagedraw_arc_width_non_whole_angle.png b/Tests/images/imagedraw_arc_width_non_whole_angle.png new file mode 100644 index 00000000000..1fb9a3c8695 Binary files /dev/null and b/Tests/images/imagedraw_arc_width_non_whole_angle.png differ diff --git a/Tests/test_imagedraw.py b/Tests/test_imagedraw.py index ffe35a4fa4f..d53a74168ba 100644 --- a/Tests/test_imagedraw.py +++ b/Tests/test_imagedraw.py @@ -140,6 +140,18 @@ def test_arc_width_fill(self): # Assert self.assert_image_similar(im, Image.open(expected), 1) + def test_arc_width_non_whole_angle(self): + # Arrange + im = Image.new("RGB", (W, H)) + draw = ImageDraw.Draw(im) + expected = "Tests/images/imagedraw_arc_width_non_whole_angle.png" + + # Act + draw.arc(BBOX1, 10, 259.5, width=5) + + # Assert + self.assert_image_similar(im, Image.open(expected), 1) + def test_bitmap(self): # Arrange small = Image.open("Tests/images/pil123rgba.png").resize((50, 50)) diff --git a/src/libImaging/Draw.c b/src/libImaging/Draw.c index 559be1b002b..dee7c524dba 100644 --- a/src/libImaging/Draw.c +++ b/src/libImaging/Draw.c @@ -834,7 +834,7 @@ ellipse(Imaging im, int x0, int y0, int x1, int y1, // Build edge list // malloc check UNDONE, FLOAT? - maxEdgeCount = end - start; + maxEdgeCount = ceil(end - start); if (inner) { maxEdgeCount *= 2; }