summaryrefslogtreecommitdiff
path: root/src/macos.zig
diff options
context:
space:
mode:
Diffstat (limited to 'src/macos.zig')
-rw-r--r--src/macos.zig20
1 files changed, 9 insertions, 11 deletions
diff --git a/src/macos.zig b/src/macos.zig
index 9f971e5f..3c1458a3 100644
--- a/src/macos.zig
+++ b/src/macos.zig
@@ -498,7 +498,7 @@ const State = struct {
arena: std.heap.ArenaAllocator,
runtime: Runtime,
cells: []Cell = &.{},
- /// Frozen canonical grid paired with `changed_cells` while a content or
+ /// Frozen canonical grid paired with an encoded change mask while a content or
/// lifecycle transition is active. Both are encoded at frame time so the
/// native renderer never borrows core-owned Cell layout across the ABI.
previous_cells: []Cell = &.{},
@@ -1397,13 +1397,13 @@ fn collectPanelDiff(st: *State, surface: *const pardes.Surface, count: usize) vo
}
for (surface.previous_cells, st.previous_cells[0..count]) |cell, *out|
out.* = encodeCell(cell);
- for (surface.changed_cells, st.changed_cells[0..count]) |changed, *out|
- out.* = encodeChanged(changed);
+ for (surface.cell_diffs, st.changed_cells[0..count]) |diff, *out|
+ out.* = encodeChanged(diff);
st.panel_diff_len = count;
}
-fn encodeChanged(changed: u8) u8 {
- return if (changed == 0) 0 else 255;
+fn encodeChanged(diff: pardes.PanelCellDiff) u8 {
+ return if (diff.changed()) 255 else 0;
}
/// Flatten Surface.images into the flat C array the host walks.
@@ -2089,8 +2089,6 @@ test "pardes.h matches the Zig boundary" {
inline for (@typeInfo(PanelTrack).@"struct".fields) |field| {
const c_name = comptime if (std.mem.eql(u8, field.name, "_padding"))
"reserved0"
- else if (std.mem.eql(u8, field.name, "_frame_padding"))
- "reserved1"
else
field.name;
try expectEqual(@offsetOf(c.pardes_panel_track_s, c_name), @offsetOf(PanelTrack, field.name));
@@ -2217,9 +2215,9 @@ test "mac panel ABI paint order includes closing tombstones after live panes" {
}
test "mac panel mask is a literal normalized grayscale texture" {
- try std.testing.expectEqual(@as(u8, 0), encodeChanged(0));
- try std.testing.expectEqual(@as(u8, 255), encodeChanged(1));
- try std.testing.expectEqual(@as(u8, 255), encodeChanged(255));
+ try std.testing.expectEqual(@as(u8, 0), encodeChanged(.unchanged));
+ try std.testing.expectEqual(@as(u8, 255), encodeChanged(.visual));
+ try std.testing.expectEqual(@as(u8, 255), encodeChanged(.{ .ascii = .{ .from = 'a', .to = 'z' } }));
}
test "mac panel ABI has the documented compact byte layout" {
@@ -2231,7 +2229,7 @@ test "mac panel ABI has the documented compact byte layout" {
try std.testing.expectEqual(@as(usize, 6), @offsetOf(PanelTrack, "effect"));
try std.testing.expectEqual(@as(usize, 7), @offsetOf(PanelTrack, "_padding"));
try std.testing.expectEqual(@as(usize, 8), @offsetOf(PanelTrack, "frame"));
- try std.testing.expectEqual(@as(usize, 10), @offsetOf(PanelTrack, "_frame_padding"));
+ try std.testing.expectEqual(@as(usize, 10), @offsetOf(PanelTrack, "frame_count"));
try std.testing.expectEqual(@as(usize, 12), @offsetOf(PanelTrack, "from"));
try std.testing.expectEqual(@as(usize, 28), @offsetOf(PanelTrack, "to"));
}