SDL API renaming: SDL_surface.h

Fixes https://github.com/libsdl-org/SDL/issues/6884
This commit is contained in:
Sam Lantinga 2022-12-27 06:36:39 -08:00
parent 2db699f48e
commit cc0296c934
47 changed files with 416 additions and 362 deletions

View file

@ -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_ */

View file

@ -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