Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When using LV_USE_DRAW_SDL, all images cannot be displayed. #44

Open
sliang951753 opened this issue Jun 21, 2024 · 7 comments
Open

When using LV_USE_DRAW_SDL, all images cannot be displayed. #44

sliang951753 opened this issue Jun 21, 2024 · 7 comments

Comments

@sliang951753
Copy link

There's two issues when using LV_USE_DRAW_SDL option in cmake.

  1. If LV_USE_DRAW_SDL option is enabled, it will cause the redefinition error because the macro LV_USE_DRAW_SDL already be defined in lv_conf.h file.
  2. If using sdl draw unit to run the widget demo, all images cannot be displayed. The console will continuously output the error "could not load image: SDL_RWFromFile(): No file or no mode specified"
@kisvegabor
Copy link
Member

I started to work on completing the SDL renderer here: lvgl/lvgl#6437

If LV_USE_DRAW_SDL option is enabled, it will cause the redefinition error because the macro LV_USE_DRAW_SDL already be defined in lv_conf.h file.

If you enable this option via CMake, you can remove LV_USE_DRAW_SDL from lv_conf.h

If using sdl draw unit to run the widget demo, all images cannot be displayed. The console will continuously output the error "could not load image: SDL_RWFromFile(): No file or no mode specified"

I'll resolve it in lvgl/lvgl#6437

@sliang951753
Copy link
Author

Please help to check the RGB mask value in draw image task of SDL draw unit. I saw currently only 32bit color can work. For other color format (such as rgb565),the SDL will report color mask error.

@kisvegabor
Copy link
Member

Is it with LVGL v8 or v9?

@sliang951753
Copy link
Author

Is it with LVGL v8 or v9?

v9

@kisvegabor
Copy link
Member

I've tried the lv_demo_widgets() with LV_COLOR_DEPTH 16 and lvgl master. It worked well for me.

Have you installed libsdl2-image-dev?

@sliang951753
Copy link
Author

The problem is when the bpp of an image is not 32. for example, bpp = 16, then the R mask is 0x001F instead of 0x000000FF
If you pass 0x000000FF to the SDL_CreateRGBSurfaceFrom function, it will report "Unknown pixel format " error.
This can be reproduced by running the benchmark. For demo widgets, its ok.

@kisvegabor
Copy link
Member

Oh I see. I can't see just a dirty fix to resolve it, however lvgl/lvgl#6437 should fix it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants