Pass by ref Gfx::rect functions (#1091)

* fillRect pass context by ref

* drawRect pass context by ref

* draw/fillRect pass context by ref

* drawLine pass context by ref
This commit is contained in:
Duncan 2021-08-08 20:43:23 +01:00 committed by GitHub
parent 8333ece44e
commit b08815aeaf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
37 changed files with 177 additions and 177 deletions

View File

@ -1206,7 +1206,7 @@ namespace OpenLoco::Gfx
}
// 0x004474BA
static void drawRectImpl(Gfx::Context* context, int16_t left, int16_t top, int16_t right, int16_t bottom, uint32_t colour)
static void drawRectImpl(Gfx::Context& context, int16_t left, int16_t top, int16_t right, int16_t bottom, uint32_t colour)
{
registers regs;
regs.ax = left;
@ -1214,22 +1214,22 @@ namespace OpenLoco::Gfx
regs.cx = top;
regs.dx = bottom;
regs.ebp = colour;
regs.edi = X86Pointer(context);
regs.edi = X86Pointer(&context);
call(0x004474BA, regs);
}
void fillRect(Gfx::Context* context, int16_t left, int16_t top, int16_t right, int16_t bottom, uint32_t colour)
void fillRect(Gfx::Context& context, int16_t left, int16_t top, int16_t right, int16_t bottom, uint32_t colour)
{
drawRectImpl(context, left, top, right, bottom, colour);
}
void drawRect(Gfx::Context* context, int16_t x, int16_t y, uint16_t dx, uint16_t dy, uint32_t colour)
void drawRect(Gfx::Context& context, int16_t x, int16_t y, uint16_t dx, uint16_t dy, uint32_t colour)
{
// This makes the function signature more like a drawing application
drawRectImpl(context, x, y, x + dx - 1, y + dy - 1, colour);
}
void fillRectInset(Gfx::Context* context, int16_t left, int16_t top, int16_t right, int16_t bottom, uint32_t colour, uint8_t flags)
void fillRectInset(Gfx::Context& context, int16_t left, int16_t top, int16_t right, int16_t bottom, uint32_t colour, uint8_t flags)
{
registers regs;
regs.ax = left;
@ -1237,19 +1237,19 @@ namespace OpenLoco::Gfx
regs.cx = top;
regs.dx = bottom;
regs.ebp = colour;
regs.edi = X86Pointer(context);
regs.edi = X86Pointer(&context);
regs.si = flags;
call(0x004C58C7, regs);
}
void drawRectInset(Gfx::Context* context, int16_t x, int16_t y, uint16_t dx, uint16_t dy, uint32_t colour, uint8_t flags)
void drawRectInset(Gfx::Context& context, int16_t x, int16_t y, uint16_t dx, uint16_t dy, uint32_t colour, uint8_t flags)
{
// This makes the function signature more like a drawing application
fillRectInset(context, x, y, x + dx - 1, y + dy - 1, colour, flags);
}
// 0x00452DA4
void drawLine(Gfx::Context* context, int16_t left, int16_t top, int16_t right, int16_t bottom, uint32_t colour)
void drawLine(Gfx::Context& context, int16_t left, int16_t top, int16_t right, int16_t bottom, uint32_t colour)
{
registers regs;
regs.ax = left;
@ -1257,7 +1257,7 @@ namespace OpenLoco::Gfx
regs.cx = right;
regs.dx = bottom;
regs.ebp = colour;
regs.edi = X86Pointer(context);
regs.edi = X86Pointer(&context);
call(0x00452DA4, regs);
}

View File

@ -221,11 +221,11 @@ namespace OpenLoco::Gfx
uint16_t getStringWidthNewLined(const char* buffer);
std::pair<uint16_t, uint16_t> wrapString(const char* buffer, uint16_t stringWidth);
void fillRect(Gfx::Context* context, int16_t left, int16_t top, int16_t right, int16_t bottom, uint32_t colour);
void drawRect(Gfx::Context* context, int16_t x, int16_t y, uint16_t dx, uint16_t dy, uint32_t colour);
void fillRectInset(Gfx::Context* context, int16_t left, int16_t top, int16_t right, int16_t bottom, uint32_t colour, uint8_t flags);
void drawRectInset(Gfx::Context* context, int16_t x, int16_t y, uint16_t dx, uint16_t dy, uint32_t colour, uint8_t flags);
void drawLine(Gfx::Context* context, int16_t left, int16_t top, int16_t right, int16_t bottom, uint32_t colour);
void fillRect(Gfx::Context& context, int16_t left, int16_t top, int16_t right, int16_t bottom, uint32_t colour);
void drawRect(Gfx::Context& context, int16_t x, int16_t y, uint16_t dx, uint16_t dy, uint32_t colour);
void fillRectInset(Gfx::Context& context, int16_t left, int16_t top, int16_t right, int16_t bottom, uint32_t colour, uint8_t flags);
void drawRectInset(Gfx::Context& context, int16_t x, int16_t y, uint16_t dx, uint16_t dy, uint32_t colour, uint8_t flags);
void drawLine(Gfx::Context& context, int16_t left, int16_t top, int16_t right, int16_t bottom, uint32_t colour);
void drawImage(Gfx::Context* context, int16_t x, int16_t y, uint32_t image);
void drawImageSolid(Gfx::Context* context, int16_t x, int16_t y, uint32_t image, uint8_t palette_index);
void drawImagePaletteSet(Gfx::Context* context, int16_t x, int16_t y, uint32_t image, uint8_t* palette);

View File

@ -13,7 +13,7 @@ namespace OpenLoco
// 0x00434D5B
void CompetitorObject::drawPreviewImage(Gfx::Context& context, const int16_t x, const int16_t y) const
{
Gfx::drawRect(&context, 0, 0, objectPreviewSize.width, objectPreviewSize.height, Colour::inset(Colour::dark_brown));
Gfx::drawRect(context, 0, 0, objectPreviewSize.width, objectPreviewSize.height, Colour::inset(Colour::dark_brown));
auto image = Gfx::recolour(images[0], Colour::inset(Colour::dark_brown));
Gfx::drawImage(&context, x - 32, y - 32, image);

View File

@ -202,7 +202,7 @@ namespace OpenLoco::Ui::Dropdown
{
auto x = _windowDropdownOnpaintCellX * _dropdownItemWidth + self->x + 2;
auto y = _windowDropdownOnpaintCellY * _dropdownItemHeight + self->y + 2;
Gfx::drawRect(context, x, y, _dropdownItemWidth, _dropdownItemHeight, (1 << 25) | PaletteIndex::index_2E);
Gfx::drawRect(*context, x, y, _dropdownItemWidth, _dropdownItemHeight, (1 << 25) | PaletteIndex::index_2E);
}
auto args = FormatArguments();
@ -265,16 +265,16 @@ namespace OpenLoco::Ui::Dropdown
if (!(self->getColour(WindowColour::primary) & Colour::translucent_flag))
{
Gfx::drawRect(context, x, y, _dropdownItemWidth - 1, 1, Colour::getShade(self->getColour(WindowColour::primary), 3));
Gfx::drawRect(context, x, y + 1, _dropdownItemWidth - 1, 1, Colour::getShade(self->getColour(WindowColour::primary), 7));
Gfx::drawRect(*context, x, y, _dropdownItemWidth - 1, 1, Colour::getShade(self->getColour(WindowColour::primary), 3));
Gfx::drawRect(*context, x, y + 1, _dropdownItemWidth - 1, 1, Colour::getShade(self->getColour(WindowColour::primary), 7));
}
else
{
uint32_t colour = _byte_5045FA[Colour::opaque(self->getColour(WindowColour::primary))] | (1 << 25);
colour++;
Gfx::drawRect(context, x, y, _dropdownItemWidth - 1, 1, colour);
Gfx::drawRect(*context, x, y, _dropdownItemWidth - 1, 1, colour);
colour++;
Gfx::drawRect(context, x, y + 1, _dropdownItemWidth - 1, 1, colour);
Gfx::drawRect(*context, x, y + 1, _dropdownItemWidth - 1, 1, colour);
}
}

View File

