From 14a4ce8b59c3fd24ba91fcfa772af03e12e069f3 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Fri, 3 Feb 2023 13:23:02 -0800 Subject: [PATCH] Fixed SDL_ScaleMode values for consistency --- build-scripts/SDL_migration.cocci | 12 ++++++++++++ docs/README-migration.md | 5 +++++ include/SDL3/SDL_oldnames.h | 6 ++++++ include/SDL3/SDL_render.h | 6 +++--- src/render/SDL_render.c | 12 ++++++------ src/render/direct3d/SDL_render_d3d.c | 4 ++-- src/render/direct3d11/SDL_render_d3d11.c | 4 ++-- src/render/direct3d12/SDL_render_d3d12.c | 4 ++-- src/render/metal/SDL_render_metal.m | 4 ++-- src/render/opengl/SDL_render_gl.c | 4 ++-- src/render/opengles2/SDL_render_gles2.c | 4 ++-- src/render/ps2/SDL_render_ps2.c | 2 +- src/render/psp/SDL_render_psp.c | 2 +- src/render/software/SDL_render_sw.c | 2 +- src/render/vitagxm/SDL_render_vita_gxm.c | 2 +- src/test/SDL_test_common.c | 14 +++++++------- src/video/SDL_stretch.c | 8 ++++---- src/video/SDL_surface.c | 6 +++--- test/gamepadmap.c | 2 +- test/testautomation_render.c | 12 ++++++------ test/testgamepad.c | 2 +- 21 files changed, 70 insertions(+), 47 deletions(-) diff --git a/build-scripts/SDL_migration.cocci b/build-scripts/SDL_migration.cocci index 76d72f908..6878ced6e 100644 --- a/build-scripts/SDL_migration.cocci +++ b/build-scripts/SDL_migration.cocci @@ -2388,3 +2388,15 @@ SDL_DisplayMode e; - SDL_RenderLogicalToWindow + SDL_RenderCoordinatesToWindow (...) +@@ +@@ +- SDL_ScaleModeNearest ++ SDL_SCALEMODE_NEAREST +@@ +@@ +- SDL_ScaleModeLinear ++ SDL_SCALEMODE_LINEAR +@@ +@@ +- SDL_ScaleModeBest ++ SDL_SCALEMODE_BEST diff --git a/docs/README-migration.md b/docs/README-migration.md index 7a9552a2c..b8030496c 100644 --- a/docs/README-migration.md +++ b/docs/README-migration.md @@ -649,6 +649,11 @@ The following functions have been removed: * SDL_RenderSetIntegerScale() - this is now explicit with SDL_LOGICAL_PRESENTATION_INTEGER_SCALE * SDL_RenderTargetSupported() - render targets are always supported +The following symbols have been renamed: +* SDL_ScaleModeBest => SDL_SCALEMODE_BEST +* SDL_ScaleModeLinear => SDL_SCALEMODE_LINEAR +* SDL_ScaleModeNearest => SDL_SCALEMODE_NEAREST + ## SDL_rwops.h The following symbols have been renamed: diff --git a/include/SDL3/SDL_oldnames.h b/include/SDL3/SDL_oldnames.h index 570c81af7..ae97d735e 100644 --- a/include/SDL3/SDL_oldnames.h +++ b/include/SDL3/SDL_oldnames.h @@ -371,6 +371,9 @@ #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 /* ##SDL_rwops.h */ #define RW_SEEK_CUR SDL_RW_SEEK_CUR @@ -757,6 +760,9 @@ #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 /* ##SDL_rwops.h */ #define RW_SEEK_CUR RW_SEEK_CUR_renamed_SDL_RW_SEEK_CUR diff --git a/include/SDL3/SDL_render.h b/include/SDL3/SDL_render.h index 7bd32c646..8205b2d87 100644 --- a/include/SDL3/SDL_render.h +++ b/include/SDL3/SDL_render.h @@ -98,9 +98,9 @@ typedef struct SDL_Vertex */ typedef enum { - SDL_ScaleModeNearest, /**< nearest pixel sampling */ - SDL_ScaleModeLinear, /**< linear filtering */ - SDL_ScaleModeBest /**< anisotropic filtering */ + SDL_SCALEMODE_NEAREST, /**< nearest pixel sampling */ + SDL_SCALEMODE_LINEAR, /**< linear filtering */ + SDL_SCALEMODE_BEST /**< anisotropic filtering */ } SDL_ScaleMode; /** diff --git a/src/render/SDL_render.c b/src/render/SDL_render.c index 7b75532d7..65680abce 100644 --- a/src/render/SDL_render.c +++ b/src/render/SDL_render.c @@ -925,7 +925,7 @@ SDL_Renderer *SDL_CreateRenderer(SDL_Window *window, const char *name, Uint32 fl SDL_SetRenderViewport(renderer, NULL); - SDL_SetRenderLogicalPresentation(renderer, 0, 0, SDL_LOGICAL_PRESENTATION_MATCH, SDL_ScaleModeLinear); + SDL_SetRenderLogicalPresentation(renderer, 0, 0, SDL_LOGICAL_PRESENTATION_MATCH, SDL_SCALEMODE_LINEAR); SDL_AddEventWatch(SDL_RendererEventWatch, renderer); @@ -1106,11 +1106,11 @@ static SDL_ScaleMode SDL_GetScaleMode(void) const char *hint = SDL_GetHint(SDL_HINT_RENDER_SCALE_QUALITY); if (hint == NULL || SDL_strcasecmp(hint, "nearest") == 0) { - return SDL_ScaleModeNearest; + return SDL_SCALEMODE_NEAREST; } else if (SDL_strcasecmp(hint, "linear") == 0) { - return SDL_ScaleModeLinear; + return SDL_SCALEMODE_LINEAR; } else if (SDL_strcasecmp(hint, "best") == 0) { - return SDL_ScaleModeBest; + return SDL_SCALEMODE_BEST; } else { return (SDL_ScaleMode)SDL_atoi(hint); } @@ -2231,7 +2231,7 @@ static int UpdateLogicalPresentation(SDL_Renderer *renderer) return 0; error: - SDL_SetRenderLogicalPresentation(renderer, 0, 0, SDL_LOGICAL_PRESENTATION_DISABLED, SDL_ScaleModeNearest); + SDL_SetRenderLogicalPresentation(renderer, 0, 0, SDL_LOGICAL_PRESENTATION_DISABLED, SDL_SCALEMODE_NEAREST); return -1; } @@ -2271,7 +2271,7 @@ int SDL_SetRenderLogicalPresentation(SDL_Renderer *renderer, int w, int h, SDL_R return UpdateLogicalPresentation(renderer); error: - SDL_SetRenderLogicalPresentation(renderer, 0, 0, SDL_LOGICAL_PRESENTATION_DISABLED, SDL_ScaleModeNearest); + SDL_SetRenderLogicalPresentation(renderer, 0, 0, SDL_LOGICAL_PRESENTATION_DISABLED, SDL_SCALEMODE_NEAREST); return -1; } diff --git a/src/render/direct3d/SDL_render_d3d.c b/src/render/direct3d/SDL_render_d3d.c index 6b22ee2d0..092cdd398 100644 --- a/src/render/direct3d/SDL_render_d3d.c +++ b/src/render/direct3d/SDL_render_d3d.c @@ -529,7 +529,7 @@ static int D3D_CreateTexture(SDL_Renderer *renderer, SDL_Texture *texture) if (texturedata == NULL) { return SDL_OutOfMemory(); } - texturedata->scaleMode = (texture->scaleMode == SDL_ScaleModeNearest) ? D3DTEXF_POINT : D3DTEXF_LINEAR; + texturedata->scaleMode = (texture->scaleMode == SDL_SCALEMODE_NEAREST) ? D3DTEXF_POINT : D3DTEXF_LINEAR; texture->driverdata = texturedata; @@ -733,7 +733,7 @@ static void D3D_SetTextureScaleMode(SDL_Renderer *renderer, SDL_Texture *texture return; } - texturedata->scaleMode = (scaleMode == SDL_ScaleModeNearest) ? D3DTEXF_POINT : D3DTEXF_LINEAR; + texturedata->scaleMode = (scaleMode == SDL_SCALEMODE_NEAREST) ? D3DTEXF_POINT : D3DTEXF_LINEAR; } static int D3D_SetRenderTargetInternal(SDL_Renderer *renderer, SDL_Texture *texture) diff --git a/src/render/direct3d11/SDL_render_d3d11.c b/src/render/direct3d11/SDL_render_d3d11.c index 0c1e49cdc..85fc010a6 100644 --- a/src/render/direct3d11/SDL_render_d3d11.c +++ b/src/render/direct3d11/SDL_render_d3d11.c @@ -1070,7 +1070,7 @@ static int D3D11_CreateTexture(SDL_Renderer *renderer, SDL_Texture *texture) SDL_OutOfMemory(); return -1; } - textureData->scaleMode = (texture->scaleMode == SDL_ScaleModeNearest) ? D3D11_FILTER_MIN_MAG_MIP_POINT : D3D11_FILTER_MIN_MAG_MIP_LINEAR; + textureData->scaleMode = (texture->scaleMode == SDL_SCALEMODE_NEAREST) ? D3D11_FILTER_MIN_MAG_MIP_POINT : D3D11_FILTER_MIN_MAG_MIP_LINEAR; texture->driverdata = textureData; @@ -1546,7 +1546,7 @@ static void D3D11_SetTextureScaleMode(SDL_Renderer *renderer, SDL_Texture *textu return; } - textureData->scaleMode = (scaleMode == SDL_ScaleModeNearest) ? D3D11_FILTER_MIN_MAG_MIP_POINT : D3D11_FILTER_MIN_MAG_MIP_LINEAR; + textureData->scaleMode = (scaleMode == SDL_SCALEMODE_NEAREST) ? D3D11_FILTER_MIN_MAG_MIP_POINT : D3D11_FILTER_MIN_MAG_MIP_LINEAR; } static int D3D11_SetRenderTarget(SDL_Renderer *renderer, SDL_Texture *texture) diff --git a/src/render/direct3d12/SDL_render_d3d12.c b/src/render/direct3d12/SDL_render_d3d12.c index b868f87ef..ad07a9d82 100644 --- a/src/render/direct3d12/SDL_render_d3d12.c +++ b/src/render/direct3d12/SDL_render_d3d12.c @@ -1432,7 +1432,7 @@ static int D3D12_CreateTexture(SDL_Renderer *renderer, SDL_Texture *texture) SDL_OutOfMemory(); return -1; } - textureData->scaleMode = (texture->scaleMode == SDL_ScaleModeNearest) ? D3D12_FILTER_MIN_MAG_MIP_POINT : D3D12_FILTER_MIN_MAG_MIP_LINEAR; + textureData->scaleMode = (texture->scaleMode == SDL_SCALEMODE_NEAREST) ? D3D12_FILTER_MIN_MAG_MIP_POINT : D3D12_FILTER_MIN_MAG_MIP_LINEAR; texture->driverdata = textureData; textureData->mainTextureFormat = textureFormat; @@ -2076,7 +2076,7 @@ static void D3D12_SetTextureScaleMode(SDL_Renderer *renderer, SDL_Texture *textu return; } - textureData->scaleMode = (scaleMode == SDL_ScaleModeNearest) ? D3D12_FILTER_MIN_MAG_MIP_POINT : D3D12_FILTER_MIN_MAG_MIP_LINEAR; + textureData->scaleMode = (scaleMode == SDL_SCALEMODE_NEAREST) ? D3D12_FILTER_MIN_MAG_MIP_POINT : D3D12_FILTER_MIN_MAG_MIP_LINEAR; } static int D3D12_SetRenderTarget(SDL_Renderer *renderer, SDL_Texture *texture) diff --git a/src/render/metal/SDL_render_metal.m b/src/render/metal/SDL_render_metal.m index a9f778488..95ddad76d 100644 --- a/src/render/metal/SDL_render_metal.m +++ b/src/render/metal/SDL_render_metal.m @@ -621,7 +621,7 @@ METAL_CreateTexture(SDL_Renderer *renderer, SDL_Texture *texture) } #endif /* SDL_HAVE_YUV */ texturedata = [[METAL_TextureData alloc] init]; - if (texture->scaleMode == SDL_ScaleModeNearest) { + if (texture->scaleMode == SDL_SCALEMODE_NEAREST) { texturedata.mtlsampler = data.mtlsamplernearest; } else { texturedata.mtlsampler = data.mtlsamplerlinear; @@ -994,7 +994,7 @@ static void METAL_SetTextureScaleMode(SDL_Renderer *renderer, SDL_Texture *textu METAL_RenderData *data = (__bridge METAL_RenderData *)renderer->driverdata; METAL_TextureData *texturedata = (__bridge METAL_TextureData *)texture->driverdata; - if (scaleMode == SDL_ScaleModeNearest) { + if (scaleMode == SDL_SCALEMODE_NEAREST) { texturedata.mtlsampler = data.mtlsamplernearest; } else { texturedata.mtlsampler = data.mtlsamplerlinear; diff --git a/src/render/opengl/SDL_render_gl.c b/src/render/opengl/SDL_render_gl.c index 05350627f..c89dd0577 100644 --- a/src/render/opengl/SDL_render_gl.c +++ b/src/render/opengl/SDL_render_gl.c @@ -525,7 +525,7 @@ static int GL_CreateTexture(SDL_Renderer *renderer, SDL_Texture *texture) data->format = format; data->formattype = type; - scaleMode = (texture->scaleMode == SDL_ScaleModeNearest) ? GL_NEAREST : GL_LINEAR; + scaleMode = (texture->scaleMode == SDL_SCALEMODE_NEAREST) ? GL_NEAREST : GL_LINEAR; renderdata->glEnable(textype); renderdata->glBindTexture(textype, data->texture); renderdata->glTexParameteri(textype, GL_TEXTURE_MIN_FILTER, scaleMode); @@ -840,7 +840,7 @@ static void GL_SetTextureScaleMode(SDL_Renderer *renderer, SDL_Texture *texture, GL_RenderData *renderdata = (GL_RenderData *)renderer->driverdata; const GLenum textype = renderdata->textype; GL_TextureData *data = (GL_TextureData *)texture->driverdata; - GLenum glScaleMode = (scaleMode == SDL_ScaleModeNearest) ? GL_NEAREST : GL_LINEAR; + GLenum glScaleMode = (scaleMode == SDL_SCALEMODE_NEAREST) ? GL_NEAREST : GL_LINEAR; renderdata->glBindTexture(textype, data->texture); renderdata->glTexParameteri(textype, GL_TEXTURE_MIN_FILTER, glScaleMode); diff --git a/src/render/opengles2/SDL_render_gles2.c b/src/render/opengles2/SDL_render_gles2.c index 144c2a624..4bb2c5c1d 100644 --- a/src/render/opengles2/SDL_render_gles2.c +++ b/src/render/opengles2/SDL_render_gles2.c @@ -1463,7 +1463,7 @@ static int GLES2_CreateTexture(SDL_Renderer *renderer, SDL_Texture *texture) data->texture_u = 0; data->texture_v = 0; #endif - scaleMode = (texture->scaleMode == SDL_ScaleModeNearest) ? GL_NEAREST : GL_LINEAR; + scaleMode = (texture->scaleMode == SDL_SCALEMODE_NEAREST) ? GL_NEAREST : GL_LINEAR; /* Allocate a blob for image renderdata */ if (texture->access == SDL_TEXTUREACCESS_STREAMING) { @@ -1824,7 +1824,7 @@ static void GLES2_SetTextureScaleMode(SDL_Renderer *renderer, SDL_Texture *textu { GLES2_RenderData *renderdata = (GLES2_RenderData *)renderer->driverdata; GLES2_TextureData *data = (GLES2_TextureData *)texture->driverdata; - GLenum glScaleMode = (scaleMode == SDL_ScaleModeNearest) ? GL_NEAREST : GL_LINEAR; + GLenum glScaleMode = (scaleMode == SDL_SCALEMODE_NEAREST) ? GL_NEAREST : GL_LINEAR; #if SDL_HAVE_YUV if (data->yuv) { diff --git a/src/render/ps2/SDL_render_ps2.c b/src/render/ps2/SDL_render_ps2.c index ca854fc05..544e1b862 100644 --- a/src/render/ps2/SDL_render_ps2.c +++ b/src/render/ps2/SDL_render_ps2.c @@ -177,7 +177,7 @@ static void PS2_SetTextureScaleMode(SDL_Renderer *renderer, SDL_Texture *texture gskit scale mode is either GS_FILTER_NEAREST (good for tile-map) or GS_FILTER_LINEAR (good for scaling) */ - uint32_t gsKitScaleMode = (scaleMode == SDL_ScaleModeNearest + uint32_t gsKitScaleMode = (scaleMode == SDL_SCALEMODE_NEAREST ? GS_FILTER_NEAREST : GS_FILTER_LINEAR); ps2_texture->Filter = gsKitScaleMode; diff --git a/src/render/psp/SDL_render_psp.c b/src/render/psp/SDL_render_psp.c index 6d3761278..e6cb4cb0c 100644 --- a/src/render/psp/SDL_render_psp.c +++ b/src/render/psp/SDL_render_psp.c @@ -542,7 +542,7 @@ static int TextureShouldSwizzle(PSP_TextureData *psp_texture, SDL_Texture *textu static void TextureActivate(SDL_Texture *texture) { PSP_TextureData *psp_texture = (PSP_TextureData *)texture->driverdata; - int scaleMode = (texture->scaleMode == SDL_ScaleModeNearest) ? GU_NEAREST : GU_LINEAR; + int scaleMode = (texture->scaleMode == SDL_SCALEMODE_NEAREST) ? GU_NEAREST : GU_LINEAR; /* Swizzling is useless with small textures. */ if (TextureShouldSwizzle(psp_texture, texture)) { diff --git a/src/render/software/SDL_render_sw.c b/src/render/software/SDL_render_sw.c index 50d99e1c0..8b5900589 100644 --- a/src/render/software/SDL_render_sw.c +++ b/src/render/software/SDL_render_sw.c @@ -416,7 +416,7 @@ static int SW_RenderCopyEx(SDL_Renderer *renderer, SDL_Surface *surface, SDL_Tex SDLgfx_rotozoomSurfaceSizeTrig(tmp_rect.w, tmp_rect.h, angle, center, &rect_dest, &cangle, &sangle); src_rotated = SDLgfx_rotateSurface(src_clone, angle, - (texture->scaleMode == SDL_ScaleModeNearest) ? 0 : 1, flip & SDL_FLIP_HORIZONTAL, flip & SDL_FLIP_VERTICAL, + (texture->scaleMode == SDL_SCALEMODE_NEAREST) ? 0 : 1, flip & SDL_FLIP_HORIZONTAL, flip & SDL_FLIP_VERTICAL, &rect_dest, cangle, sangle, center); if (src_rotated == NULL) { retval = -1; diff --git a/src/render/vitagxm/SDL_render_vita_gxm.c b/src/render/vitagxm/SDL_render_vita_gxm.c index c267434f0..26f20c373 100644 --- a/src/render/vitagxm/SDL_render_vita_gxm.c +++ b/src/render/vitagxm/SDL_render_vita_gxm.c @@ -607,7 +607,7 @@ static void VITA_GXM_SetTextureScaleMode(SDL_Renderer *renderer, SDL_Texture *te or SCE_GXM_TEXTURE_FILTER_LINEAR (good for scaling) */ - int vitaScaleMode = (scaleMode == SDL_ScaleModeNearest + int vitaScaleMode = (scaleMode == SDL_SCALEMODE_NEAREST ? SCE_GXM_TEXTURE_FILTER_POINT : SCE_GXM_TEXTURE_FILTER_LINEAR); gxm_texture_set_filters(vita_texture->tex, vitaScaleMode, vitaScaleMode); diff --git a/src/test/SDL_test_common.c b/src/test/SDL_test_common.c index f7f0c6f9f..defc13810 100644 --- a/src/test/SDL_test_common.c +++ b/src/test/SDL_test_common.c @@ -86,7 +86,7 @@ SDLTest_CommonCreateState(char **argv, Uint32 flags) state->window_w = DEFAULT_WINDOW_WIDTH; state->window_h = DEFAULT_WINDOW_HEIGHT; state->logical_presentation = SDL_LOGICAL_PRESENTATION_MATCH; - state->logical_scale_mode = SDL_ScaleModeLinear; + state->logical_scale_mode = SDL_SCALEMODE_LINEAR; state->num_windows = 1; state->audiospec.freq = 22050; state->audiospec.format = AUDIO_S16; @@ -440,15 +440,15 @@ int SDLTest_CommonArg(SDLTest_CommonState *state, int index) return -1; } if (SDL_strcasecmp(argv[index], "nearest") == 0) { - state->logical_scale_mode = SDL_ScaleModeNearest; + state->logical_scale_mode = SDL_SCALEMODE_NEAREST; return 2; } if (SDL_strcasecmp(argv[index], "linear") == 0) { - state->logical_scale_mode = SDL_ScaleModeLinear; + state->logical_scale_mode = SDL_SCALEMODE_LINEAR; return 2; } if (SDL_strcasecmp(argv[index], "best") == 0) { - state->logical_scale_mode = SDL_ScaleModeBest; + state->logical_scale_mode = SDL_SCALEMODE_BEST; return 2; } return -1; @@ -1001,13 +1001,13 @@ static void SDLTest_PrintLogicalPresentation(char *text, size_t maxlen, SDL_Rend static void SDLTest_PrintScaleMode(char *text, size_t maxlen, SDL_ScaleMode scale_mode) { switch (scale_mode) { - case SDL_ScaleModeNearest: + case SDL_SCALEMODE_NEAREST: SDL_snprintfcat(text, maxlen, "NEAREST"); break; - case SDL_ScaleModeLinear: + case SDL_SCALEMODE_LINEAR: SDL_snprintfcat(text, maxlen, "LINEAR"); break; - case SDL_ScaleModeBest: + case SDL_SCALEMODE_BEST: SDL_snprintfcat(text, maxlen, "BEST"); break; default: diff --git a/src/video/SDL_stretch.c b/src/video/SDL_stretch.c index 91d4bdb34..65bc140d1 100644 --- a/src/video/SDL_stretch.c +++ b/src/video/SDL_stretch.c @@ -29,13 +29,13 @@ static int SDL_UpperSoftStretch(SDL_Surface *src, const SDL_Rect *srcrect, SDL_S int SDL_SoftStretch(SDL_Surface *src, const SDL_Rect *srcrect, SDL_Surface *dst, const SDL_Rect *dstrect) { - return SDL_UpperSoftStretch(src, srcrect, dst, dstrect, SDL_ScaleModeNearest); + return SDL_UpperSoftStretch(src, srcrect, dst, dstrect, SDL_SCALEMODE_NEAREST); } int SDL_SoftStretchLinear(SDL_Surface *src, const SDL_Rect *srcrect, SDL_Surface *dst, const SDL_Rect *dstrect) { - return SDL_UpperSoftStretch(src, srcrect, dst, dstrect, SDL_ScaleModeLinear); + return SDL_UpperSoftStretch(src, srcrect, dst, dstrect, SDL_SCALEMODE_LINEAR); } static int SDL_UpperSoftStretch(SDL_Surface *src, const SDL_Rect *srcrect, @@ -51,7 +51,7 @@ static int SDL_UpperSoftStretch(SDL_Surface *src, const SDL_Rect *srcrect, return SDL_SetError("Only works with same format surfaces"); } - if (scaleMode != SDL_ScaleModeNearest) { + if (scaleMode != SDL_SCALEMODE_NEAREST) { if (src->format->BytesPerPixel != 4 || src->format->format == SDL_PIXELFORMAT_ARGB2101010) { return SDL_SetError("Wrong format"); } @@ -114,7 +114,7 @@ static int SDL_UpperSoftStretch(SDL_Surface *src, const SDL_Rect *srcrect, src_locked = 1; } - if (scaleMode == SDL_ScaleModeNearest) { + if (scaleMode == SDL_SCALEMODE_NEAREST) { ret = SDL_LowerSoftStretchNearest(src, srcrect, dst, dstrect); } else { ret = SDL_LowerSoftStretchLinear(src, srcrect, dst, dstrect); diff --git a/src/video/SDL_surface.c b/src/video/SDL_surface.c index bdc6f82ea..7f76595b9 100644 --- a/src/video/SDL_surface.c +++ b/src/video/SDL_surface.c @@ -759,7 +759,7 @@ int SDL_BlitSurface(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_PrivateBlitSurfaceScaled(src, srcrect, dst, dstrect, SDL_ScaleModeNearest); + return SDL_PrivateBlitSurfaceScaled(src, srcrect, dst, dstrect, SDL_SCALEMODE_NEAREST); } int SDL_PrivateBlitSurfaceScaled(SDL_Surface *src, const SDL_Rect *srcrect, @@ -927,7 +927,7 @@ int SDL_PrivateBlitSurfaceScaled(SDL_Surface *src, const SDL_Rect *srcrect, int SDL_BlitSurfaceUncheckedScaled(SDL_Surface *src, SDL_Rect *srcrect, SDL_Surface *dst, SDL_Rect *dstrect) { - return SDL_PrivateBlitSurfaceUncheckedScaled(src, srcrect, dst, dstrect, SDL_ScaleModeNearest); + return SDL_PrivateBlitSurfaceUncheckedScaled(src, srcrect, dst, dstrect, SDL_SCALEMODE_NEAREST); } int SDL_PrivateBlitSurfaceUncheckedScaled(SDL_Surface *src, SDL_Rect *srcrect, @@ -947,7 +947,7 @@ int SDL_PrivateBlitSurfaceUncheckedScaled(SDL_Surface *src, SDL_Rect *srcrect, SDL_InvalidateMap(src->map); } - if (scaleMode == SDL_ScaleModeNearest) { + if (scaleMode == SDL_SCALEMODE_NEAREST) { if (!(src->map->info.flags & complex_copy_flags) && src->format->format == dst->format->format && !SDL_ISPIXELFORMAT_INDEXED(src->format->format)) { diff --git a/test/gamepadmap.c b/test/gamepadmap.c index fbbfd8eb1..7f4f622fe 100644 --- a/test/gamepadmap.c +++ b/test/gamepadmap.c @@ -368,7 +368,7 @@ WatchJoystick(SDL_Joystick *joystick) /* scale for platforms that don't give you the window size you asked for. */ SDL_SetRenderLogicalPresentation(screen, SCREEN_WIDTH, SCREEN_HEIGHT, SDL_LOGICAL_PRESENTATION_LETTERBOX, - SDL_ScaleModeLinear); + SDL_SCALEMODE_LINEAR); /* Print info about the joystick we are watching */ name = SDL_GetJoystickName(joystick); diff --git a/test/testautomation_render.c b/test/testautomation_render.c index 43e2c3281..c8fefd3c4 100644 --- a/test/testautomation_render.c +++ b/test/testautomation_render.c @@ -894,7 +894,7 @@ int render_testLogicalSize(void *arg) SDLTest_AssertCheck(ret == 0, "Validate result from SDL_GetRendererOutputSize, expected: 0, got: %i", ret); ret = SDL_SetRenderLogicalPresentation(renderer, w / factor, h / factor, SDL_LOGICAL_PRESENTATION_LETTERBOX, - SDL_ScaleModeNearest); + SDL_SCALEMODE_NEAREST); SDLTest_AssertCheck(ret == 0, "Validate result from SDL_SetRenderLogicalSize, expected: 0, got: %i", ret); ret = SDL_SetRenderDrawColor(renderer, 0, 255, 0, SDL_ALPHA_OPAQUE); SDLTest_AssertCheck(ret == 0, "Validate result from SDL_SetRenderDrawColor, expected: 0, got: %i", ret); @@ -907,7 +907,7 @@ int render_testLogicalSize(void *arg) (void)SDL_RenderPresent(renderer); ret = SDL_SetRenderLogicalPresentation(renderer, 0, 0, SDL_LOGICAL_PRESENTATION_DISABLED, - SDL_ScaleModeNearest); + SDL_SCALEMODE_NEAREST); SDLTest_AssertCheck(ret == 0, "Validate result from SDL_SetRenderLogicalSize, expected: 0, got: %i", ret); /* Check to see if final image matches. */ @@ -921,7 +921,7 @@ int render_testLogicalSize(void *arg) SDLTest_AssertCheck(ret == 0, "Validate result from SDL_GetRendererOutputSize, expected: 0, got: %i", ret); ret = SDL_SetRenderLogicalPresentation(renderer, w / factor, h / factor, SDL_LOGICAL_PRESENTATION_LETTERBOX, - SDL_ScaleModeNearest); + SDL_SCALEMODE_NEAREST); SDLTest_AssertCheck(ret == 0, "Validate result from SDL_SetRenderLogicalSize, expected: 0, got: %i", ret); viewport.x = (TESTRENDER_SCREEN_W / 4) / factor; viewport.y = (TESTRENDER_SCREEN_H / 4) / factor; @@ -938,7 +938,7 @@ int render_testLogicalSize(void *arg) (void)SDL_RenderPresent(renderer); ret = SDL_SetRenderLogicalPresentation(renderer, 0, 0, SDL_LOGICAL_PRESENTATION_DISABLED, - SDL_ScaleModeNearest); + SDL_SCALEMODE_NEAREST); SDLTest_AssertCheck(ret == 0, "Validate result from SDL_SetRenderLogicalSize, expected: 0, got: %i", ret); /* Check to see if final image matches. */ @@ -969,7 +969,7 @@ int render_testLogicalSize(void *arg) w - 2 * (TESTRENDER_SCREEN_W / 4), h, SDL_LOGICAL_PRESENTATION_LETTERBOX, - SDL_ScaleModeLinear); + SDL_SCALEMODE_LINEAR); SDLTest_AssertCheck(ret == 0, "Validate result from SDL_SetRenderLogicalSize, expected: 0, got: %i", ret); ret = SDL_SetRenderDrawColor(renderer, 0, 255, 0, SDL_ALPHA_OPAQUE); SDLTest_AssertCheck(ret == 0, "Validate result from SDL_SetRenderDrawColor, expected: 0, got: %i", ret); @@ -978,7 +978,7 @@ int render_testLogicalSize(void *arg) (void)SDL_RenderPresent(renderer); ret = SDL_SetRenderLogicalPresentation(renderer, 0, 0, SDL_LOGICAL_PRESENTATION_DISABLED, - SDL_ScaleModeNearest); + SDL_SCALEMODE_NEAREST); SDLTest_AssertCheck(ret == 0, "Validate result from SDL_SetRenderLogicalSize, expected: 0, got: %i", ret); /* Check to see if final image matches. */ diff --git a/test/testgamepad.c b/test/testgamepad.c index 2c9ae7603..1e24565e9 100644 --- a/test/testgamepad.c +++ b/test/testgamepad.c @@ -913,7 +913,7 @@ int main(int argc, char *argv[]) /* scale for platforms that don't give you the window size you asked for. */ SDL_SetRenderLogicalPresentation(screen, SCREEN_WIDTH, SCREEN_HEIGHT, SDL_LOGICAL_PRESENTATION_LETTERBOX, - SDL_ScaleModeLinear); + SDL_SCALEMODE_LINEAR); background_front = LoadTexture(screen, "gamepadmap.bmp", SDL_FALSE, NULL, NULL); background_back = LoadTexture(screen, "gamepadmap_back.bmp", SDL_FALSE, NULL, NULL);