Fixed bug 4134 - Render targets lose scale quality after minimizing a fullscreen window

Olli-Samuli Lehmus

If one creates a window with the SDL_WINDOW_FULLSCREEN_DESKTOP flag, and creates a render target with SDL_SetHint(SDL_HINT_RENDER_SCALE_QUALITY, "linear"), and afterwards sets SDL_SetHint(SDL_HINT_RENDER_SCALE_QUALITY, "nearest"), after minimizing the window, the scale quality hint is lost on the render target. Textures however do keep their interpolation modes.
This commit is contained in:
Sam Lantinga 2018-05-07 19:52:25 -07:00
parent 31a9517639
commit 40f5b81553
10 changed files with 32 additions and 92 deletions

View file

@ -1161,17 +1161,6 @@ D3D11_SupportsBlendMode(SDL_Renderer * renderer, SDL_BlendMode blendMode)
return SDL_TRUE;
}
static D3D11_FILTER
GetScaleQuality(void)
{
const char *hint = SDL_GetHint(SDL_HINT_RENDER_SCALE_QUALITY);
if (!hint || *hint == '0' || SDL_strcasecmp(hint, "nearest") == 0) {
return D3D11_FILTER_MIN_MAG_MIP_POINT;
} else /* if (*hint == '1' || SDL_strcasecmp(hint, "linear") == 0) */ {
return D3D11_FILTER_MIN_MAG_MIP_LINEAR;
}
}
static int
D3D11_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture)
{
@ -1192,7 +1181,7 @@ D3D11_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture)
SDL_OutOfMemory();
return -1;
}
textureData->scaleMode = GetScaleQuality();
textureData->scaleMode = (texture->scaleMode == SDL_ScaleModeNearest) ? D3D11_FILTER_MIN_MAG_MIP_POINT : D3D11_FILTER_MIN_MAG_MIP_LINEAR;
texture->driverdata = textureData;