From b602c449e5447b1b69f5f38915e0c7236e292158 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Fri, 30 Aug 2024 10:30:14 -0700 Subject: [PATCH] Remove SDL_SCALEMODE_BEST Fixes https://github.com/libsdl-org/SDL/issues/10619 --- build-scripts/SDL_migration.cocci | 5 ----- docs/README-migration.md | 2 +- include/SDL3/SDL_oldnames.h | 2 -- include/SDL3/SDL_surface.h | 3 +-- src/render/sdlgpu/SDL_render_gpu.c | 8 -------- src/test/SDL_test_common.c | 7 ------- src/video/SDL_stretch.c | 2 +- src/video/SDL_surface.c | 3 +-- 8 files changed, 4 insertions(+), 28 deletions(-) diff --git a/build-scripts/SDL_migration.cocci b/build-scripts/SDL_migration.cocci index 79177f764..4141f6b7f 100644 --- a/build-scripts/SDL_migration.cocci +++ b/build-scripts/SDL_migration.cocci @@ -2263,11 +2263,6 @@ symbol SDL_ScaleModeLinear; - SDL_ScaleModeLinear + SDL_SCALEMODE_LINEAR @@ -symbol SDL_ScaleModeBest; -@@ -- SDL_ScaleModeBest -+ SDL_SCALEMODE_BEST -@@ @@ - SDL_RenderCopy + SDL_RenderTexture diff --git a/docs/README-migration.md b/docs/README-migration.md index 86bd110df..a820d42ac 100644 --- a/docs/README-migration.md +++ b/docs/README-migration.md @@ -1407,7 +1407,6 @@ The following enums have been renamed: * SDL_RendererFlip => SDL_FlipMode - moved to SDL_surface.h The following symbols have been renamed: -* SDL_ScaleModeBest => SDL_SCALEMODE_BEST * SDL_ScaleModeLinear => SDL_SCALEMODE_LINEAR * SDL_ScaleModeNearest => SDL_SCALEMODE_NEAREST @@ -1416,6 +1415,7 @@ The following symbols have been removed: * SDL_RENDERER_PRESENTVSYNC - replaced with SDL_PROP_RENDERER_CREATE_PRESENT_VSYNC_NUMBER during renderer creation and SDL_PROP_RENDERER_VSYNC_NUMBER after renderer creation * SDL_RENDERER_SOFTWARE - you can check whether the name of the renderer is `SDL_SOFTWARE_RENDERER` * SDL_RENDERER_TARGETTEXTURE - all renderers support target texture functionality +* SDL_ScaleModeBest = use SDL_SCALEMODE_LINEAR instead ## SDL_rwops.h diff --git a/include/SDL3/SDL_oldnames.h b/include/SDL3/SDL_oldnames.h index cd895d5ea..a91fb8bda 100644 --- a/include/SDL3/SDL_oldnames.h +++ b/include/SDL3/SDL_oldnames.h @@ -523,7 +523,6 @@ #define SDL_RenderSetVSync SDL_SetRenderVSync #define SDL_RenderSetViewport SDL_SetRenderViewport #define SDL_RenderWindowToLogical SDL_RenderCoordinatesFromWindow -#define SDL_ScaleModeBest SDL_SCALEMODE_BEST #define SDL_ScaleModeLinear SDL_SCALEMODE_LINEAR #define SDL_ScaleModeNearest SDL_SCALEMODE_NEAREST @@ -1144,7 +1143,6 @@ #define SDL_RenderSetVSync SDL_RenderSetVSync_renamed_SDL_SetRenderVSync #define SDL_RenderSetViewport SDL_RenderSetViewport_renamed_SDL_SetRenderViewport #define SDL_RenderWindowToLogical SDL_RenderWindowToLogical_renamed_SDL_RenderCoordinatesFromWindow -#define SDL_ScaleModeBest SDL_ScaleModeBest_renamed_SDL_SCALEMODE_BEST #define SDL_ScaleModeLinear SDL_ScaleModeLinear_renamed_SDL_SCALEMODE_LINEAR #define SDL_ScaleModeNearest SDL_ScaleModeNearest_renamed_SDL_SCALEMODE_NEAREST diff --git a/include/SDL3/SDL_surface.h b/include/SDL3/SDL_surface.h index 8c1d3577e..aafe574dd 100644 --- a/include/SDL3/SDL_surface.h +++ b/include/SDL3/SDL_surface.h @@ -71,8 +71,7 @@ typedef Uint32 SDL_SurfaceFlags; typedef enum SDL_ScaleMode { SDL_SCALEMODE_NEAREST, /**< nearest pixel sampling */ - SDL_SCALEMODE_LINEAR, /**< linear filtering */ - SDL_SCALEMODE_BEST /**< anisotropic filtering */ + SDL_SCALEMODE_LINEAR /**< linear filtering */ } SDL_ScaleMode; /** diff --git a/src/render/sdlgpu/SDL_render_gpu.c b/src/render/sdlgpu/SDL_render_gpu.c index 6cc655b7e..9738a2d66 100644 --- a/src/render/sdlgpu/SDL_render_gpu.c +++ b/src/render/sdlgpu/SDL_render_gpu.c @@ -1135,10 +1135,6 @@ static bool InitSamplers(GPU_RenderData *data) { SDL_TEXTURE_ADDRESS_CLAMP, SDL_SCALEMODE_LINEAR }, { SDL_GPU_SAMPLERADDRESSMODE_REPEAT, SDL_GPU_FILTER_LINEAR, SDL_GPU_SAMPLERMIPMAPMODE_LINEAR, 0 }, }, - { - { SDL_TEXTURE_ADDRESS_CLAMP, SDL_SCALEMODE_BEST }, - { SDL_GPU_SAMPLERADDRESSMODE_REPEAT, SDL_GPU_FILTER_LINEAR, SDL_GPU_SAMPLERMIPMAPMODE_LINEAR, 16 }, - }, { { SDL_TEXTURE_ADDRESS_WRAP, SDL_SCALEMODE_NEAREST }, { SDL_GPU_SAMPLERADDRESSMODE_REPEAT, SDL_GPU_FILTER_NEAREST, SDL_GPU_SAMPLERMIPMAPMODE_NEAREST, 0 }, @@ -1147,10 +1143,6 @@ static bool InitSamplers(GPU_RenderData *data) { SDL_TEXTURE_ADDRESS_WRAP, SDL_SCALEMODE_LINEAR }, { SDL_GPU_SAMPLERADDRESSMODE_REPEAT, SDL_GPU_FILTER_LINEAR, SDL_GPU_SAMPLERMIPMAPMODE_LINEAR, 0 }, }, - { - { SDL_TEXTURE_ADDRESS_WRAP, SDL_SCALEMODE_BEST }, - { SDL_GPU_SAMPLERADDRESSMODE_REPEAT, SDL_GPU_FILTER_LINEAR, SDL_GPU_SAMPLERMIPMAPMODE_LINEAR, 16 }, - }, }; for (Uint32 i = 0; i < SDL_arraysize(configs); ++i) { diff --git a/src/test/SDL_test_common.c b/src/test/SDL_test_common.c index 71e360957..aea372ec2 100644 --- a/src/test/SDL_test_common.c +++ b/src/test/SDL_test_common.c @@ -526,10 +526,6 @@ int SDLTest_CommonArg(SDLTest_CommonState *state, int index) state->logical_scale_mode = SDL_SCALEMODE_LINEAR; return 2; } - if (SDL_strcasecmp(argv[index], "best") == 0) { - state->logical_scale_mode = SDL_SCALEMODE_BEST; - return 2; - } return -1; } if (SDL_strcasecmp(argv[index], "--scale") == 0) { @@ -1049,9 +1045,6 @@ static void SDLTest_PrintScaleMode(char *text, size_t maxlen, SDL_ScaleMode scal case SDL_SCALEMODE_LINEAR: SDL_snprintfcat(text, maxlen, "LINEAR"); break; - case SDL_SCALEMODE_BEST: - SDL_snprintfcat(text, maxlen, "BEST"); - break; default: SDL_snprintfcat(text, maxlen, "0x%8.8x", scale_mode); break; diff --git a/src/video/SDL_stretch.c b/src/video/SDL_stretch.c index e95aca31b..d12818e4a 100644 --- a/src/video/SDL_stretch.c +++ b/src/video/SDL_stretch.c @@ -80,7 +80,7 @@ bool SDL_SoftStretch(SDL_Surface *src, const SDL_Rect *srcrect, SDL_Surface *dst return result; } - if (scaleMode != SDL_SCALEMODE_NEAREST && scaleMode != SDL_SCALEMODE_LINEAR && scaleMode != SDL_SCALEMODE_BEST) { + if (scaleMode != SDL_SCALEMODE_NEAREST && scaleMode != SDL_SCALEMODE_LINEAR) { return SDL_InvalidParamError("scaleMode"); } diff --git a/src/video/SDL_surface.c b/src/video/SDL_surface.c index 293025c04..1522616b4 100644 --- a/src/video/SDL_surface.c +++ b/src/video/SDL_surface.c @@ -1093,8 +1093,7 @@ SDL_bool SDL_BlitSurfaceScaled(SDL_Surface *src, const SDL_Rect *srcrect, SDL_Su } else if ((src->flags & SDL_SURFACE_LOCKED) || (dst->flags & SDL_SURFACE_LOCKED)) { return SDL_SetError("Surfaces must not be locked during blit"); } else if (scaleMode != SDL_SCALEMODE_NEAREST && - scaleMode != SDL_SCALEMODE_LINEAR && - scaleMode != SDL_SCALEMODE_BEST) { + scaleMode != SDL_SCALEMODE_LINEAR) { return SDL_InvalidParamError("scaleMode"); }