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

transform.scale: softstretch SDL2/SDL3 compat #2707

Merged
merged 1 commit into from
Feb 8, 2024

Conversation

Starbuck5
Copy link
Member

@Starbuck5 Starbuck5 commented Feb 4, 2024

In SDL3, SDL_SoftStretch takes a ScaleMode parameter. For this case, it should be "nearest neighbor" because this is our basic scaling function.

With this change, the transform module compiles with SDL3.

@Starbuck5 Starbuck5 added the sdl3 label Feb 4, 2024
@Starbuck5 Starbuck5 requested a review from a team as a code owner February 4, 2024 08:44
@Starbuck5 Starbuck5 marked this pull request as draft February 4, 2024 08:44
@Starbuck5 Starbuck5 added the transform pygame.transform label Feb 4, 2024
@Starbuck5 Starbuck5 marked this pull request as ready for review February 4, 2024 09:30
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.

Looks good 👍

I wonder if at any point we have compared the results, visually & performance wise between a linear filtered SoftStretch and pygame.smoothscale(). Probably we have.

@Starbuck5
Copy link
Member Author

I didn't recall ever testing out SDL2's SDL_SoftStretchLinear, so I gave it a quick test to respond to your comment.

I did a small scale test, just looked at one image and did a 1.5x upscale. Visually it looked similar.

Performance-wise, SDL_SoftStretchLinear took 1.28 - 1.31 seconds to do 1000 scales. Our smoothscale does 1000 scales in 0.83 - 0.86 seconds using SSE2.

Copy link
Member

@oddbookworm oddbookworm left a comment

Choose a reason for hiding this comment

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

LGTM!

@oddbookworm oddbookworm added this to the 2.5.0 milestone Feb 8, 2024
@oddbookworm oddbookworm merged commit b3ff30a into pygame-community:main Feb 8, 2024
30 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
sdl3 transform pygame.transform
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants