color: add get_stock_sRGB_color_profile() to color manager
In the next commit we'll stop using NULL as the stock sRGB color profile, so add a function to the color manager to allow libweston core to have access to the stock sRGB profile. Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
This commit is contained in:
parent
154ce42b8c
commit
977c41a65c
@ -457,6 +457,7 @@ weston_color_manager_create(struct weston_compositor *compositor)
|
||||
cm->base.init = cmlcms_init;
|
||||
cm->base.destroy = cmlcms_destroy;
|
||||
cm->base.destroy_color_profile = cmlcms_destroy_color_profile;
|
||||
cm->base.get_stock_sRGB_color_profile = cmlcms_get_stock_sRGB_color_profile;
|
||||
cm->base.get_color_profile_from_icc = cmlcms_get_color_profile_from_icc;
|
||||
cm->base.destroy_color_transform = cmlcms_destroy_color_transform;
|
||||
cm->base.get_surface_color_transform = cmlcms_get_surface_color_transform;
|
||||
|
@ -127,6 +127,9 @@ get_cprof(struct weston_color_profile *cprof_base)
|
||||
return container_of(cprof_base, struct cmlcms_color_profile, base);
|
||||
}
|
||||
|
||||
struct weston_color_profile *
|
||||
cmlcms_get_stock_sRGB_color_profile(struct weston_color_manager *cm_base);
|
||||
|
||||
bool
|
||||
cmlcms_get_color_profile_from_icc(struct weston_color_manager *cm,
|
||||
const void *icc_data,
|
||||
|
@ -442,6 +442,17 @@ err_close:
|
||||
return false;
|
||||
}
|
||||
|
||||
struct weston_color_profile *
|
||||
cmlcms_get_stock_sRGB_color_profile(struct weston_color_manager *cm_base)
|
||||
{
|
||||
struct weston_color_manager_lcms *cm = get_cmlcms(cm_base);
|
||||
struct cmlcms_color_profile *cprof;
|
||||
|
||||
cprof = ref_cprof(cm->sRGB_profile);
|
||||
|
||||
return &cprof->base;
|
||||
}
|
||||
|
||||
bool
|
||||
cmlcms_get_color_profile_from_icc(struct weston_color_manager *cm_base,
|
||||
const void *icc_data,
|
||||
|
@ -64,6 +64,16 @@ get_cprof(struct weston_color_profile *cprof_base)
|
||||
return container_of(cprof_base, struct cmnoop_color_profile, base);
|
||||
}
|
||||
|
||||
static struct cmnoop_color_profile *
|
||||
ref_cprof(struct cmnoop_color_profile *cprof)
|
||||
{
|
||||
if (!cprof)
|
||||
return NULL;
|
||||
|
||||
weston_color_profile_ref(&cprof->base);
|
||||
return cprof;
|
||||
}
|
||||
|
||||
static void
|
||||
unref_cprof(struct cmnoop_color_profile *cprof)
|
||||
{
|
||||
@ -101,6 +111,17 @@ cmnoop_color_profile_create(struct weston_color_manager_noop *cm, char *desc)
|
||||
return cprof;
|
||||
}
|
||||
|
||||
static struct weston_color_profile *
|
||||
cmnoop_get_stock_sRGB_color_profile(struct weston_color_manager *cm_base)
|
||||
{
|
||||
struct weston_color_manager_noop *cm = get_cmnoop(cm_base);
|
||||
struct cmnoop_color_profile *cprof;
|
||||
|
||||
cprof = ref_cprof(cm->stock_cprof);
|
||||
|
||||
return &cprof->base;
|
||||
}
|
||||
|
||||
static bool
|
||||
cmnoop_get_color_profile_from_icc(struct weston_color_manager *cm,
|
||||
const void *icc_data,
|
||||
@ -213,6 +234,7 @@ weston_color_manager_noop_create(struct weston_compositor *compositor)
|
||||
cm->base.init = cmnoop_init;
|
||||
cm->base.destroy = cmnoop_destroy;
|
||||
cm->base.destroy_color_profile = cmnoop_destroy_color_profile;
|
||||
cm->base.get_stock_sRGB_color_profile = cmnoop_get_stock_sRGB_color_profile;
|
||||
cm->base.get_color_profile_from_icc = cmnoop_get_color_profile_from_icc;
|
||||
cm->base.destroy_color_transform = cmnoop_destroy_color_transform;
|
||||
cm->base.get_surface_color_transform = cmnoop_get_surface_color_transform;
|
||||
|
@ -262,6 +262,14 @@ struct weston_color_manager {
|
||||
void
|
||||
(*destroy_color_profile)(struct weston_color_profile *cprof);
|
||||
|
||||
/** Gets a reference to the stock sRGB color profile
|
||||
*
|
||||
* \param cm The color manager.
|
||||
* \return A reference to the stock sRGB profile, never returns NULL.
|
||||
*/
|
||||
struct weston_color_profile *
|
||||
(*get_stock_sRGB_color_profile)(struct weston_color_manager *cm);
|
||||
|
||||
/** Create a color profile from ICC data
|
||||
*
|
||||
* \param cm The color manager.
|
||||
|
Loading…
Reference in New Issue
Block a user