pygame-ce icon indicating copy to clipboard operation
pygame-ce copied to clipboard

`pygame.draw.ellipse` behaves inconsistently when provided rect `width` or `height` are negative

Open denballakh opened this issue 1 year ago • 7 comments

Environment:

  • pygame-ce 2.4.1 (SDL 2.28.5, Python 3.12.0):

Current behavior: Consider this code:


import pygame as pg
s = pg.display.set_mode((250, 250))
# draw the outline where other circles will (or will not) be drawn:
pg.draw.ellipse(s, 'darkgrey', ( 50,  50,  50,  50), width=1)
pg.draw.ellipse(s, 'darkgrey', (150,  50,  50,  50), width=1)
pg.draw.ellipse(s, 'darkgrey', ( 50, 150,  50,  50), width=1)
pg.draw.ellipse(s, 'darkgrey', (150, 150,  50,  50), width=1)
# actual bug:
pg.draw.ellipse(s, 'red',      ( 50,  50,  50,  50), width=1) # normal
pg.draw.ellipse(s, 'green',    (150,  50,  50, -50), width=1) # not drawn
pg.draw.ellipse(s, 'blue',     ( 50, 150, -50,  50), width=1) # drawn, but to the left and filled
pg.draw.ellipse(s, 'yellow',   (150, 150, -50, -50), width=1) # not drawn

pg.display.update()
while True: pg.event.get()

When I run it I see this: image

2/3 weird circles are not draws (its ok), one of them is drawn to the left and is filled.

If I do not provide width=1, then same issue appears: image

Expected behavior: Either all weird-circles are draw, or none of them.

denballakh avatar Feb 25 '24 01:02 denballakh