summaryrefslogtreecommitdiff
path: root/src/newgrf_debug_gui.cpp
diff options
context:
space:
mode:
authorpeter1138 <peter1138@openttd.org>2014-09-30 11:29:23 +0000
committerpeter1138 <peter1138@openttd.org>2014-09-30 11:29:23 +0000
commit1273ca8e8d8729ce3dce89fb52e1fdc1f9fb4f33 (patch)
treee28ed625725f970d42eee207b3a1712564a09490 /src/newgrf_debug_gui.cpp
parent8385e6268e28a875157560313d308e8302626699 (diff)
downloadopenttd-1273ca8e8d8729ce3dce89fb52e1fdc1f9fb4f33.tar.xz
(svn r26941) -Codechange: Make NewGRF sprite aligner work with GUI size.
Diffstat (limited to 'src/newgrf_debug_gui.cpp')
-rw-r--r--src/newgrf_debug_gui.cpp13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/newgrf_debug_gui.cpp b/src/newgrf_debug_gui.cpp
index 6d5312514..987e1cf15 100644
--- a/src/newgrf_debug_gui.cpp
+++ b/src/newgrf_debug_gui.cpp
@@ -19,6 +19,7 @@
#include "strings_func.h"
#include "textbuf_gui.h"
#include "vehicle_gui.h"
+#include "zoom_func.h"
#include "engine_base.h"
#include "industry.h"
@@ -857,15 +858,15 @@ struct SpriteAlignerWindow : Window {
const Sprite *spr = GetSprite(this->current_sprite, ST_NORMAL);
int width = r.right - r.left + 1;
int height = r.bottom - r.top + 1;
- int x = r.left - spr->x_offs / ZOOM_LVL_BASE + (width - spr->width / ZOOM_LVL_BASE) / 2;
- int y = r.top - spr->y_offs / ZOOM_LVL_BASE + (height - spr->height / ZOOM_LVL_BASE) / 2;
+ int x = r.left - UnScaleByZoom(spr->x_offs, ZOOM_LVL_GUI) + (width - UnScaleByZoom(spr->width, ZOOM_LVL_GUI)) / 2;
+ int y = r.top - UnScaleByZoom(spr->y_offs, ZOOM_LVL_GUI) + (height - UnScaleByZoom(spr->height, ZOOM_LVL_GUI)) / 2;
/* And draw only the part within the sprite area */
SubSprite subspr = {
- spr->x_offs + (spr->width - width * ZOOM_LVL_BASE) / 2 + 1,
- spr->y_offs + (spr->height - height * ZOOM_LVL_BASE) / 2 + 1,
- spr->x_offs + (spr->width + width * ZOOM_LVL_BASE) / 2 - 1,
- spr->y_offs + (spr->height + height * ZOOM_LVL_BASE) / 2 - 1,
+ spr->x_offs + (spr->width - ScaleByZoom(width, ZOOM_LVL_GUI)) / 2 + 1,
+ spr->y_offs + (spr->height - ScaleByZoom(height, ZOOM_LVL_GUI)) / 2 + 1,
+ spr->x_offs + (spr->width + ScaleByZoom(width, ZOOM_LVL_GUI)) / 2 - 1,
+ spr->y_offs + (spr->height + ScaleByZoom(height, ZOOM_LVL_GUI)) / 2 - 1,
};
DrawSprite(this->current_sprite, PAL_NONE, x, y, &subspr, ZOOM_LVL_GUI);