OpenTTD
Functions
zoom_func.h File Reference

Functions related to zooming. More...

#include "zoom_type.h"

Go to the source code of this file.

Functions

static int ScaleByZoom (int value, ZoomLevel zoom)
 Scale by zoom level, usually shift left (when zoom > ZOOM_LVL_NORMAL) When shifting right, value is rounded up.
static int UnScaleByZoom (int value, ZoomLevel zoom)
 Scale by zoom level, usually shift right (when zoom > ZOOM_LVL_NORMAL) When shifting right, value is rounded up.
static int ScaleByZoomLower (int value, ZoomLevel zoom)
 Scale by zoom level, usually shift left (when zoom > ZOOM_LVL_NORMAL)
static int UnScaleByZoomLower (int value, ZoomLevel zoom)
 Scale by zoom level, usually shift right (when zoom > ZOOM_LVL_NORMAL)
static int UnScaleGUI (int value)
 Short-hand to apply GUI zoom level.
static int ScaleGUITrad (int value)
 Scale traditional pixel dimensions to GUI zoom level.

Detailed Description

Functions related to zooming.

Definition in file zoom_func.h.

Function Documentation

static int ScaleByZoom ( int  value,
ZoomLevel  zoom 
)
inlinestatic

Scale by zoom level, usually shift left (when zoom > ZOOM_LVL_NORMAL) When shifting right, value is rounded up.

Parameters
valuevalue to shift
zoomzoom level to shift to
Returns
shifted value

Definition at line 24 of file zoom_func.h.

Referenced by CheckClickOnVehicle(), CheckClickOnViewportSign(), Blitter_8bppSimple::Draw(), Blitter_32bppSimple::Draw(), GfxBlitter(), HandleAutoscroll(), InitializeWindowViewport(), LargeWorldCallback(), ViewportSign::MarkDirty(), ExtraViewportWindow::OnScroll(), MainWindow::OnScroll(), TranslateXYToTileCoord(), NWidgetViewport::UpdateViewportCoordinates(), ViewportAddString(), and ViewportDrawChk().

static int ScaleByZoomLower ( int  value,
ZoomLevel  zoom 
)
inlinestatic

Scale by zoom level, usually shift left (when zoom > ZOOM_LVL_NORMAL)

Parameters
valuevalue to shift
zoomzoom level to shift to
Returns
shifted value

Definition at line 49 of file zoom_func.h.

static int ScaleGUITrad ( int  value)
inlinestatic

Scale traditional pixel dimensions to GUI zoom level.

Parameters
valuePixel amount at #ZOOM_LVL_BASE (traditional "normal" interface size).
Returns
Pixel amount at #ZOOM_LVL_GUI (current interface size).

Definition at line 82 of file zoom_func.h.

References UnScaleGUI().

Referenced by DrawAircraftImage(), DrawCargoIcons(), DrawCommonTileSeqInGUI(), DrawRoadVehDetails(), DrawRoadVehImage(), DrawShipImage(), DrawTrainDetails(), DrawTrainImage(), DepotWindow::DrawVehicleInDepot(), BaseVehicleListWindow::DrawVehicleListItems(), BuildObjectWindow::DrawWidget(), ScenarioEditorLandscapeGenerationWindow::DrawWidget(), RefitWindow::DrawWidget(), BuildRoadDepotWindow::DrawWidget(), BuildRoadStationWindow::DrawWidget(), BuildRailStationWindow::DrawWidget(), BuildRailDepotWindow::DrawWidget(), BuildRailWaypointWindow::DrawWidget(), WindowDesc::GetDefaultHeight(), WindowDesc::GetDefaultWidth(), RoadVehicle::GetDisplayImageWidth(), Train::GetDisplayImageWidth(), SpriteFontCache::GetGlyphWidth(), SpriteFontCache::GetHeight(), VehicleDetailsWindow::GetRoadVehDetailsHeight(), GetTrainSpriteSize(), GetVehicleListHeight(), HighlightDragPosition(), BuildDocksDepotWindow::OnPaint(), DepotWindow::OnPaint(), BuildObjectWindow::UpdateWidgetSize(), BuildDocksDepotWindow::UpdateWidgetSize(), ScenarioEditorLandscapeGenerationWindow::UpdateWidgetSize(), DepotWindow::UpdateWidgetSize(), RefitWindow::UpdateWidgetSize(), TooltipsWindow::UpdateWidgetSize(), BuildRoadDepotWindow::UpdateWidgetSize(), BuildRoadStationWindow::UpdateWidgetSize(), BuildRailStationWindow::UpdateWidgetSize(), BuildRailDepotWindow::UpdateWidgetSize(), BuildRailWaypointWindow::UpdateWidgetSize(), and VehicleDetailsWindow::UpdateWidgetSize().

static int UnScaleByZoom ( int  value,
ZoomLevel  zoom 
)
inlinestatic

Scale by zoom level, usually shift right (when zoom > ZOOM_LVL_NORMAL) When shifting right, value is rounded up.

Parameters
valuevalue to shift
zoomzoom level to shift to
Returns
shifted value

Definition at line 37 of file zoom_func.h.

Referenced by GetSpriteSize(), GfxBlitter(), MarkViewportDirty(), ErrmsgWindow::OnInitialPosition(), SetupScreenshotViewport(), UnScaleGUI(), and ViewportDrawDirtyBlocks().

static int UnScaleByZoomLower ( int  value,
ZoomLevel  zoom 
)
inlinestatic

Scale by zoom level, usually shift right (when zoom > ZOOM_LVL_NORMAL)

Parameters
valuevalue to shift
zoomzoom level to shift to
Returns
shifted value

Definition at line 61 of file zoom_func.h.

Referenced by GfxBlitter(), and MarkViewportDirty().

static int UnScaleGUI ( int  value)
inlinestatic

Short-hand to apply GUI zoom level.

Parameters
valuePixel amount at ZOOM_LVL_BEGIN (full zoom in).
Returns
Pixel amount at #ZOOM_LVL_GUI (current interface size).

Definition at line 72 of file zoom_func.h.

References UnScaleByZoom().

Referenced by DrawAircraftImage(), DrawCommonTileSeqInGUI(), DrawRoadVehEngine(), DrawShipImage(), SpriteAlignerWindow::DrawWidget(), GetAircraftSpriteSize(), GetRoadVehSpriteSize(), GetShipSpriteSize(), GetSingleVehicleWidth(), GetTrainSpriteSize(), ScaleGUITrad(), UpdateCursorSize(), and DepotWindow::UpdateWidgetSize().