@ -44,7 +44,7 @@ namespace OpenLoco::Ui
{
Gfx::drawImage(context, x - 4, y, Gfx::recolour(ImageIds::curved_border_left, colour));
Gfx::drawImage(context, x + width, y, Gfx::recolour(ImageIds::curved_border_right, colour));
Gfx::fillRect(context, x, y, x + width - 1, y + 11, Colour::getShade(colour, 5));
Gfx::fillRect(*context, x, y, x + width - 1, y + 11, Colour::getShade(colour, 5));
}
void Widget::draw(Gfx::Context* context, Window* window, const uint64_t pressedWidgets, const uint64_t toolWidgets, const uint64_t hoveredWidgets, uint8_t& scrollviewIndex)
@ -192,14 +192,14 @@ namespace OpenLoco::Ui
auto& widget = window->widgets[widgetIndex];
if (Input::isHovering(window->type, window->number, widgetIndex))
{
Gfx::drawRect(context, widget.left + window->x, widget.top + window->y, widget.width(), widget.height(), 0x2000000 | 54);
Gfx::drawRect(context, widget.left + window->x, widget.top + window->y, widget.width(), widget.height(), 0x2000000 | 52);
Gfx::drawRect(*context, widget.left + window->x, widget.top + window->y, widget.width(), widget.height(), 0x2000000 | 54);
Gfx::drawRect(*context, widget.left + window->x, widget.top + window->y, widget.width(), widget.height(), 0x2000000 | 52);
uint8_t flags = 0;
if (Input::isPressed(window->type, window->number, widgetIndex))
flags = 0x20;
Gfx::drawRectInset(context, widget.left + window->x, widget.top + window->y, widget.width(), widget.height(), Colour::translucent(window->getColour(WindowColour::secondary)), flags);
Gfx::drawRectInset(*context, widget.left + window->x, widget.top + window->y, widget.width(), widget.height(), Colour::translucent(window->getColour(WindowColour::secondary)), flags);
}
Gfx::drawImage(context, widget.left + window->x, widget.top + window->y, Gfx::recolour(ImageIds::centre_viewport, window->getColour(WindowColour::secondary)));
@ -286,7 +286,7 @@ namespace OpenLoco::Ui
// 0x004CAB58
void Widget::drawPanel(Gfx::Context* context, const Window* window, uint16_t flags, uint8_t colour)
{
Gfx::fillRectInset(context, window->x + left, window->y + top, window->x + right, window->y + bottom, colour, flags);
Gfx::fillRectInset(*context, window->x + left, window->y + top, window->x + right, window->y + bottom, colour, flags);
draw_resize_handle(context, window, this, colour);
}
@ -320,7 +320,7 @@ namespace OpenLoco::Ui
}
Gfx::fillRect(
context,
*context,
window->x + right,
window->y + top,
window->x + right,
@ -346,16 +346,16 @@ namespace OpenLoco::Ui
if (content == -2)
{
flags |= 0x10;
Gfx::fillRectInset(context, l, t, r, b, colour, flags);
Gfx::fillRectInset(*context, l, t, r, b, colour, flags);
return;
}
if (window->flags & WindowFlags::flag_6)
{
Gfx::fillRect(context, l, t, r, b, 0x2000000 | 52);
Gfx::fillRect(*context, l, t, r, b, 0x2000000 | 52);
}
Gfx::fillRectInset(context, l, t, r, b, colour, flags);
Gfx::fillRectInset(*context, l, t, r, b, colour, flags);
if (content == -1)
{
@ -428,12 +428,12 @@ namespace OpenLoco::Ui
// 0x004CABE8
flags |= 0x10;
Gfx::fillRectInset(context, l, t, r, b, colour, flags);
Gfx::fillRectInset(*context, l, t, r, b, colour, flags);
return;
}
Gfx::fillRectInset(context, l, t, r, b, colour, flags);
Gfx::fillRectInset(*context, l, t, r, b, colour, flags);
}
if (content == -1)
@ -495,7 +495,7 @@ namespace OpenLoco::Ui
flags |= 0x20;
}
Gfx::fillRectInset(context, l, t, r, b, colour, flags);
Gfx::fillRectInset(*context, l, t, r, b, colour, flags);
}
// 0x004CB1BE
@ -579,7 +579,7 @@ namespace OpenLoco::Ui
// 0x4CB29C
void Widget::draw_17(Gfx::Context* context, const Window* window, uint16_t flags, uint8_t colour)
{
Gfx::fillRectInset(context, window->x + left, window->y + top, window->x + right, window->y + bottom, colour, flags | 0x60);
Gfx::fillRectInset(*context, window->x + left, window->y + top, window->x + right, window->y + bottom, colour, flags | 0x60);
}
// 0x004CA6AE
@ -589,8 +589,8 @@ namespace OpenLoco::Ui
int r = window->x + right;
int t = window->y + top;
int b = window->y + bottom;
Gfx::fillRectInset(context, l, t, r, b, colour, flags | 0x60);
Gfx::fillRect(context, l + 1, t + 1, r - 1, b - 1, 0x2000000 | 46);
Gfx::fillRectInset(*context, l, t, r, b, colour, flags | 0x60);
Gfx::fillRect(*context, l + 1, t + 1, r - 1, b - 1, 0x2000000 | 46);
int16_t width = r - l - 4 - 10;
int16_t y = t + window->y + 1;
@ -679,7 +679,7 @@ namespace OpenLoco::Ui
{
f = flags | 0x20;
}
Gfx::fillRectInset(context, ax, cx, ax + 9, dx, colour, f);
Gfx::fillRectInset(*context, ax, cx, ax + 9, dx, colour, f);
// popa
// pusha
@ -692,7 +692,7 @@ namespace OpenLoco::Ui
{
f = flags | 0x20;
}
Gfx::fillRectInset(context, bx - 9, cx, bx, dx, colour, f);
Gfx::fillRectInset(*context, bx - 9, cx, bx, dx, colour, f);
// popa
// pusha
@ -700,15 +700,15 @@ namespace OpenLoco::Ui
// popa
// pusha
Gfx::fillRect(context, ax + 10, cx, bx - 10, dx, Colour::getShade(colour, 7));
Gfx::fillRect(context, ax + 10, cx, bx - 10, dx, 0x1000000 | Colour::getShade(colour, 3));
Gfx::fillRect(*context, ax + 10, cx, bx - 10, dx, Colour::getShade(colour, 7));
Gfx::fillRect(*context, ax + 10, cx, bx - 10, dx, 0x1000000 | Colour::getShade(colour, 3));
// popa
// pusha
Gfx::fillRect(context, ax + 10, cx + 2, bx - 10, cx + 2, Colour::getShade(colour, 3));
Gfx::fillRect(context, ax + 10, cx + 3, bx - 10, cx + 3, Colour::getShade(colour, 7));
Gfx::fillRect(context, ax + 10, cx + 7, bx - 10, cx + 7, Colour::getShade(colour, 3));
Gfx::fillRect(context, ax + 10, cx + 8, bx - 10, cx + 8, Colour::getShade(colour, 7));
Gfx::fillRect(*context, ax + 10, cx + 2, bx - 10, cx + 2, Colour::getShade(colour, 3));
Gfx::fillRect(*context, ax + 10, cx + 3, bx - 10, cx + 3, Colour::getShade(colour, 7));
Gfx::fillRect(*context, ax + 10, cx + 7, bx - 10, cx + 7, Colour::getShade(colour, 3));
Gfx::fillRect(*context, ax + 10, cx + 8, bx - 10, cx + 8, Colour::getShade(colour, 7));
// popa
// pusha
@ -717,7 +717,7 @@ namespace OpenLoco::Ui
{
f = 0x20;
}
Gfx::fillRectInset(context, ax - 1 + scroll_area->h_thumb_left, cx, ax - 1 + scroll_area->h_thumb_right, dx, colour, f);
Gfx::fillRectInset(*context, ax - 1 + scroll_area->h_thumb_left, cx, ax - 1 + scroll_area->h_thumb_right, dx, colour, f);
// popa
}
@ -744,7 +744,7 @@ namespace OpenLoco::Ui
{
f = flags | 0x20;
}
Gfx::fillRectInset(context, ax, cx, bx, cx + 9, colour, f);
Gfx::fillRectInset(*context, ax, cx, bx, cx + 9, colour, f);
// popa
// pusha
@ -757,7 +757,7 @@ namespace OpenLoco::Ui
{
f = flags | 0x20;
}
Gfx::fillRectInset(context, ax, dx - 9, bx, dx, colour, f);
Gfx::fillRectInset(*context, ax, dx - 9, bx, dx, colour, f);
// popa
// pusha
@ -765,15 +765,15 @@ namespace OpenLoco::Ui
// popa
// pusha
Gfx::fillRect(context, ax, cx + 10, bx, dx - 10, Colour::getShade(colour, 7));
Gfx::fillRect(context, ax, cx + 10, bx, dx - 10, 0x1000000 | Colour::getShade(colour, 3));
Gfx::fillRect(*context, ax, cx + 10, bx, dx - 10, Colour::getShade(colour, 7));
Gfx::fillRect(*context, ax, cx + 10, bx, dx - 10, 0x1000000 | Colour::getShade(colour, 3));
// popa
// pusha
Gfx::fillRect(context, ax + 2, cx + 10, ax + 2, dx - 10, Colour::getShade(colour, 3));
Gfx::fillRect(context, ax + 3, cx + 10, ax + 3, dx - 10, Colour::getShade(colour, 7));
Gfx::fillRect(context, ax + 7, cx + 10, ax + 7, dx - 10, Colour::getShade(colour, 3));
Gfx::fillRect(context, ax + 8, cx + 10, ax + 8, dx - 10, Colour::getShade(colour, 7));
Gfx::fillRect(*context, ax + 2, cx + 10, ax + 2, dx - 10, Colour::getShade(colour, 3));
Gfx::fillRect(*context, ax + 3, cx + 10, ax + 3, dx - 10, Colour::getShade(colour, 7));
Gfx::fillRect(*context, ax + 7, cx + 10, ax + 7, dx - 10, Colour::getShade(colour, 3));
Gfx::fillRect(*context, ax + 8, cx + 10, ax + 8, dx - 10, Colour::getShade(colour, 7));
// popa
// pusha
@ -782,7 +782,7 @@ namespace OpenLoco::Ui
{
f = flags | 0x20;
}
Gfx::fillRectInset(context, ax, cx - 1 + scroll_area->v_thumb_top, bx, cx - 1 + scroll_area->v_thumb_bottom, colour, f);
Gfx::fillRectInset(*context, ax, cx - 1 + scroll_area->v_thumb_top, bx, cx - 1 + scroll_area->v_thumb_bottom, colour, f);
// popa
}
@ -794,7 +794,7 @@ namespace OpenLoco::Ui
int16_t r = window->x + right;
int16_t b = window->y + bottom;
Gfx::fillRectInset(context, l, t, r, b, colour, flags | 0x60);
Gfx::fillRectInset(*context, l, t, r, b, colour, flags | 0x60);
l++;
t++;
@ -868,7 +868,7 @@ namespace OpenLoco::Ui
if (enabled)
{
Gfx::fillRectInset(
context,
*context,
window->x + left,
window->y + top,
window->x + left + 9,
@ -909,7 +909,7 @@ namespace OpenLoco::Ui
int r = window->x + right;
int t = window->y + top;
int b = window->y + bottom;
Gfx::fillRect(context, l, t, r, b, Colour::getShade(Colour::black, 5));
Gfx::fillRect(*context, l, t, r, b, Colour::getShade(Colour::black, 5));
}
void Widget::drawGroupbox(Gfx::Context* const context, const Window* window)
@ -938,24 +938,24 @@ namespace OpenLoco::Ui
b = window->y + bottom;
// Border left of text
Gfx::fillRect(context, l, t, l + 4, t, Colour::getShade(colour, 4));
Gfx::fillRect(context, l + 1, t + 1, l + 4, t + 1, Colour::getShade(colour, 7));
Gfx::fillRect(*context, l, t, l + 4, t, Colour::getShade(colour, 4));
Gfx::fillRect(*context, l + 1, t + 1, l + 4, t + 1, Colour::getShade(colour, 7));
// Border right of text
Gfx::fillRect(context, textEndPos, t, r - 1, t, Colour::getShade(colour, 4));
Gfx::fillRect(context, textEndPos, t + 1, r - 2, t + 1, Colour::getShade(colour, 7));
Gfx::fillRect(*context, textEndPos, t, r - 1, t, Colour::getShade(colour, 4));
Gfx::fillRect(*context, textEndPos, t + 1, r - 2, t + 1, Colour::getShade(colour, 7));
// Border right
Gfx::fillRect(context, r - 1, t + 1, r - 1, b - 1, Colour::getShade(colour, 4));
Gfx::fillRect(context, r, t, r, b, Colour::getShade(colour, 7));
Gfx::fillRect(*context, r - 1, t + 1, r - 1, b - 1, Colour::getShade(colour, 4));
Gfx::fillRect(*context, r, t, r, b, Colour::getShade(colour, 7));
// Border bottom
Gfx::fillRect(context, l, b - 1, r - 2, b - 1, Colour::getShade(colour, 4));
Gfx::fillRect(context, l, b, r - 1, b, Colour::getShade(colour, 7));
Gfx::fillRect(*context, l, b - 1, r - 2, b - 1, Colour::getShade(colour, 4));
Gfx::fillRect(*context, l, b, r - 1, b, Colour::getShade(colour, 7));
// Border left
Gfx::fillRect(context, l, t + 1, l, b - 2, Colour::getShade(colour, 4));
Gfx::fillRect(context, l + 1, t + 2, l + 1, b - 2, Colour::getShade(colour, 7));
Gfx::fillRect(*context, l, t + 1, l, b - 2, Colour::getShade(colour, 4));
Gfx::fillRect(*context, l + 1, t + 2, l + 1, b - 2, Colour::getShade(colour, 7));
}
// 0x004CF194
@ -1001,7 +1001,7 @@ namespace OpenLoco::Ui
Gfx::drawImage(ctx, pos.x, pos.y + 1, imageId);
}
Gfx::drawImage(ctx, pos.x, pos.y, (1 << 30) | (51 << 19) | ImageIds::tab);
Gfx::drawRect(ctx, pos.x, pos.y + 26, 31, 1, Colour::getShade(w->getColour(WindowColour::secondary), 7));
Gfx::drawRect(*ctx, pos.x, pos.y + 26, 31, 1, Colour::getShade(w->getColour(WindowColour::secondary), 7));
}
}
}

