77 lines
1.8 KiB
Plaintext
77 lines
1.8 KiB
Plaintext
@startuml
|
|
title Цикл отрисовки окна (window_thread)
|
|
|
|
start
|
|
|
|
:window_thread запущен;
|
|
|
|
:Создать event queue;
|
|
:window_init();
|
|
:Запустить aux_thread для анимации;
|
|
|
|
while (окно не закрыто?) is (да)
|
|
|
|
:wl_display_dispatch_queue();
|
|
note right: Ожидание событий Wayland
|
|
|
|
if (событие произошло?) then (да)
|
|
|
|
if (xdg_surface_configure?) then (да)
|
|
:xdg_surface_ack_configure();
|
|
if (буфер не создан?) then (да)
|
|
:resize_canvas();
|
|
endif
|
|
:draw();
|
|
endif
|
|
|
|
if (xdg_toplevel_configure?) then (да)
|
|
if (размер изменился?) then (да)
|
|
:resize_new(w, h);
|
|
note right
|
|
- Освободить старый буфер
|
|
- Создать новый буфер
|
|
- Обновить размеры draw_info
|
|
end note
|
|
endif
|
|
endif
|
|
|
|
if (xdg_toplevel_close?) then (да)
|
|
:Установить need_close = 1;
|
|
endif
|
|
|
|
if (frame_callback?) then (да)
|
|
:Уничтожить старый callback;
|
|
:Создать новый callback;
|
|
|
|
partition "draw()" {
|
|
:Залочить figure_mutex;
|
|
|
|
:Очистить фон (черный);
|
|
|
|
:figure_draw();
|
|
note right
|
|
- Получить текущую фигуру
|
|
- Нарисовать границу и заливку
|
|
- Цвет зависит от типа фигуры
|
|
end note
|
|
|
|
:Разлочить figure_mutex;
|
|
|
|
:wl_surface_attach(buffer);
|
|
:wl_surface_damage_buffer();
|
|
:wl_surface_commit();
|
|
}
|
|
endif
|
|
|
|
endif
|
|
|
|
endwhile (нет)
|
|
|
|
:window_destroy();
|
|
:Уничтожить event queue;
|
|
:signal_thread_exit();
|
|
|
|
stop
|
|
|
|
@enduml
|