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

unknown SDL_PixelFormatEnum #121

Closed
Y009 opened this issue Apr 27, 2023 · 5 comments
Closed

unknown SDL_PixelFormatEnum #121

Y009 opened this issue Apr 27, 2023 · 5 comments

Comments

@Y009
Copy link

Y009 commented Apr 27, 2023

On docker latest libsdl2-dev SDL_PixelFormatEnumdoes not seem to be available anymore

It can be fixed in /lvgl/src/dev/sdl/lv_sdl_window.c as following:

static void texture_resize(lv_disp_t * disp)
{
...
#if LV_COLOR_DEPTH == 32
    SDL_PixelFormat px_format = {.format = SDL_PIXELFORMAT_ARGB8888};
#elif LV_COLOR_DEPTH == 24
    SDL_PixelFormat px_format = {.format = SDL_PIXELFORMAT_BGR24};
#elif LV_COLOR_DEPTH == 16
    SDL_PixelFormat px_format = {.format = SDL_PIXELFORMAT_RGB565};
#else
#error("Unsupported color format")
#endif

    dsc->texture = SDL_CreateTexture(dsc->renderer, px_format.format,
                                     SDL_TEXTUREACCESS_STATIC, hor_res, ver_res);
    SDL_SetTextureBlendMode(dsc->texture, SDL_BLENDMODE_BLEND);
}

Made a PR in the main repo lvgl/lvgl#4172

@kisvegabor
Copy link
Member

The PR is merged, thank you!

@Y009
Copy link
Author

Y009 commented Apr 28, 2023

I just checked with ubuntu 22.04 just in case and that pulls a newer version of libsdl (2.0.20) which does have SDL_PixelFormatEnum available,
So I think it would actually be better to revert the commit and update the dockerfile to run with ubuntu 22.04 (or 23.04) instead.

@kisvegabor
Copy link
Member

Ubuntu 18.04 is really old. So yeah, updating the Docker file would be a more elegant solution. I'll revert the commit and updated the Docker in 25b91fd

@Y009
Copy link
Author

Y009 commented Apr 28, 2023

Just checked on 23.04, it works there also

@kisvegabor
Copy link
Member

Okay, updated to 23.04. Thank you!

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