copy moving white lines into framebuffer

This commit is contained in:
2025-10-21 17:43:03 +03:00
parent c70bb8c2ce
commit bc222b77b7

View File

@@ -85,7 +85,8 @@ pub fn main() !void {
var frame_count: i32 = 0; var frame_count: i32 = 0;
var bytes: i32 = 0; var bytes: i32 = 0;
const two_lines = try allocator.alloc(u8, stride * 2); const two_lines_len = stride * 2;
const two_lines = try allocator.alloc(u8, two_lines_len);
defer allocator.free(two_lines); defer allocator.free(two_lines);
@memset(two_lines, 255); @memset(two_lines, 255);
@@ -95,7 +96,9 @@ pub fn main() !void {
while (frame_count < 10000) : (frame_count += 1) { while (frame_count < 10000) : (frame_count += 1) {
@memcpy(frame_buffer, content); @memcpy(frame_buffer, content);
// TODO: copy the white line over here const two_lines_slice = frame_buffer[line_position..(line_position + two_lines_len)];
@memcpy(two_lines_slice, two_lines[0..two_lines_len]);
line_position += stride * 2; line_position += stride * 2;
if (line_position >= video_frame.DataLength) { if (line_position >= video_frame.DataLength) {
line_position = 0; line_position = 0;