Date: | 2013-01-31 08:03:31 (10 years 8 months ago) |
---|---|
Author: | Werner Almesberger |
Commit: | f26fd3564a2664fe3deea5b86bd46e8dad8209ac |
Message: | ubb-la/gui.c (show_map): keep view rectangle size constant Before, we had rounding effects that could make the rectangle width vary by one pixel, depending on position. |
Files: |
ubb-la/gui.c (2 diffs) |
Change Details
ubb-la/gui.c | ||
---|---|---|
177 | 177 | int w = nibbles-skip; |
178 | 178 | int m = (nibbles+skip) >> 1; |
179 | 179 | int scale = 0; |
180 | int x0, x1; | |
180 | 181 | |
181 | 182 | while (w >= XWIDTH/2) { |
182 | 183 | w >>= 1; |
... | ... | |
184 | 185 | } |
185 | 186 | boxColor(surf, XCENTER-(w >> 1), MAP_BUF_Y0, |
186 | 187 | XCENTER+(w >> 1), MAP_BUF_Y1, MAP_BUF_RGBA); |
187 | rectangleColor(surf, (s0-m+(XCENTER << scale)) >> scale, MAP_VIEW_Y0, | |
188 | (s1-m+(XCENTER << scale)) >> scale, MAP_VIEW_Y1, MAP_VIEW_RGBA); | |
188 | x0 = (s0-m+(XCENTER << scale)) >> scale; | |
189 | x1 = x0+((s1-s0) >> scale); | |
190 | rectangleColor(surf, x0, MAP_VIEW_Y0, x1, MAP_VIEW_Y1, MAP_VIEW_RGBA); | |
189 | 191 | } |
190 | 192 | |
191 | 193 |
Branches:
master