From aeb8405e4494b934d362043c1b60468345ac461b Mon Sep 17 00:00:00 2001 From: Leonardo Cavagnis Date: Wed, 23 Apr 2025 17:26:58 +0200 Subject: [PATCH] H7 Video + LVGL 9: fix buffer flush size and add free() --- libraries/Arduino_H7_Video/src/Arduino_H7_Video.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/libraries/Arduino_H7_Video/src/Arduino_H7_Video.cpp b/libraries/Arduino_H7_Video/src/Arduino_H7_Video.cpp index 68ee9b01f..a3cbf0930 100644 --- a/libraries/Arduino_H7_Video/src/Arduino_H7_Video.cpp +++ b/libraries/Arduino_H7_Video/src/Arduino_H7_Video.cpp @@ -251,7 +251,11 @@ void lvgl_displayFlushing(lv_display_t * disp, const lv_area_t * area, unsigned lv_display_rotation_t rotation = lv_display_get_rotation(disp); lv_area_t rotated_area; if (rotation != LV_DISPLAY_ROTATION_0) { - rotated_buf = (uint8_t*)realloc(rotated_buf, w * h * 4); + uint8_t* new_buf = (uint8_t*)realloc(rotated_buf, w * h * 2); + if (new_buf == NULL) { + return; // Insufficient memory error + } + rotated_buf = new_buf; lv_color_format_t cf = lv_display_get_color_format(disp); #if (LVGL_VERSION_MINOR < 2) rotation = LV_DISPLAY_ROTATION_90; // bugfix: force 90 degree rotation for lvgl 9.1 end earlier @@ -277,6 +281,13 @@ void lvgl_displayFlushing(lv_display_t * disp, const lv_area_t * area, unsigned uint32_t offsetPos = (area_in_use->x1 + (dsi_getDisplayXSize() * area_in_use->y1)) * sizeof(uint16_t); dsi_lcdDrawImage((void *) px_map, (void *)(dsi_getActiveFrameBuffer() + offsetPos), w, h, DMA2D_INPUT_RGB565); + + // free the rotated buffer if it was allocated + if (rotation != LV_DISPLAY_ROTATION_0) { + free(rotated_buf); + rotated_buf = nullptr; + } + lv_display_flush_ready(disp); /* Indicate you are ready with the flushing*/ } #else pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy