Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect bounding rects returned from pygame.draw.aalines #1153

Closed
charlesej opened this issue Jul 13, 2019 · 2 comments
Closed

Incorrect bounding rects returned from pygame.draw.aalines #1153

charlesej opened this issue Jul 13, 2019 · 2 comments
Labels
draw pygame.draw

Comments

@charlesej
Copy link
Contributor

The following code gives some examples of incorrect bounding rects returned from pygame.draw.aalines.

import pygame

WIDTH, HEIGHT = 320, 320
screen = pygame.display.set_mode((WIDTH, HEIGHT))
color = pygame.Color('red')

# Drawing fully on the surface gives an incorrect bounds.
pts = ((0, 0), (WIDTH - 1, HEIGHT - 1))
bounds = pygame.draw.aalines(screen, color, 1, pts, 1)
print('bounds={}, expecting <rect(0, 0, 320, 320)>'.format(bounds))

# Drawing partially off the surface gives an incorrect bounds.
pts = ((-1, -1), (WIDTH - 1, HEIGHT - 1))
bounds = pygame.draw.aalines(screen, color, 1, pts, 1)
print('bounds={}, expecting <rect(0, 0, 320, 320)>'.format(bounds))

# Drawing fully off the surface gives an incorrect bounds.
pts = ((WIDTH + 1, HEIGHT + 1), (WIDTH + 5, HEIGHT + 5))
bounds = pygame.draw.aalines(screen, color, 1, pts, 1)
print('bounds={}, expecting <rect(321, 321, 0, 0)>'.format(bounds))

The above code gives the following output. The returned bounding rects are not as expected.

pygame 2.0.0.dev2 (SDL 2.0.9, python 3.7.2)
Hello from the pygame community. https://www.pygame.org/contribute.html
bounds=<rect(0, 0, 321, 321)>, expecting <rect(0, 0, 320, 320)>
bounds=<rect(-1, -1, 322, 322)>, expecting <rect(0, 0, 320, 320)>
bounds=<rect(321, 321, 6, 6)>, expecting <rect(321, 321, 0, 0)>

System details:

  • os: windows 10 (64bit)
  • python: 3.7.2 (64bit)
  • pygame: 2.0.0.dev2 (SDL: 2.0.9) at c0646b8
@charlesej charlesej added the draw pygame.draw label Jul 13, 2019
@charlesej
Copy link
Contributor Author

charlesej commented Aug 12, 2019

Test added with @unittest.expectedFailure decorator via #1170.

@charlesej
Copy link
Contributor Author

Resolved by #1494.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
draw pygame.draw
Projects
None yet
Development

No branches or pull requests

1 participant