libweston: add pixel_format_get_info_by_pixman()
Sometimes you will have a pixman_image_t and you need the corresponding drm_fourcc format. Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
This commit is contained in:
committed by
Marius Vlad
parent
0aac3dd343
commit
d2aa62a074
@@ -636,6 +636,19 @@ pixel_format_get_info_by_drm_name(const char *drm_format_name)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
WL_EXPORT const struct pixel_format_info *
|
||||||
|
pixel_format_get_info_by_pixman(pixman_format_code_t pixman_format)
|
||||||
|
{
|
||||||
|
unsigned int i;
|
||||||
|
|
||||||
|
for (i = 0; i < ARRAY_LENGTH(pixel_format_table); i++) {
|
||||||
|
if (pixel_format_table[i].pixman_format == pixman_format)
|
||||||
|
return &pixel_format_table[i];
|
||||||
|
}
|
||||||
|
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
WL_EXPORT unsigned int
|
WL_EXPORT unsigned int
|
||||||
pixel_format_get_plane_count(const struct pixel_format_info *info)
|
pixel_format_get_plane_count(const struct pixel_format_info *info)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -190,6 +190,19 @@ pixel_format_get_info_count(void);
|
|||||||
const struct pixel_format_info *
|
const struct pixel_format_info *
|
||||||
pixel_format_get_info_by_drm_name(const char *drm_format_name);
|
pixel_format_get_info_by_drm_name(const char *drm_format_name);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get pixel format information for a Pixman format code
|
||||||
|
*
|
||||||
|
* Given a Pixman format code, return a pixel format info structure describing
|
||||||
|
* the properties of that format.
|
||||||
|
*
|
||||||
|
* @param pixman_format Pixman format code to get info for
|
||||||
|
* @returns A pixel format structure (must not be freed), or NULL if the
|
||||||
|
* format could not be found
|
||||||
|
*/
|
||||||
|
const struct pixel_format_info *
|
||||||
|
pixel_format_get_info_by_pixman(pixman_format_code_t pixman_format);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get number of planes used by a pixel format
|
* Get number of planes used by a pixel format
|
||||||
*
|
*
|
||||||
|
|||||||
Reference in New Issue
Block a user