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

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