From 2446baf7184ea353d71e520e278c56eaa5e5e439 Mon Sep 17 00:00:00 2001 From: onpon4 Date: Sun, 5 Feb 2017 17:25:17 -0500 Subject: [PATCH] Cause scaling to always be square. --- src/gfx.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/gfx.cpp b/src/gfx.cpp index 1e09d5b..f1664f2 100644 --- a/src/gfx.cpp +++ b/src/gfx.cpp @@ -490,6 +490,7 @@ void gfx_free() void gfx_loadBackground(const char *filename) { SDL_Surface *new_bg; + double scale; if (gfx_background != NULL) { @@ -498,7 +499,8 @@ void gfx_loadBackground(const char *filename) } new_bg = gfx_loadImage(filename); SDL_SetColorKey(new_bg, 0, 0); - gfx_background = zoomSurface(new_bg, (double)screen->w / new_bg->w, (double)screen->h / new_bg->h, 0); + scale = MAX((double)screen->w / new_bg->w, (double)screen->h / new_bg->h); + gfx_background = zoomSurface(new_bg, scale, scale, 0); SDL_FreeSurface(new_bg); }