summaryrefslogtreecommitdiff
path: root/src/object_gui.cpp
diff options
context:
space:
mode:
authorfrosch <frosch@openttd.org>2015-02-01 20:54:24 +0000
committerfrosch <frosch@openttd.org>2015-02-01 20:54:24 +0000
commita8080b62563dcb9f3e3bf5180ebf2de6cf6b68ae (patch)
tree3ac628ab264823257073f281ce7e692f07e5c651 /src/object_gui.cpp
parent3bc7ee3ab731c7a855f811b36356ed907b42989a (diff)
downloadopenttd-a8080b62563dcb9f3e3bf5180ebf2de6cf6b68ae.tar.xz
(svn r27134) -Codechange: Simplify GUI scaling by adding UnScaleGUI() and ScaleGUITrad().
Diffstat (limited to 'src/object_gui.cpp')
-rw-r--r--src/object_gui.cpp20
1 files changed, 10 insertions, 10 deletions
diff --git a/src/object_gui.cpp b/src/object_gui.cpp
index 0ad74b081..25856c172 100644
--- a/src/object_gui.cpp
+++ b/src/object_gui.cpp
@@ -165,8 +165,8 @@ public:
/* Determine the pixel heights. */
for (size_t i = 0; i < lengthof(height); i++) {
- height[i] *= UnScaleByZoom(4 * TILE_HEIGHT, ZOOM_LVL_GUI);
- height[i] += UnScaleByZoom(4 * TILE_PIXELS, ZOOM_LVL_GUI) + 2 * OBJECT_MARGIN;
+ height[i] *= ScaleGUITrad(TILE_HEIGHT);
+ height[i] += ScaleGUITrad(TILE_PIXELS) + 2 * OBJECT_MARGIN;
}
/* Now determine the size of the minimum widgets. When there are two columns, then
@@ -175,9 +175,9 @@ public:
* of widgets, or just the twice the widget height of the two row ones. */
size->height = max(height[0], height[1] * 2 + 2);
if (two_wide) {
- size->width = (3 * UnScaleByZoom(4 * TILE_PIXELS, ZOOM_LVL_GUI) + 2 * OBJECT_MARGIN) * 2 + 2;
+ size->width = (3 * ScaleGUITrad(TILE_PIXELS) + 2 * OBJECT_MARGIN) * 2 + 2;
} else {
- size->width = 4 * UnScaleByZoom(4 * TILE_PIXELS, ZOOM_LVL_GUI) + 2 * OBJECT_MARGIN;
+ size->width = 4 * ScaleGUITrad(TILE_PIXELS) + 2 * OBJECT_MARGIN;
}
/* Get the right size for the single widget based on the current spec. */
@@ -199,8 +199,8 @@ public:
break;
case WID_BO_SELECT_IMAGE:
- size->width = UnScaleByZoom(4 * 64, ZOOM_LVL_GUI) + 2;
- size->height = UnScaleByZoom(4 * 58, ZOOM_LVL_GUI) + 2;
+ size->width = ScaleGUITrad(64) + 2;
+ size->height = ScaleGUITrad(58) + 2;
break;
default: break;
@@ -243,9 +243,9 @@ public:
if (spec->grf_prop.grffile == NULL) {
extern const DrawTileSprites _objects[];
const DrawTileSprites *dts = &_objects[spec->grf_prop.local_id];
- DrawOrigTileSeqInGUI((r.right - r.left) / 2 - 1, (r.bottom - r.top + matrix_height / 2) / 2 - OBJECT_MARGIN - UnScaleByZoom(4 * TILE_PIXELS, ZOOM_LVL_GUI), dts, PAL_NONE);
+ DrawOrigTileSeqInGUI((r.right - r.left) / 2 - 1, (r.bottom - r.top + matrix_height / 2) / 2 - OBJECT_MARGIN - ScaleGUITrad(TILE_PIXELS), dts, PAL_NONE);
} else {
- DrawNewObjectTileInGUI((r.right - r.left) / 2 - 1, (r.bottom - r.top + matrix_height / 2) / 2 - OBJECT_MARGIN - UnScaleByZoom(4 * TILE_PIXELS, ZOOM_LVL_GUI), spec, GB(widget, 16, 16));
+ DrawNewObjectTileInGUI((r.right - r.left) / 2 - 1, (r.bottom - r.top + matrix_height / 2) / 2 - OBJECT_MARGIN - ScaleGUITrad(TILE_PIXELS), spec, GB(widget, 16, 16));
}
_cur_dpi = old_dpi;
}
@@ -270,9 +270,9 @@ public:
if (spec->grf_prop.grffile == NULL) {
extern const DrawTileSprites _objects[];
const DrawTileSprites *dts = &_objects[spec->grf_prop.local_id];
- DrawOrigTileSeqInGUI((r.right - r.left) / 2 - 1, r.bottom - r.top - OBJECT_MARGIN - UnScaleByZoom(4 * TILE_PIXELS, ZOOM_LVL_GUI), dts, PAL_NONE);
+ DrawOrigTileSeqInGUI((r.right - r.left) / 2 - 1, r.bottom - r.top - OBJECT_MARGIN - ScaleGUITrad(TILE_PIXELS), dts, PAL_NONE);
} else {
- DrawNewObjectTileInGUI((r.right - r.left) / 2 - 1, r.bottom - r.top - OBJECT_MARGIN - UnScaleByZoom(4 * TILE_PIXELS, ZOOM_LVL_GUI), spec,
+ DrawNewObjectTileInGUI((r.right - r.left) / 2 - 1, r.bottom - r.top - OBJECT_MARGIN - ScaleGUITrad(TILE_PIXELS), spec,
min(_selected_object_view, spec->views - 1));
}
_cur_dpi = old_dpi;