color-lcms: properly print 16-bit sampled curves

There's a case we were missing when printing the tone curves: the ones
with zero segments.

These are 16-bit sampled curves. Start taking them into account.

Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
This commit is contained in:
Leandro Ribeiro 2023-06-29 14:37:20 -03:00
parent 4a40ae7718
commit 625a74d369

View file

@ -221,19 +221,35 @@ static void
curve_print(const cmsToneCurve *curve, struct weston_log_scope *scope)
{
const cmsCurveSegment *seg;
cmsUInt32Number n_entries;
unsigned int i;
weston_log_scope_printf(scope, "%*sSegments\n", 9, "");
for (i = 0; ; i++) {
seg = cmsGetToneCurveSegment(i, curve);
if (!seg)
break;
if (i == 0)
weston_log_scope_printf(scope, "%*sSegments\n", 9, "");
segment_print(seg, scope);
}
if (i > 0)
return;
if (i == 0)
n_entries = cmsGetToneCurveEstimatedTableEntries(curve);
/* We have a curve with 0 segments and 0 entries... we are not expecting
* seeing this case. */
if (n_entries <= 0) {
weston_log_scope_printf(scope, "%*sNo segments\n", 12, "");
return;
}
/* We have a curve with 0 segments but n_entries > 0. That's a 16-bit
* sampled curve. */
weston_log_scope_printf(scope, "%*sNo segments, 16-bit sampled curve " \
"with %u samples\n", 12, "", n_entries);
}
static bool