pixels: Add function to convert from wl_shm format to fourcc

pull/58/head
Andri Yngvason 2020-07-16 18:09:18 +00:00
parent fbd8020778
commit 14768ca6e3
2 changed files with 12 additions and 0 deletions

View File

@ -23,3 +23,4 @@
enum wl_shm_format fourcc_to_wl_shm(uint32_t in); enum wl_shm_format fourcc_to_wl_shm(uint32_t in);
bool fourcc_to_pixman_fmt(pixman_format_code_t* dst, uint32_t src); bool fourcc_to_pixman_fmt(pixman_format_code_t* dst, uint32_t src);
uint32_t fourcc_from_wl_shm(enum wl_shm_format in);

View File

@ -34,6 +34,17 @@ enum wl_shm_format fourcc_to_wl_shm(uint32_t in)
return in; return in;
} }
uint32_t fourcc_from_wl_shm(enum wl_shm_format in)
{
switch (in) {
case WL_SHM_FORMAT_ARGB8888: return DRM_FORMAT_ARGB8888;
case WL_SHM_FORMAT_XRGB8888: return DRM_FORMAT_XRGB8888;
default:;
}
return in;
}
bool fourcc_to_pixman_fmt(pixman_format_code_t* dst, uint32_t src) bool fourcc_to_pixman_fmt(pixman_format_code_t* dst, uint32_t src)
{ {
assert(!(src & DRM_FORMAT_BIG_ENDIAN)); assert(!(src & DRM_FORMAT_BIG_ENDIAN));