SDL: SDL API renaming: SDL_surface.h

From cc0296c934bac9c8fe4ebf53e0bc2cc67be22a5c Mon Sep 17 00:00:00 2001
From: Sam Lantinga <[EMAIL REDACTED]>
Date: Tue, 27 Dec 2022 06:36:39 -0800
Subject: [PATCH] SDL API renaming: SDL_surface.h

Fixes https://github.com/libsdl-org/SDL/issues/6884
---
 WhatsNew.txt                                  |  13 ++
 Xcode-iOS/Demos/src/accelerometer.c           |   6 +-
 Xcode-iOS/Demos/src/fireworks.c               |   4 +-
 Xcode-iOS/Demos/src/happy.c                   |   4 +-
 Xcode-iOS/Demos/src/keyboard.c                |   6 +-
 Xcode-iOS/Demos/src/touch.c                   |   2 +-
 docs/README-migration.md                      |  15 ++
 include/SDL3/SDL_oldnames.h                   |  30 +++
 include/SDL3/SDL_surface.h                    | 180 +++++++++---------
 src/SDL_internal.h                            |   2 +-
 src/dynapi/SDL_dynapi.sym                     |  26 +--
 src/dynapi/SDL_dynapi_overrides.h             |  26 +--
 src/dynapi/SDL_dynapi_procs.h                 |  26 +--
 src/events/SDL_mouse.c                        |   4 +-
 src/render/SDL_render.c                       |  14 +-
 src/render/SDL_yuv_sw.c                       |   6 +-
 src/render/software/SDL_render_sw.c           |  26 +--
 src/render/software/SDL_rotate.c              |  16 +-
 src/render/software/SDL_triangle.c            |   8 +-
 src/test/SDL_test_common.c                    |   4 +-
 src/test/SDL_test_font.c                      |   2 +-
 src/video/SDL_RLEaccel.c                      |   2 +-
 src/video/SDL_bmp.c                           |   4 +-
 src/video/SDL_fillrect.c                      |  66 +++----
 src/video/SDL_surface.c                       |  82 ++++----
 src/video/SDL_video.c                         |  10 +-
 src/video/android/SDL_androidmouse.c          |   4 +-
 src/video/cocoa/SDL_cocoavideo.m              |   4 +-
 src/video/dummy/SDL_nullframebuffer.c         |   2 +-
 .../emscripten/SDL_emscriptenframebuffer.c    |   4 +-
 src/video/emscripten/SDL_emscriptenmouse.c    |   2 +-
 src/video/haiku/SDL_bvideo.cc                 |   2 +-
 src/video/n3ds/SDL_n3dsframebuffer.c          |   4 +-
 src/video/ngage/SDL_ngageframebuffer.cpp      |   2 +-
 .../offscreen/SDL_offscreenframebuffer.c      |   2 +-
 src/video/windows/SDL_windowsmouse.c          |   2 +-
 test/testautomation_mouse.c                   |   4 +-
 test/testautomation_render.c                  |  26 +--
 test/testautomation_surface.c                 |  86 ++++-----
 test/testcustomcursor.c                       |  12 +-
 test/testime.c                                |   4 +-
 test/testoffscreen.c                          |   2 +-
 test/testoverlay2.c                           |   4 +-
 test/testshader.c                             |   4 +-
 test/testshape.c                              |  10 +-
 test/testutils.c                              |  12 +-
 test/testyuv.c                                |   2 +-
 47 files changed, 416 insertions(+), 362 deletions(-)

diff --git a/WhatsNew.txt b/WhatsNew.txt
index 9ef67b29317a..c4930b5ad8e6 100644
--- a/WhatsNew.txt
+++ b/WhatsNew.txt
@@ -24,9 +24,16 @@ General:
     * SDL_AudioStreamFlush => SDL_FlushAudioStream
     * SDL_AudioStreamGet => SDL_GetAudioStreamData
     * SDL_AudioStreamPut => SDL_PutAudioStreamData
+    * SDL_FillRect => SDL_FillSurfaceRect
+    * SDL_FillRects => SDL_FillSurfaceRects
     * SDL_FreeAudioStream => SDL_DestroyAudioStream
     * SDL_FreeFormat => SDL_DestroyPixelFormat
     * SDL_FreePalette => SDL_DestroyPalette
+    * SDL_FreeSurface => SDL_DestroySurface
+    * SDL_GetClipRect => SDL_GetSurfaceClipRect
+    * SDL_GetColorKey => SDL_GetSurfaceColorKey
+    * SDL_HasColorKey => SDL_SurfaceHasColorKey
+    * SDL_HasSurfaceRLE => SDL_SurfaceHasRLE
     * SDL_JoystickAttachVirtual => SDL_AttachVirtualJoystick
     * SDL_JoystickAttachVirtualEx => SDL_AttachVirtualJoystickEx
     * SDL_JoystickClose => SDL_CloseJoystick
