Mercurial > hg > openttd
changeset 6831:bfec3bac46a7 draft
(svn r10070) -Fix: fix the rounding problem of zoom-levels in zoom.hpp, so it is global for every call
author | truelight <truelight@openttd.org> |
---|---|
date | Fri, 08 Jun 2007 18:45:14 +0000 |
parents | 8a349f3bf427 |
children | 17319fb8c1c3 |
files | src/gfx.cpp src/zoom.hpp |
diffstat | 2 files changed, 3 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/src/gfx.cpp +++ b/src/gfx.cpp @@ -856,7 +856,7 @@ if (num <= 0) continue; } - num = UnScaleByZoom(num + ScaleByZoom(1, Tzoom) - 1, Tzoom); + num = UnScaleByZoom(num, Tzoom); switch (Tmode) { case BM_COLOUR_REMAP:
--- a/src/zoom.hpp +++ b/src/zoom.hpp @@ -37,14 +37,14 @@ { if (zoom == ZOOM_LVL_NORMAL) return value; int izoom = (int)zoom - (int)ZOOM_LVL_NORMAL; - return (zoom > ZOOM_LVL_NORMAL) ? value << izoom : value >> -izoom; + return (zoom > ZOOM_LVL_NORMAL) ? value << izoom : (value + (1 << -izoom)) >> -izoom; } static inline int UnScaleByZoom(int value, ZoomLevel zoom) { if (zoom == ZOOM_LVL_NORMAL) return value; int izoom = (int)zoom - (int)ZOOM_LVL_NORMAL; - return (zoom > ZOOM_LVL_NORMAL) ? value >> izoom : value << -izoom; + return (zoom > ZOOM_LVL_NORMAL) ? (value + (1 << izoom) - 1) >> izoom : value << -izoom; } #endif /* ZOOM_HPP */