feat: Enhance glyph caching and tooltip management

- Added a new atomic cache versioning system to track glyph updates in glyph_cache.
- Introduced methods to check for pending glyph tasks and retrieve the current cache version.
- Improved text shaping logic to estimate glyph advances for unready glyphs, ensuring smoother rendering.
- Refactored render_thread to focus on a single target window for rendering, enhancing performance.
- Updated thread_coordinator to manage window IDs and ensure proper rendering context.
- Implemented a new tooltip management system using render_window for better rendering control.
- Enhanced tooltip display logic to dynamically create and resize tooltip windows based on content.
- Added functionality to pre-request glyphs for tooltips to ensure they are ready when displayed.
- Improved window management with additional methods for setting position, resizing, and visibility checks.
This commit is contained in:
daiqingshuang
2025-12-18 14:05:36 +08:00
parent 52af669649
commit 7de09daeb1
32 changed files with 1370 additions and 528 deletions

View File

@@ -4,6 +4,7 @@
#include "ui/widgets/containers/overlay.h"
#include "ui/widgets/containers/scroll_box/scroll_box.h"
#include "ui/window/render_window.h"
#include "ui/tooltip/tooltip_types.h"
#include "render/image/texture_manager.h"
#include "render/text/font_manager.h"
#include "ui/widgets/imager.h"
@@ -27,7 +28,6 @@ int main(int argc, char* argv[]) {
window_config.title = "Test Thread";
window_config.width = 800;
window_config.height = 600;
window_config.enable_multithreading = true;
window_config.vsync = true;
if (!app.initialize(config, window_config)) {
@@ -48,6 +48,11 @@ int main(int argc, char* argv[]) {
throw std::runtime_error("加载字体失败");
const auto font_id = font_result.value();
// 设置 tooltip 默认字体
tooltip_config tooltip_cfg;
tooltip_cfg.default_font_id = font_id;
app.get_main_window()->set_tooltip_config(tooltip_cfg);
const auto root_widget = new_widget<scroll_box>()[
new_widget<text_widget>()->font_id(font_id).text("你好,我们在此相遇").font_size(24).tooltip("测试tooltip"),
new_widget<text_input>()->font_id(font_id).font_size(24),