@@ -76,6 +83,8 @@ General:
     * SDL_JoystickSetVirtualButton => SDL_SetJoystickVirtualButton
     * SDL_JoystickSetVirtualHat => SDL_SetJoystickVirtualHat
     * SDL_JoystickUpdate => SDL_UpdateJoysticks
+    * SDL_LowerBlit => SDL_BlitSurfaceUnchecked
+    * SDL_LowerBlitScaled => SDL_BlitSurfaceUncheckedScaled
     * SDL_MasksToPixelFormatEnum => SDL_GetPixelFormatEnumForMasks
     * SDL_NewAudioStream => SDL_CreateAudioStream
     * SDL_NumJoysticks => SDL_GetNumJoysticks
@@ -126,6 +135,10 @@ General:
     * SDL_SensorGetType => SDL_GetSensorType
     * SDL_SensorOpen => SDL_OpenSensor
     * SDL_SensorUpdate => SDL_UpdateSensors
+    * SDL_SetClipRect => SDL_SetSurfaceClipRect
+    * SDL_SetColorKey => SDL_SetSurfaceColorKey
+    * SDL_UpperBlit => SDL_BlitSurface
+    * SDL_UpperBlitScaled => SDL_BlitSurfaceScaled
 * Removed the following functions from the API, see docs/README-migration.md for details:
     * SDL_AudioInit()
     * SDL_AudioQuit()
diff --git a/Xcode-iOS/Demos/src/accelerometer.c b/Xcode-iOS/Demos/src/accelerometer.c
index b676e2be24c0..6c35d0009d51 100644
--- a/Xcode-iOS/Demos/src/accelerometer.c
+++ b/Xcode-iOS/Demos/src/accelerometer.c
@@ -123,7 +123,7 @@ initializeTextures(SDL_Renderer *renderer)
         fatalError("could not ship.bmp");
     }
     /* set blue to transparent on the ship */
-    SDL_SetColorKey(bmp_surface, 1,
+    SDL_SetSurfaceColorKey(bmp_surface, 1,
                     SDL_MapRGB(bmp_surface->format, 0, 0, 255));
 
     /* create ship texture from surface */
@@ -137,7 +137,7 @@ initializeTextures(SDL_Renderer *renderer)
     shipData.rect.w = bmp_surface->w;
     shipData.rect.h = bmp_surface->h;
 
-    SDL_FreeSurface(bmp_surface);
+    SDL_DestroySurface(bmp_surface);
 
     /* load the space background */
     bmp_surface = SDL_LoadBMP("space.bmp");
@@ -149,7 +149,7 @@ initializeTextures(SDL_Renderer *renderer)
     if (space == NULL) {
         fatalError("could not create space texture");
     }
-    SDL_FreeSurface(bmp_surface);
+    SDL_DestroySurface(bmp_surface);
 
 }
 
diff --git a/Xcode-iOS/Demos/src/fireworks.c b/Xcode-iOS/Demos/src/fireworks.c
index c6aaaa6ccb52..a2616f956766 100644
--- a/Xcode-iOS/Demos/src/fireworks.c
+++ b/Xcode-iOS/Demos/src/fireworks.c
@@ -357,8 +357,8 @@ initializeTexture()
                  GL_RGBA, GL_UNSIGNED_BYTE, bmp_surface_rgba8888->pixels);
 
     /* free bmp surface and converted bmp surface */
-    SDL_FreeSurface(bmp_surface);
-    SDL_FreeSurface(bmp_surface_rgba8888);
+    SDL_DestroySurface(bmp_surface);
+    SDL_DestroySurface(bmp_surface_rgba8888);
 
 }
 
diff --git a/Xcode-iOS/Demos/src/happy.c b/Xcode-iOS/Demos/src/happy.c
index 50bb799da1bb..929213900ebe 100644
--- a/Xcode-iOS/Demos/src/happy.c
+++ b/Xcode-iOS/Demos/src/happy.c
@@ -113,7 +113,7 @@ initializeTexture(SDL_Renderer *renderer)
         fatalError("could not load bmp");
     }
     /* set white to transparent on the happyface */
-    SDL_SetColorKey(bmp_surface, 1,
+    SDL_SetSurfaceColorKey(bmp_surface, 1,
                     SDL_MapRGB(bmp_surface->format, 255, 255, 255));
 
     /* convert RGBA surface to texture */
@@ -124,7 +124,7 @@ initializeTexture(SDL_Renderer *renderer)
     SDL_SetTextureBlendMode(texture, SDL_BLENDMODE_BLEND);
 
     /* free up allocated memory */
-    SDL_FreeSurface(bmp_surface);
+    SDL_DestroySurface(bmp_surface);
 }
 
 int
