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

Missing pixels in aalines when using integer coordinates #3144

Merged
merged 1 commit into from
Oct 5, 2024

Conversation

mzivic7
Copy link
Contributor

@mzivic7 mzivic7 commented Oct 5, 2024

It turned out that those endpoints I disable at specific situations are needed when points coordinates are integer.
So it created gaps on edges. And those gaps are making draw.aapolygon PR tests to fail. (#3126)
I just made it so disabling endpoints happens only for points that have float coordinates.

Both aalines are drawn with int values, left is before, right after.
Screenshot From 2024-10-05 19-53-27

Sample code
import pygame
pygame.init()
screen = pygame.display.set_mode((100, 100))
run = True
while run:
  for event in pygame.event.get():
      if event.type == pygame.QUIT:
          run = False
  screen.fill("black")
  # using ints, point of interest: (5, 3)
  pygame.draw.aalines(screen, "white", True, [(1, 3), (3, 5), (5, 3), (3, 1)])
  # using floats, point of interest: (11, 3.1)
  pygame.draw.aalines(screen, "white", True, [(7, 3), (9, 5), (11, 3.1), (9, 1)])
  pygame.display.flip()
pygame.quit()

@mzivic7 mzivic7 requested a review from a team as a code owner October 5, 2024 17:14
Copy link
Member

@MyreMylar MyreMylar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, the logic makes sense. We can get this merged into main and then it'll solve the problems in the other PRs when we bring them up to main.

👍

Copy link
Contributor

@damusss damusss left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes

@damusss damusss added this to the 2.5.2 milestone Oct 5, 2024
@damusss damusss merged commit 3435256 into pygame-community:main Oct 5, 2024
25 checks passed
@mzivic7 mzivic7 deleted the fix_int_aalines_pixel branch October 5, 2024 22:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants