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/zoom_func.h | |
parent | 3bc7ee3ab731c7a855f811b36356ed907b42989a (diff) | |
download | openttd-a8080b62563dcb9f3e3bf5180ebf2de6cf6b68ae.tar.xz |
(svn r27134) -Codechange: Simplify GUI scaling by adding UnScaleGUI() and ScaleGUITrad().
Diffstat (limited to 'src/zoom_func.h')
-rw-r--r-- | src/zoom_func.h | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/zoom_func.h b/src/zoom_func.h index 5f1bf830d..1cb3d0c48 100644 --- a/src/zoom_func.h +++ b/src/zoom_func.h @@ -64,4 +64,24 @@ static inline int UnScaleByZoomLower(int value, ZoomLevel zoom) return value >> zoom; } +/** + * Short-hand to apply GUI zoom level. + * @param value Pixel amount at #ZOOM_LVL_BEGIN (full zoom in). + * @return value Pixel amount at #ZOOM_LVL_GUI. + */ +static inline int UnScaleGUI(int value) +{ + return UnScaleByZoom(value, ZOOM_LVL_GUI); +} + +/** + * Scale traditional pixel dimensions to GUI zoom level. + * @param value Pixel amount at 1x zoom level. + * @return value Pixel amount at #ZOOM_LVL_GUI. + */ +static inline int ScaleGUITrad(int value) +{ + return UnScaleGUI(value * ZOOM_LVL_BASE); +} + #endif /* ZOOM_FUNC_H */ |