diff options
author | Marek Vasut <marex@denx.de> | 2024-03-13 05:40:11 +0100 |
---|---|---|
committer | Khem Raj <raj.khem@gmail.com> | 2024-03-12 22:28:39 -0700 |
commit | 0f2a49910011b9d9857f24cb70b795f187fab776 (patch) | |
tree | 85d11dc785e024ddc1c5f87b979e57a6ad309259 /meta-oe/recipes-graphics/lvgl/files/0002-fix-sdl-handle-both-LV_IMAGE_SRC_FILE-and-LV_IMAGE_S.patch | |
parent | 2054fda6d1dea9a0310f817492dfd743357372ad (diff) | |
download | meta-openembedded-0f2a49910011b9d9857f24cb70b795f187fab776.tar.gz |
lvgl: Replace sed patching with real patches
Replace the current awful sed hacking with real patches bound for upstream.
The sed hacking was simply not maintainable anymore.
Signed-off-by: Marek Vasut <marex@denx.de>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
Diffstat (limited to 'meta-oe/recipes-graphics/lvgl/files/0002-fix-sdl-handle-both-LV_IMAGE_SRC_FILE-and-LV_IMAGE_S.patch')
-rw-r--r-- | meta-oe/recipes-graphics/lvgl/files/0002-fix-sdl-handle-both-LV_IMAGE_SRC_FILE-and-LV_IMAGE_S.patch | 63 |
1 files changed, 63 insertions, 0 deletions
diff --git a/meta-oe/recipes-graphics/lvgl/files/0002-fix-sdl-handle-both-LV_IMAGE_SRC_FILE-and-LV_IMAGE_S.patch b/meta-oe/recipes-graphics/lvgl/files/0002-fix-sdl-handle-both-LV_IMAGE_SRC_FILE-and-LV_IMAGE_S.patch new file mode 100644 index 0000000000..bd619b1572 --- /dev/null +++ b/meta-oe/recipes-graphics/lvgl/files/0002-fix-sdl-handle-both-LV_IMAGE_SRC_FILE-and-LV_IMAGE_S.patch @@ -0,0 +1,63 @@ +From 5b7f657e8ad656e0854f2252b3bd482b966d650c Mon Sep 17 00:00:00 2001 +From: Marek Vasut <marex@denx.de> +Date: Wed, 13 Mar 2024 02:12:30 +0100 +Subject: [PATCH 2/2] fix(sdl): handle both LV_IMAGE_SRC_FILE and + LV_IMAGE_SRC_VARIABLE + +The SDL image draw code currently assumes that the image source is a +filename and attempts to open that filename. This is not necessarily +the case, e.g. the lv_demo_fb uses encoded images which are of type +LV_IMAGE_SRC_VARIABLE and instead of filename, come with a buffer of +pixels. Handle the later using SDL_CreateRGBSurfaceFrom(). + +Upstream-Status: Submitted [https://github.com/lvgl/lvgl/pull/5852] +Signed-off-by: Marek Vasut <marex@denx.de> +--- + src/draw/sdl/lv_draw_sdl.c | 30 +++++++++++++++++++++++++++--- + 1 file changed, 27 insertions(+), 3 deletions(-) + +diff --git a/src/draw/sdl/lv_draw_sdl.c b/src/draw/sdl/lv_draw_sdl.c +index cbb555d94..5eee5b725 100644 +--- a/src/draw/sdl/lv_draw_sdl.c ++++ b/src/draw/sdl/lv_draw_sdl.c +@@ -224,10 +224,34 @@ static bool draw_to_texture(lv_draw_sdl_unit_t * u, cache_data_t * data) + break; + case LV_DRAW_TASK_TYPE_IMAGE: { + lv_draw_image_dsc_t * image_dsc = task->draw_dsc; +- const char * path = image_dsc->src; +- SDL_Surface * surface = IMG_Load(&path[2]); ++ lv_image_src_t type = lv_image_src_get_type(image_dsc->src); ++ SDL_Surface * surface = NULL; ++ if(type == LV_IMAGE_SRC_FILE) { ++ const char * path = image_dsc->src; ++ surface = IMG_Load(&path[2]); ++ } ++ else if(type == LV_IMAGE_SRC_VARIABLE) { ++ lv_image_dsc_t * lvd = image_dsc->src; ++ surface = SDL_CreateRGBSurfaceFrom(lvd->data, ++ lvd->header.w, lvd->header.h, ++ LV_COLOR_FORMAT_GET_BPP(lvd->header.cf), ++ lvd->header.stride, ++#if SDL_BYTEORDER == SDL_LIL_ENDIAN ++ 0x00FF0000, ++ 0x0000FF00, ++ 0x000000FF, ++ 0xFF000000 ++#else ++ 0x0000FF00, ++ 0x00FF0000, ++ 0xFF000000, ++ 0x000000FF ++#endif ++ ); ++ } ++ + if(surface == NULL) { +- fprintf(stderr, "could not load image: %s\n", IMG_GetError()); ++ fprintf(stderr, "could not load image\n"); + return false; + } + +-- +2.43.0 + |