pygame-community / pygame-ce

🐍🎮 pygame - Community Edition is a FOSS Python library for multimedia applications (like games). Built on top of the excellent SDL library.
https://pyga.me
766 stars 120 forks source link

Replace old hack with SDL_HasSurfaceRLE #2920

Closed Starbuck5 closed 2 weeks ago

Starbuck5 commented 2 weeks ago

In surface.c we have the function pg_HasSurfaceRLE, which accesses SDL internals my mimicking one of their structs, to get access to whether the surface has RLE or not.

SDL 2.0.14 had a new function SDL_HasSurfaceRLE that seems to do the same thing, but with less code on our end. This will be necessary for SDL3 support, as the internal structures are even more hidden in SDL3.

Wrinkle is that we still support down to SDL 2.0.10.

Possible path: use the old code if below 2.0.14, use the new code if at or above 2.0.14 (including SDL3)

Starbuck5 commented 2 weeks ago

Wow, igordsm actually set this up already in the form of PG_SurfaceHasRLE in https://github.com/pygame-community/pygame-ce/pull/2491