Commit ca262809 authored by Jeremy Soller's avatar Jeremy Soller

Fix issue with scroll on odd width display

parent 58246591
......@@ -246,17 +246,15 @@ impl Display {
/// Scroll display
pub fn scroll(&mut self, rows: usize, color: u32) {
let data = (color as u64) << 32 | color as u64;
let width = self.width/2;
let width = self.width;
let height = self.height;
if rows > 0 && rows < height {
let off1 = rows * width;
let off2 = height * width - off1;
unsafe {
let data_ptr = self.offscreen.as_mut_ptr() as *mut u64;
fast_copy64(data_ptr, data_ptr.offset(off1 as isize), off2);
fast_set64(data_ptr.offset(off2 as isize), data, off1);
let data_ptr = self.offscreen.as_mut_ptr() as *mut u32;
fast_copy(data_ptr as *mut u8, data_ptr.offset(off1 as isize) as *const u8, off2 as usize * 4);
fast_set32(data_ptr.offset(off2 as isize), color, off1 as usize);
}
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment