From 0d3fa8184016ba5a7545f815e88655eaabdfd899 Mon Sep 17 00:00:00 2001 From: Pekka Paalanen Date: Fri, 16 Feb 2024 14:15:12 +0200 Subject: [PATCH] color-lcms: handle NULL render intent The clean-up following this patch will set the render intent field to NULL when it does not apply (blend-to-output transformation). Make sure we handle it. In the search param string, fix a typo, and stop claiming we get a render intent from a profile; we never do. Signed-off-by: Pekka Paalanen --- libweston/color-lcms/color-transform.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/libweston/color-lcms/color-transform.c b/libweston/color-lcms/color-transform.c index 8d3e209e4..7c89c64d2 100644 --- a/libweston/color-lcms/color-transform.c +++ b/libweston/color-lcms/color-transform.c @@ -36,6 +36,7 @@ #include "color-properties.h" #include "shared/helpers.h" #include "shared/string-helpers.h" +#include "shared/weston-assert.h" #include "shared/xalloc.h" /** @@ -910,6 +911,7 @@ xform_realize_chain(struct cmlcms_color_transform *xform) } assert(chain_len <= ARRAY_LENGTH(chain)); + weston_assert_ptr(cm->base.compositor, xform->search_key.render_intent); /** * Binding to our LittleCMS plug-in occurs here. @@ -960,7 +962,9 @@ failed: char * cmlcms_color_transform_search_param_string(const struct cmlcms_color_transform_search_param *search_key) { - const char *input_prof_desc = "none", *output_prof_desc = "none"; + const char *input_prof_desc = "none"; + const char *output_prof_desc = "none"; + const char *intent_desc = "none"; char *str; if (search_key->input_profile) @@ -969,14 +973,17 @@ cmlcms_color_transform_search_param_string(const struct cmlcms_color_transform_s if (search_key->output_profile) output_prof_desc = search_key->output_profile->base.description; - str_printf(&str, " catergory: %s\n" \ + if (search_key->render_intent) + intent_desc = search_key->render_intent->desc; + + str_printf(&str, " category: %s\n" \ " input profile: %s\n" \ " output profile: %s\n" \ - " selected intent from output profile: %s\n", + " render intent: %s\n", cmlcms_category_name(search_key->category), input_prof_desc, output_prof_desc, - search_key->render_intent->desc); + intent_desc); abort_oom_if_null(str);