From e11048c20a50b67841e648a4d5ddd7490bc9c9b7 Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Mon, 28 Sep 2026 13:24:06 -0300 Subject: Paint into a target Surface instead of swapping the frame's out The painters of a pane's body and tag (renderBody and its selection, gutter, syntax, ANSI and wrap-marker passes; paintPaneTag; paintHeaders; renderPane; the image and PDF grid paths) take the Surface they paint as a parameter. The body layer and the tag layers paint straight into their own temporary surfaces, and the std.mem.swap of p.surface around those calls is gone. No behaviour change. --- src/pdf_view.zig | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src/pdf_view.zig') diff --git a/src/pdf_view.zig b/src/pdf_view.zig index b2fd5866..78d3de27 100644 --- a/src/pdf_view.zig +++ b/src/pdf_view.zig @@ -2542,6 +2542,7 @@ pub fn horizontalWheel(core: *pardes.Pardes, pane: *pardes.Pane, direction: i8) pub fn draw( core: *pardes.Pardes, + s: *pardes.Surface, pane: *pardes.Pane, rect: pardes.Rect, pane_id: usize, @@ -2622,8 +2623,8 @@ pub fn draw( const theme = core.theme(); const pane_bg: pardes.Color = if (theme.bg) |color| .{ .rgb = color } else .default; // The rail runs past the notice bands; only the thumb tracks the text. - core.surface.fill(rect.x, body_y, 1, body_h, .{ .bg = .{ .rgb = chrome.scroll_track } }); - core.surface.fill(rect.x + 1, body_y, 1, body_h, .{ .bg = pane_bg }); + s.fill(rect.x, body_y, 1, body_h, .{ .bg = .{ .rgb = chrome.scroll_track } }); + s.fill(rect.x + 1, body_y, 1, body_h, .{ .bg = pane_bg }); const track_h: usize = body_h; const total = @max(@as(u64, 1), state.document_height); @@ -2641,7 +2642,7 @@ pub fn draw( )); var y = pos; while (y < track_h and y < pos + len) : (y += 1) - core.surface.fill( + s.fill( rect.x, body_y + @as(u16, @intCast(y)), 1, -- cgit v1.3