1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-21 05:53:02 +01:00

Part of #12097: Use ScreenRect on gfx_fill_rect_inset (1) (#12938)

* Part of #12097: Use ScreenRect on gfx_fill_rect_inset (1)

Co-authored-by: Tulio Leao <tupaschoal@gmail.com>
This commit is contained in:
frutiemax
2020-09-15 23:02:22 -04:00
committed by GitHub
parent 48f1335559
commit af591c834b
8 changed files with 62 additions and 52 deletions

View File

@@ -131,16 +131,23 @@ void chat_draw(rct_drawpixelinfo* dpi, uint8_t chatBackgroundColor)
_chatHeight = 150;
}
gfx_set_dirty_blocks({ { _chatLeft, _chatTop - 5 }, { _chatRight, _chatBottom + 5 } }); // Background area + Textbox
ScreenCoordsXY topLeft{ _chatLeft, _chatTop };
ScreenCoordsXY bottomRight{ _chatRight, _chatBottom };
ScreenCoordsXY bottomLeft{ _chatLeft, _chatBottom };
gfx_set_dirty_blocks(
{ topLeft - ScreenCoordsXY{ 0, 5 }, bottomRight + ScreenCoordsXY{ 0, 5 } }); // Background area + Textbox
gfx_filter_rect(
dpi, { { _chatLeft, _chatTop - 5 }, { _chatRight, _chatBottom + 5 } }, PALETTE_51); // Opaque gray background
dpi, { topLeft - ScreenCoordsXY{ 0, 5 }, bottomRight + ScreenCoordsXY{ 0, 5 } },
PALETTE_51); // Opaque gray background
gfx_fill_rect_inset(
dpi, _chatLeft, _chatTop - 5, _chatRight, _chatBottom + 5, chatBackgroundColor, INSET_RECT_FLAG_FILL_NONE);
dpi, { topLeft - ScreenCoordsXY{ 0, 5 }, bottomRight + ScreenCoordsXY{ 0, 5 } }, chatBackgroundColor,
INSET_RECT_FLAG_FILL_NONE);
gfx_fill_rect_inset(
dpi, _chatLeft + 1, _chatTop - 4, _chatRight - 1, _chatBottom - inputLineHeight - 6, chatBackgroundColor,
INSET_RECT_FLAG_BORDER_INSET);
dpi, { topLeft + ScreenCoordsXY{ 1, -4 }, bottomRight - ScreenCoordsXY{ 1, inputLineHeight + 6 } },
chatBackgroundColor, INSET_RECT_FLAG_BORDER_INSET);
gfx_fill_rect_inset(
dpi, _chatLeft + 1, _chatBottom - inputLineHeight - 5, _chatRight - 1, _chatBottom + 4, chatBackgroundColor,
dpi, { bottomLeft + ScreenCoordsXY{ 1, -inputLineHeight - 5 }, bottomRight + ScreenCoordsXY{ -1, 4 } },
chatBackgroundColor,
INSET_RECT_FLAG_BORDER_INSET); // Textbox
}