Codechange: Use ZOOM_LVL_MIN to refer to first zoom level.

Many uses of ZOOM_LVL_NORMAL actually just want the first zoom level slot, so use ZOOM_LVL_MIN to make this clearer.
This commit is contained in:
Peter Nelson
2024-04-04 18:49:37 +01:00
committed by Peter Nelson
parent 7c322ebcf1
commit 3c94e81665
18 changed files with 103 additions and 101 deletions

View File

@@ -53,7 +53,7 @@ static uint8_t _stringwidth_table[FS_END][224]; ///< Cache containing width of o
DrawPixelInfo *_cur_dpi;
static void GfxMainBlitterViewport(const Sprite *sprite, int x, int y, BlitterMode mode, const SubSprite *sub = nullptr, SpriteID sprite_id = SPR_CURSOR_MOUSE);
static void GfxMainBlitter(const Sprite *sprite, int x, int y, BlitterMode mode, const SubSprite *sub = nullptr, SpriteID sprite_id = SPR_CURSOR_MOUSE, ZoomLevel zoom = ZOOM_LVL_NORMAL);
static void GfxMainBlitter(const Sprite *sprite, int x, int y, BlitterMode mode, const SubSprite *sub = nullptr, SpriteID sprite_id = SPR_CURSOR_MOUSE, ZoomLevel zoom = ZOOM_LVL_MIN);
static ReusableBuffer<uint8_t> _cursor_backup;
@@ -99,7 +99,7 @@ void GfxScroll(int left, int top, int width, int height, int xo, int yo)
/**
* Applies a certain FillRectMode-operation to a rectangle [left, right] x [top, bottom] on the screen.
*
* @pre dpi->zoom == ZOOM_LVL_NORMAL, right >= left, bottom >= top
* @pre dpi->zoom == ZOOM_LVL_MIN, right >= left, bottom >= top
* @param left Minimum X (inclusive)
* @param top Minimum Y (inclusive)
* @param right Maximum X (inclusive)
@@ -118,7 +118,7 @@ void GfxFillRect(int left, int top, int right, int bottom, int colour, FillRectM
const int otop = top;
const int oleft = left;
if (dpi->zoom != ZOOM_LVL_NORMAL) return;
if (dpi->zoom != ZOOM_LVL_MIN) return;
if (left > right || top > bottom) return;
if (right < dpi->left || left >= dpi->left + dpi->width) return;
if (bottom < dpi->top || top >= dpi->top + dpi->height) return;
@@ -198,7 +198,7 @@ static std::vector<LineSegment> MakePolygonSegments(const std::vector<Point> &sh
* The odd-even winding rule is used, i.e. self-intersecting polygons will have holes in them.
* Left and top edges are inclusive, right and bottom edges are exclusive.
* @note For rectangles the GfxFillRect function will be faster.
* @pre dpi->zoom == ZOOM_LVL_NORMAL
* @pre dpi->zoom == ZOOM_LVL_MIN
* @param shape List of points on the polygon.
* @param colour An 8 bit palette index (FILLRECT_OPAQUE and FILLRECT_CHECKER) or a recolour spritenumber (FILLRECT_RECOLOUR).
* @param mode
@@ -210,7 +210,7 @@ void GfxFillPolygon(const std::vector<Point> &shape, int colour, FillRectMode mo
{
Blitter *blitter = BlitterFactory::GetCurrentBlitter();
const DrawPixelInfo *dpi = _cur_dpi;
if (dpi->zoom != ZOOM_LVL_NORMAL) return;
if (dpi->zoom != ZOOM_LVL_MIN) return;
std::vector<LineSegment> segments = MakePolygonSegments(shape, Point{ dpi->left, dpi->top });
@@ -1565,7 +1565,7 @@ bool FillDrawPixelInfo(DrawPixelInfo *n, int left, int top, int width, int heigh
Blitter *blitter = BlitterFactory::GetCurrentBlitter();
const DrawPixelInfo *o = _cur_dpi;
n->zoom = ZOOM_LVL_NORMAL;
n->zoom = ZOOM_LVL_MIN;
assert(width > 0);
assert(height > 0);
@@ -1789,7 +1789,7 @@ void UpdateGUIZoom()
_gui_scale = Clamp(_gui_scale_cfg, MIN_INTERFACE_SCALE, MAX_INTERFACE_SCALE);
}
int8_t new_zoom = ScaleGUITrad(1) <= 1 ? ZOOM_LVL_OUT_4X : ScaleGUITrad(1) >= 4 ? ZOOM_LVL_MIN : ZOOM_LVL_OUT_2X;
int8_t new_zoom = ScaleGUITrad(1) <= 1 ? ZOOM_LVL_OUT_4X : ScaleGUITrad(1) >= 4 ? ZOOM_LVL_NORMAL : ZOOM_LVL_OUT_2X;
/* Font glyphs should not be clamped to min/max zoom. */
_font_zoom = static_cast<ZoomLevel>(new_zoom);
/* Ensure the gui_zoom is clamped between min/max. */