View File

@ -1421,7 +1421,7 @@ namespace OpenLoco::Ui
{
if ((this->flags & WindowFlags::transparent) && !(this->flags & WindowFlags::no_background))
{
Gfx::fillRect(context, this->x, this->y, this->x + this->width - 1, this->y + this->height - 1, 0x2000000 | 52);
Gfx::fillRect(*context, this->x, this->y, this->x + this->width - 1, this->y + this->height - 1, 0x2000000 | 52);
}
uint64_t pressed_widget = 0;
@ -1462,7 +1462,7 @@ namespace OpenLoco::Ui
if (this->flags & WindowFlags::white_border_mask)
{
Gfx::fillRectInset(
context,
*context,
this->x,
this->y,
this->x + this->width - 1,

View File

@ -1082,7 +1082,7 @@ namespace OpenLoco::Ui::Windows::BuildVehicle
auto colouredString = StringIds::black_stringid;
if (window.row_hover == vehicleType)
{
Gfx::fillRect(&context, 0, y, window.width, y + window.row_height - 1, 0x2000030);
Gfx::fillRect(context, 0, y, window.width, y + window.row_height - 1, 0x2000030);
colouredString = StringIds::wcolour2_stringid;
}
@ -1332,13 +1332,13 @@ namespace OpenLoco::Ui::Windows::BuildVehicle
auto top = window->y + 69;
auto right = left + window->width - 187;
auto bottom = top;
Gfx::fillRect(context, left, top, right, bottom, Colour::getShade(window->getColour(WindowColour::secondary), 7));
Gfx::fillRect(*context, left, top, right, bottom, Colour::getShade(window->getColour(WindowColour::secondary), 7));
left = window->x + window->width - 187;
top = window->y + 41;
right = left;
bottom = top + 27;
Gfx::fillRect(context, left, top, right, bottom, Colour::getShade(window->getColour(WindowColour::secondary), 7));
Gfx::fillRect(*context, left, top, right, bottom, Colour::getShade(window->getColour(WindowColour::secondary), 7));
for (uint32_t tab = 0; tab < _numTrackTypeTabs; ++tab)
{
@ -1349,7 +1349,7 @@ namespace OpenLoco::Ui::Windows::BuildVehicle
top = widget.top + window->y + 26;
right = left + 29;
bottom = top;
Gfx::fillRect(context, left, top, right, bottom, Colour::getShade(window->getColour(WindowColour::secondary), 5));
Gfx::fillRect(*context, left, top, right, bottom, Colour::getShade(window->getColour(WindowColour::secondary), 5));
}
auto img = 0;

View File

@ -224,7 +224,7 @@ namespace OpenLoco::Ui::Windows::CompanyFaceSelection
const auto t = self->y + 1 + self->widgets[widx::face_frame].top;
const auto r = self->x - 1 + self->widgets[widx::face_frame].right;
const auto b = self->y - 1 + self->widgets[widx::face_frame].bottom;
Gfx::fillRect(context, l, t, r, b, colour);
Gfx::fillRect(*context, l, t, r, b, colour);
const CompetitorObject* competitor = _loadedObject;
uint32_t img = competitor->images[0] + 1 + (1 << 29);
@ -260,7 +260,7 @@ namespace OpenLoco::Ui::Windows::CompanyFaceSelection
if (index == self.row_hover)
{
inlineColour = ControlCodes::window_colour_2;
Gfx::fillRect(&context, 0, y, self.width, y + 9, 0x2000000 | 48);
Gfx::fillRect(context, 0, y, self.width, y + 9, 0x2000000 | 48);
}
std::string name(object.second._name);

View File

@ -476,7 +476,7 @@ namespace OpenLoco::Ui::Windows::CompanyList
if (rowItem == self.row_hover)
{
Gfx::drawRect(&context, 0, yBottom, self.width, 24, (1 << 25) | PaletteIndex::index_30);
Gfx::drawRect(context, 0, yBottom, self.width, 24, (1 << 25) | PaletteIndex::index_30);
stringId = StringIds::wcolour2_stringid;
}
@ -1036,7 +1036,7 @@ namespace OpenLoco::Ui::Windows::CompanyList
if (!(self->var_854 & (1 << cargoCount)) || !(_word_9C68C7 & (1 << 2)))
{
Gfx::fillRect(context, x, y + 3, x + 4, y + 7, colour);
Gfx::fillRect(*context, x, y + 3, x + 4, y + 7, colour);
}
auto args = FormatArguments();
@ -1669,7 +1669,7 @@ namespace OpenLoco::Ui::Windows::CompanyList
if (!(self->var_854 & (1 << companyCount)) || !(_word_9C68C7 & (1 << 2)))
{
Gfx::fillRect(context, x, y + 3, x + 4, y + 7, colour);
Gfx::fillRect(*context, x, y + 3, x + 4, y + 7, colour);
}
auto args = FormatArguments();

View File

@ -1711,7 +1711,7 @@ namespace OpenLoco::Ui::Windows::CompanyWindow
if (i % 2 == 0)
{
auto colour = Colour::getShade(self->getColour(WindowColour::secondary), 6) | 0x1000000;
Gfx::fillRect(context, self->x + 4, y, self->x + 129, y + 9, colour);
Gfx::fillRect(*context, self->x + 4, y, self->x + 129, y + 9, colour);
}
auto args = FormatArguments::common(ExpenditureLabels[i]);
@ -1867,7 +1867,7 @@ namespace OpenLoco::Ui::Windows::CompanyWindow
Gfx::drawString_494C78(*context, x, y, Colour::black, mainFormat, &args);
Gfx::fillRect(context, x - expenditureColumnWidth + 10, y - 2, x, y - 2, Colour::aquamarine);
Gfx::fillRect(*context, x - expenditureColumnWidth + 10, y - 2, x, y - 2, Colour::aquamarine);
}
// 0x0043361E
@ -1881,7 +1881,7 @@ namespace OpenLoco::Ui::Windows::CompanyWindow
if (i % 2 == 0)
{
auto colour = Colour::getShade(self.getColour(WindowColour::secondary), 6) | 0x1000000;
Gfx::fillRect(&context, 0, y, expenditureColumnWidth * 17, y + 9, colour);
Gfx::fillRect(context, 0, y, expenditureColumnWidth * 17, y + 9, colour);
}
y += 10;

View File

@ -301,7 +301,7 @@ namespace OpenLoco::Ui::Windows::Construction::Station
xPos = self->x + 3;
yPos = self->widgets[widx::image].bottom + self->y + 16;
auto width = self->width - 4;
Gfx::drawRectInset(context, xPos, yPos, width, 1, self->getColour(WindowColour::secondary), (1 << 5));
Gfx::drawRectInset(*context, xPos, yPos, width, 1, self->getColour(WindowColour::secondary), (1 << 5));
if (!(_byte_522096 & (1 << 3)))
return;

View File

@ -213,18 +213,18 @@ namespace OpenLoco::Ui::Windows::Error
uint16_t height = self->height;
auto skin = ObjectManager::get<InterfaceSkinObject>()->colour_09;
Gfx::drawRect(context, x + 1, y + 1, width - 2, height - 2, 0x2000000 | 45);
Gfx::drawRect(context, x + 1, y + 1, width - 2, height - 2, 0x2000000 | (116 + skin));
Gfx::drawRect(*context, x + 1, y + 1, width - 2, height - 2, 0x2000000 | 45);
Gfx::drawRect(*context, x + 1, y + 1, width - 2, height - 2, 0x2000000 | (116 + skin));
Gfx::drawRect(context, x, y + 2, 1, height - 4, 0x2000000 | 46);
Gfx::drawRect(context, x + width - 1, y + 2, 1, height - 4, 0x2000000 | 46);
Gfx::drawRect(context, x + 2, y + height - 1, width - 4, 1, 0x2000000 | 46);
Gfx::drawRect(context, x + 2, y, width - 4, 1, 0x2000000 | 46);
Gfx::drawRect(*context, x, y + 2, 1, height - 4, 0x2000000 | 46);
Gfx::drawRect(*context, x + width - 1, y + 2, 1, height - 4, 0x2000000 | 46);
Gfx::drawRect(*context, x + 2, y + height - 1, width - 4, 1, 0x2000000 | 46);
Gfx::drawRect(*context, x + 2, y, width - 4, 1, 0x2000000 | 46);
Gfx::drawRect(context, x + 1, y + 1, 1, 1, 0x2000000 | 46);
Gfx::drawRect(context, x + width - 1 - 1, y + 1, 1, 1, 0x2000000 | 46);
Gfx::drawRect(context, x + 1, y + height - 1 - 1, 1, 1, 0x2000000 | 46);
Gfx::drawRect(context, x + width - 1 - 1, y + height - 1 - 1, 1, 1, 0x2000000 | 46);
Gfx::drawRect(*context, x + 1, y + 1, 1, 1, 0x2000000 | 46);
Gfx::drawRect(*context, x + width - 1 - 1, y + 1, 1, 1, 0x2000000 | 46);
Gfx::drawRect(*context, x + 1, y + height - 1 - 1, 1, 1, 0x2000000 | 46);
Gfx::drawRect(*context, x + width - 1 - 1, y + height - 1 - 1, 1, 1, 0x2000000 | 46);
if (_errorCompetitorId == 0xFF)
{

View File

@ -400,7 +400,7 @@ namespace OpenLoco::Ui::Windows::IndustryList
// Highlight selection.
if (industryId == self.row_hover)
{
Gfx::drawRect(&context, 0, yPos, self.width, rowHeight, 0x2000030);
Gfx::drawRect(context, 0, yPos, self.width, rowHeight, 0x2000030);
text_colour_id = StringIds::wcolour2_stringid;
}
@ -884,13 +884,13 @@ namespace OpenLoco::Ui::Windows::IndustryList
if (self.row_info[i] == self.var_846)
{
word_E0C3C6 = Colour::translucent_flag;
Gfx::drawRectInset(&context, xPos, yPos, rowHeight, rowHeight, self.getColour(WindowColour::secondary), Colour::translucent_flag);
Gfx::drawRectInset(context, xPos, yPos, rowHeight, rowHeight, self.getColour(WindowColour::secondary), Colour::translucent_flag);
}
}
else
{
word_E0C3C6 = Colour::translucent_flag | Colour::outline_flag;
Gfx::drawRectInset(&context, xPos, yPos, rowHeight, rowHeight, self.getColour(WindowColour::secondary), (Colour::translucent_flag | Colour::outline_flag));
Gfx::drawRectInset(context, xPos, yPos, rowHeight, rowHeight, self.getColour(WindowColour::secondary), (Colour::translucent_flag | Colour::outline_flag));
}
auto industryObj = ObjectManager::get<IndustryObject>(self.row_info[i]);

View File

@ -592,7 +592,7 @@ namespace OpenLoco::Ui::Windows::Industry
auto args = FormatArguments();
args.push(yTick);
Gfx::drawRect(context, self->x + 41, yPos, 239, 1, Colour::getShade(self->getColour(WindowColour::secondary), 4));
Gfx::drawRect(*context, self->x + 41, yPos, 239, 1, Colour::getShade(self->getColour(WindowColour::secondary), 4));
Gfx::drawString_494C78(*context, self->x + 39, yPos - 6, Colour::black, StringIds::population_graph_people, &args);
@ -622,7 +622,7 @@ namespace OpenLoco::Ui::Windows::Industry
Gfx::drawStringCentred(*context, xPos, yPos, Colour::black, StringIds::population_graph_year, &args);
}
Gfx::drawRect(context, xPos, yPos + 11, 1, self->height - 74, Colour::getShade(self->getColour(WindowColour::secondary), 4));
Gfx::drawRect(*context, xPos, yPos + 11, 1, self->height - 74, Colour::getShade(self->getColour(WindowColour::secondary), 4));
}
const auto history = productionTabWidx == widx::tab_production ? industry->history_1 : industry->history_2;
@ -637,7 +637,7 @@ namespace OpenLoco::Ui::Windows::Industry
{
if (yPos2 <= graphBottom)
{
Gfx::drawLine(context, xPos, yPos1, xPos + 1, yPos2, Colour::getShade(self->getColour(WindowColour::secondary), 7));
Gfx::drawLine(*context, xPos, yPos1, xPos + 1, yPos2, Colour::getShade(self->getColour(WindowColour::secondary), 7));
}
}
}

