diff --git a/src/main.cpp b/src/main.cpp index 836d4fd2..e8662dc9 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -44,7 +44,8 @@ #include "pandora_gfx.h" SDL_Window* sdlWindow; SDL_Renderer* renderer; -SDL_Texture *texture; +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]) { diff --git a/src/osdep/pandora_gfx.cpp b/src/osdep/pandora_gfx.cpp index 402294b1..7ce17083 100644 --- a/src/osdep/pandora_gfx.cpp +++ b/src/osdep/pandora_gfx.cpp @@ -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; - SDL_SetHint(SDL_HINT_RENDER_SCALE_QUALITY, "nearest"); + if (isModeAspectRatioExact(&sdlMode)) + SDL_SetHint(SDL_HINT_RENDER_SCALE_QUALITY, "nearest"); + else + SDL_SetHint(SDL_HINT_RENDER_SCALE_QUALITY, "linear"); } graphics_subshutdown(); diff --git a/src/osdep/pandora_gfx.h b/src/osdep/pandora_gfx.h index 27389170..896dfb69 100644 --- a/src/osdep/pandora_gfx.h +++ b/src/osdep/pandora_gfx.h @@ -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