From 46d78e2cd9de7debdfd6fa19248c9fbdd84a5534 Mon Sep 17 00:00:00 2001 From: Steve Cook Date: Fri, 22 Jul 2022 18:12:15 -0400 Subject: [PATCH] Requested changes Use calculated buffer size over comment. Use tuple structs for input on Cam::set_detail_size --- ctru-rs/examples/camera-image.rs | 2 +- ctru-rs/src/services/cam.rs | 14 ++++++-------- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/ctru-rs/examples/camera-image.rs b/ctru-rs/examples/camera-image.rs index 86f69cd..9ae315e 100644 --- a/ctru-rs/examples/camera-image.rs +++ b/ctru-rs/examples/camera-image.rs @@ -7,7 +7,7 @@ use ctru::Gfx; const WIDTH: usize = 400; const HEIGHT: usize = 240; -const BUF_SIZE: usize = 384000; // WIDTH * HEIGHT * 2 * 2; First '* 2' is for 2 bytes per pixel, second is for 3D layer. +const BUF_SIZE: usize = WIDTH * HEIGHT * 2 * 2; const WAIT_TIMEOUT: i64 = 300000000; diff --git a/ctru-rs/src/services/cam.rs b/ctru-rs/src/services/cam.rs index 145060c..61db53d 100644 --- a/ctru-rs/src/services/cam.rs +++ b/ctru-rs/src/services/cam.rs @@ -654,10 +654,8 @@ pub trait Camera { &mut self, width: i16, height: i16, - crop_x0: i16, - crop_y0: i16, - crop_x1: i16, - crop_y1: i16, + crop_0: (i16, i16), + crop_1: (i16, i16), context: CamContext, ) -> crate::Result<()> { unsafe { @@ -665,10 +663,10 @@ pub trait Camera { self.camera_as_raw(), width, height, - crop_x0, - crop_y0, - crop_x1, - crop_y1, + crop_0.0, + crop_0.1, + crop_1.0, + crop_1.1, context.bits(), ); if r < 0 {