dep: Update SDL2 to 2.24.2

This commit is contained in:
Connor McLaughlin
2022-11-10 18:55:32 +10:00
parent a6a52b31ad
commit fd807b14aa
97 changed files with 6507 additions and 1056 deletions

View File

@ -1,6 +1,6 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2021 Sam Lantinga <slouken@libsdl.org>
Copyright (C) 1997-2022 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
@ -61,6 +61,8 @@ extern "C" {
*/
#define SDL_MUSTLOCK(S) (((S)->flags & SDL_RLEACCEL) != 0)
typedef struct SDL_BlitMap SDL_BlitMap; /* this is an opaque type. */
/**
* \brief A collection of pixels used in software blitting.
*
@ -88,7 +90,7 @@ typedef struct SDL_Surface
SDL_Rect clip_rect; /**< Read-only */
/** info for fast blit mapping to other surfaces */
struct SDL_BlitMap *map; /**< Private */
SDL_BlitMap *map; /**< Private */
/** Reference count -- used when freeing surface */
int refcount; /**< Read-mostly */
@ -149,6 +151,8 @@ typedef enum
* \returns the new SDL_Surface structure that is created or NULL if it fails;
* call SDL_GetError() for more information.
*
* \since This function is available since SDL 2.0.0.
*
* \sa SDL_CreateRGBSurfaceFrom
* \sa SDL_CreateRGBSurfaceWithFormat
* \sa SDL_FreeSurface
@ -159,6 +163,7 @@ extern DECLSPEC SDL_Surface *SDLCALL SDL_CreateRGBSurface
/* !!! FIXME for 2.1: why does this ask for depth? Format provides that. */
/**
* Allocate a new RGB surface with a specific pixel format.
*
@ -174,6 +179,8 @@ extern DECLSPEC SDL_Surface *SDLCALL SDL_CreateRGBSurface
* \returns the new SDL_Surface structure that is created or NULL if it fails;
* call SDL_GetError() for more information.
*
* \since This function is available since SDL 2.0.5.
*
* \sa SDL_CreateRGBSurface
* \sa SDL_CreateRGBSurfaceFrom
* \sa SDL_FreeSurface
@ -203,6 +210,8 @@ extern DECLSPEC SDL_Surface *SDLCALL SDL_CreateRGBSurfaceWithFormat
* \returns the new SDL_Surface structure that is created or NULL if it fails;
* call SDL_GetError() for more information.
*
* \since This function is available since SDL 2.0.0.
*
* \sa SDL_CreateRGBSurface
* \sa SDL_CreateRGBSurfaceWithFormat
* \sa SDL_FreeSurface
@ -218,6 +227,7 @@ extern DECLSPEC SDL_Surface *SDLCALL SDL_CreateRGBSurfaceFrom(void *pixels,
Uint32 Amask);
/* !!! FIXME for 2.1: why does this ask for depth? Format provides that. */
/**
* Allocate a new RGB surface with with a specific pixel format and existing
* pixel data.
@ -238,6 +248,8 @@ extern DECLSPEC SDL_Surface *SDLCALL SDL_CreateRGBSurfaceFrom(void *pixels,
* \returns the new SDL_Surface structure that is created or NULL if it fails;
* call SDL_GetError() for more information.
*
* \since This function is available since SDL 2.0.5.
*
* \sa SDL_CreateRGBSurfaceFrom
* \sa SDL_CreateRGBSurfaceWithFormat
* \sa SDL_FreeSurface
@ -252,6 +264,8 @@ extern DECLSPEC SDL_Surface *SDLCALL SDL_CreateRGBSurfaceWithFormatFrom
*
* \param surface the SDL_Surface to free.
*
* \since This function is available since SDL 2.0.0.
*
* \sa SDL_CreateRGBSurface
* \sa SDL_CreateRGBSurfaceFrom
* \sa SDL_LoadBMP
@ -268,6 +282,8 @@ extern DECLSPEC void SDLCALL SDL_FreeSurface(SDL_Surface * surface);
* \param palette the SDL_Palette structure to use
* \returns 0 on success or a negative error code on failure; call
* SDL_GetError() for more information.
*
* \since This function is available since SDL 2.0.0.
*/
extern DECLSPEC int SDLCALL SDL_SetSurfacePalette(SDL_Surface * surface,
SDL_Palette * palette);
@ -288,6 +304,8 @@ extern DECLSPEC int SDLCALL SDL_SetSurfacePalette(SDL_Surface * surface,
* \returns 0 on success or a negative error code on failure; call
* SDL_GetError() for more information.
*
* \since This function is available since SDL 2.0.0.
*
* \sa SDL_MUSTLOCK
* \sa SDL_UnlockSurface
*/
@ -298,6 +316,8 @@ extern DECLSPEC int SDLCALL SDL_LockSurface(SDL_Surface * surface);
*
* \param surface the SDL_Surface structure to be unlocked
*
* \since This function is available since SDL 2.0.0.
*
* \sa SDL_LockSurface
*/
extern DECLSPEC void SDLCALL SDL_UnlockSurface(SDL_Surface * surface);
@ -305,14 +325,22 @@ 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().
* The new surface should be freed with SDL_FreeSurface(). Not doing so will
* result in a memory leak.
*
* src is an open SDL_RWops buffer, typically loaded with SDL_RWFromFile.
* Alternitavely, you might also use the macro SDL_LoadBMP to load a bitmap
* from a file, convert it to an SDL_Surface and then close the file.
*
* \param src the data stream for the surface
* \param freesrc non-zero to close the stream after being read
* \returns a pointer to a new SDL_Surface structure or NULL if there was an
* error; call SDL_GetError() for more information.
*
* \since This function is available since SDL 2.0.0.
*
* \sa SDL_FreeSurface
* \sa SDL_RWFromFile
* \sa SDL_LoadBMP
* \sa SDL_SaveBMP_RW
*/
@ -341,6 +369,8 @@ extern DECLSPEC SDL_Surface *SDLCALL SDL_LoadBMP_RW(SDL_RWops * src,
* \returns 0 on success or a negative error code on failure; call
* SDL_GetError() for more information.
*
* \since This function is available since SDL 2.0.0.
*
* \sa SDL_LoadBMP_RW
* \sa SDL_SaveBMP
*/
@ -366,6 +396,8 @@ extern DECLSPEC int SDLCALL SDL_SaveBMP_RW
* \returns 0 on success or a negative error code on failure; call
* SDL_GetError() for more information.
*
* \since This function is available since SDL 2.0.0.
*
* \sa SDL_BlitSurface
* \sa SDL_LockSurface
* \sa SDL_UnlockSurface
@ -381,6 +413,8 @@ extern DECLSPEC int SDLCALL SDL_SetSurfaceRLE(SDL_Surface * surface,
* \param surface the SDL_Surface structure to query
* \returns SDL_TRUE if the surface is RLE enabled, SDL_FALSE otherwise.
*
* \since This function is available since SDL 2.0.14.
*
* \sa SDL_SetSurfaceRLE
*/
extern DECLSPEC SDL_bool SDLCALL SDL_HasSurfaceRLE(SDL_Surface * surface);
@ -404,6 +438,8 @@ extern DECLSPEC SDL_bool SDLCALL SDL_HasSurfaceRLE(SDL_Surface * surface);
* \returns 0 on success or a negative error code on failure; call
* SDL_GetError() for more information.
*
* \since This function is available since SDL 2.0.0.
*
* \sa SDL_BlitSurface
* \sa SDL_GetColorKey
*/
@ -418,6 +454,8 @@ extern DECLSPEC int SDLCALL SDL_SetColorKey(SDL_Surface * surface,
* \param surface the SDL_Surface structure to query
* \return SDL_TRUE if the surface has a color key, SDL_FALSE otherwise.
*
* \since This function is available since SDL 2.0.9.
*
* \sa SDL_SetColorKey
* \sa SDL_GetColorKey
*/
@ -436,6 +474,8 @@ extern DECLSPEC SDL_bool SDLCALL SDL_HasColorKey(SDL_Surface * surface);
* \returns 0 on success or a negative error code on failure; call
* SDL_GetError() for more information.
*
* \since This function is available since SDL 2.0.0.
*
* \sa SDL_BlitSurface
* \sa SDL_SetColorKey
*/
@ -458,6 +498,8 @@ extern DECLSPEC int SDLCALL SDL_GetColorKey(SDL_Surface * surface,
* \returns 0 on success or a negative error code on failure; call
* SDL_GetError() for more information.
*
* \since This function is available since SDL 2.0.0.
*
* \sa SDL_GetSurfaceColorMod
* \sa SDL_SetSurfaceAlphaMod
*/
@ -475,6 +517,8 @@ extern DECLSPEC int SDLCALL SDL_SetSurfaceColorMod(SDL_Surface * surface,
* \returns 0 on success or a negative error code on failure; call
* SDL_GetError() for more information.
*
* \since This function is available since SDL 2.0.0.
*
* \sa SDL_GetSurfaceAlphaMod
* \sa SDL_SetSurfaceColorMod
*/
@ -495,6 +539,8 @@ extern DECLSPEC int SDLCALL SDL_GetSurfaceColorMod(SDL_Surface * surface,
* \returns 0 on success or a negative error code on failure; call
* SDL_GetError() for more information.
*
* \since This function is available since SDL 2.0.0.
*
* \sa SDL_GetSurfaceAlphaMod
* \sa SDL_SetSurfaceColorMod
*/
@ -509,6 +555,8 @@ extern DECLSPEC int SDLCALL SDL_SetSurfaceAlphaMod(SDL_Surface * surface,
* \returns 0 on success or a negative error code on failure; call
* SDL_GetError() for more information.
*
* \since This function is available since SDL 2.0.0.
*
* \sa SDL_GetSurfaceColorMod
* \sa SDL_SetSurfaceAlphaMod
*/
@ -527,6 +575,8 @@ extern DECLSPEC int SDLCALL SDL_GetSurfaceAlphaMod(SDL_Surface * surface,
* \returns 0 on success or a negative error code on failure; call
* SDL_GetError() for more information.
*
* \since This function is available since SDL 2.0.0.
*
* \sa SDL_GetSurfaceBlendMode
*/
extern DECLSPEC int SDLCALL SDL_SetSurfaceBlendMode(SDL_Surface * surface,
@ -540,6 +590,8 @@ extern DECLSPEC int SDLCALL SDL_SetSurfaceBlendMode(SDL_Surface * surface,
* \returns 0 on success or a negative error code on failure; call
* SDL_GetError() for more information.
*
* \since This function is available since SDL 2.0.0.
*
* \sa SDL_SetSurfaceBlendMode
*/
extern DECLSPEC int SDLCALL SDL_GetSurfaceBlendMode(SDL_Surface * surface,
@ -560,6 +612,8 @@ extern DECLSPEC int SDLCALL SDL_GetSurfaceBlendMode(SDL_Surface * surface,
* \returns SDL_TRUE if the rectangle intersects the surface, otherwise
* SDL_FALSE and blits will be completely clipped.
*
* \since This function is available since SDL 2.0.0.
*
* \sa SDL_BlitSurface
* \sa SDL_GetClipRect
*/
@ -577,6 +631,8 @@ extern DECLSPEC SDL_bool SDLCALL SDL_SetClipRect(SDL_Surface * surface,
* \param rect an SDL_Rect structure filled in with the clipping rectangle for
* the surface
*
* \since This function is available since SDL 2.0.0.
*
* \sa SDL_BlitSurface
* \sa SDL_SetClipRect
*/
@ -610,6 +666,8 @@ extern DECLSPEC SDL_Surface *SDLCALL SDL_DuplicateSurface(SDL_Surface * surface)
* \returns the new SDL_Surface structure that is created or NULL if it fails;
* call SDL_GetError() for more information.
*
* \since This function is available since SDL 2.0.0.
*
* \sa SDL_AllocFormat
* \sa SDL_ConvertSurfaceFormat
* \sa SDL_CreateRGBSurface
@ -633,8 +691,10 @@ extern DECLSPEC SDL_Surface *SDLCALL SDL_ConvertSurface
* \returns the new SDL_Surface structure that is created or NULL if it fails;
* call SDL_GetError() for more information.
*
* \since This function is available since SDL 2.0.0.
*
* \sa SDL_AllocFormat
* \sa SDL_ConvertSurfaceFormat
* \sa SDL_ConvertSurface
* \sa SDL_CreateRGBSurface
*/
extern DECLSPEC SDL_Surface *SDLCALL SDL_ConvertSurfaceFormat
@ -647,12 +707,14 @@ extern DECLSPEC SDL_Surface *SDLCALL SDL_ConvertSurfaceFormat
* \param height the height of the block to copy, in pixels
* \param src_format an SDL_PixelFormatEnum value of the `src` pixels format
* \param src a pointer to the source pixels
* \param src_pitch the pitch of the block to copy, in bytes
* \param src_pitch the pitch of the source pixels, in bytes
* \param dst_format an SDL_PixelFormatEnum value of the `dst` pixels format
* \param dst a pointer to be filled in with new pixel data
* \param dst_pitch the pitch of the destination pixels, in bytes
* \returns 0 on success or a negative error code on failure; call
* SDL_GetError() for more information.
*
* \since This function is available since SDL 2.0.0.
*/
extern DECLSPEC int SDLCALL SDL_ConvertPixels(int width, int height,
Uint32 src_format,
@ -660,6 +722,32 @@ extern DECLSPEC int SDLCALL SDL_ConvertPixels(int width, int height,
Uint32 dst_format,
void * dst, int dst_pitch);
/**
* Premultiply the alpha on a block of pixels.
*
* This is safe to use with src == dst, but not for other overlapping areas.
*
* This function is currently only implemented for SDL_PIXELFORMAT_ARGB8888.
*
* \param width the width of the block to convert, in pixels
* \param height the height of the block to convert, in pixels
* \param src_format an SDL_PixelFormatEnum value of the `src` pixels format
* \param src a pointer to the source pixels
* \param src_pitch the pitch of the source pixels, in bytes
* \param dst_format an SDL_PixelFormatEnum value of the `dst` pixels format
* \param dst a pointer to be filled in with premultiplied pixel data
* \param dst_pitch the pitch of the destination pixels, in bytes
* \returns 0 on success or a negative error code on failure; call
* SDL_GetError() for more information.
*
* \since This function is available since SDL 2.0.18.
*/
extern DECLSPEC int SDLCALL SDL_PremultiplyAlpha(int width, int height,
Uint32 src_format,
const void * src, int src_pitch,
Uint32 dst_format,
void * dst, int dst_pitch);
/**
* Perform a fast fill of a rectangle with a specific color.
*
@ -679,6 +767,8 @@ extern DECLSPEC int SDLCALL SDL_ConvertPixels(int width, int height,
* \returns 0 on success or a negative error code on failure; call
* SDL_GetError() for more information.
*
* \since This function is available since SDL 2.0.0.
*
* \sa SDL_FillRects
*/
extern DECLSPEC int SDLCALL SDL_FillRect
@ -703,6 +793,8 @@ extern DECLSPEC int SDLCALL SDL_FillRect
* \returns 0 on success or a negative error code on failure; call
* SDL_GetError() for more information.
*
* \since This function is available since SDL 2.0.0.
*
* \sa SDL_FillRect
*/
extern DECLSPEC int SDLCALL SDL_FillRects
@ -774,6 +866,8 @@ extern DECLSPEC int SDLCALL SDL_FillRects
* SDL_UpperBlit() has been replaced by SDL_BlitSurface(), which is merely a
* macro for this function with a less confusing name.
*
* \since This function is available since SDL 2.0.0.
*
* \sa SDL_BlitSurface
*/
extern DECLSPEC int SDLCALL SDL_UpperBlit
@ -798,6 +892,8 @@ extern DECLSPEC int SDLCALL SDL_UpperBlit
* \returns 0 on success or a negative error code on failure; call
* SDL_GetError() for more information.
*
* \since This function is available since SDL 2.0.0.
*
* \sa SDL_BlitSurface
*/
extern DECLSPEC int SDLCALL SDL_LowerBlit
@ -805,12 +901,14 @@ extern DECLSPEC int SDLCALL SDL_LowerBlit
SDL_Surface * dst, SDL_Rect * dstrect);
/**
* Perform a fast, low quality, stretch blit between two surfaces of the
* same format.
*
* Please use SDL_BlitScaled() instead.
*/
/**
* Perform a fast, low quality, stretch blit between two surfaces of the same
* format.
*
* Please use SDL_BlitScaled() instead.
*
* \since This function is available since SDL 2.0.0.
*/
extern DECLSPEC int SDLCALL SDL_SoftStretch(SDL_Surface * src,
const SDL_Rect * srcrect,
SDL_Surface * dst,
@ -818,6 +916,8 @@ extern DECLSPEC int SDLCALL SDL_SoftStretch(SDL_Surface * src,
/**
* Perform bilinear scaling between two surfaces of the same format, 32BPP.
*
* \since This function is available since SDL 2.0.16.
*/
extern DECLSPEC int SDLCALL SDL_SoftStretchLinear(SDL_Surface * src,
const SDL_Rect * srcrect,
@ -833,6 +933,8 @@ extern DECLSPEC int SDLCALL SDL_SoftStretchLinear(SDL_Surface * src,
* SDL_UpperBlitScaled() has been replaced by SDL_BlitScaled(), which is
* merely a macro for this function with a less confusing name.
*
* \since This function is available since SDL 2.0.0.
*
* \sa SDL_BlitScaled
*/
extern DECLSPEC int SDLCALL SDL_UpperBlitScaled
@ -854,6 +956,8 @@ extern DECLSPEC int SDLCALL SDL_UpperBlitScaled
* \returns 0 on success or a negative error code on failure; call
* SDL_GetError() for more information.
*
* \since This function is available since SDL 2.0.0.
*
* \sa SDL_BlitScaled
*/
extern DECLSPEC int SDLCALL SDL_LowerBlitScaled
@ -862,17 +966,23 @@ extern DECLSPEC int SDLCALL SDL_LowerBlitScaled
/**
* Set the YUV conversion mode
*
* \since This function is available since SDL 2.0.8.
*/
extern DECLSPEC void SDLCALL SDL_SetYUVConversionMode(SDL_YUV_CONVERSION_MODE mode);
/**
* Get the YUV conversion mode
*
* \since This function is available since SDL 2.0.8.
*/
extern DECLSPEC SDL_YUV_CONVERSION_MODE SDLCALL SDL_GetYUVConversionMode(void);
/**
* Get the YUV conversion mode, returning the correct mode for the resolution
* when the current conversion mode is SDL_YUV_CONVERSION_AUTOMATIC
*
* \since This function is available since SDL 2.0.8.
*/
extern DECLSPEC SDL_YUV_CONVERSION_MODE SDLCALL SDL_GetYUVConversionModeForResolution(int width, int height);