SDL API renaming: SDL_surface.h

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

View File

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