Description
Environment:
(Those are probably irrelevant, but still)
- Operating system: MacOS
- Python version: 3.9.9
- SDL version: 2.26.4
- PyGame version: pygame-ce 2.3.0
Current behavior:
pygame.draw.rect()
has a set of parameters, responsible for rounding the corners. There is a border_radius
parameter, which is responsible for all 4 corners, and then there are 4 parameters, that are responsible for a single corner assigned to them. Default value of each parameter is -1
, however, if every parameter, responsible for rounding the corners, is negative, and one of them is positive, the shape becomes weird (as in the image)

This behaviour is NOT present, when all values are negative, no matter what they are, as long as they are negative, which led me to conclusion, that this behaviour is not expected
Expected behaviour:
no broken corners
Steps to reproduce:
- type
pg.draw.rect(surface, color, rect, 0, -n, -n, +n, -n, -n)
wheren
is any number - run the script and view the result
NOTE: only the "master" border_radius parameter sets the size of the drawn corners, each individual parameter responsible for only a single corner does not affect the outcome.
Test code
import pygame as pg
pg.init()
running = True
display = pg.display.set_mode((600, 600))
while running:
for event in pg.event.get():
if event.type == pg.QUIT:
pg.quit()
quit()
display.fill("black")
pg.draw.rect(display, (255, 255, 255), (100, 100, 50, 50), 4, -100, -10, -10, 1, -10)
pg.draw.rect(display, (255, 255, 255), (100, 400, 50, 50), 100, -100, -10, -10, 1, -10)
pg.draw.rect(display, (255, 255, 255), (400, 400, 50, 50), 0, -100, -10, -10, 1, -10)
pg.display.update()