mirror of
https://gitlab.gnome.org/GNOME/gimp.git
synced 2025-07-03 17:33:25 +00:00
Use the newly added profile utility functions all over the place
This commit is contained in:
parent
54553487f2
commit
6c800db1cc
10 changed files with 71 additions and 161 deletions
|
@ -347,36 +347,14 @@ colorsel_cmyk_adj_update (GtkAdjustment *adj,
|
|||
gimp_color_selector_color_changed (selector);
|
||||
}
|
||||
|
||||
static cmsHPROFILE
|
||||
color_config_get_rgb_profile (GimpColorConfig *config)
|
||||
{
|
||||
cmsHPROFILE profile = NULL;
|
||||
|
||||
if (config->rgb_profile)
|
||||
profile = cmsOpenProfileFromFile (config->rgb_profile, "r");
|
||||
|
||||
return profile ? profile : gimp_lcms_create_srgb_profile ();
|
||||
}
|
||||
|
||||
static cmsHPROFILE
|
||||
color_config_get_cmyk_profile (GimpColorConfig *config)
|
||||
{
|
||||
cmsHPROFILE profile = NULL;
|
||||
|
||||
if (config->cmyk_profile)
|
||||
profile = cmsOpenProfileFromFile (config->cmyk_profile, "r");
|
||||
|
||||
return profile;
|
||||
}
|
||||
|
||||
static void
|
||||
colorsel_cmyk_config_changed (ColorselCmyk *module)
|
||||
{
|
||||
GimpColorSelector *selector = GIMP_COLOR_SELECTOR (module);
|
||||
GimpColorConfig *config = module->config;
|
||||
cmsUInt32Number flags = 0;
|
||||
cmsHPROFILE rgb_profile = NULL;
|
||||
cmsHPROFILE cmyk_profile = NULL;
|
||||
GimpColorProfile rgb_profile = NULL;
|
||||
GimpColorProfile cmyk_profile = NULL;
|
||||
gchar *label;
|
||||
gchar *summary;
|
||||
gchar *text;
|
||||
|
@ -399,8 +377,11 @@ colorsel_cmyk_config_changed (ColorselCmyk *module)
|
|||
if (! config)
|
||||
goto out;
|
||||
|
||||
rgb_profile = color_config_get_rgb_profile (config);
|
||||
cmyk_profile = color_config_get_cmyk_profile (config);
|
||||
rgb_profile = gimp_color_config_get_rgb_profile (config, NULL);
|
||||
cmyk_profile = gimp_color_config_get_cmyk_profile (config, NULL);
|
||||
|
||||
if (! rgb_profile)
|
||||
rgb_profile = gimp_lcms_create_srgb_profile ();
|
||||
|
||||
if (! cmyk_profile)
|
||||
goto out;
|
||||
|
@ -434,10 +415,10 @@ colorsel_cmyk_config_changed (ColorselCmyk *module)
|
|||
out:
|
||||
|
||||
if (rgb_profile)
|
||||
cmsCloseProfile (rgb_profile);
|
||||
gimp_lcms_profile_close (rgb_profile);
|
||||
|
||||
if (cmyk_profile)
|
||||
cmsCloseProfile (cmyk_profile);
|
||||
gimp_lcms_profile_close (cmyk_profile);
|
||||
|
||||
if (! module->in_destruction)
|
||||
colorsel_cmyk_set_color (selector, &selector->rgb, &selector->hsv);
|
||||
|
|
|
@ -83,7 +83,6 @@ static void cdisplay_lcms_changed (GimpColorDisplay *displ
|
|||
|
||||
static cmsHPROFILE cdisplay_lcms_get_rgb_profile (CdisplayLcms *lcms);
|
||||
static cmsHPROFILE cdisplay_lcms_get_display_profile (CdisplayLcms *lcms);
|
||||
static cmsHPROFILE cdisplay_lcms_get_printer_profile (CdisplayLcms *lcms);
|
||||
|
||||
static void cdisplay_lcms_attach_labelled (GtkTable *table,
|
||||
gint row,
|
||||
|
@ -295,7 +294,7 @@ cdisplay_lcms_changed (GimpColorDisplay *display)
|
|||
return;
|
||||
|
||||
case GIMP_COLOR_MANAGEMENT_SOFTPROOF:
|
||||
proof_profile = cdisplay_lcms_get_printer_profile (lcms);
|
||||
proof_profile = gimp_color_config_get_printer_profile (config, NULL);
|
||||
/* fallthru */
|
||||
|
||||
case GIMP_COLOR_MANAGEMENT_DISPLAY:
|
||||
|
@ -342,7 +341,7 @@ cdisplay_lcms_changed (GimpColorDisplay *display)
|
|||
config->simulation_intent,
|
||||
config->display_intent,
|
||||
softproof_flags);
|
||||
cmsCloseProfile (proof_profile);
|
||||
gimp_lcms_profile_close (proof_profile);
|
||||
}
|
||||
else if (src_profile || dest_profile)
|
||||
{
|
||||
|
@ -366,10 +365,10 @@ cdisplay_lcms_changed (GimpColorDisplay *display)
|
|||
}
|
||||
|
||||
if (dest_profile)
|
||||
cmsCloseProfile (dest_profile);
|
||||
gimp_lcms_profile_close (dest_profile);
|
||||
|
||||
if (src_profile)
|
||||
cmsCloseProfile (src_profile);
|
||||
gimp_lcms_profile_close (src_profile);
|
||||
}
|
||||
|
||||
static cmsHPROFILE
|
||||
|
@ -379,6 +378,7 @@ cdisplay_lcms_get_rgb_profile (CdisplayLcms *lcms)
|
|||
GimpColorManaged *managed;
|
||||
cmsHPROFILE profile = NULL;
|
||||
|
||||
config = gimp_color_display_get_config (GIMP_COLOR_DISPLAY (lcms));
|
||||
managed = gimp_color_display_get_managed (GIMP_COLOR_DISPLAY (lcms));
|
||||
|
||||
if (managed)
|
||||
|
@ -391,24 +391,13 @@ cdisplay_lcms_get_rgb_profile (CdisplayLcms *lcms)
|
|||
|
||||
if (profile && ! gimp_lcms_profile_is_rgb (profile))
|
||||
{
|
||||
cmsCloseProfile (profile);
|
||||
gimp_lcms_profile_close (profile);
|
||||
profile = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
if (! profile)
|
||||
{
|
||||
config = gimp_color_display_get_config (GIMP_COLOR_DISPLAY (lcms));
|
||||
|
||||
if (config->rgb_profile)
|
||||
profile = cmsOpenProfileFromFile (config->rgb_profile, "r");
|
||||
|
||||
if (profile && ! gimp_lcms_profile_is_rgb (profile))
|
||||
{
|
||||
cmsCloseProfile (profile);
|
||||
profile = NULL;
|
||||
}
|
||||
}
|
||||
profile = gimp_color_config_get_rgb_profile (config, NULL);
|
||||
|
||||
return profile;
|
||||
}
|
||||
|
@ -542,25 +531,12 @@ cdisplay_lcms_get_display_profile (CdisplayLcms *lcms)
|
|||
}
|
||||
#endif
|
||||
|
||||
if (! profile && config->display_profile)
|
||||
profile = cmsOpenProfileFromFile (config->display_profile, "r");
|
||||
if (! profile)
|
||||
profile = gimp_color_config_get_display_profile (config, NULL);
|
||||
|
||||
return profile;
|
||||
}
|
||||
|
||||
static cmsHPROFILE
|
||||
cdisplay_lcms_get_printer_profile (CdisplayLcms *lcms)
|
||||
{
|
||||
GimpColorConfig *config;
|
||||
|
||||
config = gimp_color_display_get_config (GIMP_COLOR_DISPLAY (lcms));
|
||||
|
||||
if (config->printer_profile)
|
||||
return cmsOpenProfileFromFile (config->printer_profile, "r");
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
cdisplay_lcms_attach_labelled (GtkTable *table,
|
||||
gint row,
|
||||
|
@ -593,10 +569,13 @@ static void
|
|||
cdisplay_lcms_update_profile_label (CdisplayLcms *lcms,
|
||||
const gchar *name)
|
||||
{
|
||||
GtkWidget *label;
|
||||
cmsHPROFILE profile = NULL;
|
||||
gchar *text = NULL;
|
||||
gchar *tooltip = NULL;
|
||||
GimpColorConfig *config;
|
||||
GtkWidget *label;
|
||||
cmsHPROFILE profile = NULL;
|
||||
gchar *text = NULL;
|
||||
gchar *tooltip = NULL;
|
||||
|
||||
config = gimp_color_display_get_config (GIMP_COLOR_DISPLAY (lcms));
|
||||
|
||||
label = g_object_get_data (G_OBJECT (lcms), name);
|
||||
|
||||
|
@ -613,7 +592,7 @@ cdisplay_lcms_update_profile_label (CdisplayLcms *lcms,
|
|||
}
|
||||
else if (strcmp (name, "printer-profile") == 0)
|
||||
{
|
||||
profile = cdisplay_lcms_get_printer_profile (lcms);
|
||||
profile = gimp_color_config_get_printer_profile (config, NULL);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -629,7 +608,7 @@ cdisplay_lcms_update_profile_label (CdisplayLcms *lcms,
|
|||
g_free (tooltip);
|
||||
|
||||
if (profile)
|
||||
cmsCloseProfile (profile);
|
||||
gimp_lcms_profile_close (profile);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
@ -322,9 +322,10 @@ cdisplay_proof_configure (GimpColorDisplay *display)
|
|||
static void
|
||||
cdisplay_proof_changed (GimpColorDisplay *display)
|
||||
{
|
||||
CdisplayProof *proof = CDISPLAY_PROOF (display);
|
||||
cmsHPROFILE rgb_profile;
|
||||
cmsHPROFILE proof_profile;
|
||||
CdisplayProof *proof = CDISPLAY_PROOF (display);
|
||||
GimpColorProfile rgb_profile;
|
||||
GimpColorProfile proof_profile;
|
||||
GFile *file;
|
||||
|
||||
if (proof->transform)
|
||||
{
|
||||
|
@ -337,7 +338,9 @@ cdisplay_proof_changed (GimpColorDisplay *display)
|
|||
|
||||
rgb_profile = gimp_lcms_create_srgb_profile ();
|
||||
|
||||
proof_profile = cmsOpenProfileFromFile (proof->profile, "r");
|
||||
file = g_file_new_for_path (proof->profile);
|
||||
proof_profile = gimp_lcms_profile_open_from_file (file, NULL);
|
||||
g_object_unref (file);
|
||||
|
||||
if (proof_profile)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue