Port last SDL_CreateRGBSurface calls to SDL3-safe PG_CreateSurface #2501
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The surface_init one could be refactored to push the mask->pixelformat conversion to only when it's actually parsing out masks from the user, and have the format live as a pixelformat most of the time. But that would be a more complex and risky diff than this one, so lets stay the course for now.
I removed
_raise_create_surface_error
because it's no longer useful. It caught a case emitted internally by SDL_CreateRGBSurface when it converts masks to pixelformat, now that we do that ourselves we can directly set ValueError there. As for it's use in subsurface, the format will never be invalid there because it comes from already initialized surfaces-- therefore there's no point with a possible ValueError about masks.