at master 1.5 kB view raw
1From fb4a3d427898ed0a1fcf1e6795584a5a66a9cb3b Mon Sep 17 00:00:00 2001 2From: Marcin Serwin <marcin@serwin.dev> 3Date: Thu, 15 May 2025 18:24:56 +0200 4Subject: [PATCH 1/2] Use SDL_HasSurfaceRLE when available 5 6The hack does not work with sdl2-compat due to a different surface 7internals. 8 9Signed-off-by: Marcin Serwin <marcin@serwin.dev> 10--- 11 src_c/surface.c | 6 ++++++ 12 1 file changed, 6 insertions(+) 13 14diff --git a/src_c/surface.c b/src_c/surface.c 15index 958ce43f..ee9991fb 100644 16--- a/src_c/surface.c 17+++ b/src_c/surface.c 18@@ -63,6 +63,7 @@ typedef struct pg_bufferinternal_s { 19 Py_ssize_t mem[6]; /* Enough memory for dim 3 shape and strides */ 20 } pg_bufferinternal; 21 22+#if !SDL_VERSION_ATLEAST(2, 0, 14) 23 /* copy of SDL Blit mapping definitions to enable pointer casting hack 24 for checking state of the SDL_COPY_RLE_DESIRED flag */ 25 #define PGS_COPY_RLE_DESIRED 0x00001000 26@@ -97,6 +98,9 @@ typedef struct pg_BlitMap { 27 Uint32 src_palette_version; 28 } pg_BlitMap; 29 /* end PGS_COPY_RLE_DESIRED hack definitions */ 30+#else 31+#define pg_HasSurfaceRLE SDL_HasSurfaceRLE 32+#endif 33 34 int 35 pgSurface_Blit(pgSurfaceObject *dstobj, pgSurfaceObject *srcobj, 36@@ -2212,6 +2216,7 @@ surf_scroll(PyObject *self, PyObject *args, PyObject *keywds) 37 Py_RETURN_NONE; 38 } 39 40+#if !SDL_VERSION_ATLEAST(2, 0, 14) 41 int 42 pg_HasSurfaceRLE(SDL_Surface *surface) 43 { 44@@ -2230,6 +2235,7 @@ pg_HasSurfaceRLE(SDL_Surface *surface) 45 46 return SDL_TRUE; 47 } 48+#endif 49 50 static int 51 _PgSurface_SrcAlpha(SDL_Surface *surf) 52-- 532.49.0 54