color-lcms: add cmlcms_category_name()

This will be used by debug logging and error reporting.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
This commit is contained in:
Pekka Paalanen 2022-09-09 11:53:13 +03:00 committed by Pekka Paalanen
parent f3277a4fa5
commit 1874f4db92
2 changed files with 18 additions and 0 deletions

View File

@ -34,6 +34,21 @@
#include "color-lcms.h" #include "color-lcms.h"
#include "shared/helpers.h" #include "shared/helpers.h"
const char *
cmlcms_category_name(enum cmlcms_category cat)
{
static const char *const category_names[] = {
[CMLCMS_CATEGORY_INPUT_TO_BLEND] = "input-to-blend",
[CMLCMS_CATEGORY_BLEND_TO_OUTPUT] = "blend-to-output",
[CMLCMS_CATEGORY_INPUT_TO_OUTPUT] = "input-to-output",
};
if (cat < 0 || cat >= ARRAY_LENGTH(category_names))
return "[illegal category value]";
return category_names[cat] ?: "[undocumented category value]";
}
static cmsUInt32Number static cmsUInt32Number
cmlcms_get_render_intent(enum cmlcms_category cat, cmlcms_get_render_intent(enum cmlcms_category cat,
struct weston_surface *surface, struct weston_surface *surface,

View File

@ -114,6 +114,9 @@ enum cmlcms_category {
CMLCMS_CATEGORY_INPUT_TO_OUTPUT, CMLCMS_CATEGORY_INPUT_TO_OUTPUT,
}; };
const char *
cmlcms_category_name(enum cmlcms_category cat);
static inline struct cmlcms_color_profile * static inline struct cmlcms_color_profile *
get_cprof(struct weston_color_profile *cprof_base) get_cprof(struct weston_color_profile *cprof_base)
{ {