From 3f0f6bf5483a86a852f37804d69eccc5a314c1a9 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jo=C3=A3o=20Magalh=C3=A3es?= <joamag@gmail.com>
Date: Mon, 30 Oct 2023 09:47:19 +0000
Subject: [PATCH] chore: simplified fill frame buffer API

---
 src/ppu.rs | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/ppu.rs b/src/ppu.rs
index 7dec9d42..915ad4d8 100644
--- a/src/ppu.rs
+++ b/src/ppu.rs
@@ -1238,7 +1238,8 @@ impl Ppu {
     /// Fills the frame buffer with pixels of the provided color,
     /// this method should represent the fastest way of achieving
     /// the fill background with color operation.
-    pub fn fill_frame_buffer(&mut self, shade_index: u8, color: Pixel) {
+    pub fn fill_frame_buffer(&mut self, shade_index: u8) {
+        let color = &self.palette_colors[shade_index as usize];
         self.color_buffer.fill(shade_index);
         self.shade_buffer.fill(shade_index);
         self.frame_buffer_index = std::u16::MAX;
@@ -1252,7 +1253,7 @@ impl Ppu {
     /// Clears the current frame buffer, setting the background color
     /// for all the pixels in the frame buffer.
     pub fn clear_frame_buffer(&mut self) {
-        self.fill_frame_buffer(0, self.palette_colors[0]);
+        self.fill_frame_buffer(0);
     }
 
     /// Prints the tile data information to the stdout, this is
-- 
GitLab