Skip to content

Commit

Permalink
Fix report images.
Browse files Browse the repository at this point in the history
  • Loading branch information
lipk committed Jul 21, 2014
1 parent 56b873b commit 3071c38
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/display.cpp
Expand Up @@ -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);
}
Expand Down

0 comments on commit 3071c38

Please sign in to comment.