diff --git a/Xcode-iOS/Demos/src/keyboard.c b/Xcode-iOS/Demos/src/keyboard.c
index d4b6f86b8498..f0e09527691f 100644
--- a/Xcode-iOS/Demos/src/keyboard.c
+++ b/Xcode-iOS/Demos/src/keyboard.c
@@ -171,7 +171,7 @@ loadFont(void)
         return 0;
     } else {
         /* set the transparent color for the bitmap font (hot pink) */
-        SDL_SetColorKey(surface, 1, SDL_MapRGB(surface->format, 238, 0, 252));
+        SDL_SetSurfaceColorKey(surface, 1, SDL_MapRGB(surface->format, 238, 0, 252));
         /* now we convert the surface to our desired pixel format */
         int format = SDL_PIXELFORMAT_ABGR8888;  /* desired texture format */
 
@@ -186,8 +186,8 @@ loadFont(void)
             /* set blend mode for our texture */
             SDL_SetTextureBlendMode(texture, SDL_BLENDMODE_BLEND);
         }
-        SDL_FreeSurface(surface);
-        SDL_FreeSurface(converted);
+        SDL_DestroySurface(surface);
+        SDL_DestroySurface(converted);
         return texture;
     }
 }
diff --git a/Xcode-iOS/Demos/src/touch.c b/Xcode-iOS/Demos/src/touch.c
index 3b909fd156b5..446e1ef1e998 100644
--- a/Xcode-iOS/Demos/src/touch.c
+++ b/Xcode-iOS/Demos/src/touch.c
@@ -63,7 +63,7 @@ initializeTexture(SDL_Renderer *renderer)
     }
     brush =
         SDL_CreateTextureFromSurface(renderer, bmp_surface);
-    SDL_FreeSurface(bmp_surface);
+    SDL_DestroySurface(bmp_surface);
     if (brush == NULL) {
         fatalError("could not create brush texture");
     }
diff --git a/docs/README-migration.md b/docs/README-migration.md
index 2e0968719df8..94687a15f6b2 100644
--- a/docs/README-migration.md
+++ b/docs/README-migration.md
@@ -509,6 +509,21 @@ But if you're migrating your code which uses masks, you probably have a format i

+The following functions have been renamed:
+* SDL_FillRect => SDL_FillSurfaceRect
+* SDL_FillRects => SDL_FillSurfaceRects
+* SDL_FreeSurface => SDL_DestroySurface
+* SDL_GetClipRect => SDL_GetSurfaceClipRect
+* SDL_GetColorKey => SDL_GetSurfaceColorKey
+* SDL_HasColorKey => SDL_SurfaceHasColorKey
+* SDL_HasSurfaceRLE => SDL_SurfaceHasRLE
+* SDL_LowerBlit => SDL_BlitSurfaceUnchecked
+* SDL_LowerBlitScaled => SDL_BlitSurfaceUncheckedScaled
+* SDL_SetClipRect => SDL_SetSurfaceClipRect
+* SDL_SetColorKey => SDL_SetSurfaceColorKey
+* SDL_UpperBlit => SDL_BlitSurface
+* SDL_UpperBlitScaled => SDL_BlitSurfaceScaled
+

SDL_syswm.h

This header no longer includes platform specific headers and type definitions, instead allowing you to include the ones appropriate for your use case. You should define one or more of the following to enable the relevant platform-specific support:
diff --git a/include/SDL3/SDL_oldnames.h b/include/SDL3/SDL_oldnames.h
index f45faef76900…20a7d0dca6af 100644
— a/include/SDL3/SDL_oldnames.h
+++ b/include/SDL3/SDL_oldnames.h
@@ -192,6 +192,21 @@
#define SDL_SensorOpen SDL_OpenSensor
#define SDL_SensorUpdate SDL_UpdateSensors

+/* ##SDL_surface.h /
+#define SDL_FillRect SDL_FillSurfaceRect
+#define SDL_FillRects SDL_FillSurfaceRects
+#define SDL_FreeSurface SDL_DestroySurface
+#define SDL_GetClipRect SDL_GetSurfaceClipRect
+#define SDL_GetColorKey SDL_GetSurfaceColorKey
+#define SDL_HasColorKey SDL_SurfaceHasColorKey
+#define SDL_HasSurfaceRLE SDL_SurfaceHasRLE
+#define SDL_LowerBlit SDL_BlitSurfaceUnchecked
+#define SDL_LowerBlitScaled SDL_BlitSurfaceUncheckedScaled
+#define SDL_SetClipRect SDL_SetSurfaceClipRect
+#define SDL_SetColorKey SDL_SetSurfaceColorKey
+#define SDL_UpperBlit SDL_BlitSurface
+#define SDL_UpperBlitScaled SDL_BlitSurfaceScaled
+
#else /
!SDL_ENABLE_OLD_NAMES */

/* ##SDL_audio.h */
@@ -347,6 +362,21 @@
#define SDL_SensorOpen SDL_SensorOpen_renamed_SDL_OpenSensor
#define SDL_SensorUpdate SDL_SensorUpdate_renamed_SDL_UpdateSensors

