SDL API renaming: SDL_surface.h

Fixes https://github.com/libsdl-org/SDL/issues/6884
main
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

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

View File

@ -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);
}

View File

@ -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);
}

View File

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

View File

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

View File

@ -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");
}

View File

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

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

View File

@ -160,7 +160,7 @@
#endif
/* Run-Length-Encoding
- SDL_SetColorKey() called with SDL_RLEACCEL flag */
- SDL_SetSurfaceColorKey() called with SDL_RLEACCEL flag */
#ifndef SDL_HAVE_RLE
#define SDL_HAVE_RLE !SDL_LEAN_AND_MEAN
#endif

View File

@ -360,38 +360,38 @@ SDL3_0.0.0 {
SDL_TLSCleanup;
SDL_CreateSurface;
SDL_CreateSurfaceFrom;
SDL_FreeSurface;
SDL_DestroySurface;
SDL_SetSurfacePalette;
SDL_LockSurface;
SDL_UnlockSurface;
SDL_LoadBMP_RW;
SDL_SaveBMP_RW;
SDL_SetSurfaceRLE;
SDL_HasSurfaceRLE;
SDL_SetColorKey;
SDL_HasColorKey;
SDL_GetColorKey;
SDL_SurfaceHasRLE;
SDL_SetSurfaceColorKey;
SDL_SurfaceHasColorKey;
SDL_GetSurfaceColorKey;
SDL_SetSurfaceColorMod;
SDL_GetSurfaceColorMod;
SDL_SetSurfaceAlphaMod;
SDL_GetSurfaceAlphaMod;
SDL_SetSurfaceBlendMode;
SDL_GetSurfaceBlendMode;
SDL_SetClipRect;
SDL_GetClipRect;
SDL_SetSurfaceClipRect;
SDL_GetSurfaceClipRect;
SDL_DuplicateSurface;
SDL_ConvertSurface;
SDL_ConvertSurfaceFormat;
SDL_ConvertPixels;
SDL_PremultiplyAlpha;
SDL_FillRect;
SDL_FillRects;
SDL_UpperBlit;
SDL_LowerBlit;
SDL_FillSurfaceRect;
SDL_FillSurfaceRects;
SDL_BlitSurface;
SDL_BlitSurfaceUnchecked;
SDL_SoftStretch;
SDL_SoftStretchLinear;
SDL_UpperBlitScaled;
SDL_LowerBlitScaled;
SDL_BlitSurfaceScaled;
SDL_BlitSurfaceUncheckedScaled;
SDL_SetYUVConversionMode;
SDL_GetYUVConversionMode;
SDL_GetYUVConversionModeForResolution;

View File

@ -425,33 +425,33 @@
#define SDL_iconv_close SDL_iconv_close_REAL
#define SDL_iconv SDL_iconv_REAL
#define SDL_iconv_string SDL_iconv_string_REAL
#define SDL_FreeSurface SDL_FreeSurface_REAL
#define SDL_DestroySurface SDL_DestroySurface_REAL
#define SDL_SetSurfacePalette SDL_SetSurfacePalette_REAL
#define SDL_LockSurface SDL_LockSurface_REAL
#define SDL_UnlockSurface SDL_UnlockSurface_REAL
#define SDL_LoadBMP_RW SDL_LoadBMP_RW_REAL
#define SDL_SaveBMP_RW SDL_SaveBMP_RW_REAL
#define SDL_SetSurfaceRLE SDL_SetSurfaceRLE_REAL
#define SDL_SetColorKey SDL_SetColorKey_REAL
#define SDL_GetColorKey SDL_GetColorKey_REAL
#define SDL_SetSurfaceColorKey SDL_SetSurfaceColorKey_REAL
#define SDL_GetSurfaceColorKey SDL_GetSurfaceColorKey_REAL
#define SDL_SetSurfaceColorMod SDL_SetSurfaceColorMod_REAL
#define SDL_GetSurfaceColorMod SDL_GetSurfaceColorMod_REAL
#define SDL_SetSurfaceAlphaMod SDL_SetSurfaceAlphaMod_REAL
#define SDL_GetSurfaceAlphaMod SDL_GetSurfaceAlphaMod_REAL
#define SDL_SetSurfaceBlendMode SDL_SetSurfaceBlendMode_REAL
#define SDL_GetSurfaceBlendMode SDL_GetSurfaceBlendMode_REAL
#define SDL_SetClipRect SDL_SetClipRect_REAL
#define SDL_GetClipRect SDL_GetClipRect_REAL
#define SDL_SetSurfaceClipRect SDL_SetSurfaceClipRect_REAL
#define SDL_GetSurfaceClipRect SDL_GetSurfaceClipRect_REAL
#define SDL_ConvertSurface SDL_ConvertSurface_REAL
#define SDL_ConvertSurfaceFormat SDL_ConvertSurfaceFormat_REAL
#define SDL_ConvertPixels SDL_ConvertPixels_REAL
#define SDL_FillRect SDL_FillRect_REAL
#define SDL_FillRects SDL_FillRects_REAL
#define SDL_UpperBlit SDL_UpperBlit_REAL
#define SDL_LowerBlit SDL_LowerBlit_REAL
#define SDL_FillSurfaceRect SDL_FillSurfaceRect_REAL
#define SDL_FillSurfaceRects SDL_FillSurfaceRects_REAL
#define SDL_BlitSurface SDL_BlitSurface_REAL
#define SDL_BlitSurfaceUnchecked SDL_BlitSurfaceUnchecked_REAL
#define SDL_SoftStretch SDL_SoftStretch_REAL
#define SDL_UpperBlitScaled SDL_UpperBlitScaled_REAL
#define SDL_LowerBlitScaled SDL_LowerBlitScaled_REAL
#define SDL_BlitSurfaceScaled SDL_BlitSurfaceScaled_REAL
#define SDL_BlitSurfaceUncheckedScaled SDL_BlitSurfaceUncheckedScaled_REAL
#define SDL_GetThreadName SDL_GetThreadName_REAL
#define SDL_ThreadID SDL_ThreadID_REAL
#define SDL_GetThreadID SDL_GetThreadID_REAL
@ -668,7 +668,7 @@
#define SDL_UpdateSensors SDL_UpdateSensors_REAL
#define SDL_IsTablet SDL_IsTablet_REAL
#define SDL_GetDisplayOrientation SDL_GetDisplayOrientation_REAL
#define SDL_HasColorKey SDL_HasColorKey_REAL
#define SDL_SurfaceHasColorKey SDL_SurfaceHasColorKey_REAL
#define SDL_CreateThreadWithStackSize SDL_CreateThreadWithStackSize_REAL
#define SDL_GetJoystickDevicePlayerIndex SDL_GetJoystickDevicePlayerIndex_REAL
#define SDL_GetJoystickPlayerIndex SDL_GetJoystickPlayerIndex_REAL
@ -737,7 +737,7 @@
#define SDL_SIMDRealloc SDL_SIMDRealloc_REAL
#define SDL_AndroidRequestPermission SDL_AndroidRequestPermission_REAL
#define SDL_OpenURL SDL_OpenURL_REAL
#define SDL_HasSurfaceRLE SDL_HasSurfaceRLE_REAL
#define SDL_SurfaceHasRLE SDL_SurfaceHasRLE_REAL
#define SDL_GameControllerHasLED SDL_GameControllerHasLED_REAL
#define SDL_GameControllerSetLED SDL_GameControllerSetLED_REAL
#define SDL_JoystickHasLED SDL_JoystickHasLED_REAL

View File

@ -452,33 +452,33 @@ SDL_DYNAPI_PROC(SDL_iconv_t,SDL_iconv_open,(const char *a, const char *b),(a,b),
SDL_DYNAPI_PROC(int,SDL_iconv_close,(SDL_iconv_t a),(a),return)
SDL_DYNAPI_PROC(size_t,SDL_iconv,(SDL_iconv_t a, const char **b, size_t *c, char **d, size_t *e),(a,b,c,d,e),return)
SDL_DYNAPI_PROC(char*,SDL_iconv_string,(const char *a, const char *b, const char *c, size_t d),(a,b,c,d),return)
SDL_DYNAPI_PROC(void,SDL_FreeSurface,(SDL_Surface *a),(a),)
SDL_DYNAPI_PROC(void,SDL_DestroySurface,(SDL_Surface *a),(a),)
SDL_DYNAPI_PROC(int,SDL_SetSurfacePalette,(SDL_Surface *a, SDL_Palette *b),(a,b),return)
SDL_DYNAPI_PROC(int,SDL_LockSurface,(SDL_Surface *a),(a),return)
SDL_DYNAPI_PROC(void,SDL_UnlockSurface,(SDL_Surface *a),(a),)
SDL_DYNAPI_PROC(SDL_Surface*,SDL_LoadBMP_RW,(SDL_RWops *a, int b),(a,b),return)
SDL_DYNAPI_PROC(int,SDL_SaveBMP_RW,(SDL_Surface *a, SDL_RWops *b, int c),(a,b,c),return)
SDL_DYNAPI_PROC(int,SDL_SetSurfaceRLE,(SDL_Surface *a, int b),(a,b),return)
SDL_DYNAPI_PROC(int,SDL_SetColorKey,(SDL_Surface *a, int b, Uint32 c),(a,b,c),return)
SDL_DYNAPI_PROC(int,SDL_GetColorKey,(SDL_Surface *a, Uint32 *b),(a,b),return)
SDL_DYNAPI_PROC(int,SDL_SetSurfaceColorKey,(SDL_Surface *a, int b, Uint32 c),(a,b,c),return)
SDL_DYNAPI_PROC(int,SDL_GetSurfaceColorKey,(SDL_Surface *a, Uint32 *b),(a,b),return)
SDL_DYNAPI_PROC(int,SDL_SetSurfaceColorMod,(SDL_Surface *a, Uint8 b, Uint8 c, Uint8 d),(a,b,c,d),return)
SDL_DYNAPI_PROC(int,SDL_GetSurfaceColorMod,(SDL_Surface *a, Uint8 *b, Uint8 *c, Uint8 *d),(a,b,c,d),return)
SDL_DYNAPI_PROC(int,SDL_SetSurfaceAlphaMod,(SDL_Surface *a, Uint8 b),(a,b),return)
SDL_DYNAPI_PROC(int,SDL_GetSurfaceAlphaMod,(SDL_Surface *a, Uint8 *b),(a,b),return)
SDL_DYNAPI_PROC(int,SDL_SetSurfaceBlendMode,(SDL_Surface *a, SDL_BlendMode b),(a,b),return)
SDL_DYNAPI_PROC(int,SDL_GetSurfaceBlendMode,(SDL_Surface *a, SDL_BlendMode *b),(a,b),return)
SDL_DYNAPI_PROC(SDL_bool,SDL_SetClipRect,(SDL_Surface *a, const SDL_Rect *b),(a,b),return)
SDL_DYNAPI_PROC(void,SDL_GetClipRect,(SDL_Surface *a, SDL_Rect *b),(a,b),)
SDL_DYNAPI_PROC(SDL_bool,SDL_SetSurfaceClipRect,(SDL_Surface *a, const SDL_Rect *b),(a,b),return)
SDL_DYNAPI_PROC(void,SDL_GetSurfaceClipRect,(SDL_Surface *a, SDL_Rect *b),(a,b),)
SDL_DYNAPI_PROC(SDL_Surface*,SDL_ConvertSurface,(SDL_Surface *a, const SDL_PixelFormat *b),(a,b),return)
SDL_DYNAPI_PROC(SDL_Surface*,SDL_ConvertSurfaceFormat,(SDL_Surface *a, Uint32 b),(a,b),return)
SDL_DYNAPI_PROC(int,SDL_ConvertPixels,(int a, int b, Uint32 c, const void *d, int e, Uint32 f, void *g, int h),(a,b,c,d,e,f,g,h),return)
SDL_DYNAPI_PROC(int,SDL_FillRect,(SDL_Surface *a, const SDL_Rect *b, Uint32 c),(a,b,c),return)
SDL_DYNAPI_PROC(int,SDL_FillRects,(SDL_Surface *a, const SDL_Rect *b, int c, Uint32 d),(a,b,c,d),return)
SDL_DYNAPI_PROC(int,SDL_UpperBlit,(SDL_Surface *a, const SDL_Rect *b, SDL_Surface *c, SDL_Rect *d),(a,b,c,d),return)
SDL_DYNAPI_PROC(int,SDL_LowerBlit,(SDL_Surface *a, SDL_Rect *b, SDL_Surface *c, SDL_Rect *d),(a,b,c,d),return)
SDL_DYNAPI_PROC(int,SDL_FillSurfaceRect,(SDL_Surface *a, const SDL_Rect *b, Uint32 c),(a,b,c),return)
SDL_DYNAPI_PROC(int,SDL_FillSurfaceRects,(SDL_Surface *a, const SDL_Rect *b, int c, Uint32 d),(a,b,c,d),return)
SDL_DYNAPI_PROC(int,SDL_BlitSurface,(SDL_Surface *a, const SDL_Rect *b, SDL_Surface *c, SDL_Rect *d),(a,b,c,d),return)
SDL_DYNAPI_PROC(int,SDL_BlitSurfaceUnchecked,(SDL_Surface *a, SDL_Rect *b, SDL_Surface *c, SDL_Rect *d),(a,b,c,d),return)
SDL_DYNAPI_PROC(int,SDL_SoftStretch,(SDL_Surface *a, const SDL_Rect *b, SDL_Surface *c, const SDL_Rect *d),(a,b,c,d),return)
SDL_DYNAPI_PROC(int,SDL_UpperBlitScaled,(SDL_Surface *a, const SDL_Rect *b, SDL_Surface *c, SDL_Rect *d),(a,b,c,d),return)
SDL_DYNAPI_PROC(int,SDL_LowerBlitScaled,(SDL_Surface *a, SDL_Rect *b, SDL_Surface *c, SDL_Rect *d),(a,b,c,d),return)
SDL_DYNAPI_PROC(int,SDL_BlitSurfaceScaled,(SDL_Surface *a, const SDL_Rect *b, SDL_Surface *c, SDL_Rect *d),(a,b,c,d),return)
SDL_DYNAPI_PROC(int,SDL_BlitSurfaceUncheckedScaled,(SDL_Surface *a, SDL_Rect *b, SDL_Surface *c, SDL_Rect *d),(a,b,c,d),return)
SDL_DYNAPI_PROC(const char*,SDL_GetThreadName,(SDL_Thread *a),(a),return)
SDL_DYNAPI_PROC(SDL_threadID,SDL_ThreadID,(void),(),return)
SDL_DYNAPI_PROC(SDL_threadID,SDL_GetThreadID,(SDL_Thread *a),(a),return)
@ -709,7 +709,7 @@ SDL_DYNAPI_PROC(void,SDL_CloseSensor,(SDL_Sensor *a),(a),)
SDL_DYNAPI_PROC(void,SDL_UpdateSensors,(void),(),)
SDL_DYNAPI_PROC(SDL_bool,SDL_IsTablet,(void),(),return)
SDL_DYNAPI_PROC(SDL_DisplayOrientation,SDL_GetDisplayOrientation,(int a),(a),return)
SDL_DYNAPI_PROC(SDL_bool,SDL_HasColorKey,(SDL_Surface *a),(a),return)
SDL_DYNAPI_PROC(SDL_bool,SDL_SurfaceHasColorKey,(SDL_Surface *a),(a),return)
#ifdef SDL_CreateThreadWithStackSize
#undef SDL_CreateThreadWithStackSize
@ -794,7 +794,7 @@ SDL_DYNAPI_PROC(void*,SDL_SIMDRealloc,(void *a, const size_t b),(a,b),return)
SDL_DYNAPI_PROC(SDL_bool,SDL_AndroidRequestPermission,(const char *a),(a),return)
#endif
SDL_DYNAPI_PROC(int,SDL_OpenURL,(const char *a),(a),return)
SDL_DYNAPI_PROC(SDL_bool,SDL_HasSurfaceRLE,(SDL_Surface *a),(a),return)
SDL_DYNAPI_PROC(SDL_bool,SDL_SurfaceHasRLE,(SDL_Surface *a),(a),return)
SDL_DYNAPI_PROC(SDL_bool,SDL_GameControllerHasLED,(SDL_GameController *a),(a),return)
SDL_DYNAPI_PROC(int,SDL_GameControllerSetLED,(SDL_GameController *a, Uint8 b, Uint8 c, Uint8 d),(a,b,c,d),return)
SDL_DYNAPI_PROC(SDL_bool,SDL_JoystickHasLED,(SDL_Joystick *a),(a),return)

View File

@ -1247,7 +1247,7 @@ SDL_CreateCursor(const Uint8 *data, const Uint8 *mask,
cursor = SDL_CreateColorCursor(surface, hot_x, hot_y);
SDL_FreeSurface(surface);
SDL_DestroySurface(surface);
return cursor;
}
@ -1290,7 +1290,7 @@ SDL_CreateColorCursor(SDL_Surface *surface, int hot_x, int hot_y)
mouse->cursors = cursor;
}
SDL_FreeSurface(temp);
SDL_DestroySurface(temp);
return cursor;
}

