chore(ppu): rename PixelFetcher properties
This commit is contained in:
parent
5917ca203f
commit
705194eced
26
src/ppu.rs
26
src/ppu.rs
|
@ -259,7 +259,7 @@ impl Ppu {
|
|||
ObjectPaletteId::One => self.monochrome.obj_palette_1,
|
||||
};
|
||||
|
||||
let end = Pixels::PIXEL_COUNT - self.fifo.object.len();
|
||||
let end = Pixels::PIXEL_COUNT - self.fifo.obj.len();
|
||||
let start = Pixels::PIXEL_COUNT - end;
|
||||
|
||||
let x_flip = attr.flags.x_flip();
|
||||
|
@ -276,7 +276,7 @@ impl Ppu {
|
|||
priority,
|
||||
};
|
||||
|
||||
self.fifo.object.push_back(fifo_info);
|
||||
self.fifo.obj.push_back(fifo_info);
|
||||
}
|
||||
|
||||
self.fetch.back.resume();
|
||||
|
@ -352,8 +352,11 @@ impl Ppu {
|
|||
// FIXME: Is this the correct behaviour
|
||||
let bg_zero_colour = self.monochrome.bg_palette.i0_colour();
|
||||
|
||||
let maybe_rgba = self.fifo.background.pop_front().map(|bg_info| {
|
||||
match self.fifo.object.pop_front() {
|
||||
let maybe_rgba =
|
||||
self.fifo
|
||||
.back
|
||||
.pop_front()
|
||||
.map(|bg_info| match self.fifo.obj.pop_front() {
|
||||
Some(obj_info) => match obj_info.shade {
|
||||
Some(obj_shade) => match obj_info.priority {
|
||||
RenderPriority::BackgroundAndWindow => match bg_info.shade {
|
||||
|
@ -368,7 +371,6 @@ impl Ppu {
|
|||
},
|
||||
None if bg_enabled => bg_info.shade.into_rgba(),
|
||||
None => bg_zero_colour.into_rgba(),
|
||||
}
|
||||
});
|
||||
|
||||
if let Some(rgba) = maybe_rgba.as_ref() {
|
||||
|
@ -400,7 +402,7 @@ impl Ppu {
|
|||
self.window_stat.set_should_draw(true);
|
||||
self.fetch.back.reset();
|
||||
self.fetch.x_pos = 0;
|
||||
self.fifo.background.clear();
|
||||
self.fifo.back.clear();
|
||||
}
|
||||
} else {
|
||||
self.window_stat.set_should_draw(false);
|
||||
|
@ -711,12 +713,12 @@ impl PixelFetcher {
|
|||
|
||||
let tbpp = Pixels::from_bytes(high, low);
|
||||
|
||||
if fifo.background.is_empty() {
|
||||
if fifo.back.is_empty() {
|
||||
for x in 0..Pixels::PIXEL_COUNT {
|
||||
let shade = palette.shade(tbpp.shade_id(x));
|
||||
|
||||
let fifo_info = BackgroundFifoInfo { shade };
|
||||
fifo.background.push_back(fifo_info);
|
||||
fifo.back.push_back(fifo_info);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -885,8 +887,8 @@ struct ObjectFifoInfo {
|
|||
// really necessary here?
|
||||
#[derive(Debug, Clone)]
|
||||
struct FifoRenderer {
|
||||
background: VecDeque<BackgroundFifoInfo>,
|
||||
object: VecDeque<ObjectFifoInfo>,
|
||||
back: VecDeque<BackgroundFifoInfo>,
|
||||
obj: VecDeque<ObjectFifoInfo>,
|
||||
enabled: bool,
|
||||
}
|
||||
|
||||
|
@ -907,8 +909,8 @@ impl FifoRenderer {
|
|||
impl Default for FifoRenderer {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
background: VecDeque::with_capacity(8),
|
||||
object: VecDeque::with_capacity(8),
|
||||
back: VecDeque::with_capacity(8),
|
||||
obj: VecDeque::with_capacity(8),
|
||||
enabled: true,
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue