From 2f7c24e4be97d154aac7db82d425c504882fecaa Mon Sep 17 00:00:00 2001
From: Sam Lantinga <[EMAIL REDACTED]>
Date: Sun, 11 Feb 2024 19:07:07 -0800
Subject: [PATCH] Removed SDL_HINT_RENDER_SCALE_QUALITY
Textures now default to linear filtering, use SDL_SetTextureScaleMode(texture, SDL_SCALEMODE_NEAREST) if you want nearest pixel mode instead.
---
docs/README-migration.md | 3 ++-
include/SDL3/SDL_hints.h | 12 ------------
include/SDL3/SDL_render.h | 2 ++
src/render/SDL_render.c | 17 +----------------
test/testautomation_hints.c | 2 --
test/testpen.c | 2 --
6 files changed, 5 insertions(+), 33 deletions(-)
diff --git a/docs/README-migration.md b/docs/README-migration.md
index d840418c475c..50ddd3ec1fb2 100644
--- a/docs/README-migration.md
+++ b/docs/README-migration.md
@@ -705,12 +705,13 @@ Calling SDL_GetHint() with the name of the hint being changed from within a hint
The following hints have been removed:
* SDL_HINT_ACCELEROMETER_AS_JOYSTICK
* SDL_HINT_GAMECONTROLLER_USE_BUTTON_LABELS - gamepad buttons are always positional
-* SDL_HINT_IDLE_TIMER_DISABLED - use SDL_DisableScreenSaver instead
+* SDL_HINT_IDLE_TIMER_DISABLED - use SDL_DisableScreenSaver() instead
* SDL_HINT_IME_SUPPORT_EXTENDED_TEXT - the normal text editing event has extended text
* SDL_HINT_MOUSE_RELATIVE_SCALING - mouse coordinates are no longer automatically scaled by the SDL renderer
* SDL_HINT_RENDER_BATCHING - Render batching is always enabled, apps should call SDL_FlushRenderer() before calling into a lower-level graphics API.
* SDL_HINT_RENDER_LOGICAL_SIZE_MODE - the logical size mode is explicitly set with SDL_SetRenderLogicalPresentation()
* SDL_HINT_RENDER_OPENGL_SHADERS - shaders are always used if they are available
+* SDL_HINT_RENDER_SCALE_QUALITY - textures now default to linear filtering, use SDL_SetTextureScaleMode(texture, SDL_SCALEMODE_NEAREST) if you want nearest pixel mode instead
* SDL_HINT_THREAD_STACK_SIZE - the stack size can be specified using SDL_CreateThreadWithStackSize()
* SDL_HINT_VIDEO_FOREIGN_WINDOW_OPENGL - replaced with the "opengl" property in SDL_CreateWindowWithProperties()
* SDL_HINT_VIDEO_FOREIGN_WINDOW_VULKAN - replaced with the "vulkan" property in SDL_CreateWindowWithProperties()
diff --git a/include/SDL3/SDL_hints.h b/include/SDL3/SDL_hints.h
index c2be6743ebd2..b9ed452ee229 100644
--- a/include/SDL3/SDL_hints.h
+++ b/include/SDL3/SDL_hints.h
@@ -1776,18 +1776,6 @@ extern "C" {
*/
#define SDL_HINT_RENDER_PS2_DYNAMIC_VSYNC "SDL_RENDER_PS2_DYNAMIC_VSYNC"
-/**
- * A variable controlling texture scaling quality.
- *
- * The variable can be set to the following values:
- * "0" or "nearest" - Nearest pixel sampling. (default)
- * "1" or "linear" - Linear filtering. (supported by OpenGL and Direct3D)
- * "2" or "best" - Currently this is the same as "linear".
- *
- * This hint should be set before creating a texture.
- */
-#define SDL_HINT_RENDER_SCALE_QUALITY "SDL_RENDER_SCALE_QUALITY"
-
/**
* A variable controlling whether updates to the SDL screen surface should be synchronized with the vertical refresh, to avoid tearing.
*
diff --git a/include/SDL3/SDL_render.h b/include/SDL3/SDL_render.h
index 932fdba6a2be..8d80beee199e 100644
--- a/include/SDL3/SDL_render.h
+++ b/include/SDL3/SDL_render.h
@@ -913,6 +913,8 @@ extern DECLSPEC int SDLCALL SDL_GetTextureBlendMode(SDL_Texture *texture, SDL_Bl
/**
* Set the scale mode used for texture scale operations.
*
+ * The default texture scale mode is SDL_SCALEMODE_LINEAR.
+ *
* If the scale mode is not supported, the closest supported mode is chosen.
*
* \param texture The texture to update.
diff --git a/src/render/SDL_render.c b/src/render/SDL_render.c
index dff4141fb60e..d61c8b0d7e00 100644
--- a/src/render/SDL_render.c
+++ b/src/render/SDL_render.c
@@ -1206,21 +1206,6 @@ static Uint32 GetClosestSupportedFormat(SDL_Renderer *renderer, Uint32 format)
return renderer->info.texture_formats[0];
}
-static SDL_ScaleMode SDL_GetScaleMode(void)
-{
- const char *hint = SDL_GetHint(SDL_HINT_RENDER_SCALE_QUALITY);
-
- if (!hint || SDL_strcasecmp(hint, "nearest") == 0) {
- return SDL_SCALEMODE_NEAREST;
- } else if (SDL_strcasecmp(hint, "linear") == 0) {
- return SDL_SCALEMODE_LINEAR;
- } else if (SDL_strcasecmp(hint, "best") == 0) {
- return SDL_SCALEMODE_BEST;
- } else {
- return (SDL_ScaleMode)SDL_atoi(hint);
- }
-}
-
SDL_Texture *SDL_CreateTextureWithProperties(SDL_Renderer *renderer, SDL_PropertiesID props)
{
SDL_Texture *texture;
@@ -1272,7 +1257,7 @@ SDL_Texture *SDL_CreateTextureWithProperties(SDL_Renderer *renderer, SDL_Propert
texture->color.g = 1.0f;
texture->color.b = 1.0f;
texture->color.a = 1.0f;
- texture->scaleMode = SDL_GetScaleMode();
+ texture->scaleMode = SDL_SCALEMODE_LINEAR;
texture->view.pixel_w = w;
texture->view.pixel_h = h;
texture->view.viewport.w = -1;
diff --git a/test/testautomation_hints.c b/test/testautomation_hints.c
index b7c48f757f94..4e42b6cc5d4d 100644
--- a/test/testautomation_hints.c
+++ b/test/testautomation_hints.c
@@ -16,7 +16,6 @@ static const char *HintsEnum[] = {
SDL_HINT_ORIENTATIONS,
SDL_HINT_RENDER_DIRECT3D_THREADSAFE,
SDL_HINT_RENDER_DRIVER,
- SDL_HINT_RENDER_SCALE_QUALITY,
SDL_HINT_RENDER_VSYNC,
SDL_HINT_TIMER_RESOLUTION,
SDL_HINT_VIDEO_ALLOW_SCREENSAVER,
@@ -36,7 +35,6 @@ static const char *HintsVerbose[] = {
"SDL_ORIENTATIONS",
"SDL_RENDER_DIRECT3D_THREADSAFE",
"SDL_RENDER_DRIVER",
- "SDL_RENDER_SCALE_QUALITY",
"SDL_RENDER_VSYNC",
"SDL_TIMER_RESOLUTION",
"SDL_VIDEO_ALLOW_SCREENSAVER",
diff --git a/test/testpen.c b/test/testpen.c
index be96c20f0af0..87a3f9412c1f 100644
--- a/test/testpen.c
+++ b/test/testpen.c
@@ -509,8 +509,6 @@ int main(int argc, char *argv[])
return 1;
}
- SDL_SetHint(SDL_HINT_RENDER_SCALE_QUALITY, "2");
-
state->window_title = "Pressure-Sensitive Pen Test";
state->window_w = WIDTH;
state->window_h = HEIGHT;