mirror of
https://github.com/openmv/openmv.git
synced 2025-09-26 23:09:13 +08:00
lib/imlib: Fix raw stream buffer size check.
Check frame dimensions as well as total image size top scale the image if needed. Signed-off-by: iabdalkader <i.abdalkader@gmail.com>
This commit is contained in:
parent
7a7788a03a
commit
552f4ada8e
@ -305,7 +305,7 @@ void framebuffer_update_preview(image_t *src) {
|
||||
// Down-scale the frame (if necessary) and send the raw frame.
|
||||
dst.size = src->bpp;
|
||||
dst.pixfmt = src->pixfmt;
|
||||
if (image_size(&dst) <= available_size) {
|
||||
if (src->w <= fb->raw_w && src->h <= fb->raw_h && image_size(&dst) <= available_size) {
|
||||
memcpy(dst.pixels, src->pixels, image_size(src));
|
||||
} else {
|
||||
float scale = IM_MIN((fb->raw_w / (float) src->w),
|
||||
|
Loading…
Reference in New Issue
Block a user