diff options
author | frosch <frosch@openttd.org> | 2015-02-01 20:54:24 +0000 |
---|---|---|
committer | frosch <frosch@openttd.org> | 2015-02-01 20:54:24 +0000 |
commit | a8080b62563dcb9f3e3bf5180ebf2de6cf6b68ae (patch) | |
tree | 3ac628ab264823257073f281ce7e692f07e5c651 /src/newgrf_debug_gui.cpp | |
parent | 3bc7ee3ab731c7a855f811b36356ed907b42989a (diff) | |
download | openttd-a8080b62563dcb9f3e3bf5180ebf2de6cf6b68ae.tar.xz |
(svn r27134) -Codechange: Simplify GUI scaling by adding UnScaleGUI() and ScaleGUITrad().
Diffstat (limited to 'src/newgrf_debug_gui.cpp')
-rw-r--r-- | src/newgrf_debug_gui.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/newgrf_debug_gui.cpp b/src/newgrf_debug_gui.cpp index 82c7a7d22..4831b691a 100644 --- a/src/newgrf_debug_gui.cpp +++ b/src/newgrf_debug_gui.cpp @@ -858,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 - 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; + int x = r.left - UnScaleGUI(spr->x_offs) + (width - UnScaleGUI(spr->width) ) / 2; + int y = r.top - UnScaleGUI(spr->y_offs) + (height - UnScaleGUI(spr->height)) / 2; /* And draw only the part within the sprite area */ SubSprite subspr = { - 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, + spr->x_offs + (spr->width - UnScaleGUI(width) ) / 2 + 1, + spr->y_offs + (spr->height - UnScaleGUI(height)) / 2 + 1, + spr->x_offs + (spr->width + UnScaleGUI(width) ) / 2 - 1, + spr->y_offs + (spr->height + UnScaleGUI(height)) / 2 - 1, }; DrawSprite(this->current_sprite, PAL_NONE, x, y, &subspr, ZOOM_LVL_GUI); |