Skip to content

Commit

Permalink
Merge pull request #316 from cbeck88/fixup_graphics
Browse files Browse the repository at this point in the history
when zooming in, use scale_surface_sharp for units, terrain (1.12 branch)
  • Loading branch information
cbeck88 committed Nov 6, 2014
2 parents 9aec23d + f500d53 commit 2a0a319
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions src/image.cpp
Expand Up @@ -731,7 +731,12 @@ static surface get_hexed(const locator& i_locator)
static surface get_scaled_to_hex(const locator& i_locator)
{
surface img = get_image(i_locator, HEXED);
return scale_surface(img, zoom, zoom);

if (zoom < tile_size) {
return scale_surface(img, zoom, zoom);
} else {
return scale_surface_sharp(img, zoom, zoom);
}
}

static surface get_tod_colored(const locator& i_locator)
Expand All @@ -748,7 +753,11 @@ static surface get_scaled_to_zoom(const locator& i_locator)
surface res(get_image(i_locator, UNSCALED));
// For some reason haloes seems to have invalid images, protect against crashing
if(!res.null()) {
return scale_surface(res, ((res.get()->w * zoom) / tile_size), ((res.get()->h * zoom) / tile_size));
if (zoom < tile_size) {
return scale_surface(res, ((res.get()->w * zoom) / tile_size), ((res.get()->h * zoom) / tile_size));
} else {
return scale_surface_sharp(res, ((res.get()->w * zoom) / tile_size), ((res.get()->h * zoom) / tile_size));
}
} else {
return surface(NULL);
}
Expand Down

0 comments on commit 2a0a319

Please sign in to comment.