Skip to content

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

Open
@denballakh

Description

@denballakh

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions