Skip to content

Commit 03bfa77

Browse files
committed
Raise minimum supported SDL2 to 2.0.14
1 parent de88561 commit 03bfa77

20 files changed

+19
-124
lines changed

README.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ Dependency versions:
141141
+----------+------------------------+
142142
| CPython | >= 3.8 (Or use PyPy3) |
143143
+----------+------------------------+
144-
| SDL | >= 2.0.10 |
144+
| SDL | >= 2.0.14 |
145145
+----------+------------------------+
146146
| SDL_mixer| >= 2.0.4 |
147147
+----------+------------------------+

docs/reST/ref/system.rst

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,7 @@
4343
'LASX': False
4444
}
4545

46-
.. Note:: The value of ``ARMSIMD`` will be always False if
47-
SDL version < 2.0.12.
48-
49-
The values of ``LSX`` and ``LASX`` will be always False if
46+
.. Note:: The values of ``LSX`` and ``LASX`` will be always False if
5047
SDL version < 2.24.0.
5148

5249
.. versionadded:: 2.3.1

docs/readmes/README.es.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ Versiones de dependencia:
118118
+----------+-----------------------------+
119119
| CPython | >= 3.8 (Ou utiliser PyPy3) |
120120
+----------+-----------------------------+
121-
| SDL | >= 2.0.10 |
121+
| SDL | >= 2.0.14 |
122122
+----------+-----------------------------+
123123
| SDL_mixer| >= 2.0.4 |
124124
+----------+-----------------------------+

docs/readmes/README.fa.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ Dependencies (وابستگی ها)
190190
+----------+------------------------+
191191
| CPython | >= 3.8 (Or use PyPy3) |
192192
+----------+------------------------+
193-
| SDL | >= 2.0.10 |
193+
| SDL | >= 2.0.14 |
194194
+----------+------------------------+
195195
| SDL_mixer| >= 2.0.4 |
196196
+----------+------------------------+

docs/readmes/README.fr.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ Versions des dépendances:
147147
+----------+-----------------------------+
148148
| CPython | >= 3.8 (Ou utiliser PyPy3) |
149149
+----------+-----------------------------+
150-
| SDL | >= 2.0.10 |
150+
| SDL | >= 2.0.14 |
151151
+----------+-----------------------------+
152152
| SDL_mixer| >= 2.0.4 |
153153
+----------+-----------------------------+

docs/readmes/README.it.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ Le versioni dei requisiti:
142142
+----------+------------------------+
143143
| CPython | >= 3.8 (Or use PyPy3) |
144144
+----------+------------------------+
145-
| SDL | >= 2.0.10 |
145+
| SDL | >= 2.0.14 |
146146
+----------+------------------------+
147147
| SDL_mixer| >= 2.0.4 |
148148
+----------+------------------------+

docs/readmes/README.ja.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ gfxdraw には SDL_gfx の埋め込みバージョンが含まれています。
152152
+----------+------------------------+
153153
| CPython | >= 3.8 (Or use PyPy3) |
154154
+----------+------------------------+
155-
| SDL | >= 2.0.10 |
155+
| SDL | >= 2.0.14 |
156156
+----------+------------------------+
157157
| SDL_mixer| >= 2.0.4 |
158158
+----------+------------------------+

docs/readmes/README.zh-cn.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ pygame显然依赖于SDL和Python。此外pygame还嵌入了几个较小的库
106106
+----------+------------------------+
107107
| CPython | >= 3.8 (或 PyPy3) |
108108
+----------+------------------------+
109-
| SDL | >= 2.0.10 |
109+
| SDL | >= 2.0.14 |
110110
+----------+------------------------+
111111
| SDL_mixer| >= 2.0.4 |
112112
+----------+------------------------+

src_c/_camera.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -425,7 +425,7 @@ camera_get_image(pgCameraObject *self, PyObject *arg)
425425
return NULL;
426426

