diff --git a/README.rst b/README.rst index e9c952c6a4..b94bc28d2a 100644 --- a/README.rst +++ b/README.rst @@ -141,7 +141,7 @@ Dependency versions: +----------+------------------------+ | CPython | >= 3.8 (Or use PyPy3) | +----------+------------------------+ -| SDL | >= 2.0.10 | +| SDL | >= 2.0.14 | +----------+------------------------+ | SDL_mixer| >= 2.0.4 | +----------+------------------------+ diff --git a/docs/reST/ref/system.rst b/docs/reST/ref/system.rst index eb1450f9e3..de5cb55daf 100644 --- a/docs/reST/ref/system.rst +++ b/docs/reST/ref/system.rst @@ -43,10 +43,7 @@ 'LASX': False } - .. Note:: The value of ``ARMSIMD`` will be always False if - SDL version < 2.0.12. - - The values of ``LSX`` and ``LASX`` will be always False if + .. Note:: The values of ``LSX`` and ``LASX`` will be always False if SDL version < 2.24.0. .. versionadded:: 2.3.1 diff --git a/docs/readmes/README.es.rst b/docs/readmes/README.es.rst index 9c78006fe2..37aad70d3c 100644 --- a/docs/readmes/README.es.rst +++ b/docs/readmes/README.es.rst @@ -118,7 +118,7 @@ Versiones de dependencia: +----------+-----------------------------+ | CPython | >= 3.8 (Ou utiliser PyPy3) | +----------+-----------------------------+ -| SDL | >= 2.0.10 | +| SDL | >= 2.0.14 | +----------+-----------------------------+ | SDL_mixer| >= 2.0.4 | +----------+-----------------------------+ diff --git a/docs/readmes/README.fa.rst b/docs/readmes/README.fa.rst index e41ebb3ea8..d1116a3825 100644 --- a/docs/readmes/README.fa.rst +++ b/docs/readmes/README.fa.rst @@ -190,7 +190,7 @@ Dependencies (وابستگی ها) +----------+------------------------+ | CPython | >= 3.8 (Or use PyPy3) | +----------+------------------------+ -| SDL | >= 2.0.10 | +| SDL | >= 2.0.14 | +----------+------------------------+ | SDL_mixer| >= 2.0.4 | +----------+------------------------+ diff --git a/docs/readmes/README.fr.rst b/docs/readmes/README.fr.rst index e546df1afe..4aaa5c9e1e 100644 --- a/docs/readmes/README.fr.rst +++ b/docs/readmes/README.fr.rst @@ -147,7 +147,7 @@ Versions des dépendances: +----------+-----------------------------+ | CPython | >= 3.8 (Ou utiliser PyPy3) | +----------+-----------------------------+ -| SDL | >= 2.0.10 | +| SDL | >= 2.0.14 | +----------+-----------------------------+ | SDL_mixer| >= 2.0.4 | +----------+-----------------------------+ diff --git a/docs/readmes/README.it.rst b/docs/readmes/README.it.rst index df7dcddb58..d054d98575 100644 --- a/docs/readmes/README.it.rst +++ b/docs/readmes/README.it.rst @@ -142,7 +142,7 @@ Le versioni dei requisiti: +----------+------------------------+ | CPython | >= 3.8 (Or use PyPy3) | +----------+------------------------+ -| SDL | >= 2.0.10 | +| SDL | >= 2.0.14 | +----------+------------------------+ | SDL_mixer| >= 2.0.4 | +----------+------------------------+ diff --git a/docs/readmes/README.ja.rst b/docs/readmes/README.ja.rst index 7774b97a1d..1b99a895f0 100644 --- a/docs/readmes/README.ja.rst +++ b/docs/readmes/README.ja.rst @@ -152,7 +152,7 @@ gfxdraw には SDL_gfx の埋め込みバージョンが含まれています。 +----------+------------------------+ | CPython | >= 3.8 (Or use PyPy3) | +----------+------------------------+ -| SDL | >= 2.0.10 | +| SDL | >= 2.0.14 | +----------+------------------------+ | SDL_mixer| >= 2.0.4 | +----------+------------------------+ diff --git a/docs/readmes/README.zh-cn.rst b/docs/readmes/README.zh-cn.rst index 7816284e70..9e36fa58c4 100644 --- a/docs/readmes/README.zh-cn.rst +++ b/docs/readmes/README.zh-cn.rst @@ -106,7 +106,7 @@ pygame显然依赖于SDL和Python。此外pygame还嵌入了几个较小的库 +----------+------------------------+ | CPython | >= 3.8 (或 PyPy3) | +----------+------------------------+ -| SDL | >= 2.0.10 | +| SDL | >= 2.0.14 | +----------+------------------------+ | SDL_mixer| >= 2.0.4 | +----------+------------------------+ diff --git a/src_c/_camera.c b/src_c/_camera.c index 8bf528b559..3776e9fa68 100644 --- a/src_c/_camera.c +++ b/src_c/_camera.c @@ -425,7 +425,7 @@ camera_get_image(pgCameraObject *self, PyObject *arg) return NULL; if (!surfobj) { - surf = PG_CreateSurface(width, height, PG_PIXELFORMAT_XRGB8888); + surf = PG_CreateSurface(width, height, SDL_PIXELFORMAT_XRGB8888); } else { surf = pgSurface_AsSurface(surfobj); diff --git a/src_c/_pygame.h b/src_c/_pygame.h index 46fe2d966d..f98acc934d 100644 --- a/src_c/_pygame.h +++ b/src_c/_pygame.h @@ -188,47 +188,7 @@ PG_UnlockMutex(SDL_mutex *mutex) #define PG_INIT_TIMER SDL_INIT_TIMER -#if SDL_VERSION_ATLEAST(2, 0, 14) #define PG_SurfaceHasRLE SDL_HasSurfaceRLE -#else -// vendored in until our lowest SDL version is 2.0.14 -typedef struct { - Uint8 *src; - int src_w, src_h; - int src_pitch; - int src_skip; - Uint8 *dst; - int dst_w, dst_h; - int dst_pitch; - int dst_skip; - SDL_PixelFormat *src_fmt; - SDL_PixelFormat *dst_fmt; - Uint8 *table; - int flags; - Uint32 colorkey; - Uint8 r, g, b, a; -} SDL_InternalBlitInfo; - -struct SDL_BlitMap { - SDL_Surface *dst; - int identity; - SDL_blit blit; - void *data; - SDL_InternalBlitInfo info; - - /* the version count matches the destination; mismatch indicates - an invalid mapping */ - Uint32 dst_palette_version; - Uint32 src_palette_version; -}; -#define SDL_COPY_RLE_DESIRED 0x00001000 - -#define PG_SurfaceHasRLE(surface) \ - (((surface) == NULL) \ - ? 0 \ - : ((surface)->map->info.flags & SDL_COPY_RLE_DESIRED)) - -#endif #endif diff --git a/src_c/_sdl2/controller.c b/src_c/_sdl2/controller.c index 6425aa4f51..331ffd876d 100644 --- a/src_c/_sdl2/controller.c +++ b/src_c/_sdl2/controller.c @@ -367,7 +367,6 @@ controller_rumble(pgControllerObject *self, PyObject *args, PyObject *kwargs) return RAISE(pgExc_SDLError, "Controller is not initalized"); } -#if SDL_VERSION_ATLEAST(2, 0, 9) // rumble takes values in range 0 to 0xFFFF (65535) low_freq = MAX(MIN(low_freq, 1.0f), 0.0f) * 65535; high_freq = MAX(MIN(high_freq, 1.0f), 0.0f) * 65535; @@ -376,9 +375,6 @@ controller_rumble(pgControllerObject *self, PyObject *args, PyObject *kwargs) (Uint16)high_freq, duration); return PyBool_FromLong(success == 0); -#else - Py_RETURN_FALSE; -#endif } static PyObject * @@ -388,9 +384,7 @@ controller_stop_rumble(pgControllerObject *self, PyObject *_null) if (!self->controller) { return RAISE(pgExc_SDLError, "Controller is not initalized"); } -#if SDL_VERSION_ATLEAST(2, 0, 9) SDL_GameControllerRumble(self->controller, 0, 0, 1); -#endif Py_RETURN_NONE; } diff --git a/src_c/constants.c b/src_c/constants.c index f9eb244007..771aefca5a 100644 --- a/src_c/constants.c +++ b/src_c/constants.c @@ -317,19 +317,11 @@ MODINIT_DEFINE(constants) DEC_CONST(CONTROLLERDEVICEADDED); DEC_CONST(CONTROLLERDEVICEREMOVED); DEC_CONST(CONTROLLERDEVICEREMAPPED); -#if SDL_VERSION_ATLEAST(2, 0, 14) DEC_CONST(CONTROLLERTOUCHPADDOWN); DEC_CONST(CONTROLLERTOUCHPADMOTION); DEC_CONST(CONTROLLERTOUCHPADUP); DEC_CONST(CONTROLLERSENSORUPDATE); DEC_CONST(LOCALECHANGED); -#else - DEC_CONSTS(CONTROLLERTOUCHPADDOWN, -1); - DEC_CONSTS(CONTROLLERTOUCHPADMOTION, -1); - DEC_CONSTS(CONTROLLERTOUCHPADUP, -1); - DEC_CONSTS(CONTROLLERSENSORUPDATE, -1); - DEC_CONSTS(LOCALECHANGED, -1); -#endif DEC_CONST(JOYDEVICEADDED); DEC_CONST(JOYDEVICEREMOVED); diff --git a/src_c/display.c b/src_c/display.c index af7e268cbc..3ff35d4fa0 100644 --- a/src_c/display.c +++ b/src_c/display.c @@ -688,7 +688,7 @@ pg_ResizeEventWatch(void *userdata, SDL_Event *event) int h = event->window.data2; pgSurfaceObject *display_surface = pg_GetDefaultWindowSurface(); SDL_Surface *surf = - PG_CreateSurface(w, h, PG_PIXELFORMAT_XRGB8888); + PG_CreateSurface(w, h, SDL_PIXELFORMAT_XRGB8888); SDL_FreeSurface(display_surface->surf); display_surface->surf = surf; @@ -1156,7 +1156,7 @@ pg_set_mode(PyObject *self, PyObject *arg, PyObject *kwds) So we make a fake surface. */ - surf = PG_CreateSurface(w, h, PG_PIXELFORMAT_XRGB8888); + surf = PG_CreateSurface(w, h, SDL_PIXELFORMAT_XRGB8888); newownedsurf = surf; } else { @@ -1265,7 +1265,7 @@ pg_set_mode(PyObject *self, PyObject *arg, PyObject *kwds) pg_renderer, SDL_PIXELFORMAT_ARGB8888, SDL_TEXTUREACCESS_STREAMING, w, h); } - surf = PG_CreateSurface(w, h, PG_PIXELFORMAT_XRGB8888); + surf = PG_CreateSurface(w, h, SDL_PIXELFORMAT_XRGB8888); newownedsurf = surf; } else { @@ -1571,7 +1571,7 @@ pg_list_modes(PyObject *self, PyObject *args, PyObject *kwds) } /* use reasonable defaults (cf. SDL_video.c) */ if (!mode.format) - mode.format = PG_PIXELFORMAT_XRGB8888; + mode.format = SDL_PIXELFORMAT_XRGB8888; if (!mode.w) mode.w = 640; if (!mode.h) @@ -2803,9 +2803,7 @@ pg_message_box(PyObject *self, PyObject *arg, PyObject *kwargs) return NULL; } -#if SDL_VERSION_ATLEAST(2, 0, 12) msgbox_data.flags |= SDL_MESSAGEBOX_BUTTONS_LEFT_TO_RIGHT; -#endif if (parent_window == Py_None) { msgbox_data.window = NULL; @@ -2896,12 +2894,7 @@ pg_message_box(PyObject *self, PyObject *arg, PyObject *kwargs) buttons_data = malloc(sizeof(SDL_MessageBoxButtonData) * num_buttons); for (Py_ssize_t i = 0; i < num_buttons; i++) { -#if SDL_VERSION_ATLEAST(2, 0, 12) PyObject *btn_name_obj = PySequence_GetItem(buttons, i); -#else - PyObject *btn_name_obj = - PySequence_GetItem(buttons, num_buttons - i - 1); -#endif if (!btn_name_obj) goto error; @@ -2916,11 +2909,7 @@ pg_message_box(PyObject *self, PyObject *arg, PyObject *kwargs) goto error; buttons_data[i].text = btn_name; -#if SDL_VERSION_ATLEAST(2, 0, 12) buttons_data[i].buttonid = (int)i; -#else - buttons_data[i].buttonid = (int)(num_buttons - i - 1); -#endif buttons_data[i].flags = 0; if (return_button_index == buttons_data[i].buttonid) buttons_data[i].flags |= diff --git a/src_c/event.c b/src_c/event.c index 59132e3330..4af65354f7 100644 --- a/src_c/event.c +++ b/src_c/event.c @@ -342,12 +342,10 @@ _pg_pgevent_proxify_helper(Uint32 type, Uint8 proxify) _PG_HANDLE_PROXIFY(CONTROLLERDEVICEADDED); _PG_HANDLE_PROXIFY(CONTROLLERDEVICEREMOVED); _PG_HANDLE_PROXIFY(CONTROLLERDEVICEREMAPPED); -#if SDL_VERSION_ATLEAST(2, 0, 14) _PG_HANDLE_PROXIFY(CONTROLLERTOUCHPADDOWN); _PG_HANDLE_PROXIFY(CONTROLLERTOUCHPADMOTION); _PG_HANDLE_PROXIFY(CONTROLLERTOUCHPADUP); _PG_HANDLE_PROXIFY(CONTROLLERSENSORUPDATE); -#endif _PG_HANDLE_PROXIFY(DOLLARGESTURE); _PG_HANDLE_PROXIFY(DOLLARRECORD); _PG_HANDLE_PROXIFY(DROPFILE); @@ -367,9 +365,7 @@ _pg_pgevent_proxify_helper(Uint32 type, Uint8 proxify) _PG_HANDLE_PROXIFY(JOYBUTTONUP); _PG_HANDLE_PROXIFY(JOYDEVICEADDED); _PG_HANDLE_PROXIFY(JOYDEVICEREMOVED); -#if SDL_VERSION_ATLEAST(2, 0, 14) _PG_HANDLE_PROXIFY(LOCALECHANGED); -#endif _PG_HANDLE_PROXIFY(MOUSEMOTION); _PG_HANDLE_PROXIFY(MOUSEBUTTONDOWN); _PG_HANDLE_PROXIFY(MOUSEBUTTONUP); @@ -756,10 +752,8 @@ _pg_name_from_eventtype(int type) return "KeyUp"; case SDL_KEYMAPCHANGED: return "KeyMapChanged"; -#if SDL_VERSION_ATLEAST(2, 0, 14) case SDL_LOCALECHANGED: return "LocaleChanged"; -#endif case SDL_MOUSEMOTION: return "MouseMotion"; case SDL_MOUSEBUTTONDOWN: @@ -828,7 +822,6 @@ _pg_name_from_eventtype(int type) return "JoyDeviceAdded"; case SDL_JOYDEVICEREMOVED: return "JoyDeviceRemoved"; -#if SDL_VERSION_ATLEAST(2, 0, 14) case SDL_CONTROLLERTOUCHPADDOWN: return "ControllerTouchpadDown"; case SDL_CONTROLLERTOUCHPADMOTION: @@ -837,7 +830,6 @@ _pg_name_from_eventtype(int type) return "ControllerTouchpadUp"; case SDL_CONTROLLERSENSORUPDATE: return "ControllerSensorUpdate"; -#endif /*SDL_VERSION_ATLEAST(2, 0, 14)*/ case SDL_AUDIODEVICEADDED: return "AudioDeviceAdded"; case SDL_AUDIODEVICEREMOVED: @@ -1215,7 +1207,6 @@ dict_from_event(SDL_Event *event) _pg_insobj(dict, "instance_id", PyLong_FromLong(event->jdevice.which)); break; -#if SDL_VERSION_ATLEAST(2, 0, 14) case SDL_CONTROLLERTOUCHPADDOWN: case SDL_CONTROLLERTOUCHPADMOTION: case SDL_CONTROLLERTOUCHPADUP: @@ -1230,7 +1221,6 @@ dict_from_event(SDL_Event *event) _pg_insobj(dict, "pressure", PyFloat_FromDouble(event->ctouchpad.pressure)); break; -#endif /*SDL_VERSION_ATLEAST(2, 0, 14)*/ #ifdef WIN32 case SDL_SYSWMEVENT: @@ -1318,14 +1308,12 @@ dict_from_event(SDL_Event *event) window = SDL_GetWindowFromID(event->button.windowID); break; } -#if SDL_VERSION_ATLEAST(2, 0, 14) case SDL_FINGERMOTION: case SDL_FINGERDOWN: case SDL_FINGERUP: { window = SDL_GetWindowFromID(event->tfinger.windowID); break; } -#endif default: { return dict; } diff --git a/src_c/font.c b/src_c/font.c index cae985f1cc..8530bcd3e1 100644 --- a/src_c/font.c +++ b/src_c/font.c @@ -612,7 +612,7 @@ font_render(PyObject *self, PyObject *args, PyObject *kwds) if (strlen(astring) == 0) { /* special 0 string case */ int height = TTF_FontHeight(font); - surf = PG_CreateSurface(0, height, PG_PIXELFORMAT_XRGB8888); + surf = PG_CreateSurface(0, height, SDL_PIXELFORMAT_XRGB8888); } else { /* normal case */ if (antialias && bg_rgba_obj == Py_None) { diff --git a/src_c/include/pgcompat.h b/src_c/include/pgcompat.h index 7c89877d78..aa7a2e37e1 100644 --- a/src_c/include/pgcompat.h +++ b/src_c/include/pgcompat.h @@ -27,29 +27,13 @@ typedef uint8_t Uint8; * warning without this check here, which is very weird. */ #ifdef SDL_VERSION_ATLEAST -// SDL_PIXELFORMAT_XRGB8888 and SDL_PIXELFORMAT_XBGR8888 are new names -// in SDL 2.0.14, the macros below let us use the new (less confusing) -// naming while still building on old versions. - -#if SDL_VERSION_ATLEAST(2, 0, 14) -#define PG_PIXELFORMAT_XRGB8888 SDL_PIXELFORMAT_XRGB8888 -#else -#define PG_PIXELFORMAT_XRGB8888 SDL_PIXELFORMAT_RGB888 -#endif - -#if SDL_VERSION_ATLEAST(2, 0, 14) -#define PG_PIXELFORMAT_XBGR8888 SDL_PIXELFORMAT_XBGR8888 -#else -#define PG_PIXELFORMAT_XBGR8888 SDL_PIXELFORMAT_BGR888 -#endif - // SDL does not provide endian independent names for 32 bit formats without // alpha channels the way they do for ones with alpha channels. // E.g. SDL_PIXELFORMAT_RGBA32. This macro allows us the convenience of the // endian independent name. #if SDL_BYTEORDER == SDL_LIL_ENDIAN -#define PG_PIXELFORMAT_RGBX32 PG_PIXELFORMAT_XBGR8888 +#define PG_PIXELFORMAT_RGBX32 SDL_PIXELFORMAT_XBGR8888 #else #define PG_PIXELFORMAT_RGBX32 SDL_PIXELFORMAT_RGBX8888 #endif diff --git a/src_c/pixelcopy.c b/src_c/pixelcopy.c index 751ed25124..a964b9f373 100644 --- a/src_c/pixelcopy.c +++ b/src_c/pixelcopy.c @@ -1160,7 +1160,7 @@ make_surface(PyObject *self, PyObject *arg) pixelformat = SDL_PIXELFORMAT_INDEX8; } else { - pixelformat = PG_PIXELFORMAT_XRGB8888; + pixelformat = SDL_PIXELFORMAT_XRGB8888; } sizex = (int)view_p->shape[0]; sizey = (int)view_p->shape[1]; diff --git a/src_c/simd_transform_sse2.c b/src_c/simd_transform_sse2.c index 174ee09378..9b33c47b9b 100644 --- a/src_c/simd_transform_sse2.c +++ b/src_c/simd_transform_sse2.c @@ -180,7 +180,7 @@ filter_shrink_Y_SSE2(Uint8 *srcpix, Uint8 *dstpix, int width, int srcpitch, Uint16 *templine; /* allocate a clear memory area for storing the accumulator line */ - // Future: when we support SDL 2.0.10 and up, we can use SDL_SIMDAlloc + // Future: when we support SDL 2.0.14 and up, we can use SDL_SIMDAlloc // here so accumulate load/stores can be aligned, for a small perf // improvement. templine = (Uint16 *)calloc(dstpitch, 2); diff --git a/src_c/surface.c b/src_c/surface.c index d4a8eae2e9..1850ebc19f 100644 --- a/src_c/surface.c +++ b/src_c/surface.c @@ -1612,7 +1612,7 @@ pg_DisplayFormatAlpha(SDL_Surface *surface) #endif case SDL_PIXELFORMAT_ABGR1555: case SDL_PIXELFORMAT_BGR565: - case PG_PIXELFORMAT_XBGR8888: + case SDL_PIXELFORMAT_XBGR8888: case SDL_PIXELFORMAT_ABGR8888: pfe = SDL_PIXELFORMAT_ABGR8888; break; diff --git a/src_c/system.c b/src_c/system.c index 8794a95993..4e7c21162a 100644 --- a/src_c/system.c +++ b/src_c/system.c @@ -35,12 +35,7 @@ pg_system_get_cpu_instruction_sets(PyObject *self, PyObject *_null) INSERT_INSTRUCTIONSET_INFO("AVX2", SDL_HasAVX2); INSERT_INSTRUCTIONSET_INFO("AVX512F", SDL_HasAVX512F); INSERT_INSTRUCTIONSET_INFO("NEON", SDL_HasNEON); -#if SDL_VERSION_ATLEAST(2, 0, 12) INSERT_INSTRUCTIONSET_INFO("ARMSIMD", SDL_HasARMSIMD); -#else - if (PyDict_SetItemString(instruction_sets, "ARMSIMD", Py_False)) - goto error; -#endif #if SDL_VERSION_ATLEAST(2, 24, 0) INSERT_INSTRUCTIONSET_INFO("LSX", SDL_HasLSX); INSERT_INSTRUCTIONSET_INFO("LASX", SDL_HasLASX); @@ -113,7 +108,7 @@ pg_system_get_pref_locales(PyObject *self, PyObject *_null) * information */ return ret_list; } -#elif SDL_VERSION_ATLEAST(2, 0, 14) +#else SDL_Locale *locales = SDL_GetPreferredLocales(); if (!locales) { /* Return an empty list if SDL function does not return any useful @@ -131,7 +126,6 @@ pg_system_get_pref_locales(PyObject *self, PyObject *_null) } #endif -#if SDL_VERSION_ATLEAST(2, 0, 14) for (int i = 0; i < num_locales; i++) { dict = PyDict_New(); if (!dict) { @@ -183,9 +177,6 @@ pg_system_get_pref_locales(PyObject *self, PyObject *_null) SDL_free(locales); Py_DECREF(ret_list); return NULL; -#else - return ret_list; -#endif } static PyObject *PowerState_class = NULL;