feat(libpng): let png handle stride alignment

Signed-off-by: Xu Xingliang <xuxingliang@xiaomi.com>
This commit is contained in:
Xu Xingliang
2024-03-21 11:39:37 +08:00
committed by Neo Xu
parent 4b41590cf1
commit 3116dc469e
+2 -2
View File
@@ -264,7 +264,7 @@ static lv_draw_buf_t * decode_png_file(const char * filename)
/*Alloc image buffer*/
lv_draw_buf_t * decoded;
decoded = lv_draw_buf_create(image.width, image.height, LV_COLOR_FORMAT_ARGB8888, PNG_IMAGE_ROW_STRIDE(image));
decoded = lv_draw_buf_create(image.width, image.height, LV_COLOR_FORMAT_ARGB8888, LV_STRIDE_AUTO);
if(decoded == NULL) {
LV_LOG_ERROR("alloc PNG_IMAGE_SIZE(%" LV_PRIu32 ") failed: %s", (uint32_t)PNG_IMAGE_SIZE(image), filename);
lv_free(data);
@@ -272,7 +272,7 @@ static lv_draw_buf_t * decode_png_file(const char * filename)
}
/*Start decoding*/
ret = png_image_finish_read(&image, NULL, decoded->data, 0, NULL);
ret = png_image_finish_read(&image, NULL, decoded->data, decoded->header.stride, NULL);
png_image_free(&image);
lv_free(data);
if(!ret) {