View File

@ -110,7 +110,7 @@ namespace OpenLoco::Ui::Windows::KeyboardShortcuts
string_id format = StringIds::black_stringid;
if (i == self.row_hover)
{
Gfx::drawRect(&context, 0, yPos, 800, rowHeight, 0x2000030);
Gfx::drawRect(context, 0, yPos, 800, rowHeight, 0x2000030);
format = StringIds::wcolour2_stringid;
}

View File

@ -443,7 +443,7 @@ namespace OpenLoco::Ui::Windows::LandscapeGeneration
Gfx::drawString_494BBF(context, 24, yPos + 5, 121, Colour::black, StringIds::wcolour2_stringid, &*commonFormatArgs);
// Draw rectangle.
Gfx::fillRectInset(&context, 150, yPos + 5, 340, yPos + 16, window.getColour(WindowColour::secondary), 0b110000);
Gfx::fillRectInset(context, 150, yPos + 5, 340, yPos + 16, window.getColour(WindowColour::secondary), 0b110000);
// Draw current distribution setting.
const string_id distributionId = landDistributionLabelIds[S5::getOptions().landDistributionPatterns[i]];
@ -452,7 +452,7 @@ namespace OpenLoco::Ui::Windows::LandscapeGeneration
// Draw rectangle (knob).
const uint8_t flags = window.row_hover == i ? 0b110000 : 0;
Gfx::fillRectInset(&context, 329, yPos + 6, 339, yPos + 15, window.getColour(WindowColour::secondary), flags);
Gfx::fillRectInset(context, 329, yPos + 6, 339, yPos + 15, window.getColour(WindowColour::secondary), flags);
// Draw triangle (knob).
Gfx::drawString_494B3F(context, 330, yPos + 6, Colour::black, StringIds::dropdown, nullptr);

View File

@ -137,7 +137,7 @@ namespace OpenLoco::Ui::Windows::MapToolTip
auto right = left + 25;
auto bottom = top + 25;
Gfx::fillRect(context, left, top, right, bottom, Colour::aquamarine);
Gfx::fillRect(*context, left, top, right, bottom, Colour::aquamarine);
auto* company = CompanyManager::get(_mapTooltipOwner);
auto* competitor = ObjectManager::get<CompetitorObject>(company->competitor_id);

View File

@ -592,7 +592,7 @@ namespace OpenLoco::Ui::Windows::MapWindow
auto colour = overallColours[i];
if (!(self->var_854 & (1 << i)) || !(mapFrameNumber & (1 << 2)))
{
Gfx::drawRect(context, x, *y + 3, 5, 5, colour);
Gfx::drawRect(*context, x, *y + 3, 5, 5, colour);
}
auto args = FormatArguments();
args.push(lineNames[i]);
@ -638,7 +638,7 @@ namespace OpenLoco::Ui::Windows::MapWindow
{
auto colour = vehicleTypeColours[i];
Gfx::drawRect(context, x, *y + 3, 5, 5, colour);
Gfx::drawRect(*context, x, *y + 3, 5, 5, colour);
}
auto args = FormatArguments();
args.push(lineNames[i]);
@ -704,7 +704,7 @@ namespace OpenLoco::Ui::Windows::MapWindow
{
auto colour = industryColours[_byte_F253CE[i]];
Gfx::drawRect(context, x, *y + 3, 5, 5, colour);
Gfx::drawRect(*context, x, *y + 3, 5, 5, colour);
}
auto args = FormatArguments();
@ -733,7 +733,7 @@ namespace OpenLoco::Ui::Windows::MapWindow
if (!(self->var_854 & (1 << i)) || !(mapFrameNumber & (1 << 2)))
{
Gfx::drawRect(context, x, *y + 3, 5, 5, colour);
Gfx::drawRect(*context, x, *y + 3, 5, 5, colour);
}
auto routeType = StringIds::map_routes_aircraft;
@ -783,7 +783,7 @@ namespace OpenLoco::Ui::Windows::MapWindow
if (!(self->var_854 & (1 << index)) || !(mapFrameNumber & (1 << 2)))
{
Gfx::drawRect(context, x, *y + 3, 5, 5, colour);
Gfx::drawRect(*context, x, *y + 3, 5, 5, colour);
}
auto args = FormatArguments();
@ -1003,7 +1003,7 @@ namespace OpenLoco::Ui::Windows::MapWindow
auto trainPos = locationToMapWindowPos(vehicle->position);
Gfx::fillRect(context, trainPos.x, trainPos.y, trainPos.x, trainPos.y, colour);
Gfx::fillRect(*context, trainPos.x, trainPos.y, trainPos.x, trainPos.y, colour);
}
// 0x0046C294
@ -1013,7 +1013,7 @@ namespace OpenLoco::Ui::Windows::MapWindow
if (endPos.x != Location::null)
{
Gfx::drawLine(context, endPos.x, endPos.y, newStartPos.x, newStartPos.y, colour);
Gfx::drawLine(*context, endPos.x, endPos.y, newStartPos.x, newStartPos.y, colour);
}
endPos = newStartPos;
@ -1094,7 +1094,7 @@ namespace OpenLoco::Ui::Windows::MapWindow
if (startPos.x == Location::null || endPos.x == Location::null)
return;
Gfx::drawLine(context, startPos.x, startPos.y, endPos.x, endPos.y, *colour);
Gfx::drawLine(*context, startPos.x, startPos.y, endPos.x, endPos.y, *colour);
}
// 0x0046C426
@ -1193,7 +1193,7 @@ namespace OpenLoco::Ui::Windows::MapWindow
std::swap(top, bottom);
}
Gfx::fillRect(context, left, top, right, bottom, colour);
Gfx::fillRect(*context, left, top, right, bottom, colour);
}
// 0x0046BE51

View File

@ -246,7 +246,7 @@ namespace OpenLoco::Ui::Windows::MessageWindow
if (self.row_hover == i)
{
Gfx::drawRect(&context, 0, height, self.width, 38, (1 << 25) | PaletteIndex::index_30);
Gfx::drawRect(context, 0, height, self.width, 38, (1 << 25) | PaletteIndex::index_30);
stringId = StringIds::wcolour2_stringid;
}

View File

@ -113,12 +113,12 @@ namespace OpenLoco::Ui::Windows::MusicSelection
// Draw hovered track
if (i == window.row_hover)
{
Gfx::drawRect(&context, 0, y, 800, rowHeight, 0x2000030);
Gfx::drawRect(context, 0, y, 800, rowHeight, 0x2000030);
text_colour_id = StringIds::wcolour2_stringid;
}
// Draw checkbox.
Gfx::fillRectInset(&context, 2, y, 11, y + 10, window.getColour(WindowColour::secondary), 0xE0);
Gfx::fillRectInset(context, 2, y, 11, y + 10, window.getColour(WindowColour::secondary), 0xE0);
// Draw checkmark if track is enabled.
if (config.enabled_music[i])

View File

@ -615,7 +615,7 @@ namespace OpenLoco::Ui::Windows::NewsWindow
auto width = self->widgets[Common::widx::viewport1].width() + 1;
auto height = self->widgets[Common::widx::viewport1].height() + 1;
auto colour = (1 << 25) | PaletteIndex::index_35;
Gfx::drawRect(context, x, y, width, height, colour);
Gfx::drawRect(*context, x, y, width, height, colour);
}
}
}
@ -631,7 +631,7 @@ namespace OpenLoco::Ui::Windows::NewsWindow
auto width = self->widgets[Common::widx::viewport2].width() + 1;
auto height = self->widgets[Common::widx::viewport2].height() + 1;
auto colour = (1 << 25) | PaletteIndex::index_35;
Gfx::drawRect(context, x, y, width, height, colour);
Gfx::drawRect(*context, x, y, width, height, colour);
}
}
}
@ -684,14 +684,14 @@ namespace OpenLoco::Ui::Windows::NewsWindow
auto width = self->width - 6;
auto height = self->height;
auto colour = (1 << 25) | PaletteIndex::index_68;
Gfx::drawRect(context, x, y, width, height, colour);
Gfx::drawRect(*context, x, y, width, height, colour);
x = self->widgets[Common::widx::viewport1].left + self->x;
y = self->widgets[Common::widx::viewport1].top + self->y;
width = self->widgets[Common::widx::viewport1].width();
height = self->widgets[Common::widx::viewport1].height();
colour = (1 << 25) | PaletteIndex::index_68;
Gfx::drawRect(context, x, y, width, height, colour);
Gfx::drawRect(*context, x, y, width, height, colour);
}
// 0x00429761
@ -726,7 +726,7 @@ namespace OpenLoco::Ui::Windows::NewsWindow
auto width = self->widgets[Common::widx::viewport1].width();
auto height = self->widgets[Common::widx::viewport1].height();
auto colour = (1 << 25) | PaletteIndex::index_35;
Gfx::drawRect(context, x, y, width, height, colour);
Gfx::drawRect(*context, x, y, width, height, colour);
}
}
}
@ -742,7 +742,7 @@ namespace OpenLoco::Ui::Windows::NewsWindow
auto width = self->widgets[Common::widx::viewport2].width();
auto height = self->widgets[Common::widx::viewport2].height();
auto colour = (1 << 25) | PaletteIndex::index_35;
Gfx::drawRect(context, x, y, width, height, colour);
Gfx::drawRect(*context, x, y, width, height, colour);
}
}
}

