Replace remaining rectangle flags with Rect::FillMode enum

This commit is contained in:
Gymnasiast committed 2025-10-23 18:42:50 +02:00
1 parent 679064da77
commit 298f3fdeb1
21 files changed
+48 -49

No files matched your search

+1 -1
View File
@@ -323,7 +323,7 @@ void InGameConsole::Draw(RenderTarget& rt) const
auto backgroundColour = ThemeGetColour(WindowClass::console, 0);
Rect::fillInset(
rt, { _consoleTopLeft, _consoleBottomRight }, backgroundColour, Rect::BorderStyle::outset, Rect::FillBrightness::light,
INSET_RECT_FLAG_FILL_NONE);
Rect::FillMode::none);
Rect::fillInset(
rt, { _consoleTopLeft + ScreenCoordsXY{ 1, 1 }, _consoleBottomRight - ScreenCoordsXY{ 1, 1 } }, backgroundColour,
Rect::BorderStyle::inset);
+8 -9
View File
@@ -211,7 +211,7 @@ namespace OpenRCT2::Ui
if (static_cast<int32_t>(widget.image.GetIndex()) == -2)
{
// Draw border with no fill
Rect::fillInset(rt, rect, colour, borderStyle, Rect::FillBrightness::light, INSET_RECT_FLAG_FILL_NONE);
Rect::fillInset(rt, rect, colour, borderStyle, Rect::FillBrightness::light, Rect::FillMode::none);
return;
}
@@ -298,8 +298,7 @@ namespace OpenRCT2::Ui
if (static_cast<int32_t>(widget.image.GetIndex()) == -2)
{
// Draw border with no fill
Rect::fillInset(
rt, rect, colour, Rect::BorderStyle::inset, Rect::FillBrightness::light, INSET_RECT_FLAG_FILL_NONE);
Rect::fillInset(rt, rect, colour, Rect::BorderStyle::inset, Rect::FillBrightness::light, Rect::FillMode::none);
return;
}
@@ -451,7 +450,7 @@ namespace OpenRCT2::Ui
auto colour = w.colours[widget.colour];
Rect::fillInset(
rt, rect, colour, Rect::BorderStyle::inset, Rect::FillBrightness::light, INSET_RECT_FLAG_FILL_DONT_LIGHTEN);
rt, rect, colour, Rect::BorderStyle::inset, Rect::FillBrightness::light, Rect::FillMode::dontLightenWhenInset);
WidgetText(rt, w, widgetIndex);
}
@@ -550,7 +549,7 @@ namespace OpenRCT2::Ui
brightness = Rect::FillBrightness::dark;
Rect::fillInset(
rt, { topLeft, bottomRight }, colour, Rect::BorderStyle::inset, brightness, INSET_RECT_FLAG_FILL_DONT_LIGHTEN);
rt, { topLeft, bottomRight }, colour, Rect::BorderStyle::inset, brightness, Rect::FillMode::dontLightenWhenInset);
// Black caption bars look slightly green, this fixes that
if (colour.colour == COLOUR_BLACK)
@@ -644,7 +643,7 @@ namespace OpenRCT2::Ui
// checkbox
Rect::fillInset(
rt, { midLeft - ScreenCoordsXY{ 0, 5 }, midLeft + ScreenCoordsXY{ 9, 4 } }, colour, Rect::BorderStyle::inset,
Rect::FillBrightness::light, INSET_RECT_FLAG_FILL_DONT_LIGHTEN);
Rect::FillBrightness::light, Rect::FillMode::dontLightenWhenInset);
if (widgetIsDisabled(w, widgetIndex))
{
@@ -695,7 +694,7 @@ namespace OpenRCT2::Ui
// Draw the border
Rect::fillInset(
rt, { topLeft, bottomRight }, colour, Rect::BorderStyle::inset, Rect::FillBrightness::light,
INSET_RECT_FLAG_FILL_DONT_LIGHTEN);
Rect::FillMode::dontLightenWhenInset);
// Inflate by -1
topLeft.x++;
@@ -1146,7 +1145,7 @@ namespace OpenRCT2::Ui
// Rect::fillInset(rt, l, t, r, b, colour, 0x20 | (!active ? 0x40 : 0x00));
Rect::fillInset(
rt, { topLeft, bottomRight }, w.colours[widget.colour], Rect::BorderStyle::inset, Rect::FillBrightness::light,
INSET_RECT_FLAG_FILL_DONT_LIGHTEN);
Rect::FillMode::dontLightenWhenInset);
// Figure out where the text should be positioned vertically.
topLeft.y = w.windowPos.y + widget.textTop();
@@ -1212,7 +1211,7 @@ namespace OpenRCT2::Ui
Rect::fillInset(
rt, { topLeft, bottomRight }, w.colours[1], Rect::BorderStyle::inset, Rect::FillBrightness::light,
INSET_RECT_FLAG_FILL_NONE);
Rect::FillMode::none);
if (isBlinking)
{
if (GameIsNotPaused() && (gCurrentRealTimeTicks & 8))
+1 -1
View File
@@ -1053,7 +1053,7 @@ namespace OpenRCT2::Ui::Windows
{
Rect::fillInset(
rt, { w.windowPos, w.windowPos + ScreenCoordsXY{ w.width - 1, w.height - 1 } }, { COLOUR_WHITE },
Rect::BorderStyle::outset, Rect::FillBrightness::light, INSET_RECT_FLAG_FILL_NONE);
Rect::BorderStyle::outset, Rect::FillBrightness::light, Rect::FillMode::none);
}
}
@@ -173,7 +173,7 @@ namespace OpenRCT2::Scripting
{
Rect::fillInset(
_rt, { x, y, x + width - 1, y + height - 1 }, { _colour.value_or(0) }, Rect::BorderStyle::inset,
Rect::FillBrightness::light, INSET_RECT_FLAG_FILL_DONT_LIGHTEN);
Rect::FillBrightness::light, Rect::FillMode::dontLightenWhenInset);
}
void clear()
+2 -1
View File
@@ -261,7 +261,8 @@ namespace OpenRCT2::Ui::Windows
void PaintCheckbox(RenderTarget& rt, const ScreenRect& rect, bool checked)
{
Rect::fillInset(
rt, rect, colours[1], Rect::BorderStyle::inset, Rect::FillBrightness::dark, INSET_RECT_FLAG_FILL_DONT_LIGHTEN);
rt, rect, colours[1], Rect::BorderStyle::inset, Rect::FillBrightness::dark,
Rect::FillMode::dontLightenWhenInset);
if (checked)
{
auto checkmark = Formatter();
@@ -350,7 +350,7 @@ namespace OpenRCT2::Ui::Windows
+ ScreenCoordsXY{ widgets[WIDX_PREVIOUS_IMAGE].right - 1, widgets[WIDX_PREVIOUS_IMAGE].bottom - 1 };
Rect::fillInset(
rt, { topLeft, bottomRight }, colours[1], Rect::BorderStyle::inset, Rect::FillBrightness::light,
INSET_RECT_FLAG_FILL_NONE);
Rect::FillMode::none);
GfxDrawSprite(
rt, ImageId(SPR_PREVIOUS),
@@ -390,7 +390,7 @@ namespace OpenRCT2::Ui::Windows
+ ScreenCoordsXY{ widgets[WIDX_NEXT_IMAGE].right - 1, widgets[WIDX_NEXT_IMAGE].bottom - 1 };
Rect::fillInset(
rt, { topLeft, bottomRight }, colours[1], Rect::BorderStyle::inset, Rect::FillBrightness::light,
INSET_RECT_FLAG_FILL_NONE);
Rect::FillMode::none);
GfxDrawSprite(
rt, ImageId(SPR_NEXT),
@@ -744,7 +744,7 @@ namespace OpenRCT2::Ui::Windows
if (!(gLegacyScene == LegacyScene::trackDesignsManager) && !(*listItem.flags & 0x20))
Rect::fillInset(
rt, { { 2, screenCoords.y }, { 11, screenCoords.y + 10 } }, colours[1], Rect::BorderStyle::inset,
Rect::FillBrightness::dark, INSET_RECT_FLAG_FILL_DONT_LIGHTEN);
Rect::FillBrightness::dark, Rect::FillMode::dontLightenWhenInset);
// Highlight background
auto highlighted = i == static_cast<size_t>(selectedListItem)
@@ -2352,7 +2352,7 @@ namespace OpenRCT2::Ui::Windows
// Checkbox
Rect::fillInset(
rt, { { 2, y }, { 11, y + 10 } }, colours[1], Rect::BorderStyle::inset, Rect::FillBrightness::dark,
INSET_RECT_FLAG_FILL_DONT_LIGHTEN);
Rect::FillMode::dontLightenWhenInset);
// Highlighted
auto stringId = STR_BLACK_STRING;
+2 -2
View File
@@ -793,13 +793,13 @@ namespace OpenRCT2::Ui::Windows
// Graph
Rect::fillInset(
rt, _graphBounds, colours[1], Rect::BorderStyle::inset, Rect::FillBrightness::light, INSET_RECT_FLAG_FILL_NONE);
rt, _graphBounds, colours[1], Rect::BorderStyle::inset, Rect::FillBrightness::light, Rect::FillMode::none);
// hide resize widget on graph area
constexpr ScreenCoordsXY offset{ 1, 1 };
constexpr ScreenCoordsXY bigOffset{ 5, 5 };
Rect::fillInset(
rt, { _graphBounds.Point2 - bigOffset, _graphBounds.Point2 - offset }, colours[1], Rect::BorderStyle::none,
Rect::FillBrightness::light, INSET_RECT_FLAG_FILL_DONT_LIGHTEN);
Rect::FillBrightness::light, Rect::FillMode::dontLightenWhenInset);
Graph::DrawFinanceGraph(rt, _graphProps);
}
@@ -97,7 +97,7 @@ namespace OpenRCT2::Ui::Windows
// Draw green inset rectangle on panel
Rect::fillInset(
rt, { topLeft, bottomRight }, colours[0], Rect::BorderStyle::inset, Rect::FillBrightness::light,
INSET_RECT_FLAG_FILL_NONE);
Rect::FillMode::none);
// Figure out how much line height we have to work with.
uint32_t line_height = FontGetLineHeight(FontStyle::Medium);
@@ -158,7 +158,7 @@ namespace OpenRCT2::Ui::Windows
int16_t bar_width = (factor * 114) / 255;
Rect::fillInset(
rt, { coords + ScreenCoordsXY{ 1, 1 }, coords + ScreenCoordsXY{ 114, 9 } }, colours[0],
Rect::BorderStyle::inset, Rect::FillBrightness::light, INSET_RECT_FLAG_FILL_NONE);
Rect::BorderStyle::inset, Rect::FillBrightness::light, Rect::FillMode::none);
if (!(colour & kBarBlink) || GameIsPaused() || (gCurrentRealTimeTicks & 8))
{
if (bar_width > 2)
@@ -183,7 +183,7 @@ namespace OpenRCT2::Ui::Windows
// Draw green inset rectangle on panel
Rect::fillInset(
rt, { topLeft, bottomRight }, colours[0], Rect::BorderStyle::inset, Rect::FillBrightness::light,
INSET_RECT_FLAG_FILL_NONE);
Rect::FillMode::none);
auto screenCoords = ScreenCoordsXY{ (rightPanelWidget.left + rightPanelWidget.right) / 2 + windowPos.x,
rightPanelWidget.top + windowPos.y + 2 };
@@ -247,7 +247,7 @@ namespace OpenRCT2::Ui::Windows
{ windowPos + ScreenCoordsXY{ middleOutsetWidget.left + 1, middleOutsetWidget.top + 1 },
windowPos + ScreenCoordsXY{ middleOutsetWidget.right - 1, middleOutsetWidget.bottom - 1 } },
colours[2], Rect::BorderStyle::inset, Rect::FillBrightness::light, INSET_RECT_FLAG_FILL_NONE);
colours[2], Rect::BorderStyle::inset, Rect::FillBrightness::light, Rect::FillMode::none);
// Text
auto screenCoords = windowPos + ScreenCoordsXY{ middleOutsetWidget.midX(), middleOutsetWidget.top + 11 };
@@ -360,7 +360,7 @@ namespace OpenRCT2::Ui::Windows
rt,
{ windowPos + ScreenCoordsXY{ middleOutsetWidget->left + 1, middleOutsetWidget->top + 1 },
windowPos + ScreenCoordsXY{ middleOutsetWidget->right - 1, middleOutsetWidget->bottom - 1 } },
colours[0], Rect::BorderStyle::inset, Rect::FillBrightness::light, INSET_RECT_FLAG_FILL_NONE);
colours[0], Rect::BorderStyle::inset, Rect::FillBrightness::light, Rect::FillMode::none);
// Figure out how much line height we have to work with.
uint32_t line_height = FontGetLineHeight(FontStyle::Medium);
+1 -1
View File
@@ -446,7 +446,7 @@ namespace OpenRCT2::Ui::Windows
{
Rect::fillInset(
rt, { frameStartPos, frameEndPos }, colours[1], Rect::BorderStyle::inset, Rect::FillBrightness::dark,
INSET_RECT_FLAG_FILL_DONT_LIGHTEN);
Rect::FillMode::dontLightenWhenInset);
}
// Draw image, or placeholder if no preview was found
+1 -1
View File
@@ -467,7 +467,7 @@ namespace OpenRCT2::Ui::Windows
// Outer frame
Rect::fillInset(
rt, { -1, y, 383 + scrollbarFill, y + itemHeight - 1 }, colours[1], Rect::BorderStyle::inset,
Rect::FillBrightness::light, INSET_RECT_FLAG_FILL_NONE);
Rect::FillBrightness::light, Rect::FillMode::none);
// Background
Rect::fill(rt, { 0, y + 1, 381 + scrollbarFill, y + itemHeight - 2 }, backgroundPaletteIndex);
+4 -5
View File
@@ -715,13 +715,13 @@ namespace OpenRCT2::Ui::Windows
// Graph border
Rect::fillInset(
rt, _ratingGraphBounds, colours[1], Rect::BorderStyle::inset, Rect::FillBrightness::light,
INSET_RECT_FLAG_FILL_NONE);
Rect::FillMode::none);
// hide resize widget on graph area
constexpr ScreenCoordsXY offset{ 1, 1 };
constexpr ScreenCoordsXY bigOffset{ 5, 5 };
Rect::fillInset(
rt, { _ratingGraphBounds.Point2 - bigOffset, _ratingGraphBounds.Point2 - offset }, colours[1],
Rect::BorderStyle::none, Rect::FillBrightness::light, INSET_RECT_FLAG_FILL_DONT_LIGHTEN);
Rect::BorderStyle::none, Rect::FillBrightness::light, Rect::FillMode::dontLightenWhenInset);
Graph::DrawRatingGraph(rt, _ratingProps);
}
@@ -795,14 +795,13 @@ namespace OpenRCT2::Ui::Windows
// Graph border
Rect::fillInset(
rt, _guestGraphBounds, colours[1], Rect::BorderStyle::inset, Rect::FillBrightness::light,
INSET_RECT_FLAG_FILL_NONE);
rt, _guestGraphBounds, colours[1], Rect::BorderStyle::inset, Rect::FillBrightness::light, Rect::FillMode::none);
// hide resize widget on graph area
constexpr ScreenCoordsXY offset{ 1, 1 };
constexpr ScreenCoordsXY bigOffset{ 5, 5 };
Rect::fillInset(
rt, { _guestGraphBounds.Point2 - bigOffset, _guestGraphBounds.Point2 - offset }, colours[1],
Rect::BorderStyle::none, Rect::FillBrightness::light, INSET_RECT_FLAG_FILL_DONT_LIGHTEN);
Rect::BorderStyle::none, Rect::FillBrightness::light, Rect::FillMode::dontLightenWhenInset);
Graph::DrawGuestGraph(rt, _guestProps);
}
+1 -1
View File
@@ -292,7 +292,7 @@ namespace OpenRCT2::Ui::Windows
auto frameEndPos = frameStartPos + ScreenCoordsXY(image->width + 1, image->height + 1);
Rect::fillInset(
rt, { frameStartPos, frameEndPos }, colours[1], Rect::BorderStyle::inset, Rect::FillBrightness::dark,
INSET_RECT_FLAG_FILL_DONT_LIGHTEN);
Rect::FillMode::dontLightenWhenInset);
// Draw image, if available
auto imagePos = frameStartPos + ScreenCoordsXY(1, 1);
+1 -1
View File
@@ -230,7 +230,7 @@ namespace OpenRCT2::Ui::Windows
rt,
{ { windowPos.x + 10, screenCoords.y },
{ windowPos.x + kWindowSize.width - 10, screenCoords.y + 10 * (no_lines + 1) + 3 } },
colours[1], Rect::BorderStyle::inset, Rect::FillBrightness::light, INSET_RECT_FLAG_FILL_DONT_LIGHTEN);
colours[1], Rect::BorderStyle::inset, Rect::FillBrightness::light, Rect::FillMode::dontLightenWhenInset);
screenCoords.y += 1;
+1 -1
View File
@@ -798,7 +798,7 @@ namespace OpenRCT2::Ui::Windows
screenCoords.y + _check_offset_y + 11 + _button_size * j };
Rect::fillInset(
rt, { topLeft, bottomRight }, colours[1], Rect::BorderStyle::inset, Rect::FillBrightness::dark,
INSET_RECT_FLAG_FILL_DONT_LIGHTEN);
Rect::FillMode::dontLightenWhenInset);
if (colour.hasFlag(ColourFlag::translucent))
{
DrawText(
+1 -1
View File
@@ -1640,7 +1640,7 @@ static uint64_t PageDisabledWidgets[] = {
// Draw checkbox and check if visible
Rect::fillInset(
rt, { { 2, screenCoords.y }, { 15, screenCoords.y + 11 } }, colours[1], Rect::BorderStyle::inset,
Rect::FillBrightness::dark, INSET_RECT_FLAG_FILL_DONT_LIGHTEN);
Rect::FillBrightness::dark, Rect::FillMode::dontLightenWhenInset);
if (!tileElement->IsInvisible())
{
auto eyeFormatter = Formatter();
-6
View File
@@ -183,12 +183,6 @@ constexpr DrawBlendOp kBlendSrc = 1 << 1;
*/
constexpr DrawBlendOp kBlendDst = 2 << 2;
enum
{
INSET_RECT_FLAG_FILL_NONE = (1 << 4), // 0x10
INSET_RECT_FLAG_FILL_DONT_LIGHTEN = (1 << 6), // 0x40
};
enum class FilterPaletteID : int32_t
{
paletteNull = 0,
+6 -6
View File
@@ -43,7 +43,7 @@ namespace OpenRCT2::Drawing::Rect
*/
void fillInset(
RenderTarget& rt, const ScreenRect& rect, ColourWithFlags colour, BorderStyle borderStyle, FillBrightness brightness,
uint8_t flags)
FillMode fillMode)
{
const auto leftTop = ScreenCoordsXY{ rect.GetLeft(), rect.GetTop() };
const auto leftBottom = ScreenCoordsXY{ rect.GetLeft(), rect.GetBottom() };
@@ -66,7 +66,7 @@ namespace OpenRCT2::Drawing::Rect
Rect::filter(rt, { rightTop, rightBottom }, palette.shadow);
Rect::filter(rt, { leftBottom, rightBottom }, palette.shadow);
if (!(flags & INSET_RECT_FLAG_FILL_NONE))
if (fillMode != FillMode::none)
{
Rect::filter(
rt, { leftTop + ScreenCoordsXY{ 1, 1 }, rightBottom - ScreenCoordsXY{ 1, 1 } }, palette.base);
@@ -80,7 +80,7 @@ namespace OpenRCT2::Drawing::Rect
Rect::filter(rt, { rightTop, rightBottom }, palette.highlight);
Rect::filter(rt, { leftBottom, rightBottom }, palette.highlight);
if (!(flags & INSET_RECT_FLAG_FILL_NONE))
if (fillMode != FillMode::none)
{
Rect::filter(
rt, { leftTop + ScreenCoordsXY{ 1, 1 }, { rightBottom - ScreenCoordsXY{ 1, 1 } } }, palette.base);
@@ -117,9 +117,9 @@ namespace OpenRCT2::Drawing::Rect
Rect::fill(rt, { rightTop + ScreenCoordsXY{ 0, 1 }, rightBottom - ScreenCoordsXY{ 0, 1 } }, hilight);
Rect::fill(rt, { leftBottom + ScreenCoordsXY{ 1, 0 }, rightBottom }, hilight);
if (!(flags & INSET_RECT_FLAG_FILL_NONE))
if (fillMode != FillMode::none)
{
if (!(flags & INSET_RECT_FLAG_FILL_DONT_LIGHTEN))
if (fillMode != FillMode::dontLightenWhenInset)
{
fill = ColourMapA[colour.colour].lighter;
}
@@ -134,7 +134,7 @@ namespace OpenRCT2::Drawing::Rect
Rect::fill(rt, { rightTop, rightBottom - ScreenCoordsXY{ 0, 1 } }, shadow);
Rect::fill(rt, { leftBottom, rightBottom }, shadow);
if (!(flags & INSET_RECT_FLAG_FILL_NONE))
if (fillMode != FillMode::none)
{
Rect::fill(rt, { leftTop + ScreenCoordsXY{ 1, 1 }, rightBottom - ScreenCoordsXY{ 1, 1 } }, fill);
}
+7 -1
View File
@@ -29,10 +29,16 @@ namespace OpenRCT2::Drawing::Rect
light,
dark,
};
enum class FillMode : uint8_t
{
standard,
none,
dontLightenWhenInset,
};
void fill(RenderTarget& rt, const ScreenRect& rect, int32_t colour);
void fillInset(
RenderTarget& rt, const ScreenRect& rect, ColourWithFlags colour, BorderStyle borderStyle = BorderStyle::outset,
FillBrightness brightness = FillBrightness::light, uint8_t flags = 0);
FillBrightness brightness = FillBrightness::light, FillMode fillMode = FillMode::standard);
void filter(RenderTarget& rt, const ScreenRect& rect, FilterPaletteID palette);
} // namespace OpenRCT2::Drawing::Rect
+1 -1
View File
@@ -145,7 +145,7 @@ void ChatDraw(RenderTarget& rt, ColourWithFlags chatBackgroundColor)
FilterPaletteID::palette51); // Opaque grey background
Rect::fillInset(
rt, { topLeft - ScreenCoordsXY{ 0, 5 }, bottomRight + ScreenCoordsXY{ 0, 5 } }, chatBackgroundColor,
Rect::BorderStyle::outset, Rect::FillBrightness::light, INSET_RECT_FLAG_FILL_NONE);
Rect::BorderStyle::outset, Rect::FillBrightness::light, Rect::FillMode::none);
Rect::fillInset(
rt, { topLeft + ScreenCoordsXY{ 1, -4 }, bottomRight - ScreenCoordsXY{ 1, inputLineHeight + 6 } },
chatBackgroundColor, Rect::BorderStyle::inset);