From 69bb0c4830c6bf20f57a56dda6a9abd77899d8c7 Mon Sep 17 00:00:00 2001 From: gered Date: Fri, 31 Mar 2023 22:16:32 -0400 Subject: [PATCH] this should be a mutable reference argument to be honest, i'm not sure how this compiled successfully before, since the value being passed in via Bitmap::triangle_2d_custom is clearly of type `&mut PixelType` ... ? either way, this is now written consistently and we get to remove an unnecessary unsafe block --- ggdt/src/graphics/bitmap/triangles.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ggdt/src/graphics/bitmap/triangles.rs b/ggdt/src/graphics/bitmap/triangles.rs index d18eee1..b0dfd89 100644 --- a/ggdt/src/graphics/bitmap/triangles.rs +++ b/ggdt/src/graphics/bitmap/triangles.rs @@ -13,7 +13,7 @@ impl Bitmap { a, // b, c, - |dest_pixels, _w0, _w1, _w2| unsafe { + |dest_pixels, _w0, _w1, _w2| { *dest_pixels = color; }, ) @@ -25,7 +25,7 @@ impl Bitmap { a: Vector2, b: Vector2, c: Vector2, - pixel_fn: impl Fn(*mut PixelType, f32, f32, f32), + pixel_fn: impl Fn(&mut PixelType, f32, f32, f32), ) { // based off the triangle rasterization algorithm presented in these article series' (as well as others) // https://fgiesen.wordpress.com/2013/02/17/optimizing-sw-occlusion-culling-index/