libgimpcolor, *: change GimpColorProfile to be a GObject

it used to be a typedef to gpointer and actually was a cmsHPROFILE.

Change its API to be more "standard", remove the public close()
function. The object caches both the cmsHPROFILE and the data/length
ICC blob, so conversions between the two become obsolete (simply call
get_lcms_profile() or get_icc_profile()).

Adapt everything to the new API, but port it in a naive way for now,
the code doesn't take advantage of the new possibilities yet (like
refcounting).
This commit is contained in:
Michael Natterer 2015-07-10 22:43:53 +02:00
parent 763e459a92
commit c102dde92b
33 changed files with 730 additions and 512 deletions

View file

@ -353,8 +353,10 @@ colorsel_cmyk_config_changed (ColorselCmyk *module)
GimpColorSelector *selector = GIMP_COLOR_SELECTOR (module);
GimpColorConfig *config = module->config;
cmsUInt32Number flags = 0;
GimpColorProfile rgb_profile = NULL;
GimpColorProfile cmyk_profile = NULL;
GimpColorProfile *rgb_profile = NULL;
GimpColorProfile *cmyk_profile = NULL;
cmsHPROFILE rgb_lcms;
cmsHPROFILE cmyk_lcms;
gchar *label;
gchar *summary;
gchar *text;
@ -397,28 +399,31 @@ colorsel_cmyk_config_changed (ColorselCmyk *module)
g_free (label);
g_free (summary);
rgb_lcms = gimp_color_profile_get_lcms_profile (rgb_profile);
cmyk_lcms = gimp_color_profile_get_lcms_profile (cmyk_profile);
if (config->display_intent ==
GIMP_COLOR_RENDERING_INTENT_RELATIVE_COLORIMETRIC)
{
flags |= cmsFLAGS_BLACKPOINTCOMPENSATION;
}
module->rgb2cmyk = cmsCreateTransform (rgb_profile, TYPE_RGB_DBL,
cmyk_profile, TYPE_CMYK_DBL,
module->rgb2cmyk = cmsCreateTransform (rgb_lcms, TYPE_RGB_DBL,
cmyk_lcms, TYPE_CMYK_DBL,
config->display_intent,
flags);
module->cmyk2rgb = cmsCreateTransform (cmyk_profile, TYPE_CMYK_DBL,
rgb_profile, TYPE_RGB_DBL,
module->cmyk2rgb = cmsCreateTransform (cmyk_lcms, TYPE_CMYK_DBL,
rgb_lcms, TYPE_RGB_DBL,
config->display_intent,
flags);
out:
if (rgb_profile)
gimp_color_profile_close (rgb_profile);
g_object_unref (rgb_profile);
if (cmyk_profile)
gimp_color_profile_close (cmyk_profile);
g_object_unref (cmyk_profile);
if (! module->in_destruction)
colorsel_cmyk_set_color (selector, &selector->rgb, &selector->hsv);