From 3db2099635973a7c5ac90f7782eeb9b57c2ba426 Mon Sep 17 00:00:00 2001 From: Bob Polis Date: Mon, 1 Feb 2021 10:50:40 +0100 Subject: [PATCH] Setting image no longer resizes window It caused bugs in more general cases. You should resize the window from app code when necessary. --- src/Window.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/Window.cpp b/src/Window.cpp index 9447945..eede1b7 100644 --- a/src/Window.cpp +++ b/src/Window.cpp @@ -118,7 +118,7 @@ void Window::update() { void Window::show_image(const Image& image) { // create texture from surface _t.reset(SDL_CreateTextureFromSurface(_r.get(), image.surface())); - +/* // get screen size, to scale down if image is too big int w {image.width()}; int h {image.height()}; @@ -136,7 +136,12 @@ void Window::show_image(const Image& image) { h = static_cast(round(w / image_ratio)); } } - set_size(w, h); + int ww, wh; + SDL_GetWindowSize(_w.get(), &ww, &wh); + if (ww != w || wh != h) { + set_size(w, h); + } + */ } void Window::add_event_handler(WindowEventHandler handler, SDL_WindowEventID type) {