Change memory layout of Image, so it's not drawn upside-down by SDL
This commit is contained in:
parent
2ec0c133a8
commit
9d47821062
|
|
@ -24,7 +24,7 @@ impl OutputImage {
|
|||
|
||||
pub fn set_color(&mut self, row: u32, column: u32, red: u8, green: u8, blue: u8) {
|
||||
assert!(row < self.height && column < self.width);
|
||||
let index = ((row * self.width + column) * self.channels) as usize;
|
||||
let index = (((self.height - (row + 1)) * self.width + column) * self.channels) as usize;
|
||||
self.pixel_data[index] = red;
|
||||
self.pixel_data[index + 1] = green;
|
||||
self.pixel_data[index + 2] = blue;
|
||||
|
|
|
|||
Loading…
Reference in New Issue