View File

@ -292,7 +292,7 @@ namespace OpenLoco::Ui::Windows::ObjectSelectionWindow
if (row < 1)
{
auto colour = Colour::getShade(self->getColour(WindowColour::secondary), 7);
Gfx::drawRect(context, xPos, yPos + 26, 31, 1, colour);
Gfx::drawRect(*context, xPos, yPos + 26, 31, 1, colour);
}
}
xPos += 31;
@ -501,7 +501,7 @@ namespace OpenLoco::Ui::Windows::ObjectSelectionWindow
// 0x004733F5
static void draw(Window* self, Gfx::Context* context)
{
Gfx::fillRectInset(context, self->x, self->y + 20, self->x + self->width - 1, self->y + 20 + 60, self->getColour(WindowColour::primary), 0);
Gfx::fillRectInset(*context, self->x, self->y + 20, self->x + self->width - 1, self->y + 20 + 60, self->getColour(WindowColour::primary), 0);
self->draw(context);
drawTabs(self, context);
@ -521,13 +521,13 @@ namespace OpenLoco::Ui::Windows::ObjectSelectionWindow
{
auto widget = widgets[widx::objectImage];
auto colour = Colour::getShade(self->getColour(WindowColour::secondary), 5);
Gfx::drawRect(context, self->x + widget.left, self->y + widget.top, widget.width(), widget.height(), colour);
Gfx::drawRect(*context, self->x + widget.left, self->y + widget.top, widget.width(), widget.height(), colour);
}
else
{
auto widget = widgets[widx::objectImage];
auto colour = Colour::getShade(self->getColour(WindowColour::secondary), 0);
Gfx::drawRect(context, self->x + widget.left + 1, self->y + widget.top + 1, widget.width() - 2, widget.height() - 2, colour);
Gfx::drawRect(*context, self->x + widget.left + 1, self->y + widget.top + 1, widget.width() - 2, widget.height() - 2, colour);
}
auto type = self->current_tab;
@ -598,7 +598,7 @@ namespace OpenLoco::Ui::Windows::ObjectSelectionWindow
for (auto [i, object] : objects)
{
uint8_t flags = (1 << 7) | (1 << 6) | (1 << 5);
Gfx::fillRectInset(&context, 2, y, 11, y + 10, self.getColour(WindowColour::secondary), flags);
Gfx::fillRectInset(context, 2, y, 11, y + 10, self.getColour(WindowColour::secondary), flags);
uint8_t textColour = ControlCodes::colour_black;
@ -608,7 +608,7 @@ namespace OpenLoco::Ui::Windows::ObjectSelectionWindow
auto windowObjectName = ObjectManager::ObjectIndexEntry::read(&objectPtr)._name;
if (object._name == windowObjectName)
{
Gfx::fillRect(&context, 0, y, self.width, y + rowHeight - 1, (1 << 25) | PaletteIndex::index_30);
Gfx::fillRect(context, 0, y, self.width, y + rowHeight - 1, (1 << 25) | PaletteIndex::index_30);
textColour = ControlCodes::window_colour_2;
}
}

View File

@ -208,12 +208,12 @@ namespace OpenLoco::Ui::Windows::PlayerInfoPanel
static void draw(Ui::Window* window, Gfx::Context* context)
{
Widget& frame = _widgets[Widx::outer_frame];
Gfx::drawRect(context, window->x + frame.left, window->y + frame.top, frame.width(), frame.height(), 0x2000000 | 52);
Gfx::drawRect(*context, window->x + frame.left, window->y + frame.top, frame.width(), frame.height(), 0x2000000 | 52);
// Draw widgets.
window->draw(context);
drawRectInset(context, window->x + frame.left + 1, window->y + frame.top + 1, frame.width() - 2, frame.height() - 2, window->getColour(WindowColour::secondary), 0x30);
drawRectInset(*context, window->x + frame.left + 1, window->y + frame.top + 1, frame.width() - 2, frame.height() - 2, window->getColour(WindowColour::secondary), 0x30);
auto playerCompany = CompanyManager::get(CompanyManager::getControllingId());
auto competitor = ObjectManager::get<CompetitorObject>(playerCompany->competitor_id);

View File

@ -488,7 +488,7 @@ namespace OpenLoco::Ui::Windows::PromptBrowse
{
loco_global<char[16], 0x0112C826> _commonFormatArgs;
Gfx::fillRectInset(&context, x, y, x + width, y + height, window.getColour(WindowColour::secondary), 0x30);
Gfx::fillRectInset(context, x, y, x + width, y + height, window.getColour(WindowColour::secondary), 0x30);
auto imageId = 0;
auto g1 = Gfx::getG1Element(imageId);
@ -539,7 +539,7 @@ namespace OpenLoco::Ui::Windows::PromptBrowse
static void drawLandscapePreview(Ui::Window& window, Gfx::Context& context, int32_t x, int32_t y, int32_t width, int32_t height)
{
Gfx::fillRectInset(&context, x, y, x + width, y + height, window.getColour(WindowColour::secondary), 0x30);
Gfx::fillRectInset(context, x, y, x + width, y + height, window.getColour(WindowColour::secondary), 0x30);
if (S5::getPreviewOptions().scenarioFlags & Scenario::flags::landscape_generation_done)
{
@ -598,7 +598,7 @@ namespace OpenLoco::Ui::Windows::PromptBrowse
Gfx::drawString_494B3F(context, &origin, 0, StringIds::black_stringid, _commonFormatArgs);
// Draw vertical caret
Gfx::drawRect(&context, origin.x, origin.y, 1, 9, byte_1136C99[window->getColour(WindowColour::secondary) * 8]);
Gfx::drawRect(context, origin.x, origin.y, 1, 9, byte_1136C99[window->getColour(WindowColour::secondary) * 8]);
}
}
}
@ -626,7 +626,7 @@ namespace OpenLoco::Ui::Windows::PromptBrowse
auto stringId = StringIds::black_stringid;
if (i == window.var_85A)
{
Gfx::drawRect(&context, 0, y, window.width, lineHeight, 0x2000000 | 48);
Gfx::drawRect(context, 0, y, window.width, lineHeight, 0x2000000 | 48);
stringId = StringIds::wcolour2_stringid;
}

View File

@ -153,7 +153,7 @@ namespace OpenLoco::Ui::Windows::ScenarioSelect
// 0x004439AF
static void draw(Window* self, Gfx::Context* context)
{
Gfx::drawRectInset(context, self->x, self->y + 20, self->width, 41, self->getColour(WindowColour::primary), 0);
Gfx::drawRectInset(*context, self->x, self->y + 20, self->width, 41, self->getColour(WindowColour::primary), 0);
// Draw widgets.
self->draw(context);
@ -227,7 +227,7 @@ namespace OpenLoco::Ui::Windows::ScenarioSelect
// Outline for preview image
{
x = baseX + 20;
Gfx::drawRectInset(context, x, y, 130, 130, self->getColour(WindowColour::secondary), 0x30);
Gfx::drawRectInset(*context, x, y, 130, 130, self->getColour(WindowColour::secondary), 0x30);
x += 1;
y += 1;
@ -351,7 +351,7 @@ namespace OpenLoco::Ui::Windows::ScenarioSelect
auto formatStringId = StringIds::black_stringid;
if (scenarioInfo == reinterpret_cast<ScenarioIndexEntry*>(self.info))
{
Gfx::drawRect(&context, 0, y, self.width, rowHeight - 1, 0x2000000 | 48);
Gfx::drawRect(context, 0, y, self.width, rowHeight - 1, 0x2000000 | 48);
formatStringId = StringIds::wcolour2_stringid;
}

View File

@ -482,7 +482,7 @@ namespace OpenLoco::Ui::Windows::StationList
// Highlight selection.
if (stationId == window.row_hover)
{
Gfx::drawRect(&context, 0, yPos, window.width, rowHeight, 0x2000030);
Gfx::drawRect(context, 0, yPos, window.width, rowHeight, 0x2000030);
text_colour_id = StringIds::wcolour2_stringid;
}

View File

@ -655,12 +655,12 @@ namespace OpenLoco::Ui::Windows::Station
// 0x0048EF02
static void drawRatingBar(Window* self, Gfx::Context* context, int16_t x, int16_t y, uint8_t amount, Colour_t colour)
{
Gfx::fillRectInset(context, x, y, x + 99, y + 9, self->getColour(WindowColour::secondary), 48);
Gfx::fillRectInset(*context, x, y, x + 99, y + 9, self->getColour(WindowColour::secondary), 48);
uint16_t rating = (amount * 96) / 256;
if (rating > 2)
{
Gfx::fillRectInset(context, x + 2, y + 2, x + 1 + rating, y + 8, colour, 0);
Gfx::fillRectInset(*context, x + 2, y + 2, x + 1 + rating, y + 8, colour, 0);
}
}
@ -980,7 +980,7 @@ namespace OpenLoco::Ui::Windows::Station
auto& cargo = cargoStats;
if (!cargo.empty())
{
Gfx::fillRect(context, xOffset, yOffset, xOffset + 22, yOffset + 1, (1 << 25) | PaletteIndex::index_30);
Gfx::fillRect(*context, xOffset, yOffset, xOffset + 22, yOffset + 1, (1 << 25) | PaletteIndex::index_30);
auto ratingColour = Colour::moss_green;
if (cargo.rating < 100)
@ -991,7 +991,7 @@ namespace OpenLoco::Ui::Windows::Station
}
auto ratingBarLength = (cargo.rating * 30) / 256;
Gfx::fillRect(context, xOffset, yOffset, xOffset - 1 + ratingBarLength, yOffset + 1, Colour::getShade(ratingColour, 6));
Gfx::fillRect(*context, xOffset, yOffset, xOffset - 1 + ratingBarLength, yOffset + 1, Colour::getShade(ratingColour, 6));
yOffset += 3;
totalRatingBars++;

View File

@ -906,13 +906,13 @@ namespace OpenLoco::Ui::Windows::Terraform
if (self.row_info[i] == self.var_846)
{
_lastTreeColourFlag = Colour::translucent_flag;
Gfx::drawRectInset(&context, xPos, yPos, 65, rowHeight - 1, self.getColour(WindowColour::secondary), Colour::translucent_flag);
Gfx::drawRectInset(context, xPos, yPos, 65, rowHeight - 1, self.getColour(WindowColour::secondary), Colour::translucent_flag);
}
}
else
{
_lastTreeColourFlag = Colour::translucent_flag | Colour::outline_flag;
Gfx::drawRectInset(&context, xPos, yPos, 65, rowHeight - 1, self.getColour(WindowColour::secondary), (Colour::translucent_flag | Colour::outline_flag));
Gfx::drawRectInset(context, xPos, yPos, 65, rowHeight - 1, self.getColour(WindowColour::secondary), (Colour::translucent_flag | Colour::outline_flag));
}
auto treeObj = ObjectManager::get<TreeObject>(self.row_info[i]);
@ -2340,12 +2340,12 @@ namespace OpenLoco::Ui::Windows::Terraform
{
if (self.row_info[i] == self.var_846)
{
Gfx::drawRectInset(&context, xPos, yPos, 40, rowHeight, self.getColour(WindowColour::secondary), Colour::translucent_flag);
Gfx::drawRectInset(context, xPos, yPos, 40, rowHeight, self.getColour(WindowColour::secondary), Colour::translucent_flag);
}
}
else
{
Gfx::drawRectInset(&context, xPos, yPos, 40, rowHeight, self.getColour(WindowColour::secondary), (Colour::translucent_flag | Colour::outline_flag));
Gfx::drawRectInset(context, xPos, yPos, 40, rowHeight, self.getColour(WindowColour::secondary), (Colour::translucent_flag | Colour::outline_flag));
}
auto wallObj = ObjectManager::get<WallObject>(self.row_info[i]);

View File

@ -268,7 +268,7 @@ namespace OpenLoco::Ui::Windows::TextInput
*((string_id*)(&_commonFormatArgs[0])) = StringIds::buffer_2039;
position = { inputSession.xOffset, 1 };
Gfx::drawString_494B3F(*clipped, &position, 0, StringIds::black_stringid, _commonFormatArgs);
Gfx::fillRect(&*clipped, position.x, position.y, position.x, position.y + 9, Colour::getShade(window->getColour(WindowColour::secondary), 9));
Gfx::fillRect(*clipped, position.x, position.y, position.x, position.y + 9, Colour::getShade(window->getColour(WindowColour::secondary), 9));
}
// 0x004CE8B6

View File

@ -344,12 +344,12 @@ namespace OpenLoco::Ui::Windows::TileInspector
string_id formatString;
if (self.var_842 == rowNum)
{
Gfx::fillRect(&context, 0, yPos, self.width, yPos + self.row_height, Colour::aquamarine);
Gfx::fillRect(context, 0, yPos, self.width, yPos + self.row_height, Colour::aquamarine);
formatString = StringIds::white_stringid;
}
else if (self.row_hover == rowNum)
{
Gfx::fillRect(&context, 0, yPos, self.width, yPos + self.row_height, 0x2000030);
Gfx::fillRect(context, 0, yPos, self.width, yPos + self.row_height, 0x2000030);
formatString = StringIds::wcolour2_stringid;
}
else

View File

@ -175,12 +175,12 @@ namespace OpenLoco::Ui::Windows::TimePanel
static void draw(Ui::Window* self, Gfx::Context* context)
{
Widget& frame = _widgets[Widx::outer_frame];
Gfx::drawRect(context, self->x + frame.left, self->y + frame.top, frame.width(), frame.height(), 0x2000000 | 52);
Gfx::drawRect(*context, self->x + frame.left, self->y + frame.top, frame.width(), frame.height(), 0x2000000 | 52);
// Draw widgets.
self->draw(context);
Gfx::drawRectInset(context, self->x + frame.left + 1, self->y + frame.top + 1, frame.width() - 2, frame.height() - 2, self->getColour(WindowColour::secondary), 0x30);
Gfx::drawRectInset(*context, self->x + frame.left + 1, self->y + frame.top + 1, frame.width() - 2, frame.height() - 2, self->getColour(WindowColour::secondary), 0x30);
*(uint32_t*)&_common_format_args[0] = getCurrentDay();
string_id format = StringIds::date_monthyear;

View File

@ -174,18 +174,18 @@ namespace OpenLoco::Ui::Windows::ToolTip
uint16_t width = window->width;
uint16_t height = window->height;
Gfx::drawRect(context, x + 1, y + 1, width - 2, height - 2, 0x2000000 | 45);
Gfx::drawRect(context, x + 1, y + 1, width - 2, height - 2, 0x2000000 | (116 + ObjectManager::get<InterfaceSkinObject>()->colour_08));
Gfx::drawRect(*context, x + 1, y + 1, width - 2, height - 2, 0x2000000 | 45);
Gfx::drawRect(*context, x + 1, y + 1, width - 2, height - 2, 0x2000000 | (116 + ObjectManager::get<InterfaceSkinObject>()->colour_08));
Gfx::drawRect(context, x, y + 2, 1, height - 4, 0x2000000 | 46);
Gfx::drawRect(context, x + width - 1, y + 2, 1, height - 4, 0x2000000 | 46);
Gfx::drawRect(context, x + 2, y + height - 1, width - 4, 1, 0x2000000 | 46);
Gfx::drawRect(context, x + 2, y, width - 4, 1, 0x2000000 | 46);
Gfx::drawRect(*context, x, y + 2, 1, height - 4, 0x2000000 | 46);
Gfx::drawRect(*context, x + width - 1, y + 2, 1, height - 4, 0x2000000 | 46);
Gfx::drawRect(*context, x + 2, y + height - 1, width - 4, 1, 0x2000000 | 46);
Gfx::drawRect(*context, x + 2, y, width - 4, 1, 0x2000000 | 46);
Gfx::drawRect(context, x + 1, y + 1, 1, 1, 0x2000000 | 46);
Gfx::drawRect(context, x + width - 1 - 1, y + 1, 1, 1, 0x2000000 | 46);
Gfx::drawRect(context, x + 1, y + height - 1 - 1, 1, 1, 0x2000000 | 46);
Gfx::drawRect(context, x + width - 1 - 1, y + height - 1 - 1, 1, 1, 0x2000000 | 46);
Gfx::drawRect(*context, x + 1, y + 1, 1, 1, 0x2000000 | 46);
Gfx::drawRect(*context, x + width - 1 - 1, y + 1, 1, 1, 0x2000000 | 46);
Gfx::drawRect(*context, x + 1, y + height - 1 - 1, 1, 1, 0x2000000 | 46);
Gfx::drawRect(*context, x + width - 1 - 1, y + height - 1 - 1, 1, 1, 0x2000000 | 46);
Gfx::drawStringCentredRaw(*context, ((width + 1) / 2) + x - 1, y + 1, _lineBreakCount, Colour::black, _text);
}

View File

@ -69,17 +69,17 @@ namespace OpenLoco::Ui::Windows::ToolbarBottom::Editor
if (EditorController::canGoBack())
{
Gfx::drawRect(ctx, previous.left + self->x, previous.top + self->y, previous.width(), previous.height(), 0x2000000 | 52);
Gfx::drawRect(*ctx, previous.left + self->x, previous.top + self->y, previous.width(), previous.height(), 0x2000000 | 52);
}
Gfx::drawRect(ctx, next.left + self->x, next.top + self->y, next.width(), next.height(), 0x2000000 | 52);
Gfx::drawRect(*ctx, next.left + self->x, next.top + self->y, next.width(), next.height(), 0x2000000 | 52);
self->draw(ctx);
if (EditorController::canGoBack())
{
Gfx::drawRectInset(ctx, previous.left + self->x + 1, previous.top + self->y + 1, previous.width() - 2, previous.height() - 2, self->getColour(WindowColour::secondary), 0x30);
Gfx::drawRectInset(*ctx, previous.left + self->x + 1, previous.top + self->y + 1, previous.width() - 2, previous.height() - 2, self->getColour(WindowColour::secondary), 0x30);
}
Gfx::drawRectInset(ctx, next.left + self->x + 1, next.top + self->y + 1, next.width() - 2, next.height() - 2, self->getColour(WindowColour::secondary), 0x30);
Gfx::drawRectInset(*ctx, next.left + self->x + 1, next.top + self->y + 1, next.width() - 2, next.height() - 2, self->getColour(WindowColour::secondary), 0x30);
Gfx::drawStringCentred(*ctx, (previous.right + next.left) / 2 + self->x, self->y + self->height - 12, Colour::opaque(self->getColour(WindowColour::tertiary)) | Colour::outline_flag, _stepNames[EditorController::getCurrentStep()]);

View File

@ -164,7 +164,7 @@ namespace OpenLoco::Ui::Windows::TownList
// Highlight selection.
if (townId == self.row_hover)
{
Gfx::drawRect(&context, 0, yPos, self.width, rowHeight, 0x2000030);
Gfx::drawRect(context, 0, yPos, self.width, rowHeight, 0x2000030);
text_colour_id = StringIds::wcolour2_stringid;
}
@ -1195,12 +1195,12 @@ namespace OpenLoco::Ui::Windows::TownList
{
if (self.row_info[i] == self.var_846)
{
Gfx::drawRectInset(&context, xPos, yPos, 112, 112, self.getColour(WindowColour::secondary), Colour::translucent_flag);
Gfx::drawRectInset(context, xPos, yPos, 112, 112, self.getColour(WindowColour::secondary), Colour::translucent_flag);
}
}
else
{
Gfx::drawRectInset(&context, xPos, yPos, 112, 112, self.getColour(WindowColour::secondary), (Colour::translucent_flag | Colour::outline_flag));
Gfx::drawRectInset(context, xPos, yPos, 112, 112, self.getColour(WindowColour::secondary), (Colour::translucent_flag | Colour::outline_flag));
}
auto buildingObj = ObjectManager::get<BuildingObject>(self.row_info[i]);

View File

@ -414,7 +414,7 @@ namespace OpenLoco::Ui::Windows::Town
args.push(yTick);
const uint16_t xPos = 39;
Gfx::drawRect(&*clipped, xPos, yPos, 241, 1, Colour::getShade(self->getColour(WindowColour::secondary), 4));
Gfx::drawRect(*clipped, xPos, yPos, 241, 1, Colour::getShade(self->getColour(WindowColour::secondary), 4));
Gfx::drawString_494C78(*clipped, xPos, yPos - 6, Colour::black, StringIds::population_graph_people, &args);
@ -441,7 +441,7 @@ namespace OpenLoco::Ui::Windows::Town
Gfx::drawStringCentred(*clipped, xPos, yPos, Colour::black, StringIds::population_graph_year, &args);
}
Gfx::drawRect(&*clipped, xPos, 11, 1, self->height - 66, Colour::getShade(self->getColour(WindowColour::secondary), 4));
Gfx::drawRect(*clipped, xPos, 11, 1, self->height - 66, Colour::getShade(self->getColour(WindowColour::secondary), 4));
}
// Draw population graph
@ -450,7 +450,7 @@ namespace OpenLoco::Ui::Windows::Town
// Do not draw current segment yet; it may be zeroed.
if (i < town->history_size - 1)
Gfx::drawLine(&*clipped, xPos, yPos1, xPos + 1, yPos2, Colour::getShade(self->getColour(WindowColour::secondary), 7));
Gfx::drawLine(*clipped, xPos, yPos1, xPos + 1, yPos2, Colour::getShade(self->getColour(WindowColour::secondary), 7));
month--;
if (month < 0)