427427
if (!surfobj) {
428-
surf = PG_CreateSurface(width, height, PG_PIXELFORMAT_XRGB8888);
428+
surf = PG_CreateSurface(width, height, SDL_PIXELFORMAT_XRGB8888);
429429
}
430430
else {
431431
surf = pgSurface_AsSurface(surfobj);

src_c/_pygame.h

Lines changed: 0 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -188,47 +188,7 @@ PG_UnlockMutex(SDL_mutex *mutex)
188188

189189
#define PG_INIT_TIMER SDL_INIT_TIMER
190190

191-
#if SDL_VERSION_ATLEAST(2, 0, 14)
192191
#define PG_SurfaceHasRLE SDL_HasSurfaceRLE
193-
#else
194-
// vendored in until our lowest SDL version is 2.0.14
195-
typedef struct {
196-
Uint8 *src;
197-
int src_w, src_h;
198-
int src_pitch;
199-
int src_skip;
200-
Uint8 *dst;
201-
int dst_w, dst_h;
202-
int dst_pitch;
203-
int dst_skip;
204-
SDL_PixelFormat *src_fmt;
205-
SDL_PixelFormat *dst_fmt;
206-
Uint8 *table;
207-
int flags;
208-
Uint32 colorkey;
209-
Uint8 r, g, b, a;
210-
} SDL_InternalBlitInfo;
211-
212-
struct SDL_BlitMap {
213-
SDL_Surface *dst;
214-
int identity;
215-
SDL_blit blit;
216-
void *data;
217-
SDL_InternalBlitInfo info;
218-
219-
/* the version count matches the destination; mismatch indicates
220-
an invalid mapping */
221-
Uint32 dst_palette_version;
222-
Uint32 src_palette_version;
223-
};
224-
#define SDL_COPY_RLE_DESIRED 0x00001000
225-
226-
#define PG_SurfaceHasRLE(surface) \
227-
(((surface) == NULL) \
228-
? 0 \
229-
: ((surface)->map->info.flags & SDL_COPY_RLE_DESIRED))
230-
231-
#endif
232192

233193
#endif
234194

src_c/_sdl2/controller.c

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -367,7 +367,6 @@ controller_rumble(pgControllerObject *self, PyObject *args, PyObject *kwargs)
367367
return RAISE(pgExc_SDLError, "Controller is not initalized");
368368
}
369369

370-
#if SDL_VERSION_ATLEAST(2, 0, 9)
371370
// rumble takes values in range 0 to 0xFFFF (65535)
372371
low_freq = MAX(MIN(low_freq, 1.0f), 0.0f) * 65535;
373372
high_freq = MAX(MIN(high_freq, 1.0f), 0.0f) * 65535;
@@ -376,9 +375,6 @@ controller_rumble(pgControllerObject *self, PyObject *args, PyObject *kwargs)
376375
(Uint16)high_freq, duration);
377376

378377
return PyBool_FromLong(success == 0);
379-
#else
380-
Py_RETURN_FALSE;
381-
#endif
382378
}
383379

384380
static PyObject *
@@ -388,9 +384,7 @@ controller_stop_rumble(pgControllerObject *self, PyObject *_null)
388384
if (!self->controller) {
389385
return RAISE(pgExc_SDLError, "Controller is not initalized");
390386
}
391-
#if SDL_VERSION_ATLEAST(2, 0, 9)
392387
SDL_GameControllerRumble(self->controller, 0, 0, 1);
393-
#endif
394388
Py_RETURN_NONE;
395389
}
396390

src_c/constants.c

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -317,19 +317,11 @@ MODINIT_DEFINE(constants)
317317
DEC_CONST(CONTROLLERDEVICEADDED);
318318
DEC_CONST(CONTROLLERDEVICEREMOVED);
319319
DEC_CONST(CONTROLLERDEVICEREMAPPED);
320-
#if SDL_VERSION_ATLEAST(2, 0, 14)
321320
DEC_CONST(CONTROLLERTOUCHPADDOWN);
322321
DEC_CONST(CONTROLLERTOUCHPADMOTION);
323322
DEC_CONST(CONTROLLERTOUCHPADUP);
324323
DEC_CONST(CONTROLLERSENSORUPDATE);
325324
DEC_CONST(LOCALECHANGED);
326-
#else
327-
DEC_CONSTS(CONTROLLERTOUCHPADDOWN, -1);
328-
DEC_CONSTS(CONTROLLERTOUCHPADMOTION, -1);
329-
DEC_CONSTS(CONTROLLERTOUCHPADUP, -1);
330-
DEC_CONSTS(CONTROLLERSENSORUPDATE, -1);
331-
DEC_CONSTS(LOCALECHANGED, -1);
332-
#endif
333325

334326
DEC_CONST(JOYDEVICEADDED);
335327
DEC_CONST(JOYDEVICEREMOVED);