View File

@ -1348,7 +1348,7 @@ SDL_CreateTextureFromSurface(SDL_Renderer *renderer, SDL_Surface *surface)
/* See what the best texture format is */
fmt = surface->format;
if (fmt->Amask || SDL_HasColorKey(surface)) {
if (fmt->Amask || SDL_SurfaceHasColorKey(surface)) {
needAlpha = SDL_TRUE;
} else {
needAlpha = SDL_FALSE;
@ -1365,7 +1365,7 @@ SDL_CreateTextureFromSurface(SDL_Renderer *renderer, SDL_Surface *surface)
/* Try to have the best pixel format for the texture */
/* No alpha, but a colorkey => promote to alpha */
if (!fmt->Amask && SDL_HasColorKey(surface)) {
if (!fmt->Amask && SDL_SurfaceHasColorKey(surface)) {
if (fmt->format == SDL_PIXELFORMAT_RGB888) {
for (i = 0; i < (int)renderer->info.num_texture_formats; ++i) {
if (renderer->info.texture_formats[i] == SDL_PIXELFORMAT_ARGB8888) {
@ -1410,7 +1410,7 @@ SDL_CreateTextureFromSurface(SDL_Renderer *renderer, SDL_Surface *surface)
}
if (format == surface->format->format) {
if (surface->format->Amask && SDL_HasColorKey(surface)) {
if (surface->format->Amask && SDL_SurfaceHasColorKey(surface)) {
/* Surface and Renderer formats are identicals.
* Intermediate conversion is needed to convert color key to alpha (SDL_ConvertColorkeyToAlpha()). */
direct_update = SDL_FALSE;
@ -1445,7 +1445,7 @@ SDL_CreateTextureFromSurface(SDL_Renderer *renderer, SDL_Surface *surface)
SDL_DestroyPixelFormat(dst_fmt);
if (temp) {
SDL_UpdateTexture(texture, NULL, temp->pixels, temp->pitch);
SDL_FreeSurface(temp);
SDL_DestroySurface(temp);
} else {
SDL_DestroyTexture(texture);
return NULL;
@ -1462,7 +1462,7 @@ SDL_CreateTextureFromSurface(SDL_Renderer *renderer, SDL_Surface *surface)
SDL_GetSurfaceAlphaMod(surface, &a);
SDL_SetTextureAlphaMod(texture, a);
if (SDL_HasColorKey(surface)) {
if (SDL_SurfaceHasColorKey(surface)) {
/* We converted to a texture with alpha format */
SDL_SetTextureBlendMode(texture, SDL_BLENDMODE_BLEND);
} else {
@ -2136,7 +2136,7 @@ void SDL_UnlockTexture(SDL_Texture *texture)
renderer->UnlockTexture(renderer, texture);
}
SDL_FreeSurface(texture->locked_surface);
SDL_DestroySurface(texture->locked_surface);
texture->locked_surface = NULL;
}
@ -4261,7 +4261,7 @@ void SDL_DestroyTexture(SDL_Texture *texture)
renderer->DestroyTexture(renderer, texture);
SDL_FreeSurface(texture->locked_surface);
SDL_DestroySurface(texture->locked_surface);
texture->locked_surface = NULL;
SDL_free(texture);

View File

@ -342,7 +342,7 @@ int SDL_SW_CopyYUVToRGB(SDL_SW_YUVTexture *swdata, const SDL_Rect *srcrect,
/* Make sure we're set up to display in the desired format */
if (target_format != swdata->target_format && swdata->display) {
SDL_FreeSurface(swdata->display);
SDL_DestroySurface(swdata->display);
swdata->display = NULL;
}
@ -394,8 +394,8 @@ void SDL_SW_DestroyYUVTexture(SDL_SW_YUVTexture *swdata)
{
if (swdata) {
SDL_SIMDFree(swdata->pixels);
SDL_FreeSurface(swdata->stretch);
SDL_FreeSurface(swdata->display);
SDL_DestroySurface(swdata->stretch);
SDL_DestroySurface(swdata->display);
SDL_free(swdata);
}
}

View File

@ -400,7 +400,7 @@ static int SW_RenderCopyEx(SDL_Renderer *renderer, SDL_Surface *surface, SDL_Tex
} else {
SDL_SetSurfaceBlendMode(src_clone, SDL_BLENDMODE_NONE);
retval = SDL_PrivateUpperBlitScaled(src_clone, srcrect, src_scaled, &scale_rect, texture->scaleMode);
SDL_FreeSurface(src_clone);
SDL_DestroySurface(src_clone);
src_clone = src_scaled;
src_scaled = NULL;
}
@ -488,14 +488,14 @@ static int SW_RenderCopyEx(SDL_Renderer *renderer, SDL_Surface *surface, SDL_Tex
SDL_SetSurfaceBlendMode(src_rotated_rgb, SDL_BLENDMODE_ADD);
/* Renderer scaling, if needed */
retval = Blit_to_Screen(src_rotated_rgb, NULL, surface, &tmp_rect, scale_x, scale_y, texture->scaleMode);
SDL_FreeSurface(src_rotated_rgb);
SDL_DestroySurface(src_rotated_rgb);
}
}
}
SDL_FreeSurface(mask_rotated);
SDL_DestroySurface(mask_rotated);
}
if (src_rotated != NULL) {
SDL_FreeSurface(src_rotated);
SDL_DestroySurface(src_rotated);
}
}
}
@ -504,10 +504,10 @@ static int SW_RenderCopyEx(SDL_Renderer *renderer, SDL_Surface *surface, SDL_Tex
SDL_UnlockSurface(src);
}
if (mask != NULL) {
SDL_FreeSurface(mask);
SDL_DestroySurface(mask);
}
if (src_clone != NULL) {
SDL_FreeSurface(src_clone);
SDL_DestroySurface(src_clone);
}
return retval;
}
@ -645,9 +645,9 @@ static void SetDrawState(SDL_Surface *surface, SW_DrawStateCache *drawstate)
clip_rect.w = cliprect->w;
clip_rect.h = cliprect->h;
SDL_IntersectRect(viewport, &clip_rect, &clip_rect);
SDL_SetClipRect(surface, &clip_rect);
SDL_SetSurfaceClipRect(surface, &clip_rect);
} else {
SDL_SetClipRect(surface, drawstate->viewport);
SDL_SetSurfaceClipRect(surface, drawstate->viewport);
}
drawstate->surface_cliprect_dirty = SDL_FALSE;
}
@ -694,8 +694,8 @@ static int SW_RunCommandQueue(SDL_Renderer *renderer, SDL_RenderCommand *cmd, vo
const Uint8 b = cmd->data.color.b;
const Uint8 a = cmd->data.color.a;
/* By definition the clear ignores the clip rect */
SDL_SetClipRect(surface, NULL);
SDL_FillRect(surface, NULL, SDL_MapRGBA(surface->format, r, g, b, a));
SDL_SetSurfaceClipRect(surface, NULL);
SDL_FillSurfaceRect(surface, NULL, SDL_MapRGBA(surface->format, r, g, b, a));
drawstate.surface_cliprect_dirty = SDL_TRUE;
break;
}
@ -777,7 +777,7 @@ static int SW_RunCommandQueue(SDL_Renderer *renderer, SDL_RenderCommand *cmd, vo
}
if (blend == SDL_BLENDMODE_NONE) {
SDL_FillRects(surface, verts, count, SDL_MapRGBA(surface->format, r, g, b, a));
SDL_FillSurfaceRects(surface, verts, count, SDL_MapRGBA(surface->format, r, g, b, a));
} else {
SDL_BlendFillRects(surface, verts, count, blend, r, g, b, a);
}
@ -839,7 +839,7 @@ static int SW_RunCommandQueue(SDL_Renderer *renderer, SDL_RenderCommand *cmd, vo
SDL_SetSurfaceBlendMode(tmp, blendmode);
SDL_BlitSurface(tmp, NULL, surface, dstrect);
SDL_FreeSurface(tmp);
SDL_DestroySurface(tmp);
/* No need to set back r/g/b/a/blendmode to 'src' since it's done in PrepTextureForCopy() */
}
} else {
@ -980,7 +980,7 @@ static void SW_DestroyTexture(SDL_Renderer *renderer, SDL_Texture *texture)
{
SDL_Surface *surface = (SDL_Surface *)texture->driverdata;
SDL_FreeSurface(surface);
SDL_DestroySurface(surface);
}
static void SW_DestroyRenderer(SDL_Renderer *renderer)

View File

@ -80,8 +80,8 @@ to a situation where the program can segfault.
static Uint32 get_colorkey(SDL_Surface *src)
{
Uint32 key = 0;
if (SDL_HasColorKey(src)) {
SDL_GetColorKey(src, &key);
if (SDL_SurfaceHasColorKey(src)) {
SDL_GetSurfaceColorKey(src, &key);
}
return key;
}
@ -504,8 +504,8 @@ SDLgfx_rotateSurface(SDL_Surface *src, double angle, int smooth, int flipx, int
return NULL;
}
if (SDL_HasColorKey(src)) {
if (SDL_GetColorKey(src, &colorkey) == 0) {
if (SDL_SurfaceHasColorKey(src)) {
if (SDL_GetSurfaceColorKey(src, &colorkey) == 0) {
colorKeyAvailable = SDL_TRUE;
}
}
@ -549,8 +549,8 @@ SDLgfx_rotateSurface(SDL_Surface *src, double angle, int smooth, int flipx, int
if (colorKeyAvailable == SDL_TRUE) {
/* If available, the colorkey will be used to discard the pixels that are outside of the rotated area. */
SDL_SetColorKey(rz_dst, SDL_TRUE, colorkey);
SDL_FillRect(rz_dst, NULL, colorkey);
SDL_SetSurfaceColorKey(rz_dst, SDL_TRUE, colorkey);
SDL_FillSurfaceRect(rz_dst, NULL, colorkey);
} else if (blendmode == SDL_BLENDMODE_NONE) {
blendmode = SDL_BLENDMODE_BLEND;
} else if (blendmode == SDL_BLENDMODE_MOD || blendmode == SDL_BLENDMODE_MUL) {
@ -558,12 +558,12 @@ SDLgfx_rotateSurface(SDL_Surface *src, double angle, int smooth, int flipx, int
* that the pixels outside the rotated area don't affect the destination surface.
*/
colorkey = SDL_MapRGBA(rz_dst->format, 255, 255, 255, 0);
SDL_FillRect(rz_dst, NULL, colorkey);
SDL_FillSurfaceRect(rz_dst, NULL, colorkey);
/* Setting a white colorkey for the destination surface makes the final blit discard
* all pixels outside of the rotated area. This doesn't interfere with anything because
* white pixels are already a no-op and the MOD blend mode does not interact with alpha.
*/
SDL_SetColorKey(rz_dst, SDL_TRUE, colorkey);
SDL_SetSurfaceColorKey(rz_dst, SDL_TRUE, colorkey);
}
SDL_SetSurfaceBlendMode(rz_dst, blendmode);

View File

@ -257,7 +257,7 @@ int SDL_SW_FillTriangle(SDL_Surface *dst, SDL_Point *d0, SDL_Point *d1, SDL_Poin
{
/* Clip triangle with surface clip rect */
SDL_Rect rect;
SDL_GetClipRect(dst, &rect);
SDL_GetSurfaceClipRect(dst, &rect);
SDL_IntersectRect(&dstrect, &rect, &dstrect);
}
@ -278,7 +278,7 @@ int SDL_SW_FillTriangle(SDL_Surface *dst, SDL_Point *d0, SDL_Point *d1, SDL_Poin
if (blend == SDL_BLENDMODE_MOD) {
Uint32 c = SDL_MapRGBA(tmp->format, 255, 255, 255, 255);
SDL_FillRect(tmp, NULL, c);
SDL_FillSurfaceRect(tmp, NULL, c);
}
SDL_SetSurfaceBlendMode(tmp, blend);
@ -417,7 +417,7 @@ int SDL_SW_FillTriangle(SDL_Surface *dst, SDL_Point *d0, SDL_Point *d1, SDL_Poin
if (tmp) {
SDL_BlitSurface(tmp, NULL, dst, &dstrect);
SDL_FreeSurface(tmp);
SDL_DestroySurface(tmp);
}
end:
@ -553,7 +553,7 @@ int SDL_SW_BlitTriangle(
{
/* Clip triangle with surface clip rect */
SDL_Rect rect;
SDL_GetClipRect(dst, &rect);
SDL_GetSurfaceClipRect(dst, &rect);
SDL_IntersectRect(&dstrect, &rect, &dstrect);
}

View File

@ -997,7 +997,7 @@ static SDL_Surface *SDLTest_LoadIcon(const char *file)
if (icon->format->palette) {
/* Set the colorkey */
SDL_SetColorKey(icon, 1, *((Uint8 *)icon->pixels));
SDL_SetSurfaceColorKey(icon, 1, *((Uint8 *)icon->pixels));
}
return icon;
@ -1297,7 +1297,7 @@ SDLTest_CommonInit(SDLTest_CommonState *state)
SDL_Surface *icon = SDLTest_LoadIcon(state->window_icon);
if (icon) {
SDL_SetWindowIcon(state->windows[i], icon);
SDL_FreeSurface(icon);
SDL_DestroySurface(icon);
}
}

View File

@ -3213,7 +3213,7 @@ int SDLTest_DrawCharacter(SDL_Renderer *renderer, int x, int y, Uint32 c)
/* Convert temp surface into texture */
cache->charTextureCache[ci] = SDL_CreateTextureFromSurface(renderer, character);
SDL_FreeSurface(character);
SDL_DestroySurface(character);
/*
* Check pointer

View File

@ -1565,7 +1565,7 @@ void SDL_UnRLESurface(SDL_Surface *surface, int recode)
surface->flags |= SDL_SIMD_ALIGNED;
/* fill it with the background color */
SDL_FillRect(surface, NULL, surface->map->info.colorkey);
SDL_FillSurfaceRect(surface, NULL, surface->map->info.colorkey);
/* now render the encoded surface */
full.x = full.y = 0;

View File

@ -616,7 +616,7 @@ done:
if (src) {
SDL_RWseek(src, fp_offset, SDL_RW_SEEK_SET);
}
SDL_FreeSurface(surface);
SDL_DestroySurface(surface);
surface = NULL;
}
if (freesrc && src) {
@ -861,7 +861,7 @@ int SDL_SaveBMP_RW(SDL_Surface *surface, SDL_RWops *dst, int freedst)
/* Close it up.. */
SDL_UnlockSurface(intermediate_surface);
if (intermediate_surface != surface) {
SDL_FreeSurface(intermediate_surface);
SDL_DestroySurface(intermediate_surface);
}
}

View File

@ -56,7 +56,7 @@
#define SSE_END
#define DEFINE_SSE_FILLRECT(bpp, type) \
static void SDL_FillRect##bpp##SSE(Uint8 *pixels, int pitch, Uint32 color, int w, int h) \
static void SDL_FillSurfaceRect##bpp##SSE(Uint8 *pixels, int pitch, Uint32 color, int w, int h) \
{ \
int i, n; \
Uint8 *p = NULL; \
@ -93,7 +93,7 @@ static void SDL_FillRect##bpp##SSE(Uint8 *pixels, int pitch, Uint32 color, int w
SSE_END; \
}
static void SDL_FillRect1SSE(Uint8 *pixels, int pitch, Uint32 color, int w, int h)
static void SDL_FillSurfaceRect1SSE(Uint8 *pixels, int pitch, Uint32 color, int w, int h)
{
int i, n;
@ -127,7 +127,7 @@ DEFINE_SSE_FILLRECT(4, Uint32)
/* *INDENT-ON* */ /* clang-format on */
#endif /* __SSE__ */
static void SDL_FillRect1(Uint8 *pixels, int pitch, Uint32 color, int w, int h)
static void SDL_FillSurfaceRect1(Uint8 *pixels, int pitch, Uint32 color, int w, int h)
{
int n;
Uint8 *p = NULL;
@ -169,7 +169,7 @@ static void SDL_FillRect1(Uint8 *pixels, int pitch, Uint32 color, int w, int h)
}
}
static void SDL_FillRect2(Uint8 *pixels, int pitch, Uint32 color, int w, int h)
static void SDL_FillSurfaceRect2(Uint8 *pixels, int pitch, Uint32 color, int w, int h)
{
int n;
Uint16 *p = NULL;
@ -192,7 +192,7 @@ static void SDL_FillRect2(Uint8 *pixels, int pitch, Uint32 color, int w, int h)
}
}
static void SDL_FillRect3(Uint8 *pixels, int pitch, Uint32 color, int w, int h)
static void SDL_FillSurfaceRect3(Uint8 *pixels, int pitch, Uint32 color, int w, int h)
{
#if SDL_BYTEORDER == SDL_LIL_ENDIAN
Uint8 b1 = (Uint8)(color & 0xFF);
@ -219,7 +219,7 @@ static void SDL_FillRect3(Uint8 *pixels, int pitch, Uint32 color, int w, int h)
}
}
static void SDL_FillRect4(Uint8 *pixels, int pitch, Uint32 color, int w, int h)
static void SDL_FillSurfaceRect4(Uint8 *pixels, int pitch, Uint32 color, int w, int h)
{
while (h--) {
SDL_memset4(pixels, color, w);
@ -230,10 +230,10 @@ static void SDL_FillRect4(Uint8 *pixels, int pitch, Uint32 color, int w, int h)
/*
* This function performs a fast fill of the given rectangle with 'color'
*/
int SDL_FillRect(SDL_Surface *dst, const SDL_Rect *rect, Uint32 color)
int SDL_FillSurfaceRect(SDL_Surface *dst, const SDL_Rect *rect, Uint32 color)
{
if (dst == NULL) {
return SDL_InvalidParamError("SDL_FillRect(): dst");
return SDL_InvalidParamError("SDL_FillSurfaceRect(): dst");
}
/* If 'rect' == NULL, then fill the whole surface */
@ -245,58 +245,58 @@ int SDL_FillRect(SDL_Surface *dst, const SDL_Rect *rect, Uint32 color)
}
}
return SDL_FillRects(dst, rect, 1, color);
return SDL_FillSurfaceRects(dst, rect, 1, color);
}
#if SDL_ARM_NEON_BLITTERS
void FillRect8ARMNEONAsm(int32_t w, int32_t h, uint8_t *dst, int32_t dst_stride, uint8_t src);
void FillRect16ARMNEONAsm(int32_t w, int32_t h, uint16_t *dst, int32_t dst_stride, uint16_t src);
void FillRect32ARMNEONAsm(int32_t w, int32_t h, uint32_t *dst, int32_t dst_stride, uint32_t src);
void FillSurfaceRect8ARMNEONAsm(int32_t w, int32_t h, uint8_t *dst, int32_t dst_stride, uint8_t src);
void FillSurfaceRect16ARMNEONAsm(int32_t w, int32_t h, uint16_t *dst, int32_t dst_stride, uint16_t src);
void FillSurfaceRect32ARMNEONAsm(int32_t w, int32_t h, uint32_t *dst, int32_t dst_stride, uint32_t src);
static void fill_8_neon(Uint8 *pixels, int pitch, Uint32 color, int w, int h)
{
FillRect8ARMNEONAsm(w, h, (uint8_t *)pixels, pitch >> 0, color);
FillSurfaceRect8ARMNEONAsm(w, h, (uint8_t *)pixels, pitch >> 0, color);
return;
}
static void fill_16_neon(Uint8 *pixels, int pitch, Uint32 color, int w, int h)
{
FillRect16ARMNEONAsm(w, h, (uint16_t *)pixels, pitch >> 1, color);
FillSurfaceRect16ARMNEONAsm(w, h, (uint16_t *)pixels, pitch >> 1, color);
return;
}
static void fill_32_neon(Uint8 *pixels, int pitch, Uint32 color, int w, int h)
{
FillRect32ARMNEONAsm(w, h, (uint32_t *)pixels, pitch >> 2, color);
FillSurfaceRect32ARMNEONAsm(w, h, (uint32_t *)pixels, pitch >> 2, color);
return;
}
#endif
#if SDL_ARM_SIMD_BLITTERS
void FillRect8ARMSIMDAsm(int32_t w, int32_t h, uint8_t *dst, int32_t dst_stride, uint8_t src);
void FillRect16ARMSIMDAsm(int32_t w, int32_t h, uint16_t *dst, int32_t dst_stride, uint16_t src);
void FillRect32ARMSIMDAsm(int32_t w, int32_t h, uint32_t *dst, int32_t dst_stride, uint32_t src);
void FillSurfaceRect8ARMSIMDAsm(int32_t w, int32_t h, uint8_t *dst, int32_t dst_stride, uint8_t src);
void FillSurfaceRect16ARMSIMDAsm(int32_t w, int32_t h, uint16_t *dst, int32_t dst_stride, uint16_t src);
void FillSurfaceRect32ARMSIMDAsm(int32_t w, int32_t h, uint32_t *dst, int32_t dst_stride, uint32_t src);
static void fill_8_simd(Uint8 *pixels, int pitch, Uint32 color, int w, int h)
{
FillRect8ARMSIMDAsm(w, h, (uint8_t *)pixels, pitch >> 0, color);
FillSurfaceRect8ARMSIMDAsm(w, h, (uint8_t *)pixels, pitch >> 0, color);
return;
}
static void fill_16_simd(Uint8 *pixels, int pitch, Uint32 color, int w, int h)
{
FillRect16ARMSIMDAsm(w, h, (uint16_t *)pixels, pitch >> 1, color);
FillSurfaceRect16ARMSIMDAsm(w, h, (uint16_t *)pixels, pitch >> 1, color);
return;
}
static void fill_32_simd(Uint8 *pixels, int pitch, Uint32 color, int w, int h)
{
FillRect32ARMSIMDAsm(w, h, (uint32_t *)pixels, pitch >> 2, color);
FillSurfaceRect32ARMSIMDAsm(w, h, (uint32_t *)pixels, pitch >> 2, color);
return;
}
#endif
int SDL_FillRects(SDL_Surface *dst, const SDL_Rect *rects, int count,
int SDL_FillSurfaceRects(SDL_Surface *dst, const SDL_Rect *rects, int count,
Uint32 color)
{
SDL_Rect clipped;
@ -306,7 +306,7 @@ int SDL_FillRects(SDL_Surface *dst, const SDL_Rect *rects, int count,
int i;
if (dst == NULL) {
return SDL_InvalidParamError("SDL_FillRects(): dst");
return SDL_InvalidParamError("SDL_FillSurfaceRects(): dst");
}
/* Nothing to do */
@ -316,11 +316,11 @@ int SDL_FillRects(SDL_Surface *dst, const SDL_Rect *rects, int count,
/* Perform software fill */
if (!dst->pixels) {
return SDL_SetError("SDL_FillRects(): You must lock the surface");
return SDL_SetError("SDL_FillSurfaceRects(): You must lock the surface");
}
if (rects == NULL) {
return SDL_InvalidParamError("SDL_FillRects(): rects");
return SDL_InvalidParamError("SDL_FillSurfaceRects(): rects");
}
/* This function doesn't usually work on surfaces < 8 bpp
@ -337,7 +337,7 @@ int SDL_FillRects(SDL_Surface *dst, const SDL_Rect *rects, int count,
}
}
}
return SDL_SetError("SDL_FillRects(): Unsupported surface format");
return SDL_SetError("SDL_FillSurfaceRects(): Unsupported surface format");
}
#if SDL_ARM_NEON_BLITTERS
@ -379,11 +379,11 @@ int SDL_FillRects(SDL_Surface *dst, const SDL_Rect *rects, int count,
color |= (color << 16);
#ifdef __SSE__
if (SDL_HasSSE()) {
fill_function = SDL_FillRect1SSE;
fill_function = SDL_FillSurfaceRect1SSE;
break;
}
#endif
fill_function = SDL_FillRect1;
fill_function = SDL_FillSurfaceRect1;
break;
}
@ -392,18 +392,18 @@ int SDL_FillRects(SDL_Surface *dst, const SDL_Rect *rects, int count,
color |= (color << 16);
#ifdef __SSE__
if (SDL_HasSSE()) {
fill_function = SDL_FillRect2SSE;
fill_function = SDL_FillSurfaceRect2SSE;
break;
}
#endif
fill_function = SDL_FillRect2;
fill_function = SDL_FillSurfaceRect2;
break;
}
case 3:
/* 24-bit RGB is a slow path, at least for now. */
{
fill_function = SDL_FillRect3;
fill_function = SDL_FillSurfaceRect3;
break;
}
@ -411,11 +411,11 @@ int SDL_FillRects(SDL_Surface *dst, const SDL_Rect *rects, int count,
{
#ifdef __SSE__
if (SDL_HasSSE()) {
fill_function = SDL_FillRect4SSE;
fill_function = SDL_FillSurfaceRect4SSE;
break;
}
#endif
fill_function = SDL_FillRect4;
fill_function = SDL_FillSurfaceRect4;
break;
}

View File

@ -116,19 +116,19 @@ SDL_CreateSurface(int width, int height, Uint32 format)
surface->format = SDL_CreatePixelFormat(format);
if (!surface->format) {
SDL_FreeSurface(surface);
SDL_DestroySurface(surface);
return NULL;
}
surface->w = width;
surface->h = height;
surface->pitch = (int)pitch;
SDL_SetClipRect(surface, NULL);
SDL_SetSurfaceClipRect(surface, NULL);
if (SDL_ISPIXELFORMAT_INDEXED(surface->format->format)) {
SDL_Palette *palette =
SDL_CreatePalette((1 << surface->format->BitsPerPixel));
if (palette == NULL) {
SDL_FreeSurface(surface);
SDL_DestroySurface(surface);
return NULL;
}
if (palette->ncolors == 2) {
@ -151,7 +151,7 @@ SDL_CreateSurface(int width, int height, Uint32 format)
/* Get correct size and pitch for YUV formats */
if (SDL_CalculateYUVSize(surface->format->format, surface->w, surface->h, &size, &surface->pitch) < 0) {
/* Overflow... */
SDL_FreeSurface(surface);
SDL_DestroySurface(surface);
SDL_OutOfMemory();
return NULL;
}
@ -159,7 +159,7 @@ SDL_CreateSurface(int width, int height, Uint32 format)
/* Assumptions checked in surface_size_assumptions assert above */
if (SDL_size_mul_overflow(surface->h, surface->pitch, &size)) {
/* Overflow... */
SDL_FreeSurface(surface);
SDL_DestroySurface(surface);
SDL_OutOfMemory();
return NULL;
}
@ -167,7 +167,7 @@ SDL_CreateSurface(int width, int height, Uint32 format)
surface->pixels = SDL_SIMDAlloc(size);
if (!surface->pixels) {
SDL_FreeSurface(surface);
SDL_DestroySurface(surface);
SDL_OutOfMemory();
return NULL;
}
@ -179,7 +179,7 @@ SDL_CreateSurface(int width, int height, Uint32 format)
/* Allocate an empty mapping */
surface->map = SDL_AllocBlitMap();
if (!surface->map) {
SDL_FreeSurface(surface);
SDL_DestroySurface(surface);
return NULL;
}
@ -238,7 +238,7 @@ SDL_CreateSurfaceFrom(void *pixels,
surface->w = width;
surface->h = height;
surface->pitch = pitch;
SDL_SetClipRect(surface, NULL);
SDL_SetSurfaceClipRect(surface, NULL);
}
return surface;
}
@ -277,7 +277,7 @@ int SDL_SetSurfaceRLE(SDL_Surface *surface, int flag)
}
SDL_bool
SDL_HasSurfaceRLE(SDL_Surface *surface)
SDL_SurfaceHasRLE(SDL_Surface *surface)
{
if (surface == NULL) {
return SDL_FALSE;
@ -290,7 +290,7 @@ SDL_HasSurfaceRLE(SDL_Surface *surface)
return SDL_TRUE;
}
int SDL_SetColorKey(SDL_Surface *surface, int flag, Uint32 key)
int SDL_SetSurfaceColorKey(SDL_Surface *surface, int flag, Uint32 key)
{
int flags;
@ -321,7 +321,7 @@ int SDL_SetColorKey(SDL_Surface *surface, int flag, Uint32 key)
}
SDL_bool
SDL_HasColorKey(SDL_Surface *surface)
SDL_SurfaceHasColorKey(SDL_Surface *surface)
{
if (surface == NULL) {
return SDL_FALSE;
@ -334,7 +334,7 @@ SDL_HasColorKey(SDL_Surface *surface)
return SDL_TRUE;
}
int SDL_GetColorKey(SDL_Surface *surface, Uint32 *key)
int SDL_GetSurfaceColorKey(SDL_Surface *surface, Uint32 *key)
{
if (surface == NULL) {
return SDL_InvalidParamError("surface");
@ -437,7 +437,7 @@ static void SDL_ConvertColorkeyToAlpha(SDL_Surface *surface, SDL_bool ignore_alp
SDL_UnlockSurface(surface);
SDL_SetColorKey(surface, 0, 0);
SDL_SetSurfaceColorKey(surface, 0, 0);
SDL_SetSurfaceBlendMode(surface, SDL_BLENDMODE_BLEND);
}
@ -587,7 +587,7 @@ int SDL_GetSurfaceBlendMode(SDL_Surface *surface, SDL_BlendMode *blendMode)
}
SDL_bool
SDL_SetClipRect(SDL_Surface *surface, const SDL_Rect *rect)
SDL_SetSurfaceClipRect(SDL_Surface *surface, const SDL_Rect *rect)
{
SDL_Rect full_rect;
@ -610,7 +610,7 @@ SDL_SetClipRect(SDL_Surface *surface, const SDL_Rect *rect)
return SDL_IntersectRect(rect, &full_rect, &surface->clip_rect);
}
void SDL_GetClipRect(SDL_Surface *surface, SDL_Rect *rect)
void SDL_GetSurfaceClipRect(SDL_Surface *surface, SDL_Rect *rect)
{
if (surface && rect) {
*rect = surface->clip_rect;
@ -619,7 +619,7 @@ void SDL_GetClipRect(SDL_Surface *surface, SDL_Rect *rect)
/*
* Set up a blit between two surfaces -- split into three parts:
* The upper part, SDL_UpperBlit(), performs clipping and rectangle
* The upper part, SDL_BlitSurface(), performs clipping and rectangle
* verification. The lower part is a pointer to a low level
* accelerated blitting function.
*
@ -628,7 +628,7 @@ void SDL_GetClipRect(SDL_Surface *surface, SDL_Rect *rect)
* you know exactly what you are doing, you can optimize your code
* by calling the one(s) you need.
*/
int SDL_LowerBlit(SDL_Surface *src, SDL_Rect *srcrect,
int SDL_BlitSurfaceUnchecked(SDL_Surface *src, SDL_Rect *srcrect,
SDL_Surface *dst, SDL_Rect *dstrect)
{
/* Check to make sure the blit mapping is valid */
@ -649,7 +649,7 @@ int SDL_LowerBlit(SDL_Surface *src, SDL_Rect *srcrect,
return src->map->blit(src, srcrect, dst, dstrect);
}
int SDL_UpperBlit(SDL_Surface *src, const SDL_Rect *srcrect,
int SDL_BlitSurface(SDL_Surface *src, const SDL_Rect *srcrect,
SDL_Surface *dst, SDL_Rect *dstrect)
{
SDL_Rect fulldst;
@ -657,7 +657,7 @@ int SDL_UpperBlit(SDL_Surface *src, const SDL_Rect *srcrect,
/* Make sure the surfaces aren't locked */
if (src == NULL || dst == NULL) {
return SDL_InvalidParamError("SDL_UpperBlit(): src/dst");
return SDL_InvalidParamError("SDL_BlitSurface(): src/dst");
}
if (src->locked || dst->locked) {
return SDL_SetError("Surfaces must not be locked during blit");
@ -745,13 +745,13 @@ int SDL_UpperBlit(SDL_Surface *src, const SDL_Rect *srcrect,
sr.y = srcy;
sr.w = dstrect->w = w;
sr.h = dstrect->h = h;
return SDL_LowerBlit(src, &sr, dst, dstrect);
return SDL_BlitSurfaceUnchecked(src, &sr, dst, dstrect);
}
dstrect->w = dstrect->h = 0;
return 0;
}
int SDL_UpperBlitScaled(SDL_Surface *src, const SDL_Rect *srcrect,
int SDL_BlitSurfaceScaled(SDL_Surface *src, const SDL_Rect *srcrect,
SDL_Surface *dst, SDL_Rect *dstrect)
{
return SDL_PrivateUpperBlitScaled(src, srcrect, dst, dstrect, SDL_ScaleModeNearest);
@ -769,7 +769,7 @@ int SDL_PrivateUpperBlitScaled(SDL_Surface *src, const SDL_Rect *srcrect,
/* Make sure the surfaces aren't locked */
if (src == NULL || dst == NULL) {
return SDL_InvalidParamError("SDL_UpperBlitScaled(): src/dst");
return SDL_InvalidParamError("SDL_BlitSurfaceScaled(): src/dst");
}
if (src->locked || dst->locked) {
return SDL_SetError("Surfaces must not be locked during blit");
@ -919,7 +919,7 @@ int SDL_PrivateUpperBlitScaled(SDL_Surface *src, const SDL_Rect *srcrect,
* This is a semi-private blit function and it performs low-level surface
* scaled blitting only.
*/
int SDL_LowerBlitScaled(SDL_Surface *src, SDL_Rect *srcrect,
int SDL_BlitSurfaceUncheckedScaled(SDL_Surface *src, SDL_Rect *srcrect,
SDL_Surface *dst, SDL_Rect *dstrect)
{
return SDL_PrivateLowerBlitScaled(src, srcrect, dst, dstrect, SDL_ScaleModeNearest);
@ -948,7 +948,7 @@ int SDL_PrivateLowerBlitScaled(SDL_Surface *src, SDL_Rect *srcrect,
!SDL_ISPIXELFORMAT_INDEXED(src->format->format)) {
return SDL_SoftStretch(src, srcrect, dst, dstrect);
} else {
return SDL_LowerBlit(src, srcrect, dst, dstrect);
return SDL_BlitSurfaceUnchecked(src, srcrect, dst, dstrect);
}
} else {
if (!(src->map->info.flags & complex_copy_flags) &&
@ -992,7 +992,7 @@ int SDL_PrivateLowerBlitScaled(SDL_Surface *src, SDL_Rect *srcrect,
fmt = SDL_PIXELFORMAT_ARGB8888;
}
tmp1 = SDL_CreateSurface(src->w, src->h, fmt);
SDL_LowerBlit(src, srcrect, tmp1, &tmprect);
SDL_BlitSurfaceUnchecked(src, srcrect, tmp1, &tmprect);
srcrect2.x = 0;
srcrect2.y = 0;
@ -1017,13 +1017,13 @@ int SDL_PrivateLowerBlitScaled(SDL_Surface *src, SDL_Rect *srcrect,
tmprect.y = 0;
tmprect.w = dstrect->w;
tmprect.h = dstrect->h;
ret = SDL_LowerBlit(tmp2, &tmprect, dst, dstrect);
SDL_FreeSurface(tmp2);
ret = SDL_BlitSurfaceUnchecked(tmp2, &tmprect, dst, dstrect);
SDL_DestroySurface(tmp2);
} else {
ret = SDL_SoftStretchLinear(src, &srcrect2, dst, dstrect);
}
SDL_FreeSurface(tmp1);
SDL_DestroySurface(tmp1);
return ret;
}
}
@ -1132,7 +1132,7 @@ SDL_ConvertSurface(SDL_Surface *surface, const SDL_PixelFormat *format)
convert->format->format, convert->pixels, convert->pitch);
if (ret < 0) {
SDL_FreeSurface(convert);
SDL_DestroySurface(convert);
return NULL;
}
@ -1208,7 +1208,7 @@ SDL_ConvertSurface(SDL_Surface *surface, const SDL_PixelFormat *format)
}
}
ret = SDL_LowerBlit(surface, &bounds, convert, &bounds);
ret = SDL_BlitSurfaceUnchecked(surface, &bounds, convert, &bounds);
/* Restore colorkey alpha value */
if (palette_ck_transform) {
@ -1240,9 +1240,9 @@ SDL_ConvertSurface(SDL_Surface *surface, const SDL_PixelFormat *format)
surface->map->info.flags = copy_flags;
SDL_InvalidateMap(surface->map);
/* SDL_LowerBlit failed, and so the conversion */
/* SDL_BlitSurfaceUnchecked failed, and so the conversion */
if (ret < 0) {
SDL_FreeSurface(convert);
SDL_DestroySurface(convert);
return NULL;
}
@ -1256,7 +1256,7 @@ SDL_ConvertSurface(SDL_Surface *surface, const SDL_PixelFormat *format)
(SDL_memcmp(surface->format->palette->colors, format->palette->colors,
surface->format->palette->ncolors * sizeof(SDL_Color)) == 0)) {
/* The palette is identical, just set the same colorkey */
SDL_SetColorKey(convert, 1, surface->map->info.colorkey);
SDL_SetSurfaceColorKey(convert, 1, surface->map->info.colorkey);
} else if (!format->palette) {
if (format->Amask) {
/* No need to add the colorkey, transparency is in the alpha channel*/
@ -1285,7 +1285,7 @@ SDL_ConvertSurface(SDL_Surface *surface, const SDL_PixelFormat *format)
SDL_SetSurfacePalette(tmp, surface->format->palette);
}
SDL_FillRect(tmp, NULL, surface->map->info.colorkey);
SDL_FillSurfaceRect(tmp, NULL, surface->map->info.colorkey);
tmp->map->info.flags &= ~SDL_COPY_COLORKEY;
@ -1295,11 +1295,11 @@ SDL_ConvertSurface(SDL_Surface *surface, const SDL_PixelFormat *format)
/* Get the converted colorkey */
SDL_memcpy(&converted_colorkey, tmp2->pixels, tmp2->format->BytesPerPixel);
SDL_FreeSurface(tmp);
SDL_FreeSurface(tmp2);
SDL_DestroySurface(tmp);
SDL_DestroySurface(tmp2);
/* Set the converted colorkey on the new surface */
SDL_SetColorKey(convert, 1, converted_colorkey);
SDL_SetSurfaceColorKey(convert, 1, converted_colorkey);
/* This is needed when converting for 3D texture upload */
if (convert_colorkey) {
@ -1310,7 +1310,7 @@ SDL_ConvertSurface(SDL_Surface *surface, const SDL_PixelFormat *format)
end:
SDL_SetClipRect(convert, &surface->clip_rect);
SDL_SetSurfaceClipRect(convert, &surface->clip_rect);
/* Enable alpha blending by default if the new surface has an
* alpha channel or alpha modulation */
@ -1364,7 +1364,7 @@ static SDL_INLINE SDL_bool SDL_CreateSurfaceOnStack(int width, int height, Uint3
surface->h = height;
surface->pitch = pitch;
/* We don't actually need to set up the clip rect for our purposes */
/* SDL_SetClipRect(surface, NULL); */
/* SDL_SetSurfaceClipRect(surface, NULL); */
/* Allocate an empty mapping */
SDL_zerop(blitmap);
@ -1448,7 +1448,7 @@ int SDL_ConvertPixels(int width, int height,
rect.y = 0;
rect.w = width;
rect.h = height;
ret = SDL_LowerBlit(&src_surface, &rect, &dst_surface, &rect);
ret = SDL_BlitSurfaceUnchecked(&src_surface, &rect, &dst_surface, &rect);
/* Free blitmap reference, after blitting between stack'ed surfaces */
SDL_InvalidateMap(src_surface.map);
@ -1521,7 +1521,7 @@ int SDL_PremultiplyAlpha(int width, int height,
/*
* Free a surface created by the above function.
*/
void SDL_FreeSurface(SDL_Surface *surface)
void SDL_DestroySurface(SDL_Surface *surface)
{
if (surface == NULL) {
return;

View File

@ -1872,7 +1872,7 @@ int SDL_RecreateWindow(SDL_Window *window, Uint32 flags)
/* Tear down the old native window */
if (window->surface) {
window->surface->flags &= ~SDL_DONTFREE;
SDL_FreeSurface(window->surface);
SDL_DestroySurface(window->surface);
window->surface = NULL;
window->surface_valid = SDL_FALSE;
}
@ -2041,7 +2041,7 @@ void SDL_SetWindowIcon(SDL_Window *window, SDL_Surface *icon)
return;
}
SDL_FreeSurface(window->icon);
SDL_DestroySurface(window->icon);
/* Convert the icon into ARGB8888 */
window->icon = SDL_ConvertSurfaceFormat(icon, SDL_PIXELFORMAT_ARGB8888);
@ -2666,7 +2666,7 @@ SDL_GetWindowSurface(SDL_Window *window)
if (!window->surface_valid) {
if (window->surface) {
window->surface->flags &= ~SDL_DONTFREE;
SDL_FreeSurface(window->surface);
SDL_DestroySurface(window->surface);
window->surface = NULL;
}
window->surface = SDL_CreateWindowFramebuffer(window);
@ -3088,7 +3088,7 @@ void SDL_DestroyWindow(SDL_Window *window)
if (window->surface) {
window->surface->flags &= ~SDL_DONTFREE;
SDL_FreeSurface(window->surface);
SDL_DestroySurface(window->surface);
window->surface = NULL;
window->surface_valid = SDL_FALSE;
}
@ -3126,7 +3126,7 @@ void SDL_DestroyWindow(SDL_Window *window)
/* Free memory associated with the window */
SDL_free(window->title);
SDL_FreeSurface(window->icon);
SDL_DestroySurface(window->icon);
while (window->data) {
SDL_WindowUserData *data = window->data;

View File

@ -92,7 +92,7 @@ static SDL_Cursor *Android_CreateCursor(SDL_Surface *surface, int hot_x, int hot
return NULL;
}
custom_cursor = Android_JNI_CreateCustomCursor(converted, hot_x, hot_y);
SDL_FreeSurface(converted);
SDL_DestroySurface(converted);
if (!custom_cursor) {
SDL_Unsupported();
return NULL;
@ -122,7 +122,7 @@ static SDL_Cursor *Android_CreateEmptyCursor()
if (empty_surface) {
SDL_memset(empty_surface->pixels, 0, (size_t)empty_surface->h * empty_surface->pitch);
empty_cursor = Android_CreateCursor(empty_surface, 0, 0);
SDL_FreeSurface(empty_surface);
SDL_DestroySurface(empty_surface);
}
}
return empty_cursor;

View File

@ -251,14 +251,14 @@ Cocoa_CreateImage(SDL_Surface *surface)
bytesPerRow:converted->pitch
bitsPerPixel:converted->format->BitsPerPixel];
if (imgrep == nil) {
SDL_FreeSurface(converted);
SDL_DestroySurface(converted);
return nil;
}
/* Copy the pixels */
pixels = [imgrep bitmapData];
SDL_memcpy(pixels, converted->pixels, converted->h * converted->pitch);
SDL_FreeSurface(converted);
SDL_DestroySurface(converted);
/* Premultiply the alpha channel */
for (i = (surface->h * surface->w); i--;) {

View File

@ -76,7 +76,7 @@ void SDL_DUMMY_DestroyWindowFramebuffer(_THIS, SDL_Window *window)
SDL_Surface *surface;
surface = (SDL_Surface *)SDL_SetWindowData(window, DUMMY_SURFACE, NULL);
SDL_FreeSurface(surface);
SDL_DestroySurface(surface);
}
#endif /* SDL_VIDEO_DRIVER_DUMMY */

View File

@ -36,7 +36,7 @@ int Emscripten_CreateWindowFramebuffer(_THIS, SDL_Window *window, Uint32 *format
/* Free the old framebuffer surface */
SDL_WindowData *data = (SDL_WindowData *)window->driverdata;
surface = data->surface;
SDL_FreeSurface(surface);
SDL_DestroySurface(surface);
/* Create a new one */
SDL_GetWindowSize(window, &w, &h);
@ -154,7 +154,7 @@ void Emscripten_DestroyWindowFramebuffer(_THIS, SDL_Window *window)
{
SDL_WindowData *data = (SDL_WindowData *)window->driverdata;
SDL_FreeSurface(data->surface);
SDL_DestroySurface(data->surface);
data->surface = NULL;
}

View File

@ -104,7 +104,7 @@ static SDL_Cursor *Emscripten_CreateCursor(SDL_Surface *surface, int hot_x, int
}, surface->w, surface->h, hot_x, hot_y, conv_surf->pixels);
/* *INDENT-ON* */ /* clang-format on */
SDL_FreeSurface(conv_surf);
SDL_DestroySurface(conv_surf);
return Emscripten_CreateCursorFromString(cursor_url, SDL_TRUE);
}

View File

@ -197,7 +197,7 @@ static SDL_Cursor * HAIKU_CreateCursor(SDL_Surface * surface, int hot_x, int hot
BBitmap *cursorBitmap = new BBitmap(BRect(0, 0, surface->w - 1, surface->h - 1), B_RGBA32);
cursorBitmap->SetBits(converted->pixels, converted->h * converted->pitch, 0, B_RGBA32);
SDL_FreeSurface(converted);
SDL_DestroySurface(converted);
cursor = (SDL_Cursor *) SDL_calloc(1, sizeof(*cursor));
if (cursor) {

View File

@ -62,7 +62,7 @@ SDL_FORCE_INLINE void
FreePreviousWindowFramebuffer(SDL_Window *window)
{
SDL_Surface *surface = (SDL_Surface *)SDL_GetWindowData(window, N3DS_SURFACE);
SDL_FreeSurface(surface);
SDL_DestroySurface(surface);
}
SDL_FORCE_INLINE SDL_Surface *
@ -135,7 +135,7 @@ void SDL_N3DS_DestroyWindowFramebuffer(_THIS, SDL_Window *window)
{
SDL_Surface *surface;
surface = (SDL_Surface *)SDL_SetWindowData(window, N3DS_SURFACE, NULL);
SDL_FreeSurface(surface);
SDL_DestroySurface(surface);
}
#endif /* SDL_VIDEO_DRIVER_N3DS */

View File

@ -171,7 +171,7 @@ void SDL_NGAGE_DestroyWindowFramebuffer(_THIS, SDL_Window *window)
SDL_Surface *surface;
surface = (SDL_Surface *)SDL_SetWindowData(window, NGAGE_SURFACE, NULL);
SDL_FreeSurface(surface);
SDL_DestroySurface(surface);
}
/*****************************************************************************/

View File

@ -76,7 +76,7 @@ void SDL_OFFSCREEN_DestroyWindowFramebuffer(_THIS, SDL_Window *window)
SDL_Surface *surface;
surface = (SDL_Surface *)SDL_SetWindowData(window, OFFSCREEN_SURFACE, NULL);
SDL_FreeSurface(surface);
SDL_DestroySurface(surface);
}
#endif /* SDL_VIDEO_DRIVER_OFFSCREEN */

View File

@ -173,7 +173,7 @@ static SDL_Cursor *WIN_CreateBlankCursor()
SDL_Surface *surface = SDL_CreateSurface(32, 32, SDL_PIXELFORMAT_ARGB8888);
if (surface) {
cursor = WIN_CreateCursor(surface, 0, 0);
SDL_FreeSurface(surface);
SDL_DestroySurface(surface);
}
return cursor;
}

View File

@ -232,7 +232,7 @@ int mouse_createFreeColorCursor(void *arg)
SDLTest_AssertPass("Call to SDL_CreateColorCursor()");
SDLTest_AssertCheck(cursor != NULL, "Validate result from SDL_CreateColorCursor() is not NULL");
if (cursor == NULL) {
SDL_FreeSurface(face);
SDL_DestroySurface(face);
return TEST_ABORTED;
}
@ -241,7 +241,7 @@ int mouse_createFreeColorCursor(void *arg)
SDLTest_AssertPass("Call to SDL_FreeCursor()");
/* Clean up */
SDL_FreeSurface(face);
SDL_DestroySurface(face);
return TEST_COMPLETED;
}

View File

@ -191,7 +191,7 @@ int render_testPrimitives(void *arg)
SDL_RenderPresent(renderer);
/* Clean up. */
SDL_FreeSurface(referenceSurface);
SDL_DestroySurface(referenceSurface);
referenceSurface = NULL;
return TEST_COMPLETED;
@ -355,7 +355,7 @@ int render_testPrimitivesBlend(void *arg)
SDL_RenderPresent(renderer);
/* Clean up. */
SDL_FreeSurface(referenceSurface);
SDL_DestroySurface(referenceSurface);
referenceSurface = NULL;
return TEST_COMPLETED;
@ -424,7 +424,7 @@ int render_testBlit(void *arg)
/* Clean up. */
SDL_DestroyTexture(tface);
SDL_FreeSurface(referenceSurface);
SDL_DestroySurface(referenceSurface);
referenceSurface = NULL;
return TEST_COMPLETED;
@ -500,7 +500,7 @@ int render_testBlitColor(void *arg)
/* Clean up. */
SDL_DestroyTexture(tface);
SDL_FreeSurface(referenceSurface);
SDL_DestroySurface(referenceSurface);
referenceSurface = NULL;
return TEST_COMPLETED;
@ -579,7 +579,7 @@ int render_testBlitAlpha(void *arg)
/* Clean up. */
SDL_DestroyTexture(tface);
SDL_FreeSurface(referenceSurface);
SDL_DestroySurface(referenceSurface);
referenceSurface = NULL;
return TEST_COMPLETED;
@ -695,7 +695,7 @@ int render_testBlitBlend(void *arg)
_compare(referenceSurface, ALLOWABLE_ERROR_OPAQUE);
SDL_RenderPresent(renderer);
SDL_FreeSurface(referenceSurface);
SDL_DestroySurface(referenceSurface);
referenceSurface = NULL;
/* Test Blend. */
@ -706,7 +706,7 @@ int render_testBlitBlend(void *arg)
_compare(referenceSurface, ALLOWABLE_ERROR_BLENDED);
SDL_RenderPresent(renderer);
SDL_FreeSurface(referenceSurface);
SDL_DestroySurface(referenceSurface);
referenceSurface = NULL;
/* Test Add. */
@ -717,7 +717,7 @@ int render_testBlitBlend(void *arg)
_compare(referenceSurface, ALLOWABLE_ERROR_BLENDED);
SDL_RenderPresent(renderer);
SDL_FreeSurface(referenceSurface);
SDL_DestroySurface(referenceSurface);
referenceSurface = NULL;
/* Test Mod. */
@ -728,7 +728,7 @@ int render_testBlitBlend(void *arg)
_compare(referenceSurface, ALLOWABLE_ERROR_BLENDED);
SDL_RenderPresent(renderer);
SDL_FreeSurface(referenceSurface);
SDL_DestroySurface(referenceSurface);
referenceSurface = NULL;
/* Clear surface. */
@ -794,7 +794,7 @@ int render_testBlitBlend(void *arg)
/* Make current */
SDL_RenderPresent(renderer);
SDL_FreeSurface(referenceSurface);
SDL_DestroySurface(referenceSurface);
referenceSurface = NULL;
return TEST_COMPLETED;
@ -941,7 +941,7 @@ _loadTestFace(void)
SDLTest_LogError("SDL_CreateTextureFromSurface() failed with error: %s", SDL_GetError());
}
SDL_FreeSurface(face);
SDL_DestroySurface(face);
return tface;
}
@ -1042,7 +1042,7 @@ _hasTexAlpha(void)
* \sa
* http://wiki.libsdl.org/SDL_RenderReadPixels
* http://wiki.libsdl.org/SDL_CreateSurfaceFrom
* http://wiki.libsdl.org/SDL_FreeSurface
* http://wiki.libsdl.org/SDL_DestroySurface
*/
static void
_compare(SDL_Surface *referenceSurface, int allowable_error)
@ -1077,7 +1077,7 @@ _compare(SDL_Surface *referenceSurface, int allowable_error)
/* Clean up. */
SDL_free(pixels);
SDL_FreeSurface(testSurface);
SDL_DestroySurface(testSurface);
}
/**

View File

@ -56,9 +56,9 @@ void _surfaceSetUp(void *arg)
void _surfaceTearDown(void *arg)
{
SDL_FreeSurface(referenceSurface);
SDL_DestroySurface(referenceSurface);
referenceSurface = NULL;
SDL_FreeSurface(testSurface);
SDL_DestroySurface(testSurface);
testSurface = NULL;
}
@ -73,9 +73,9 @@ void _clearTestSurface()
/* Clear surface. */
color = SDL_MapRGBA(testSurface->format, 0, 0, 0, 0);
SDLTest_AssertPass("Call to SDL_MapRGBA()");
ret = SDL_FillRect(testSurface, NULL, color);
SDLTest_AssertPass("Call to SDL_FillRect()");
SDLTest_AssertCheck(ret == 0, "Verify result from SDL_FillRect, expected: 0, got: %i", ret);
ret = SDL_FillSurfaceRect(testSurface, NULL, color);
SDLTest_AssertPass("Call to SDL_FillSurfaceRect()");
SDLTest_AssertCheck(ret == 0, "Verify result from SDL_FillSurfaceRect, expected: 0, got: %i", ret);
}
/**
@ -118,9 +118,9 @@ void _testBlitBlendMode(int mode)
SDLTest_AssertCheck(ret == 0, "Verify result from SDL_SetSurfaceColorMod(), expected: 0, got: %i", ret);
/* Reset color key */
ret = SDL_SetColorKey(face, SDL_FALSE, 0);
SDLTest_AssertPass("Call to SDL_SetColorKey()");
SDLTest_AssertCheck(ret == 0, "Verify result from SDL_SetColorKey(), expected: 0, got: %i", ret);
ret = SDL_SetSurfaceColorKey(face, SDL_FALSE, 0);
SDLTest_AssertPass("Call to SDL_SetSurfaceColorKey()");
SDLTest_AssertCheck(ret == 0, "Verify result from SDL_SetSurfaceColorKey(), expected: 0, got: %i", ret);
/* Clear the test surface */
_clearTestSurface();
@ -196,7 +196,7 @@ void _testBlitBlendMode(int mode)
SDLTest_AssertCheck(checkFailCount4 == 0, "Validate results from calls to SDL_SetSurfaceBlendMode, expected: 0, got: %i", checkFailCount4);
/* Clean up */
SDL_FreeSurface(face);
SDL_DestroySurface(face);
face = NULL;
}
@ -250,9 +250,9 @@ int surface_testSaveLoadBitmap(void *arg)
unlink(sampleFilename);
/* Clean up */
SDL_FreeSurface(face);
SDL_DestroySurface(face);
face = NULL;
SDL_FreeSurface(rface);
SDL_DestroySurface(rface);
rface = NULL;
return TEST_COMPLETED;
@ -275,9 +275,9 @@ int surface_testSurfaceConversion(void *arg)
/* Set transparent pixel as the pixel at (0,0) */
if (face->format->palette) {
ret = SDL_SetColorKey(face, SDL_RLEACCEL, *(Uint8 *)face->pixels);
SDLTest_AssertPass("Call to SDL_SetColorKey()");
SDLTest_AssertCheck(ret == 0, "Verify result from SDL_SetColorKey, expected: 0, got: %i", ret);
ret = SDL_SetSurfaceColorKey(face, SDL_RLEACCEL, *(Uint8 *)face->pixels);
SDLTest_AssertPass("Call to SDL_SetSurfaceColorKey()");
SDLTest_AssertCheck(ret == 0, "Verify result from SDL_SetSurfaceColorKey, expected: 0, got: %i", ret);
}
/* Convert to 32 bit to compare. */
@ -290,9 +290,9 @@ int surface_testSurfaceConversion(void *arg)
SDLTest_AssertCheck(ret == 0, "Validate result from SDLTest_CompareSurfaces, expected: 0, got: %i", ret);
/* Clean up. */
SDL_FreeSurface(face);
SDL_DestroySurface(face);
face = NULL;
SDL_FreeSurface(rface);
SDL_DestroySurface(rface);
rface = NULL;
return TEST_COMPLETED;
@ -345,9 +345,9 @@ int surface_testCompleteSurfaceConversion(void *arg)
/* Set transparent pixel as the pixel at (0,0) */
if (face->format->palette) {
ret = SDL_SetColorKey(face, SDL_RLEACCEL, *(Uint8 *)face->pixels);
SDLTest_AssertPass("Call to SDL_SetColorKey()");
SDLTest_AssertCheck(ret == 0, "Verify result from SDL_SetColorKey, expected: 0, got: %i", ret);
ret = SDL_SetSurfaceColorKey(face, SDL_RLEACCEL, *(Uint8 *)face->pixels);
SDLTest_AssertPass("Call to SDL_SetSurfaceColorKey()");
SDLTest_AssertCheck(ret == 0, "Verify result from SDL_SetSurfaceColorKey, expected: 0, got: %i", ret);
}
for (i = 0; i < SDL_arraysize(pixel_formats); ++i) {
@ -372,18 +372,18 @@ int surface_testCompleteSurfaceConversion(void *arg)
/* Compare surface. */
ret = SDLTest_CompareSurfaces(face, final, 0);
SDLTest_AssertCheck(ret == 0, "Validate result from SDLTest_CompareSurfaces, expected: 0, got: %i", ret);
SDL_FreeSurface(final);
SDL_DestroySurface(final);
}
SDL_FreeSurface(cvt1);
SDL_DestroySurface(cvt1);
SDL_DestroyPixelFormat(fmt1);
SDL_FreeSurface(cvt2);
SDL_DestroySurface(cvt2);
SDL_DestroyPixelFormat(fmt2);
}
}
/* Clean up. */
SDL_FreeSurface(face);
SDL_DestroySurface(face);
return TEST_COMPLETED;
}
@ -416,7 +416,7 @@ int surface_testBlit(void *arg)
SDLTest_AssertCheck(ret == 0, "Validate result from SDLTest_CompareSurfaces, expected: 0, got: %i", ret);
/* Clean up. */
SDL_FreeSurface(compareSurface);
SDL_DestroySurface(compareSurface);
return TEST_COMPLETED;
}
@ -438,7 +438,7 @@ int surface_testBlitColorMod(void *arg)
SDLTest_AssertCheck(ret == 0, "Validate result from SDLTest_CompareSurfaces, expected: 0, got: %i", ret);
/* Clean up. */
SDL_FreeSurface(compareSurface);
SDL_DestroySurface(compareSurface);
return TEST_COMPLETED;
}
@ -460,7 +460,7 @@ int surface_testBlitAlphaMod(void *arg)
SDLTest_AssertCheck(ret == 0, "Validate result from SDLTest_CompareSurfaces, expected: 0, got: %i", ret);
/* Clean up. */
SDL_FreeSurface(compareSurface);
SDL_DestroySurface(compareSurface);
return TEST_COMPLETED;
}
@ -482,7 +482,7 @@ int surface_testBlitBlendNone(void *arg)
SDLTest_AssertCheck(ret == 0, "Validate result from SDLTest_CompareSurfaces, expected: 0, got: %i", ret);
/* Clean up. */
SDL_FreeSurface(compareSurface);
SDL_DestroySurface(compareSurface);
return TEST_COMPLETED;
}
@ -504,7 +504,7 @@ int surface_testBlitBlendBlend(void *arg)
SDLTest_AssertCheck(ret == 0, "Validate result from SDLTest_CompareSurfaces, expected: 0, got: %i", ret);
/* Clean up. */
SDL_FreeSurface(compareSurface);
SDL_DestroySurface(compareSurface);
return TEST_COMPLETED;
}
@ -526,7 +526,7 @@ int surface_testBlitBlendAdd(void *arg)
SDLTest_AssertCheck(ret == 0, "Validate result from SDLTest_CompareSurfaces, expected: 0, got: %i", ret);
/* Clean up. */
SDL_FreeSurface(compareSurface);
SDL_DestroySurface(compareSurface);
return TEST_COMPLETED;
}
@ -548,7 +548,7 @@ int surface_testBlitBlendMod(void *arg)
SDLTest_AssertCheck(ret == 0, "Validate result from SDLTest_CompareSurfaces, expected: 0, got: %i", ret);
/* Clean up. */
SDL_FreeSurface(compareSurface);
SDL_DestroySurface(compareSurface);
return TEST_COMPLETED;
}
@ -571,7 +571,7 @@ int surface_testBlitBlendLoop(void *arg)
SDLTest_AssertCheck(ret == 0, "Validate result from SDLTest_CompareSurfaces, expected: 0, got: %i", ret);
/* Clean up. */
SDL_FreeSurface(compareSurface);
SDL_DestroySurface(compareSurface);
return TEST_COMPLETED;
}
@ -628,11 +628,11 @@ int surface_testOverflow(void *arg)
surface = SDL_CreateSurfaceFrom(buf, 6, 1, 3, SDL_PIXELFORMAT_INDEX4LSB);
SDLTest_AssertCheck(surface != NULL, "6px * 4 bits per px fits in 3 bytes: %s",
surface != NULL ? "(success)" : SDL_GetError());
SDL_FreeSurface(surface);
SDL_DestroySurface(surface);
surface = SDL_CreateSurfaceFrom(buf, 6, 1, 3, SDL_PIXELFORMAT_INDEX4LSB);
SDLTest_AssertCheck(surface != NULL, "6px * 4 bits per px fits in 3 bytes: %s",
surface != NULL ? "(success)" : SDL_GetError());
SDL_FreeSurface(surface);
SDL_DestroySurface(surface);
surface = SDL_CreateSurfaceFrom(buf, 7, 1, 3, SDL_PIXELFORMAT_INDEX4LSB);
SDLTest_AssertCheck(surface == NULL, "Should detect pitch < width * bpp");
@ -646,21 +646,21 @@ int surface_testOverflow(void *arg)
surface = SDL_CreateSurfaceFrom(buf, 7, 1, 4, SDL_PIXELFORMAT_INDEX4LSB);
SDLTest_AssertCheck(surface != NULL, "7px * 4 bits per px fits in 4 bytes: %s",
surface != NULL ? "(success)" : SDL_GetError());
SDL_FreeSurface(surface);
SDL_DestroySurface(surface);
surface = SDL_CreateSurfaceFrom(buf, 7, 1, 4, SDL_PIXELFORMAT_INDEX4LSB);
SDLTest_AssertCheck(surface != NULL, "7px * 4 bits per px fits in 4 bytes: %s",
surface != NULL ? "(success)" : SDL_GetError());
SDL_FreeSurface(surface);
SDL_DestroySurface(surface);
/* SDL_PIXELFORMAT_INDEX1* needs 1 byte per 8 pixels. */
surface = SDL_CreateSurfaceFrom(buf, 16, 1, 2, SDL_PIXELFORMAT_INDEX1LSB);
SDLTest_AssertCheck(surface != NULL, "16px * 1 bit per px fits in 2 bytes: %s",
surface != NULL ? "(success)" : SDL_GetError());
SDL_FreeSurface(surface);
SDL_DestroySurface(surface);
surface = SDL_CreateSurfaceFrom(buf, 16, 1, 2, SDL_PIXELFORMAT_INDEX1LSB);
SDLTest_AssertCheck(surface != NULL, "16px * 1 bit per px fits in 2 bytes: %s",
surface != NULL ? "(success)" : SDL_GetError());
SDL_FreeSurface(surface);
SDL_DestroySurface(surface);
surface = SDL_CreateSurfaceFrom(buf, 17, 1, 2, SDL_PIXELFORMAT_INDEX1LSB);
SDLTest_AssertCheck(surface == NULL, "Should detect pitch < width * bpp");
@ -674,21 +674,21 @@ int surface_testOverflow(void *arg)
surface = SDL_CreateSurfaceFrom(buf, 17, 1, 3, SDL_PIXELFORMAT_INDEX1LSB);
SDLTest_AssertCheck(surface != NULL, "17px * 1 bit per px fits in 3 bytes: %s",
surface != NULL ? "(success)" : SDL_GetError());
SDL_FreeSurface(surface);
SDL_DestroySurface(surface);
surface = SDL_CreateSurfaceFrom(buf, 17, 1, 3, SDL_PIXELFORMAT_INDEX1LSB);
SDLTest_AssertCheck(surface != NULL, "17px * 1 bit per px fits in 3 bytes: %s",
surface != NULL ? "(success)" : SDL_GetError());
SDL_FreeSurface(surface);
SDL_DestroySurface(surface);
/* SDL_PIXELFORMAT_INDEX8 and SDL_PIXELFORMAT_RGB332 require 1 byte per pixel. */
surface = SDL_CreateSurfaceFrom(buf, 5, 1, 5, SDL_PIXELFORMAT_RGB332);
SDLTest_AssertCheck(surface != NULL, "5px * 8 bits per px fits in 5 bytes: %s",
surface != NULL ? "(success)" : SDL_GetError());
SDL_FreeSurface(surface);
SDL_DestroySurface(surface);
surface = SDL_CreateSurfaceFrom(buf, 5, 1, 5, SDL_PIXELFORMAT_INDEX8);
SDLTest_AssertCheck(surface != NULL, "5px * 8 bits per px fits in 5 bytes: %s",
surface != NULL ? "(success)" : SDL_GetError());
SDL_FreeSurface(surface);
SDL_DestroySurface(surface);
surface = SDL_CreateSurfaceFrom(buf, 6, 1, 5, SDL_PIXELFORMAT_RGB332);
SDLTest_AssertCheck(surface == NULL, "Should detect pitch < width * bpp");
@ -705,11 +705,11 @@ int surface_testOverflow(void *arg)
surface = SDL_CreateSurfaceFrom(buf, 3, 1, 6, SDL_PIXELFORMAT_RGB555);
SDLTest_AssertCheck(surface != NULL, "3px * 15 (really 16) bits per px fits in 6 bytes: %s",
surface != NULL ? "(success)" : SDL_GetError());
SDL_FreeSurface(surface);
SDL_DestroySurface(surface);
surface = SDL_CreateSurfaceFrom(buf, 3, 1, 6, SDL_PIXELFORMAT_RGB555);
SDLTest_AssertCheck(surface != NULL, "5px * 15 (really 16) bits per px fits in 6 bytes: %s",
surface != NULL ? "(success)" : SDL_GetError());
SDL_FreeSurface(surface);
SDL_DestroySurface(surface);
surface = SDL_CreateSurfaceFrom(buf, 4, 1, 6, SDL_PIXELFORMAT_RGB555);
SDLTest_AssertCheck(surface == NULL, "4px * 15 (really 16) bits per px doesn't fit in 6 bytes");

View File

@ -72,25 +72,25 @@ init_color_cursor(const char *file)
SDL_Surface *surface = SDL_LoadBMP(file);
if (surface) {
if (surface->format->palette) {
SDL_SetColorKey(surface, 1, *(Uint8 *)surface->pixels);
SDL_SetSurfaceColorKey(surface, 1, *(Uint8 *)surface->pixels);
} else {
switch (surface->format->BitsPerPixel) {
case 15:
SDL_SetColorKey(surface, 1, (*(Uint16 *)surface->pixels) & 0x00007FFF);
SDL_SetSurfaceColorKey(surface, 1, (*(Uint16 *)surface->pixels) & 0x00007FFF);
break;
case 16:
SDL_SetColorKey(surface, 1, *(Uint16 *)surface->pixels);
SDL_SetSurfaceColorKey(surface, 1, *(Uint16 *)surface->pixels);
break;
case 24:
SDL_SetColorKey(surface, 1, (*(Uint32 *)surface->pixels) & 0x00FFFFFF);
SDL_SetSurfaceColorKey(surface, 1, (*(Uint32 *)surface->pixels) & 0x00FFFFFF);
break;
case 32:
SDL_SetColorKey(surface, 1, *(Uint32 *)surface->pixels);
SDL_SetSurfaceColorKey(surface, 1, *(Uint32 *)surface->pixels);
break;
}
}
cursor = SDL_CreateColorCursor(surface, 0, 0);
SDL_FreeSurface(surface);
SDL_DestroySurface(surface);
}
return cursor;
}

View File

@ -496,7 +496,7 @@ static void _Redraw(int rendererID)
drawnTextRect.h = textSur->h;
texture = SDL_CreateTextureFromSurface(renderer, textSur);
SDL_FreeSurface(textSur);
SDL_DestroySurface(textSur);
SDL_RenderTexture(renderer, texture, NULL, &drawnTextRect);
SDL_DestroyTexture(texture);
@ -567,7 +567,7 @@ static void _Redraw(int rendererID)
drawnTextRect.h = textSur->h;
texture = SDL_CreateTextureFromSurface(renderer, textSur);
SDL_FreeSurface(textSur);
SDL_DestroySurface(textSur);
SDL_RenderTexture(renderer, texture, NULL, &drawnTextRect);
SDL_DestroyTexture(texture);

View File

@ -65,7 +65,7 @@ void save_surface_to_bmp()
SDL_GetWindowID(window), ++frame_number);
SDL_SaveBMP(surface, file);
SDL_FreeSurface(surface);
SDL_DestroySurface(surface);
}
void loop()

View File

@ -171,7 +171,7 @@ quit(int rc)
SDL_free(RawMooseData);
for (i = 0; i < MOOSEFRAMES_COUNT; i++) {
SDL_FreeSurface(MooseYUVSurfaces[i]);
SDL_DestroySurface(MooseYUVSurfaces[i]);
}
SDLTest_CommonQuit(state);
@ -472,7 +472,7 @@ int main(int argc, char **argv)
quit(7);
}
SDL_FreeSurface(mooseRGBSurface);
SDL_DestroySurface(mooseRGBSurface);
}
SDL_free(RawMooseData);

View File

@ -350,7 +350,7 @@ SDL_GL_LoadTexture(SDL_Surface *surface, GLfloat *texcoord)
glTexImage2D(GL_TEXTURE_2D,
0,
GL_RGBA, w, h, 0, GL_RGBA, GL_UNSIGNED_BYTE, image->pixels);
SDL_FreeSurface(image); /* No longer needed */
SDL_DestroySurface(image); /* No longer needed */
return texture;
}
@ -476,7 +476,7 @@ int main(int argc, char **argv)
exit(3);
}
texture = SDL_GL_LoadTexture(surface, texcoords);
SDL_FreeSurface(surface);
SDL_DestroySurface(surface);
/* Loop, drawing and checking events */
InitGL(640, 480);

View File

@ -82,7 +82,7 @@ int main(int argc, char **argv)
pictures[i].name = argv[i + 1];
if (pictures[i].surface == NULL) {
for (j = 0; j < num_pictures; j++) {
SDL_FreeSurface(pictures[j].surface);
SDL_DestroySurface(pictures[j].surface);
}
SDL_free(pictures);
SDL_Quit();
@ -107,7 +107,7 @@ int main(int argc, char **argv)
SDL_SetWindowPosition(window, SHAPED_WINDOW_X, SHAPED_WINDOW_Y);
if (window == NULL) {
for (i = 0; i < num_pictures; i++) {
SDL_FreeSurface(pictures[i].surface);
SDL_DestroySurface(pictures[i].surface);
}
SDL_free(pictures);
SDL_Quit();
@ -118,7 +118,7 @@ int main(int argc, char **argv)
if (renderer == NULL) {
SDL_DestroyWindow(window);
for (i = 0; i < num_pictures; i++) {
SDL_FreeSurface(pictures[i].surface);
SDL_DestroySurface(pictures[i].surface);
}
SDL_free(pictures);
SDL_Quit();
@ -138,7 +138,7 @@ int main(int argc, char **argv)
}
}
for (i = 0; i < num_pictures; i++) {
SDL_FreeSurface(pictures[i].surface);
SDL_DestroySurface(pictures[i].surface);
}
SDL_free(pictures);
SDL_DestroyRenderer(renderer);
@ -198,7 +198,7 @@ int main(int argc, char **argv)
SDL_DestroyWindow(window);
/* Free the original surfaces backing the textures. */
for (i = 0; i < num_pictures; i++) {
SDL_FreeSurface(pictures[i].surface);
SDL_DestroySurface(pictures[i].surface);
}
SDL_free(pictures);
/* Call SDL_Quit() before quitting. */

View File

@ -109,22 +109,22 @@ LoadTexture(SDL_Renderer *renderer, const char *file, SDL_bool transparent,
/* Set transparent pixel as the pixel at (0,0) */
if (transparent) {
if (temp->format->palette) {
SDL_SetColorKey(temp, SDL_TRUE, *(Uint8 *)temp->pixels);
SDL_SetSurfaceColorKey(temp, SDL_TRUE, *(Uint8 *)temp->pixels);
} else {
switch (temp->format->BitsPerPixel) {
case 15:
SDL_SetColorKey(temp, SDL_TRUE,
SDL_SetSurfaceColorKey(temp, SDL_TRUE,
(*(Uint16 *)temp->pixels) & 0x00007FFF);
break;
case 16:
SDL_SetColorKey(temp, SDL_TRUE, *(Uint16 *)temp->pixels);
SDL_SetSurfaceColorKey(temp, SDL_TRUE, *(Uint16 *)temp->pixels);
break;
case 24:
SDL_SetColorKey(temp, SDL_TRUE,
SDL_SetSurfaceColorKey(temp, SDL_TRUE,
(*(Uint32 *)temp->pixels) & 0x00FFFFFF);
break;
case 32:
SDL_SetColorKey(temp, SDL_TRUE, *(Uint32 *)temp->pixels);
SDL_SetSurfaceColorKey(temp, SDL_TRUE, *(Uint32 *)temp->pixels);
break;
}
}
@ -143,7 +143,7 @@ LoadTexture(SDL_Renderer *renderer, const char *file, SDL_bool transparent,
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create texture: %s\n", SDL_GetError());
}
}
SDL_FreeSurface(temp);
SDL_DestroySurface(temp);
if (path) {
SDL_free(path);
}

View File

@ -204,7 +204,7 @@ static int run_automated_tests(int pattern_size, int extra_pitch)
done:
SDL_free(yuv1);
SDL_free(yuv2);
SDL_FreeSurface(pattern);
SDL_DestroySurface(pattern);
return result;
}