use arrays for buffers
This commit is contained in:
parent
4290640870
commit
36b50b8c55
1 changed files with 9 additions and 12 deletions
|
@ -28,19 +28,19 @@ where
|
|||
ColourFormat: From<Colour> + Copy,
|
||||
R: Renderer<ColourFormat>,
|
||||
{
|
||||
pub buffer: Vec<ColourFormat>,
|
||||
pub buffer: [ColourFormat; WIDTH * HEIGHT],
|
||||
pub vram: Vram,
|
||||
pub oam: Oam,
|
||||
pub window: R,
|
||||
is_bg_zero: Vec<bool>,
|
||||
is_bg_priority: Vec<bool>,
|
||||
is_bg_zero: [bool; WIDTH],
|
||||
is_bg_priority: [bool; WIDTH],
|
||||
lcdc: Lcdc,
|
||||
stat: Stat,
|
||||
mode_clock: usize,
|
||||
scanline: u8,
|
||||
lyc: u8,
|
||||
tile_window: Option<TileWindow<ColourFormat, R>>,
|
||||
layer_window: Option<(R, Vec<ColourFormat>)>,
|
||||
layer_window: Option<(R, [ColourFormat; WIDTH * HEIGHT * 3])>,
|
||||
window_lc: u8,
|
||||
has_window_been_enabled: bool,
|
||||
bg_palette: Palette,
|
||||
|
@ -74,14 +74,11 @@ where
|
|||
ColourInner::Error.rgb_bytes(None).into()
|
||||
};
|
||||
|
||||
let buffer = vec![blank_colour.clone(); WIDTH * HEIGHT];
|
||||
let buffer = [blank_colour; WIDTH * HEIGHT];
|
||||
|
||||
let layer_window = layer_window_renderer.map(|mut layer_window_renderer| {
|
||||
layer_window_renderer.prepare(WIDTH, HEIGHT * 3);
|
||||
(
|
||||
layer_window_renderer,
|
||||
vec![blank_colour; WIDTH * HEIGHT * 3],
|
||||
)
|
||||
(layer_window_renderer, [blank_colour; WIDTH * HEIGHT * 3])
|
||||
});
|
||||
|
||||
Self {
|
||||
|
@ -89,8 +86,8 @@ where
|
|||
vram: Vram::new(cgb),
|
||||
oam: Oam::default(),
|
||||
window,
|
||||
is_bg_zero: vec![true; WIDTH],
|
||||
is_bg_priority: vec![false; WIDTH],
|
||||
is_bg_zero: [true; WIDTH],
|
||||
is_bg_priority: [false; WIDTH],
|
||||
lcdc: Lcdc::default(),
|
||||
stat: Stat::default(),
|
||||
mode_clock: 0,
|
||||
|
@ -495,7 +492,7 @@ where
|
|||
ColourInner::Error.rgb_bytes(None).into()
|
||||
};
|
||||
for val in buffer {
|
||||
*val = blank_colour.clone();
|
||||
*val = blank_colour;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue