cleaning
This commit is contained in:
parent
36b50b8c55
commit
f4f97982ce
1 changed files with 18 additions and 14 deletions
|
@ -68,17 +68,14 @@ where
|
||||||
let tile_window = tile_window_renderer
|
let tile_window = tile_window_renderer
|
||||||
.map(|tile_window_renderer| TileWindow::new(tile_window_renderer, cgb));
|
.map(|tile_window_renderer| TileWindow::new(tile_window_renderer, cgb));
|
||||||
|
|
||||||
let blank_colour: ColourFormat = if cgb {
|
let buffer = [get_blank_colour(cgb); WIDTH * HEIGHT];
|
||||||
rgb_from_bytes(0xFFFF).into()
|
|
||||||
} else {
|
|
||||||
ColourInner::Error.rgb_bytes(None).into()
|
|
||||||
};
|
|
||||||
|
|
||||||
let buffer = [blank_colour; WIDTH * HEIGHT];
|
|
||||||
|
|
||||||
let layer_window = layer_window_renderer.map(|mut layer_window_renderer| {
|
let layer_window = layer_window_renderer.map(|mut layer_window_renderer| {
|
||||||
layer_window_renderer.prepare(WIDTH, HEIGHT * 3);
|
layer_window_renderer.prepare(WIDTH, HEIGHT * 3);
|
||||||
(layer_window_renderer, [blank_colour; WIDTH * HEIGHT * 3])
|
(
|
||||||
|
layer_window_renderer,
|
||||||
|
[get_blank_colour(cgb); WIDTH * HEIGHT * 3],
|
||||||
|
)
|
||||||
});
|
});
|
||||||
|
|
||||||
Self {
|
Self {
|
||||||
|
@ -486,14 +483,21 @@ where
|
||||||
self.window.display(&self.buffer);
|
self.window.display(&self.buffer);
|
||||||
if let Some((ref mut window, ref mut buffer)) = self.layer_window {
|
if let Some((ref mut window, ref mut buffer)) = self.layer_window {
|
||||||
window.display(buffer);
|
window.display(buffer);
|
||||||
let blank_colour: ColourFormat = if self.cgb_data.is_some() {
|
|
||||||
|
for val in buffer {
|
||||||
|
*val = get_blank_colour(self.cgb_data.is_some());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn get_blank_colour<ColourFormat>(cgb: bool) -> ColourFormat
|
||||||
|
where
|
||||||
|
ColourFormat: From<Colour> + Copy,
|
||||||
|
{
|
||||||
|
if cgb {
|
||||||
rgb_from_bytes(0xFFFF).into()
|
rgb_from_bytes(0xFFFF).into()
|
||||||
} else {
|
} else {
|
||||||
ColourInner::Error.rgb_bytes(None).into()
|
ColourInner::Error.rgb_bytes(None).into()
|
||||||
};
|
|
||||||
for val in buffer {
|
|
||||||
*val = blank_colour;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue