Closed xuanplus closed 4 months ago
Oh, I get it.
for i in 0..(info.height - LINE_HEIGHT * 2) {
let old = (i + LINE_HEIGHT) * info.stride;
let new = i * info.stride;
self.buffer.as_mut().unwrap().copy_within(
(old * info.bytes_per_pixel)..((old + info.stride) * info.bytes_per_pixel),
new * info.bytes_per_pixel
);
}
When the screen is filled with characters, I hope the line will scroll to up, and write to the last line, but to clear.
so, I get this:
It works, but too slow. It scrolls per pixel line. :(
So I want to copy a pixel line at once to up. This is what the comment do.
But I can't get the ref after mut ref. What should I do?