Added function to decide scaling method to use

This commit is contained in:
Dimitris Panokostas 2017-02-22 15:30:49 +01:00
parent 2e49e5c423
commit a34d164691
3 changed files with 21 additions and 2 deletions

View file

@ -45,6 +45,7 @@
SDL_Window* sdlWindow;
SDL_Renderer* renderer;
SDL_Texture* texture;
SDL_DisplayMode sdlMode;
#endif
#ifdef CAPSLOCK_DEBIAN_WORKAROUND
@ -668,6 +669,11 @@ static int real_main2 (int argc, TCHAR **argv)
renderer = SDL_CreateRenderer(sdlWindow, -1, SDL_RENDERER_ACCELERATED | SDL_RENDERER_PRESENTVSYNC);
check_error_sdl(renderer == nullptr, "Unable to create a renderer");
if (SDL_GetWindowDisplayMode(sdlWindow, &sdlMode) != 0)
{
SDL_Log("Could not get information about SDL Mode! SDL_Error: %s\n", SDL_GetError());
}
keyboard_settrans();
if (restart_config[0]) {

View file

@ -73,6 +73,14 @@ void graphics_subshutdown()
}
}
// Check if the requested Amiga resolution can be displayed with the current Screen mode as a direct multiple
// Based on this we make the decision to use Linear (smooth) or Nearest Neighbor (pixelated) scaling
bool isModeAspectRatioExact(SDL_DisplayMode* mode)
{
//TODO: for now, this is hardcoded to false which will cause Linear scaling to be used
return false;
}
static void open_screen(struct uae_prefs* p)
{
int width;
@ -91,7 +99,10 @@ static void open_screen(struct uae_prefs* p)
p->gfx_resolution = p->gfx_size.width > 600 ? 1 : 0;
width = p->gfx_size.width;
height = p->gfx_size.height;
if (isModeAspectRatioExact(&sdlMode))
SDL_SetHint(SDL_HINT_RENDER_SCALE_QUALITY, "nearest");
else
SDL_SetHint(SDL_HINT_RENDER_SCALE_QUALITY, "linear");
}
graphics_subshutdown();

View file

@ -9,5 +9,7 @@ extern SDL_Surface* screen;
extern SDL_Surface* gui_screen;
extern SDL_Texture* gui_texture;
extern SDL_DisplayMode sdlMode;
extern void check_error_sdl(bool check, const char* message);
#endif