mirror of
https://github.com/python-pillow/Pillow.git
synced 2024-12-26 01:46:18 +03:00
Fixed joined corners for odd dimensions
This commit is contained in:
parent
2a274a4760
commit
c68c508e27
BIN
Tests/images/imagedraw_rounded_rectangle_x_odd.png
Normal file
BIN
Tests/images/imagedraw_rounded_rectangle_x_odd.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 565 B |
BIN
Tests/images/imagedraw_rounded_rectangle_y_odd.png
Normal file
BIN
Tests/images/imagedraw_rounded_rectangle_y_odd.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 527 B |
|
@ -839,7 +839,9 @@ def test_rounded_rectangle_zero_radius(bbox):
|
||||||
"xy, suffix",
|
"xy, suffix",
|
||||||
[
|
[
|
||||||
((20, 10, 80, 90), "x"),
|
((20, 10, 80, 90), "x"),
|
||||||
|
((20, 10, 81, 90), "x_odd"),
|
||||||
((10, 20, 90, 80), "y"),
|
((10, 20, 90, 80), "y"),
|
||||||
|
((10, 20, 90, 81), "y_odd"),
|
||||||
((20, 20, 80, 80), "both"),
|
((20, 20, 80, 80), "both"),
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
|
|
@ -314,11 +314,11 @@ class ImageDraw:
|
||||||
|
|
||||||
full_x, full_y = False, False
|
full_x, full_y = False, False
|
||||||
if all(corners):
|
if all(corners):
|
||||||
full_x = d >= x1 - x0
|
full_x = d >= x1 - x0 - 1
|
||||||
if full_x:
|
if full_x:
|
||||||
# The two left and two right corners are joined
|
# The two left and two right corners are joined
|
||||||
d = x1 - x0
|
d = x1 - x0
|
||||||
full_y = d >= y1 - y0
|
full_y = d >= y1 - y0 - 1
|
||||||
if full_y:
|
if full_y:
|
||||||
# The two top and two bottom corners are joined
|
# The two top and two bottom corners are joined
|
||||||
d = y1 - y0
|
d = y1 - y0
|
||||||
|
|
Loading…
Reference in New Issue
Block a user