From 02c2827bc07a000910cec4fc52f2006921d11d35 Mon Sep 17 00:00:00 2001 From: Michael Martin Date: Sat, 28 Sep 2019 22:16:23 -0700 Subject: [PATCH] Properly set SDL2 texture scaling hints --- sc2/src/libs/graphics/sdl/sdl2_pure.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/sc2/src/libs/graphics/sdl/sdl2_pure.c b/sc2/src/libs/graphics/sdl/sdl2_pure.c index aa2866d93..4039fa295 100644 --- a/sc2/src/libs/graphics/sdl/sdl2_pure.c +++ b/sc2/src/libs/graphics/sdl/sdl2_pure.c @@ -169,6 +169,17 @@ TFB_Pure_ConfigureVideo (int driver, int flags, int width, int height, int toggl } } + if (GfxFlags & TFB_GFXFLAGS_SCALE_ANY) + { + /* Linear scaling */ + SDL_SetHint(SDL_HINT_RENDER_SCALE_QUALITY, "1"); + } + else + { + /* Nearest-neighbor scaling */ + SDL_SetHint(SDL_HINT_RENDER_SCALE_QUALITY, "0"); + } + if (GfxFlags & TFB_GFXFLAGS_SCALE_SOFT_ONLY) { for (i = 0; i < TFB_GFX_NUMSCREENS; i++) @@ -221,8 +232,7 @@ TFB_Pure_ConfigureVideo (int driver, int flags, int width, int height, int toggl /* We succeeded, so alter the screen size to our new sizes */ ScreenWidthActual = width; ScreenHeightActual = height; - /* TODO: Set bilinear vs nearest-neighbor filtering based on - * GfxFlags & TFB_GFXFLAGS_SCALE_ANY */ + return 0; }