From a92fa34d1d60cf30bdcc1e97da5c3d43678f0316 Mon Sep 17 00:00:00 2001 From: Vitaly Prosyak Date: Wed, 22 Sep 2021 19:17:05 -0400 Subject: [PATCH] color-lcms: add wrapper API for refcounting cmlcms_color_profile It is used for convenience when profile is cached. Signed-off-by: Vitaly Prosyak --- libweston/color-lcms/color-lcms.h | 6 ++++++ libweston/color-lcms/color-profile.c | 19 +++++++++++++++++++ 2 files changed, 25 insertions(+) diff --git a/libweston/color-lcms/color-lcms.h b/libweston/color-lcms/color-lcms.h index 9d859b08f..05fa940ac 100644 --- a/libweston/color-lcms/color-lcms.h +++ b/libweston/color-lcms/color-lcms.h @@ -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 */ diff --git a/libweston/color-lcms/color-profile.c b/libweston/color-lcms/color-profile.c index 46ef46bf2..0d11439d3 100644 --- a/libweston/color-lcms/color-profile.c +++ b/libweston/color-lcms/color-profile.c @@ -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,