статистика времени кадра

This commit is contained in:
2026-03-01 17:19:52 +03:00
parent 8ca31bf479
commit 9fa13fa913
8 changed files with 98 additions and 29 deletions

View File

@@ -24,17 +24,20 @@ scroll: dvui.ScrollInfo = .{
.horizontal = .auto,
},
native_scaling: bool = true,
redraw_throttle_ms: u32 = 50,
_visible_rect: ?Rect_i = null,
_zoom: f32 = 1,
_redraw_pending: bool = false,
_last_redraw_time_ms: i64 = 0,
cursor_document_point: ?Point2_f = null,
draw_document: bool = true,
show_render_stats: bool = true,
/// Rect тулбара (из предыдущего кадра) для исключения кликов по нему из handleCanvasMouse.
toolbar_rect_scale: ?dvui.RectScale = null,
/// Rect панели свойств (из предыдущего кадра) для исключения кликов по нему из handleCanvasMouse.
properties_rect_scale: ?dvui.RectScale = null,
redraw_throttle_ms: u32 = 50,
frame_index: u64 = 0,
_zoom: f32 = 1,
_last_redraw_time_ms: i64 = 0, // Метка последней перерисовки чтобы ограничить частоту
_visible_rect: ?Rect_i = null,
_redraw_pending: bool = false,
pub fn init(allocator: std.mem.Allocator, document: *Document, engine: RenderEngine) Canvas {
return .{
@@ -80,6 +83,7 @@ fn redraw(self: *Canvas) !void {
self.texture = tex;
}
self._last_redraw_time_ms = std.time.milliTimestamp();
self.frame_index += 1;
}
pub fn exampleReset(self: *Canvas) !void {