LibGUI: Rework window rendering

Abstract drawing surface to Texture. All windows now contain a texture
matching its size.
This commit is contained in:
2025-05-05 23:08:01 +03:00
parent f78c7e7926
commit f959905adf
6 changed files with 40 additions and 214 deletions

View File

@@ -90,7 +90,7 @@ int main()
window->set_position(0, 0);
window->fill(bg_color);
window->texture().fill(bg_color);
window->invalidate();
bool is_running = true;
@@ -108,8 +108,9 @@ int main()
const uint32_t text_x = window->width() - text_w - padding;
const uint32_t text_y = padding;
window->fill_rect(text_x, text_y, text_w, text_h, bg_color);
window->draw_text(text, font, text_x, text_y, fg_color);
auto& texture = window->texture();
texture.fill_rect(text_x, text_y, text_w, text_h, bg_color);
texture.draw_text(text, font, text_x, text_y, fg_color);
window->invalidate(text_x, text_y, text_w, text_h);
};