1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-17 03:53:07 +01:00

Move gLastStringPos into rct_drawpixelinfo (#14811)

This commit is contained in:
ζeh Matt
2021-06-04 04:10:09 +03:00
committed by GitHub
parent 8f59fe91cb
commit 8fc7e06116
5 changed files with 7 additions and 13 deletions

View File

@@ -282,7 +282,7 @@ public:
if (!cur_drawn)
{
cursorX = gLastDrawStringX;
cursorX = dpi.lastStringPos.x;
cursorY = screenCoords.y - 10;
}

View File

@@ -959,8 +959,7 @@ void ttf_draw_string(
ttf_process_string(dpi, text, &info);
std::memcpy(text_palette, info.palette, sizeof(info.palette));
gLastDrawStringX = info.x;
gLastDrawStringY = info.y;
dpi->lastStringPos = { info.x, info.y };
}
static int32_t ttf_get_string_width(std::string_view text, FontSpriteBase fontSpriteBase, bool noFormatting)
@@ -1020,8 +1019,7 @@ void gfx_draw_string_with_y_offsets(
ttf_process_string(dpi, text, &info);
std::memcpy(text_palette, info.palette, sizeof(info.palette));
gLastDrawStringX = info.x;
gLastDrawStringY = info.y;
dpi->lastStringPos = { info.x, info.y };
}
void shorten_path(utf8* buffer, size_t bufferSize, const utf8* path, int32_t availableWidth, FontSpriteBase fontSpriteBase)

View File

@@ -81,10 +81,6 @@ void PaletteMap::Copy(size_t dstIndex, const PaletteMap& src, size_t srcIndex, s
std::memcpy(&_data[dstIndex], &src._data[srcIndex], copyLength);
}
// HACK These were originally passed back through registers
thread_local int32_t gLastDrawStringX;
thread_local int32_t gLastDrawStringY;
uint8_t gGamePalette[256 * 4];
uint32_t gPaletteEffectFrame;

View File

@@ -120,6 +120,9 @@ struct rct_drawpixelinfo
uint8_t remX{};
uint8_t remY{};
// Last position of drawn text.
ScreenCoordsXY lastStringPos{};
OpenRCT2::Drawing::IDrawingEngine* DrawingEngine{};
size_t GetBytesPerRow() const;
@@ -662,9 +665,6 @@ extern uint8_t gOtherPalette[256];
extern uint8_t text_palette[];
extern const translucent_window_palette TranslucentWindowPalettes[COLOUR_COUNT];
extern thread_local int32_t gLastDrawStringX;
extern thread_local int32_t gLastDrawStringY;
extern uint32_t gPickupPeepImage;
extern int32_t gPickupPeepX;
extern int32_t gPickupPeepY;

View File

@@ -112,7 +112,7 @@ void Painter::PaintFPS(rct_drawpixelinfo* dpi)
gfx_draw_string(dpi, screenCoords, buffer);
// Make area dirty so the text doesn't get drawn over the last
gfx_set_dirty_blocks({ { screenCoords - ScreenCoordsXY{ 16, 4 } }, { gLastDrawStringX + 16, 16 } });
gfx_set_dirty_blocks({ { screenCoords - ScreenCoordsXY{ 16, 4 } }, { dpi->lastStringPos.x + 16, 16 } });
}
void Painter::MeasureFPS()