src_c/display.c

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -688,7 +688,7 @@ pg_ResizeEventWatch(void *userdata, SDL_Event *event)
688688
int h = event->window.data2;
689689
pgSurfaceObject *display_surface = pg_GetDefaultWindowSurface();
690690
SDL_Surface *surf =
691-
PG_CreateSurface(w, h, PG_PIXELFORMAT_XRGB8888);
691+
PG_CreateSurface(w, h, SDL_PIXELFORMAT_XRGB8888);
692692

693693
SDL_FreeSurface(display_surface->surf);
694694
display_surface->surf = surf;
@@ -1156,7 +1156,7 @@ pg_set_mode(PyObject *self, PyObject *arg, PyObject *kwds)
11561156
11571157
So we make a fake surface.
11581158
*/
1159-
surf = PG_CreateSurface(w, h, PG_PIXELFORMAT_XRGB8888);
1159+
surf = PG_CreateSurface(w, h, SDL_PIXELFORMAT_XRGB8888);
11601160
newownedsurf = surf;
11611161
}
11621162
else {
@@ -1265,7 +1265,7 @@ pg_set_mode(PyObject *self, PyObject *arg, PyObject *kwds)
12651265
pg_renderer, SDL_PIXELFORMAT_ARGB8888,
12661266
SDL_TEXTUREACCESS_STREAMING, w, h);
12671267
}
1268-
surf = PG_CreateSurface(w, h, PG_PIXELFORMAT_XRGB8888);
1268+
surf = PG_CreateSurface(w, h, SDL_PIXELFORMAT_XRGB8888);
12691269
newownedsurf = surf;
12701270
}
12711271
else {
@@ -1571,7 +1571,7 @@ pg_list_modes(PyObject *self, PyObject *args, PyObject *kwds)
15711571
}
15721572
/* use reasonable defaults (cf. SDL_video.c) */
15731573
if (!mode.format)
1574-
mode.format = PG_PIXELFORMAT_XRGB8888;
1574+
mode.format = SDL_PIXELFORMAT_XRGB8888;
15751575
if (!mode.w)
15761576
mode.w = 640;
15771577
if (!mode.h)
@@ -2803,9 +2803,7 @@ pg_message_box(PyObject *self, PyObject *arg, PyObject *kwargs)
28032803
return NULL;
28042804
}
28052805

2806-
#if SDL_VERSION_ATLEAST(2, 0, 12)
28072806
msgbox_data.flags |= SDL_MESSAGEBOX_BUTTONS_LEFT_TO_RIGHT;
2808-
#endif
28092807

