From 3071c388149856552cabdd58c0cad822bbbc7a74 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Boldizs=C3=A1r=20Lipka?= Date: Sat, 19 Jul 2014 11:54:10 +0200 Subject: [PATCH] Fix report images. --- src/display.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/display.cpp b/src/display.cpp index 3162a761ae28..0f8384a43b52 100644 --- a/src/display.cpp +++ b/src/display.cpp @@ -2953,9 +2953,10 @@ image::TYPE display::get_image_type(const map_location& /*loc*/) { #ifdef SDL_GPU void display::draw_image_for_report(sdl::timage& img, SDL_Rect& rect) { - const float scale_factor = std::min(rect.w / img.width(), rect.h / img.height()); - const int xpos = rect.x + (rect.w - img.width() * scale_factor)/2; - const int ypos = rect.y + (rect.h - img.height() * scale_factor)/2; + const float scale_factor = std::min(rect.w / img.base_width(), rect.h / img.base_height()); + img.set_scale(scale_factor, scale_factor); + const int xpos = rect.x + (rect.w - img.width())/2; + const int ypos = rect.y + (rect.h - img.height())/2; screen_.draw_texture(img, xpos, ypos); }