selective clearing

This commit is contained in:
Jorijn van der Graaf 2025-11-26 18:48:58 +01:00
commit 9bb36c990d
7 changed files with 98 additions and 30 deletions

View file

@ -34,7 +34,8 @@ TextElement::TextElement(std::int_fast32_t anchorX, std::int_fast32_t anchorY, s
}
void TextElement::RenderText(const std::string_view text, float size, Pixel_BU8_GU8_RU8_AU8 color, Font& font, TextAlignment alignment, VerticalTextAlignment verticalAlignment, TextOverflowMode overflowMode) {
void TextElement::RenderText(Window& window, const std::string_view text, float size, Pixel_BU8_GU8_RU8_AU8 color, Font& font, TextAlignment alignment, VerticalTextAlignment verticalAlignment, TextOverflowMode overflowMode) {
window.AddDirtyRect(scaled);
// Calculate the actual size needed for the text
float scale = stbtt_ScaleForPixelHeight(&font.font, size);
int baseline = (int)(font.ascent * scale);