+/* ##SDL_surface.h /
+#define SDL_FillRect SDL_FillRect_renamed_SDL_FillSurfaceRect
+#define SDL_FillRects SDL_FillRects_renamed_SDL_FillSurfaceRects
+#define SDL_FreeSurface SDL_FreeSurface_renamed_SDL_DestroySurface
+#define SDL_GetClipRect SDL_GetClipRect_renamed_SDL_GetSurfaceClipRect
+#define SDL_GetColorKey SDL_GetColorKey_renamed_SDL_GetSurfaceColorKey
+#define SDL_HasColorKey SDL_HasColorKey_renamed_SDL_SurfaceHasColorKey
+#define SDL_HasSurfaceRLE SDL_HasSurfaceRLE_renamed_SDL_SurfaceHasRLE
+#define SDL_LowerBlit SDL_LowerBlit_renamed_SDL_BlitSurfaceUnchecked
+#define SDL_LowerBlitScaled SDL_LowerBlitScaled_renamed_SDL_BlitSurfaceUncheckedScaled
+#define SDL_SetClipRect SDL_SetClipRect_renamed_SDL_SetSurfaceClipRect
+#define SDL_SetColorKey SDL_SetColorKey_renamed_SDL_SetSurfaceColorKey
+#define SDL_UpperBlit SDL_UpperBlit_renamed_SDL_BlitSurface
+#define SDL_UpperBlitScaled SDL_UpperBlitScaled_renamed_SDL_BlitSurfaceScaled
+
#endif /
SDL_ENABLE_OLD_NAMES */

#endif /* SDL_oldnames_h_ /
diff --git a/include/SDL3/SDL_surface.h b/include/SDL3/SDL_surface.h
index ce888aabb759…067b5bb80410 100644
— a/include/SDL3/SDL_surface.h
+++ b/include/SDL3/SDL_surface.h
@@ -99,8 +99,8 @@ typedef struct SDL_Surface
/
*

  • \brief The type of function used for surface blitting functions.
    */
    -typedef int (SDLCALL *SDL_blit) (struct SDL_Surface * src, SDL_Rect * srcrect,
  •                             struct SDL_Surface * dst, SDL_Rect * dstrect);
    

+typedef int (SDLCALL *SDL_blit) (struct SDL_Surface *src, SDL_Rect *srcrect,

  •                             struct SDL_Surface *dst, SDL_Rect *dstrect);
    

/**

  • \brief The formula used for converting between YUV and RGB
    @@ -125,7 +125,7 @@ typedef enum
  • \since This function is available since SDL 3.0.0.
  • \sa SDL_CreateSurfaceFrom
    • \sa SDL_FreeSurface
    • \sa SDL_DestroySurface
      */
      extern DECLSPEC SDL_Surface *SDLCALL SDL_CreateSurface
      (int width, int height, Uint32 format);
      @@ -148,7 +148,7 @@ extern DECLSPEC SDL_Surface *SDLCALL SDL_CreateSurface
    • \since This function is available since SDL 3.0.0.
    • \sa SDL_CreateSurface
    • \sa SDL_FreeSurface
    • \sa SDL_DestroySurface
      */
      extern DECLSPEC SDL_Surface *SDLCALL SDL_CreateSurfaceFrom
      (void *pixels, int width, int height, int pitch, Uint32 format);
      @@ -167,7 +167,7 @@ extern DECLSPEC SDL_Surface *SDLCALL SDL_CreateSurfaceFrom
    • \sa SDL_LoadBMP
    • \sa SDL_LoadBMP_RW
      */
      -extern DECLSPEC void SDLCALL SDL_FreeSurface(SDL_Surface * surface);
      +extern DECLSPEC void SDLCALL SDL_DestroySurface(SDL_Surface *surface);

/**

  • Set the palette used by a surface.
    @@ -181,8 +181,8 @@ extern DECLSPEC void SDLCALL SDL_FreeSurface(SDL_Surface * surface);
  • \since This function is available since SDL 3.0.0.
    */
    -extern DECLSPEC int SDLCALL SDL_SetSurfacePalette(SDL_Surface * surface,
  •                                              SDL_Palette * palette);
    

+extern DECLSPEC int SDLCALL SDL_SetSurfacePalette(SDL_Surface *surface,

  •                                              SDL_Palette *palette);
    

/**

  • Set up a surface for directly accessing the pixels.
    @@ -205,7 +205,7 @@ extern DECLSPEC int SDLCALL SDL_SetSurfacePalette(SDL_Surface * surface,
  • \sa SDL_MUSTLOCK
  • \sa SDL_UnlockSurface
    */
    -extern DECLSPEC int SDLCALL SDL_LockSurface(SDL_Surface * surface);
    +extern DECLSPEC int SDLCALL SDL_LockSurface(SDL_Surface *surface);

/**

  • Release a surface after directly accessing the pixels.
    @@ -216,12 +216,12 @@ extern DECLSPEC int SDLCALL SDL_LockSurface(SDL_Surface * surface);
  • \sa SDL_LockSurface
    */
    -extern DECLSPEC void SDLCALL SDL_UnlockSurface(SDL_Surface * surface);
    +extern DECLSPEC void SDLCALL SDL_UnlockSurface(SDL_Surface *surface);

