[DISP] but any access to self.depth in this lambda causes a failure!

This commit is contained in:
Berkus Decker 2018-11-17 15:33:36 +02:00
parent 72d4e52009
commit 0221f3128d
1 changed files with 4 additions and 1 deletions

View File

@ -107,9 +107,12 @@ impl Display {
pub fn putpixel(&mut self, x: u16, y: u16, color: u32) {
let f = |mut v: u32, chan: u16| unsafe {
if self.depth != 32 { // marker for errors
v = 128;
}
*(self.base as *mut u8)
.offset((u32::from(y) * self.pitch
+ u32::from(x) * 4//(self.depth / 8)
+ u32::from(x) * (self.depth / 8)
+ self.color_component(chan)) as isize) = v as u8;
};