Skip to content

Commit

Permalink
replace len to result byte len
Browse files Browse the repository at this point in the history
  • Loading branch information
raphamorim committed Feb 12, 2025
1 parent 8cca458 commit c4a8eae
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,6 @@ pub extern "C" fn scaled_image_png(scale: u8) -> ImageBuffer {
let height = 144;

let image: &[u8] = locked_gb.as_mut().unwrap().image();
let len = image.len() as i32;
// std::mem::forget(image);

// Allocate a new buffer for the RGB image, 3 bytes per pixel
Expand All @@ -127,10 +126,11 @@ pub extern "C" fn scaled_image_png(scale: u8) -> ImageBuffer {
);
}
let result = image::DynamicImage::ImageRgb8(buffer);
let b = result.as_bytes();

return ImageBuffer {
len,
data: result.as_bytes().as_ptr(),
len: b.len() as i32,
data: b.as_ptr(),
};
}
}
Expand Down

0 comments on commit c4a8eae

Please sign in to comment.