color-lcms: add wrapper API for refcounting cmlcms_color_profile

It is used for convenience when profile is cached.

Signed-off-by: Vitaly Prosyak <vitaly.prosyak@amd.com>
This commit is contained in:
Vitaly Prosyak 2021-09-22 19:17:05 -04:00
parent 494ff5b23b
commit a92fa34d1d
2 changed files with 25 additions and 0 deletions

View File

@ -180,4 +180,10 @@ cmlcms_color_transform_get(struct weston_color_manager_lcms *cm,
void
cmlcms_color_transform_destroy(struct cmlcms_color_transform *xform);
struct cmlcms_color_profile *
ref_cprof(struct cmlcms_color_profile *cprof);
void
unref_cprof(struct cmlcms_color_profile *cprof);
#endif /* WESTON_COLOR_LCMS_H */

View File

@ -114,6 +114,25 @@ cmlcms_color_profile_destroy(struct cmlcms_color_profile *cprof)
free(cprof);
}
struct cmlcms_color_profile *
ref_cprof(struct cmlcms_color_profile *cprof)
{
if (!cprof)
return NULL;
weston_color_profile_ref(&cprof->base);
return cprof;
}
void
unref_cprof(struct cmlcms_color_profile *cprof)
{
if (!cprof)
return;
weston_color_profile_unref(&cprof->base);
}
static char *
make_icc_file_description(cmsHPROFILE profile,
const struct cmlcms_md5_sum *md5sum,