mirror of
https://github.com/italicsjenga/rust_minifb.git
synced 2025-01-11 03:21:32 +11:00
Bump orbclient to 0.3.20 on Redox, remove alpha handling hacks (#67)
This commit is contained in:
parent
0b5e39c396
commit
ceadd15e6c
|
@ -64,4 +64,4 @@ x11-dl = "~2.14"
|
|||
x11-dl = "~2.14"
|
||||
|
||||
[target.x86_64-unknown-redox.dependencies]
|
||||
orbclient = "0.3.14"
|
||||
orbclient = "0.3.20"
|
||||
|
|
|
@ -244,12 +244,6 @@ impl Window {
|
|||
self.mouse_pos = None;
|
||||
}
|
||||
},
|
||||
orbclient::EventOption::Resize(_) => {
|
||||
// The window must be redrawn with an opaque color (black)
|
||||
// because Orbital uses the transparent color for the new areas
|
||||
// appearing after resizing
|
||||
self.window.set(orbclient::Color::rgb(0, 0, 0));
|
||||
},
|
||||
orbclient::EventOption::Scroll(scroll_event) => {
|
||||
self.mouse_pos = Some((scroll_event.x, scroll_event.y));
|
||||
},
|
||||
|
@ -352,17 +346,17 @@ impl Window {
|
|||
let render_height = cmp::min(self.buffer_height * self.window_scale,
|
||||
self.window.height() as usize);
|
||||
|
||||
let window_width = self.window.width() as usize;
|
||||
let window_buffer = self.window.data_mut();
|
||||
|
||||
for y in 0..render_height {
|
||||
for x in 0..render_width {
|
||||
let buffer_x = x / self.window_scale;
|
||||
let buffer_y = y / self.window_scale;
|
||||
|
||||
// The pixel format of MiniFB and Orbital are the same (0xAARRGGBB),
|
||||
// however Orbital expects opaque colors where the alpha is 0xFF
|
||||
let data = buffer[buffer_y * self.buffer_width + buffer_x];
|
||||
let color = orbclient::Color { data: data | 0xFF000000 };
|
||||
|
||||
self.window.pixel(x as i32, y as i32, color);
|
||||
window_buffer[y * window_width + x] = orbclient::Color {
|
||||
data: buffer[buffer_y * self.buffer_width + buffer_x],
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue