From d1c6305221500875df23e282a520d3fe96a9c5f8 Mon Sep 17 00:00:00 2001
From: Steve Cook <steviecook210@gmail.com>
Date: Tue, 23 Aug 2022 14:44:56 -0400
Subject: [PATCH] Rename set_size to set_view_size Move variables inside loop
 for conversion function

---
 ctru-rs/examples/camera-image.rs | 8 +++-----
 ctru-rs/src/services/cam.rs      | 2 +-
 2 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/ctru-rs/examples/camera-image.rs b/ctru-rs/examples/camera-image.rs
index c65d6b1..c321919 100644
--- a/ctru-rs/examples/camera-image.rs
+++ b/ctru-rs/examples/camera-image.rs
@@ -34,7 +34,7 @@ fn main() {
         let camera = &mut cam.outer_right_cam;
 
         camera
-            .set_size(CamSize::CTR_TOP_LCD)
+            .set_view_size(CamSize::CTR_TOP_LCD)
             .expect("Failed to set camera size");
 
         camera
@@ -108,14 +108,12 @@ fn main() {
 // but the image would need to be rotated 90 degrees.
 fn convert_image_to_rgb8(img: &[u8], x: usize, y: usize, width: usize, height: usize) -> Vec<u8> {
     let mut rgb8 = vec![0u8; img.len()];
-    let mut draw_x;
-    let mut draw_y;
     for j in 0..height {
         for i in 0..width {
             // Y-coordinate of where to draw in the frame buffer
-            draw_y = y + height - j;
+            let draw_y = y + height - j;
             // X-coordinate of where to draw in the frame buffer
-            draw_x = x + i;
+            let draw_x = x + i;
             // Initial index of where to draw in the frame buffer based on y and x coordinates
             let draw_index = (draw_y + draw_x * height) * 3;
 
diff --git a/ctru-rs/src/services/cam.rs b/ctru-rs/src/services/cam.rs
index 42f2a42..e564810 100644
--- a/ctru-rs/src/services/cam.rs
+++ b/ctru-rs/src/services/cam.rs
@@ -521,7 +521,7 @@ pub trait Camera {
         }
     }
 
-    fn set_size(&mut self, size: CamSize) -> crate::Result<()> {
+    fn set_view_size(&mut self, size: CamSize) -> crate::Result<()> {
         unsafe {
             let r = ctru_sys::CAMU_SetSize(self.camera_as_raw(), size.bits(), ctru_sys::CONTEXT_A);
             if r < 0 {