28102808
if (parent_window == Py_None) {
28112809
msgbox_data.window = NULL;
@@ -2896,12 +2894,7 @@ pg_message_box(PyObject *self, PyObject *arg, PyObject *kwargs)
28962894

28972895
buttons_data = malloc(sizeof(SDL_MessageBoxButtonData) * num_buttons);
28982896
for (Py_ssize_t i = 0; i < num_buttons; i++) {
2899-
#if SDL_VERSION_ATLEAST(2, 0, 12)
29002897
PyObject *btn_name_obj = PySequence_GetItem(buttons, i);
2901-
#else
2902-
PyObject *btn_name_obj =
2903-
PySequence_GetItem(buttons, num_buttons - i - 1);
2904-
#endif
29052898
if (!btn_name_obj)
29062899
goto error;
29072900

@@ -2916,11 +2909,7 @@ pg_message_box(PyObject *self, PyObject *arg, PyObject *kwargs)
29162909
goto error;
29172910

29182911
buttons_data[i].text = btn_name;
2919-
#if SDL_VERSION_ATLEAST(2, 0, 12)
29202912
buttons_data[i].buttonid = (int)i;
2921-
#else
2922-
buttons_data[i].buttonid = (int)(num_buttons - i - 1);
2923-
#endif
29242913
buttons_data[i].flags = 0;
29252914
if (return_button_index == buttons_data[i].buttonid)
29262915
buttons_data[i].flags |=

src_c/event.c

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -342,12 +342,10 @@ _pg_pgevent_proxify_helper(Uint32 type, Uint8 proxify)
342342
_PG_HANDLE_PROXIFY(CONTROLLERDEVICEADDED);
343343
_PG_HANDLE_PROXIFY(CONTROLLERDEVICEREMOVED);
344344
_PG_HANDLE_PROXIFY(CONTROLLERDEVICEREMAPPED);
345-
#if SDL_VERSION_ATLEAST(2, 0, 14)
346345
_PG_HANDLE_PROXIFY(CONTROLLERTOUCHPADDOWN);
347346
_PG_HANDLE_PROXIFY(CONTROLLERTOUCHPADMOTION);
348347
_PG_HANDLE_PROXIFY(CONTROLLERTOUCHPADUP);
349348
_PG_HANDLE_PROXIFY(CONTROLLERSENSORUPDATE);
350-
#endif
351349
_PG_HANDLE_PROXIFY(DOLLARGESTURE);
352350
_PG_HANDLE_PROXIFY(DOLLARRECORD);
353351
_PG_HANDLE_PROXIFY(DROPFILE);
@@ -367,9 +365,7 @@ _pg_pgevent_proxify_helper(Uint32 type, Uint8 proxify)
367365
_PG_HANDLE_PROXIFY(JOYBUTTONUP);
368366
_PG_HANDLE_PROXIFY(JOYDEVICEADDED);
369367
_PG_HANDLE_PROXIFY(JOYDEVICEREMOVED);
370-
#if SDL_VERSION_ATLEAST(2, 0, 14)
371368
_PG_HANDLE_PROXIFY(LOCALECHANGED);
372-
#endif
373369
_PG_HANDLE_PROXIFY(MOUSEMOTION);
374370
_PG_HANDLE_PROXIFY(MOUSEBUTTONDOWN);
375371
_PG_HANDLE_PROXIFY(MOUSEBUTTONUP);
@@ -756,10 +752,8 @@ _pg_name_from_eventtype(int type)
756752
return "KeyUp";
757753
case SDL_KEYMAPCHANGED:
758754
return "KeyMapChanged";
759-
#if SDL_VERSION_ATLEAST(2, 0, 14)
760755
case SDL_LOCALECHANGED:
761756
return "LocaleChanged";
762-
#endif
763757
case SDL_MOUSEMOTION:
764758
return "MouseMotion";
765759
case SDL_MOUSEBUTTONDOWN:
@@ -828,7 +822,6 @@ _pg_name_from_eventtype(int type)
828822
return "JoyDeviceAdded";
829823
case SDL_JOYDEVICEREMOVED:
830824
return "JoyDeviceRemoved";
831-
#if SDL_VERSION_ATLEAST(2, 0, 14)
832825
case SDL_CONTROLLERTOUCHPADDOWN:
833826
return "ControllerTouchpadDown";
834827
case SDL_CONTROLLERTOUCHPADMOTION:
@@ -837,7 +830,6 @@ _pg_name_from_eventtype(int type)
837830
return "ControllerTouchpadUp";
838831
case SDL_CONTROLLERSENSORUPDATE:
839832
return "ControllerSensorUpdate";
840-
#endif /*SDL_VERSION_ATLEAST(2, 0, 14)*/
841833
case SDL_AUDIODEVICEADDED:
842834
return "AudioDeviceAdded";
843835
case SDL_AUDIODEVICEREMOVED:
@@ -1215,7 +1207,6 @@ dict_from_event(SDL_Event *event)
12151207
_pg_insobj(dict, "instance_id",
12161208
PyLong_FromLong(event->jdevice.which));
12171209
break;
1218-
#if SDL_VERSION_ATLEAST(2, 0, 14)
12191210
case SDL_CONTROLLERTOUCHPADDOWN:
12201211
case SDL_CONTROLLERTOUCHPADMOTION:
12211212
case SDL_CONTROLLERTOUCHPADUP:
@@ -1230,7 +1221,6 @@ dict_from_event(SDL_Event *event)
12301221
_pg_insobj(dict, "pressure",
12311222
PyFloat_FromDouble(event->ctouchpad.pressure));
12321223
break;
1233-
#endif /*SDL_VERSION_ATLEAST(2, 0, 14)*/
12341224

12351225
#ifdef WIN32
12361226
case SDL_SYSWMEVENT:
@@ -1318,14 +1308,12 @@ dict_from_event(SDL_Event *event)
13181308
window = SDL_GetWindowFromID(event->button.windowID);
13191309
break;
13201310
}
1321-
#if SDL_VERSION_ATLEAST(2, 0, 14)
13221311
case SDL_FINGERMOTION:
13231312
case SDL_FINGERDOWN:
13241313
case SDL_FINGERUP: {
13251314
window = SDL_GetWindowFromID(event->tfinger.windowID);
13261315
break;
13271316
}
1328-
#endif
13291317
default: {
13301318
return dict;
13311319
}

src_c/font.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -612,7 +612,7 @@ font_render(PyObject *self, PyObject *args, PyObject *kwds)
612612

613613
if (strlen(astring) == 0) { /* special 0 string case */
614614
int height = TTF_FontHeight(font);
615-
surf = PG_CreateSurface(0, height, PG_PIXELFORMAT_XRGB8888);
615+
surf = PG_CreateSurface(0, height, SDL_PIXELFORMAT_XRGB8888);
616616
}
617617
else { /* normal case */
618618
if (antialias && bg_rgba_obj == Py_None) {

src_c/include/pgcompat.h

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -27,29 +27,13 @@ typedef uint8_t Uint8;
2727
* warning without this check here, which is very weird. */
2828
#ifdef SDL_VERSION_ATLEAST
2929

30-
// SDL_PIXELFORMAT_XRGB8888 and SDL_PIXELFORMAT_XBGR8888 are new names
31-
// in SDL 2.0.14, the macros below let us use the new (less confusing)
32-
// naming while still building on old versions.
33-
34-
#if SDL_VERSION_ATLEAST(2, 0, 14)
35-
#define PG_PIXELFORMAT_XRGB8888 SDL_PIXELFORMAT_XRGB8888
36-
#else
37-
#define PG_PIXELFORMAT_XRGB8888 SDL_PIXELFORMAT_RGB888
38-
#endif
39-
40-
#if SDL_VERSION_ATLEAST(2, 0, 14)
41-
#define PG_PIXELFORMAT_XBGR8888 SDL_PIXELFORMAT_XBGR8888
42-
#else
43-
#define PG_PIXELFORMAT_XBGR8888 SDL_PIXELFORMAT_BGR888
44-
#endif
45-
4630
// SDL does not provide endian independent names for 32 bit formats without
4731
// alpha channels the way they do for ones with alpha channels.
4832
// E.g. SDL_PIXELFORMAT_RGBA32. This macro allows us the convenience of the
4933
// endian independent name.
5034

5135
#if SDL_BYTEORDER == SDL_LIL_ENDIAN
52-
#define PG_PIXELFORMAT_RGBX32 PG_PIXELFORMAT_XBGR8888
36+
#define PG_PIXELFORMAT_RGBX32 SDL_PIXELFORMAT_XBGR8888
5337
#else
5438
#define PG_PIXELFORMAT_RGBX32 SDL_PIXELFORMAT_RGBX8888
5539
#endif

src_c/pixelcopy.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1160,7 +1160,7 @@ make_surface(PyObject *self, PyObject *arg)
11601160
pixelformat = SDL_PIXELFORMAT_INDEX8;
11611161
}
11621162
else {
1163-
pixelformat = PG_PIXELFORMAT_XRGB8888;
1163+
pixelformat = SDL_PIXELFORMAT_XRGB8888;
11641164
}
11651165
sizex = (int)view_p->shape[0];
11661166
sizey = (int)view_p->shape[1];

src_c/simd_transform_sse2.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ filter_shrink_Y_SSE2(Uint8 *srcpix, Uint8 *dstpix, int width, int srcpitch,
180180

181181
Uint16 *templine;
182182
/* allocate a clear memory area for storing the accumulator line */
183-
// Future: when we support SDL 2.0.10 and up, we can use SDL_SIMDAlloc
183+
// Future: when we support SDL 2.0.14 and up, we can use SDL_SIMDAlloc
184184
// here so accumulate load/stores can be aligned, for a small perf
185185
// improvement.
186186
templine = (Uint16 *)calloc(dstpitch, 2);

src_c/surface.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1612,7 +1612,7 @@ pg_DisplayFormatAlpha(SDL_Surface *surface)
16121612
#endif
16131613
case SDL_PIXELFORMAT_ABGR1555:
16141614
case SDL_PIXELFORMAT_BGR565:
1615-
case PG_PIXELFORMAT_XBGR8888:
1615+
case SDL_PIXELFORMAT_XBGR8888:
16161616
case SDL_PIXELFORMAT_ABGR8888:
16171617
pfe = SDL_PIXELFORMAT_ABGR8888;
16181618
break;

0 commit comments

Comments
 (0)