/**

  • Load a BMP image from a seekable SDL data stream.
    • The new surface should be freed with SDL_FreeSurface(). Not doing so will
    • The new surface should be freed with SDL_DestroySurface(). Not doing so will
    • result in a memory leak.
    • src is an open SDL_RWops buffer, typically loaded with SDL_RWFromFile.
      @@ -235,12 +235,12 @@ extern DECLSPEC void SDLCALL SDL_UnlockSurface(SDL_Surface * surface);
    • \since This function is available since SDL 3.0.0.
    • \sa SDL_FreeSurface
    • \sa SDL_DestroySurface
    • \sa SDL_RWFromFile
    • \sa SDL_LoadBMP
    • \sa SDL_SaveBMP_RW
      */
      -extern DECLSPEC SDL_Surface *SDLCALL SDL_LoadBMP_RW(SDL_RWops * src,
      +extern DECLSPEC SDL_Surface *SDLCALL SDL_LoadBMP_RW(SDL_RWops *src,
      int freesrc);

/**
@@ -271,7 +271,7 @@ extern DECLSPEC SDL_Surface *SDLCALL SDL_LoadBMP_RW(SDL_RWops * src,

  • \sa SDL_SaveBMP
    */
    extern DECLSPEC int SDLCALL SDL_SaveBMP_RW
  • (SDL_Surface * surface, SDL_RWops * dst, int freedst);
  • (SDL_Surface *surface, SDL_RWops *dst, int freedst);

/**

  • Save a surface to a file.
    @@ -298,7 +298,7 @@ extern DECLSPEC int SDLCALL SDL_SaveBMP_RW
  • \sa SDL_LockSurface
  • \sa SDL_UnlockSurface
    */
    -extern DECLSPEC int SDLCALL SDL_SetSurfaceRLE(SDL_Surface * surface,
    +extern DECLSPEC int SDLCALL SDL_SetSurfaceRLE(SDL_Surface *surface,
    int flag);

/**
@@ -313,7 +313,7 @@ extern DECLSPEC int SDLCALL SDL_SetSurfaceRLE(SDL_Surface * surface,
*

  • \sa SDL_SetSurfaceRLE
    */
    -extern DECLSPEC SDL_bool SDLCALL SDL_HasSurfaceRLE(SDL_Surface * surface);
    +extern DECLSPEC SDL_bool SDLCALL SDL_SurfaceHasRLE(SDL_Surface *surface);

/**

  • Set the color key (transparent pixel) in a surface.
    @@ -337,9 +337,9 @@ extern DECLSPEC SDL_bool SDLCALL SDL_HasSurfaceRLE(SDL_Surface * surface);
  • \since This function is available since SDL 3.0.0.
  • \sa SDL_BlitSurface
    • \sa SDL_GetColorKey
    • \sa SDL_GetSurfaceColorKey
      */
      -extern DECLSPEC int SDLCALL SDL_SetColorKey(SDL_Surface * surface,
      +extern DECLSPEC int SDLCALL SDL_SetSurfaceColorKey(SDL_Surface *surface,
      int flag, Uint32 key);

/**
@@ -352,10 +352,10 @@ extern DECLSPEC int SDLCALL SDL_SetColorKey(SDL_Surface * surface,
*

  • \since This function is available since SDL 3.0.0.
    • \sa SDL_SetColorKey
    • \sa SDL_GetColorKey
    • \sa SDL_SetSurfaceColorKey
    • \sa SDL_GetSurfaceColorKey
      */
      -extern DECLSPEC SDL_bool SDLCALL SDL_HasColorKey(SDL_Surface * surface);
      +extern DECLSPEC SDL_bool SDLCALL SDL_SurfaceHasColorKey(SDL_Surface *surface);

/**

  • Get the color key (transparent pixel) for a surface.
    @@ -373,10 +373,10 @@ extern DECLSPEC SDL_bool SDLCALL SDL_HasColorKey(SDL_Surface * surface);
  • \since This function is available since SDL 3.0.0.
  • \sa SDL_BlitSurface
    • \sa SDL_SetColorKey
    • \sa SDL_SetSurfaceColorKey
      */
      -extern DECLSPEC int SDLCALL SDL_GetColorKey(SDL_Surface * surface,
  •                                        Uint32 * key);
    

+extern DECLSPEC int SDLCALL SDL_GetSurfaceColorKey(SDL_Surface *surface,

  •                                        Uint32 *key);
    

/**

  • Set an additional color value multiplied into blit operations.
    @@ -399,7 +399,7 @@ extern DECLSPEC int SDLCALL SDL_GetColorKey(SDL_Surface * surface,
  • \sa SDL_GetSurfaceColorMod
  • \sa SDL_SetSurfaceAlphaMod
    */
    -extern DECLSPEC int SDLCALL SDL_SetSurfaceColorMod(SDL_Surface * surface,
    +extern DECLSPEC int SDLCALL SDL_SetSurfaceColorMod(SDL_Surface *surface,
    Uint8 r, Uint8 g, Uint8 b);

@@ -418,9 +418,9 @@ extern DECLSPEC int SDLCALL SDL_SetSurfaceColorMod(SDL_Surface * surface,

  • \sa SDL_GetSurfaceAlphaMod
  • \sa SDL_SetSurfaceColorMod
    */
    -extern DECLSPEC int SDLCALL SDL_GetSurfaceColorMod(SDL_Surface * surface,
  •                                               Uint8 * r, Uint8 * g,
    
  •                                               Uint8 * b);
    

+extern DECLSPEC int SDLCALL SDL_GetSurfaceColorMod(SDL_Surface *surface,

  •                                               Uint8 *r, Uint8 *g,
    
  •                                               Uint8 *b);
    

/**

  • Set an additional alpha value used in blit operations.
    @@ -440,7 +440,7 @@ extern DECLSPEC int SDLCALL SDL_GetSurfaceColorMod(SDL_Surface * surface,
  • \sa SDL_GetSurfaceAlphaMod
  • \sa SDL_SetSurfaceColorMod
    */
    -extern DECLSPEC int SDLCALL SDL_SetSurfaceAlphaMod(SDL_Surface * surface,
    +extern DECLSPEC int SDLCALL SDL_SetSurfaceAlphaMod(SDL_Surface *surface,
    Uint8 alpha);

/**
@@ -456,8 +456,8 @@ extern DECLSPEC int SDLCALL SDL_SetSurfaceAlphaMod(SDL_Surface * surface,

  • \sa SDL_GetSurfaceColorMod
  • \sa SDL_SetSurfaceAlphaMod
    */
    -extern DECLSPEC int SDLCALL SDL_GetSurfaceAlphaMod(SDL_Surface * surface,
  •                                               Uint8 * alpha);
    

+extern DECLSPEC int SDLCALL SDL_GetSurfaceAlphaMod(SDL_Surface *surface,

  •                                               Uint8 *alpha);
    

/**

  • Set the blend mode used for blit operations.
    @@ -475,7 +475,7 @@ extern DECLSPEC int SDLCALL SDL_GetSurfaceAlphaMod(SDL_Surface * surface,
  • \sa SDL_GetSurfaceBlendMode
    */
    -extern DECLSPEC int SDLCALL SDL_SetSurfaceBlendMode(SDL_Surface * surface,
    +extern DECLSPEC int SDLCALL SDL_SetSurfaceBlendMode(SDL_Surface *surface,
    SDL_BlendMode blendMode);

/**
@@ -490,7 +490,7 @@ extern DECLSPEC int SDLCALL SDL_SetSurfaceBlendMode(SDL_Surface * surface,
*

  • \sa SDL_SetSurfaceBlendMode
    */
    -extern DECLSPEC int SDLCALL SDL_GetSurfaceBlendMode(SDL_Surface * surface,
    +extern DECLSPEC int SDLCALL SDL_GetSurfaceBlendMode(SDL_Surface *surface,
    SDL_BlendMode *blendMode);

/**
@@ -511,10 +511,10 @@ extern DECLSPEC int SDLCALL SDL_GetSurfaceBlendMode(SDL_Surface * surface,

  • \since This function is available since SDL 3.0.0.
  • \sa SDL_BlitSurface
    • \sa SDL_GetClipRect
    • \sa SDL_GetSurfaceClipRect
      */
      -extern DECLSPEC SDL_bool SDLCALL SDL_SetClipRect(SDL_Surface * surface,
  •                                             const SDL_Rect * rect);
    

+extern DECLSPEC SDL_bool SDLCALL SDL_SetSurfaceClipRect(SDL_Surface *surface,

  •                                             const SDL_Rect *rect);
    

/**

  • Get the clipping rectangle for a surface.
    @@ -530,21 +530,21 @@ extern DECLSPEC SDL_bool SDLCALL SDL_SetClipRect(SDL_Surface * surface,
  • \since This function is available since SDL 3.0.0.
  • \sa SDL_BlitSurface
    • \sa SDL_SetClipRect
    • \sa SDL_SetSurfaceClipRect
      */
      -extern DECLSPEC void SDLCALL SDL_GetClipRect(SDL_Surface * surface,
  •                                         SDL_Rect * rect);
    

+extern DECLSPEC void SDLCALL SDL_GetSurfaceClipRect(SDL_Surface *surface,

  •                                         SDL_Rect *rect);
    

/*

  • Creates a new surface identical to the existing surface.
    • The returned surface should be freed with SDL_FreeSurface().
    • The returned surface should be freed with SDL_DestroySurface().
    • \param surface the surface to duplicate.
    • \returns a copy of the surface, or NULL on failure; call SDL_GetError() for
    •      more information.
      
    */
    -extern DECLSPEC SDL_Surface *SDLCALL SDL_DuplicateSurface(SDL_Surface * surface);
    +extern DECLSPEC SDL_Surface *SDLCALL SDL_DuplicateSurface(SDL_Surface *surface);

/**

  • Copy an existing surface to a new surface of the specified format.
    @@ -610,9 +610,9 @@ extern DECLSPEC SDL_Surface *SDLCALL SDL_ConvertSurfaceFormat(SDL_Surface *surfa
    */
    extern DECLSPEC int SDLCALL SDL_ConvertPixels(int width, int height,
    Uint32 src_format,
  •                                          const void * src, int src_pitch,
    
  •                                          const void *src, int src_pitch,
                                             Uint32 dst_format,
    
  •                                          void * dst, int dst_pitch);
    
  •                                          void *dst, int dst_pitch);
    

/**

  • Premultiply the alpha on a block of pixels.
    @@ -636,9 +636,9 @@ extern DECLSPEC int SDLCALL SDL_ConvertPixels(int width, int height,
    */
    extern DECLSPEC int SDLCALL SDL_PremultiplyAlpha(int width, int height,
    Uint32 src_format,
  •                                             const void * src, int src_pitch,
    
  •                                             const void *src, int src_pitch,
                                                Uint32 dst_format,
    
  •                                             void * dst, int dst_pitch);
    
  •                                             void *dst, int dst_pitch);
    

/**

  • Perform a fast fill of a rectangle with a specific color.
    @@ -649,7 +649,7 @@ extern DECLSPEC int SDLCALL SDL_PremultiplyAlpha(int width, int height,
  • information, no blending takes place.
  • If there is a clip rectangle set on the destination (set via
    • SDL_SetClipRect()), then this function will fill based on the intersection
    • SDL_SetSurfaceClipRect()), then this function will fill based on the intersection
    • of the clip rectangle and rect.
    • \param dst the SDL_Surface structure that is the drawing target
      @@ -661,10 +661,10 @@ extern DECLSPEC int SDLCALL SDL_PremultiplyAlpha(int width, int height,
    • \since This function is available since SDL 3.0.0.
    • \sa SDL_FillRects
    • \sa SDL_FillSurfaceRects
      */
      -extern DECLSPEC int SDLCALL SDL_FillRect
  • (SDL_Surface * dst, const SDL_Rect * rect, Uint32 color);
    +extern DECLSPEC int SDLCALL SDL_FillSurfaceRect
  • (SDL_Surface *dst, const SDL_Rect *rect, Uint32 color);

/**

  • Perform a fast fill of a set of rectangles with a specific color.
    @@ -675,7 +675,7 @@ extern DECLSPEC int SDLCALL SDL_FillRect
  • information, no blending takes place.
  • If there is a clip rectangle set on the destination (set via
    • SDL_SetClipRect()), then this function will fill based on the intersection
    • SDL_SetSurfaceClipRect()), then this function will fill based on the intersection
    • of the clip rectangle and rect.
    • \param dst the SDL_Surface structure that is the drawing target
      @@ -687,12 +687,11 @@ extern DECLSPEC int SDLCALL SDL_FillRect
    • \since This function is available since SDL 3.0.0.
    • \sa SDL_FillRect
    • \sa SDL_FillSurfaceRect
      */
      -extern DECLSPEC int SDLCALL SDL_FillRects
  • (SDL_Surface * dst, const SDL_Rect * rects, int count, Uint32 color);
    +extern DECLSPEC int SDLCALL SDL_FillSurfaceRects
  • (SDL_Surface *dst, const SDL_Rect *rects, int count, Uint32 color);

-/* !!! FIXME: merge this documentation with the wiki /
/
*

  • Performs a fast blit from the source surface to the destination surface.

@@ -701,8 +700,6 @@ extern DECLSPEC int SDLCALL SDL_FillRects

  • surface (\c src or \c dst) is copied. The final blit rectangles are saved
  • in \c srcrect and \c dstrect after all clipping is performed.
    • \returns 0 if the blit is successful, otherwise it returns -1.
    • The blit function should not be called on a locked surface.
    • The blit semantics for surfaces with and without blending and colorkey
      @@ -747,24 +744,22 @@ extern DECLSPEC int SDLCALL SDL_FillRects
      source color key.
      \endverbatim
    • You should call SDL_BlitSurface() unless you know exactly how SDL
    • blitting works internally and how to use the other blit functions.
  • */
    -#define SDL_BlitSurface SDL_UpperBlit

-/**

    • Perform a fast blit from the source surface to the destination surface.
    • SDL_UpperBlit() has been replaced by SDL_BlitSurface(), which is merely a
    • macro for this function with a less confusing name.
    • \param src the SDL_Surface structure to be copied from
    • \param srcrect the SDL_Rect structure representing the rectangle to be
    •            copied, or NULL to copy the entire surface
      
    • \param dst the SDL_Surface structure that is the blit target
    • \param dstrect the SDL_Rect structure representing the rectangle that is
    •            copied into
      
    • \returns 0 on success or a negative error code on failure; call
    •      SDL_GetError() for more information.
      
    • \since This function is available since SDL 3.0.0.
    • \sa SDL_BlitSurface
      */
      -extern DECLSPEC int SDLCALL SDL_UpperBlit
  • (SDL_Surface * src, const SDL_Rect * srcrect,
  • SDL_Surface * dst, SDL_Rect * dstrect);
    

+extern DECLSPEC int SDLCALL SDL_BlitSurface

  • (SDL_Surface *src, const SDL_Rect *srcrect,
  • SDL_Surface *dst, SDL_Rect *dstrect);
    

/**

  • Perform low-level surface blitting only.
    @@ -772,9 +767,6 @@ extern DECLSPEC int SDLCALL SDL_UpperBlit
  • This is a semi-private blit function and it performs low-level surface
  • blitting, assuming the input rectangles have already been clipped.
    • Unless you know what you’re doing, you should be using SDL_BlitSurface()
    • instead.
    • \param src the SDL_Surface structure to be copied from
    • \param srcrect the SDL_Rect structure representing the rectangle to be
    •            copied, or NULL to copy the entire surface
      

@@ -788,9 +780,9 @@ extern DECLSPEC int SDLCALL SDL_UpperBlit
*

  • \sa SDL_BlitSurface
    */
    -extern DECLSPEC int SDLCALL SDL_LowerBlit
  • (SDL_Surface * src, SDL_Rect * srcrect,
  • SDL_Surface * dst, SDL_Rect * dstrect);
    

+extern DECLSPEC int SDLCALL SDL_BlitSurfaceUnchecked

  • (SDL_Surface *src, SDL_Rect *srcrect,
  • SDL_Surface *dst, SDL_Rect *dstrect);
    

/**
@@ -801,37 +793,41 @@ extern DECLSPEC int SDLCALL SDL_LowerBlit
*

  • \since This function is available since SDL 3.0.0.
    */
    -extern DECLSPEC int SDLCALL SDL_SoftStretch(SDL_Surface * src,
  •                                        const SDL_Rect * srcrect,
    
  •                                        SDL_Surface * dst,
    
  •                                        const SDL_Rect * dstrect);
    

+extern DECLSPEC int SDLCALL SDL_SoftStretch(SDL_Surface *src,

  •                                        const SDL_Rect *srcrect,
    
  •                                        SDL_Surface *dst,
    
  •                                        const SDL_Rect *dstrect);
    

/**

  • Perform bilinear scaling between two surfaces of the same format, 32BPP.
  • \since This function is available since SDL 3.0.0.
    */
    -extern DECLSPEC int SDLCALL SDL_SoftStretchLinear(SDL_Surface * src,
  •                                        const SDL_Rect * srcrect,
    
  •                                        SDL_Surface * dst,
    
  •                                        const SDL_Rect * dstrect);
    

+extern DECLSPEC int SDLCALL SDL_SoftStretchLinear(SDL_Surface *src,

  •                                        const SDL_Rect *srcrect,
    
  •                                        SDL_Surface *dst,
    
  •                                        const SDL_Rect *dstrect);
    

-#define SDL_BlitScaled SDL_UpperBlitScaled

/**

  • Perform a scaled surface copy to a destination surface.
    • SDL_UpperBlitScaled() has been replaced by SDL_BlitScaled(), which is
    • merely a macro for this function with a less confusing name.
    • \param src the SDL_Surface structure to be copied from
    • \param srcrect the SDL_Rect structure representing the rectangle to be
    •            copied
      
    • \param dst the SDL_Surface structure that is the blit target
    • \param dstrect the SDL_Rect structure representing the rectangle that is
    •            copied into
      
    • \returns 0 on success or a negative error code on failure; call
    •      SDL_GetError() for more information.
      
    • \since This function is available since SDL 3.0.0.
    • \sa SDL_BlitScaled
      */
      -extern DECLSPEC int SDLCALL SDL_UpperBlitScaled
  • (SDL_Surface * src, const SDL_Rect * srcrect,
  • SDL_Surface * dst, SDL_Rect * dstrect);
    +extern DECLSPEC int SDLCALL SDL_BlitSurfaceScaled
  • (SDL_Surface *src, const SDL_Rect *srcrect,
  • SDL_Surface *dst, SDL_Rect *dstrect);

/**

  • Perform low-level surface scaled blitting only.
    @@ -852,9 +848,9 @@ extern DECLSPEC int SDLCALL SDL_UpperBlitScaled
  • \sa SDL_BlitScaled
    */
    -extern DECLSPEC int SDLCALL SDL_LowerBlitScaled
  • (SDL_Surface * src, SDL_Rect * srcrect,
  • SDL_Surface * dst, SDL_Rect * dstrect);
    +extern DECLSPEC int SDLCALL SDL_BlitSurfaceUncheckedScaled
  • (SDL_Surface *src, SDL_Rect *srcrect,
  • SDL_Surface *dst, SDL_Rect *dstrect);

/**

  • Set the YUV conversion mode
    diff --git a/src/SDL_internal.h b/src/SDL_internal.h
    index b7490529fb28…09076f29bade 100644
    — a/src/SDL_internal.
(Patch may be truncated, please check the link at the top of this post.)