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.
This commit is contained in:
Sam Lantinga 2024-02-11 19:07:07 -08:00
parent 20051f805f
commit 2f7c24e4be
6 changed files with 5 additions and 33 deletions

View file

@ -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: The following hints have been removed:
* SDL_HINT_ACCELEROMETER_AS_JOYSTICK * SDL_HINT_ACCELEROMETER_AS_JOYSTICK
* SDL_HINT_GAMECONTROLLER_USE_BUTTON_LABELS - gamepad buttons are always positional * 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_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_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_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_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_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_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_OPENGL - replaced with the "opengl" property in SDL_CreateWindowWithProperties()
* SDL_HINT_VIDEO_FOREIGN_WINDOW_VULKAN - replaced with the "vulkan" property in SDL_CreateWindowWithProperties() * SDL_HINT_VIDEO_FOREIGN_WINDOW_VULKAN - replaced with the "vulkan" property in SDL_CreateWindowWithProperties()

View file

@ -1776,18 +1776,6 @@ extern "C" {
*/ */
#define SDL_HINT_RENDER_PS2_DYNAMIC_VSYNC "SDL_RENDER_PS2_DYNAMIC_VSYNC" #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. * A variable controlling whether updates to the SDL screen surface should be synchronized with the vertical refresh, to avoid tearing.
* *

View file

@ -913,6 +913,8 @@ extern DECLSPEC int SDLCALL SDL_GetTextureBlendMode(SDL_Texture *texture, SDL_Bl
/** /**
* Set the scale mode used for texture scale operations. * 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. * If the scale mode is not supported, the closest supported mode is chosen.
* *
* \param texture The texture to update. * \param texture The texture to update.

View file

@ -1206,21 +1206,6 @@ static Uint32 GetClosestSupportedFormat(SDL_Renderer *renderer, Uint32 format)
return renderer->info.texture_formats[0]; 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 *SDL_CreateTextureWithProperties(SDL_Renderer *renderer, SDL_PropertiesID props)
{ {
SDL_Texture *texture; SDL_Texture *texture;
@ -1272,7 +1257,7 @@ SDL_Texture *SDL_CreateTextureWithProperties(SDL_Renderer *renderer, SDL_Propert
texture->color.g = 1.0f; texture->color.g = 1.0f;
texture->color.b = 1.0f; texture->color.b = 1.0f;
texture->color.a = 1.0f; texture->color.a = 1.0f;
texture->scaleMode = SDL_GetScaleMode(); texture->scaleMode = SDL_SCALEMODE_LINEAR;
texture->view.pixel_w = w; texture->view.pixel_w = w;
texture->view.pixel_h = h; texture->view.pixel_h = h;
texture->view.viewport.w = -1; texture->view.viewport.w = -1;

View file

@ -16,7 +16,6 @@ static const char *HintsEnum[] = {
SDL_HINT_ORIENTATIONS, SDL_HINT_ORIENTATIONS,
SDL_HINT_RENDER_DIRECT3D_THREADSAFE, SDL_HINT_RENDER_DIRECT3D_THREADSAFE,
SDL_HINT_RENDER_DRIVER, SDL_HINT_RENDER_DRIVER,
SDL_HINT_RENDER_SCALE_QUALITY,
SDL_HINT_RENDER_VSYNC, SDL_HINT_RENDER_VSYNC,
SDL_HINT_TIMER_RESOLUTION, SDL_HINT_TIMER_RESOLUTION,
SDL_HINT_VIDEO_ALLOW_SCREENSAVER, SDL_HINT_VIDEO_ALLOW_SCREENSAVER,
@ -36,7 +35,6 @@ static const char *HintsVerbose[] = {
"SDL_ORIENTATIONS", "SDL_ORIENTATIONS",
"SDL_RENDER_DIRECT3D_THREADSAFE", "SDL_RENDER_DIRECT3D_THREADSAFE",
"SDL_RENDER_DRIVER", "SDL_RENDER_DRIVER",
"SDL_RENDER_SCALE_QUALITY",
"SDL_RENDER_VSYNC", "SDL_RENDER_VSYNC",
"SDL_TIMER_RESOLUTION", "SDL_TIMER_RESOLUTION",
"SDL_VIDEO_ALLOW_SCREENSAVER", "SDL_VIDEO_ALLOW_SCREENSAVER",

View file

@ -509,8 +509,6 @@ int main(int argc, char *argv[])
return 1; return 1;
} }
SDL_SetHint(SDL_HINT_RENDER_SCALE_QUALITY, "2");
state->window_title = "Pressure-Sensitive Pen Test"; state->window_title = "Pressure-Sensitive Pen Test";
state->window_w = WIDTH; state->window_w = WIDTH;
state->window_h = HEIGHT; state->window_h = HEIGHT;