mirror of
https://github.com/edera-dev/sprout.git
synced 2026-11-05 03:02:20 +00:00
fix(framebuffer): check width, height and implement proper checking when accessing pixels
This commit is contained in:
2 files changed
+18
-6
No files matched your search
@@ -120,7 +120,8 @@ fn draw(image: DynamicImage) -> Result<()> {
|
||||
let image = resize_to_fit(&image, fit);
|
||||
|
||||
// Create a framebuffer to draw the image on.
|
||||
let mut framebuffer = Framebuffer::new(width, height);
|
||||
let mut framebuffer =
|
||||
Framebuffer::new(width, height).context("unable to create framebuffer")?;
|
||||
|
||||
// Iterate over the pixels in the image and put them on the framebuffer.
|
||||
for (x, y, pixel) in image.enumerate_pixels() {
|
||||
|
||||
Reference in new issue
Block a user