migration: Fixes and additions to SDL_migration.cocci and README-migration.md.

This commit is contained in:
Ryan C. Gordon committed 2026-10-05 15:00:22 -04:00
1 parent 008dd4195b
commit e5335f9a20
2 files changed
+59 -9

No files matched your search

+57 -9
View File
@@ -30,6 +30,27 @@
//
// So this file is a set of many semantic patches, mostly independent.
@@
@@
- SDL_VideoInit()
+ SDL_InitSubSystem(SDL_INIT_VIDEO)
@@
@@
- SDL_VideoQuit()
+ SDL_QuitSubSystem(SDL_INIT_VIDEO)
@@
@@
- SDL_AudioInit()
+ SDL_InitSubSystem(SDL_INIT_AUDIO)
@@
@@
- SDL_AudioQuit()
+ SDL_QuitSubSystem(SDL_INIT_AUDIO)
@ rule_audio_open @
expression e1, e2;
@@
@@ -84,8 +105,6 @@ expression e1, e2;
+ SDL_QueueAudio(g_audio_id, e1, e2)
// SDL_EventState() - replaced with SDL_SetEventEnabled()
@@
expression e1;
@@ -379,6 +398,14 @@ expression e;
)
@@
// Add parameter to SDL_PremultiplyAlpha
expression e1, e2, e3, e4, e5, e6, e7, e8;
@@
-SDL_PremultiplyAlpha(e1, e2, e3, e4, e5, e6, e7, e8)
+SDL_PremultiplyAlpha(e1, e2, e3, e4, e5, e6, e7, e8, false)
@@
// Remove parameter from SDL_ConvertSurface
expression e1, e2, e3;
@@ -743,12 +770,12 @@ expression e1, e2, e3, e4, e5, e6, e7, e8, e9;
|
-SDL_CreateRGBSurface(e1, e2, e3, e4, e5, e6, e7, e8)
+SDL_CreateSurface(e2, e3, SDL_MasksToPixelFormatEnum(e4, e5, e6, e7, e8))
+SDL_CreateSurface(e2, e3, SDL_GetPixelFormatForMasks(e4, e5, e6, e7, e8))
|
-SDL_CreateRGBSurfaceFrom(e1, e2, e3, e4, e5, e6, e7, e8, e9)
+SDL_CreateSurfaceFrom(e1, e2, e3, e5, SDL_MasksToPixelFormatEnum(e4, e6, e7, e8, e9))
+SDL_CreateSurfaceFrom(e1, e2, e3, e5, SDL_GetPixelFormatForMasks(e4, e6, e7, e8, e9))
)
@@ -2063,11 +2090,11 @@ expression e;
@@
@@
- SDL_DISPLAYEVENT_CONNECTED
+ SDL_EVENT_DISPLAY_CONNECTED
+ SDL_EVENT_DISPLAY_ADDED
@@
@@
- SDL_DISPLAYEVENT_DISCONNECTED
+ SDL_EVENT_DISPLAY_DISCONNECTED
+ SDL_EVENT_DISPLAY_REMOVED
@@
@@
- SDL_DISPLAYEVENT_MOVED
@@ -3087,6 +3114,27 @@ expression e1, e2, e3, e4;
+ SDL_WindowHasSurface
(...)
@@
@@
- SDL_SetWindowGrab
+ SDL_SetWindowMouseGrab
(...)
@@
@@
- SDL_ShowCursor(1)
+ SDL_ShowCursor()
@@
@@
- SDL_ShowCursor(0)
+ SDL_HideCursor()
@@
@@
- SDL_ShowCursor(SDL_TRUE)
+ SDL_ShowCursor()
@@
@@
- SDL_ShowCursor(SDL_FALSE)
+ SDL_HideCursor()
@@
SDL_PixelFormat e1;
@@
- e1.BitsPerPixel
@@ -3337,10 +3385,10 @@ typedef SDL_Colour, SDL_Color;
+ SDL_MixAudio
(...)
@@
expression e1, e2, e3, e4;
@@
- SDL_BlitScaled
+ SDL_BlitSurfaceScaled
(...)
- SDL_BlitScaled(e1, e2, e3, e4)
+ SDL_BlitSurfaceScaled(e1, e2, e3, e4, SDL_SCALEMODE_NEAREST)
@@
@@
- SDL_SYSTEM_CURSOR_ARROW
+2
View File
@@ -1859,6 +1859,8 @@ SDL_SetSurfaceColorKey() takes an bool to enable and disable colorkey. RLE accel
SDL_SetSurfaceRLE() takes an bool to enable and disable RLE acceleration.
SDL_PremultiplyAlpha() takes an extra bool parameter ("linear"). For SDL2 compatibility, pass false for this parameter.
The following functions have been renamed:
* SDL_BlitScaled() => SDL_BlitSurfaceScaled(), returns bool
* SDL_ConvertSurfaceFormat() => SDL_ConvertSurface()