View File

@ -1458,7 +1458,7 @@ namespace OpenLoco::Ui::Windows::Vehicle
top = pos.y - 1;
carStr = StringIds::black_stringid;
}
Gfx::fillRect(&context, 0, top, self.width, bottom, 0x2000030);
Gfx::fillRect(context, 0, top, self.width, bottom, 0x2000030);
}
int16_t y = pos.y + (self.row_height - 22) / 2;
@ -1483,7 +1483,7 @@ namespace OpenLoco::Ui::Windows::Vehicle
if (self.row_hover == train.tail->id && _dragCarComponent != nullptr)
{
Gfx::fillRect(&context, 0, pos.y - 1, self.width, pos.y, 0x2000030);
Gfx::fillRect(context, 0, pos.y - 1, self.width, pos.y, 0x2000030);
}
}
@ -1732,7 +1732,7 @@ namespace OpenLoco::Ui::Windows::Vehicle
auto body = car.body;
if (front->id == self.row_hover)
{
Gfx::fillRect(&context, 0, y, self.width, y + self.row_height - 1, 0x2000030);
Gfx::fillRect(context, 0, y, self.width, y + self.row_height - 1, 0x2000030);
strFormat = StringIds::wcolour2_stringid;
}
// Get width of the drawing
@ -3104,13 +3104,13 @@ namespace OpenLoco::Ui::Windows::Vehicle
auto strFormat = StringIds::black_stringid;
if (self.var_842 == rowNum)
{
Gfx::fillRect(&context, 0, y, self.width, y + 9, Colour::aquamarine);
Gfx::fillRect(context, 0, y, self.width, y + 9, Colour::aquamarine);
strFormat = StringIds::white_stringid;
}
if (self.row_hover == rowNum)
{
strFormat = StringIds::wcolour2_stringid;
Gfx::fillRect(&context, 0, y, self.width, y + 9, 0x2000030);
Gfx::fillRect(context, 0, y, self.width, y + 9, 0x2000030);
}
FormatArguments args{};
@ -3152,13 +3152,13 @@ namespace OpenLoco::Ui::Windows::Vehicle
auto strFormat = StringIds::black_stringid;
if (self.var_842 == rowNum)
{
Gfx::fillRect(&context, 0, loc.y, self.width, loc.y + lineHeight, Colour::aquamarine);
Gfx::fillRect(context, 0, loc.y, self.width, loc.y + lineHeight, Colour::aquamarine);
strFormat = StringIds::white_stringid;
}
if (self.row_hover == rowNum)
{
strFormat = StringIds::wcolour2_stringid;
Gfx::fillRect(&context, 0, loc.y, self.width, loc.y + lineHeight, 0x2000030);
Gfx::fillRect(context, 0, loc.y, self.width, loc.y + lineHeight, 0x2000030);
}
loc.y -= 1;

View File

@ -723,7 +723,7 @@ namespace OpenLoco::Ui::Windows::VehicleList
// Highlight selection.
if (head->id == self.row_hover)
Gfx::drawRect(&context, 0, yPos, self.width, self.row_height, Colour::getShade(self.getColour(WindowColour::secondary), 0));
Gfx::drawRect(context, 0, yPos, self.width, self.row_height, Colour::getShade(self.getColour(WindowColour::secondary), 0));
// Draw vehicle at the bottom of the row.
drawVehicle(head, &context, yPos + (self.row_height - 28) / 2 + 6);