mirror of
https://github.com/lvgl/lvgl.git
synced 2026-05-25 18:29:26 +08:00
feat(libpng): let png handle stride alignment
Signed-off-by: Xu Xingliang <xuxingliang@xiaomi.com>
This commit is contained in:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user