Skip to content

Conversation

@sparklost
Copy link
Contributor

@sparklost sparklost 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()

@sparklost sparklost 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
Member

@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
@sparklost sparklost 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