mirror of
https://gitlab.gnome.org/GNOME/gimp.git
synced 2025-07-03 17:33:25 +00:00
libgimpcolor: return an optional MD5 digest from gimp_lcms_create_srgb_profile()
pass NULL in most places, use the feature in the lcms.c plu-gin.
This commit is contained in:
parent
a0e8913a43
commit
b3395d989e
8 changed files with 36 additions and 44 deletions
|
@ -120,7 +120,7 @@ gimp_image_profile_view_update (GimpImageParasiteView *view)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! profile)
|
if (! profile)
|
||||||
profile = gimp_lcms_create_srgb_profile ();
|
profile = gimp_lcms_create_srgb_profile (NULL);
|
||||||
|
|
||||||
gimp_color_profile_view_set_profile (profile_view->profile_view, profile);
|
gimp_color_profile_view_set_profile (profile_view->profile_view, profile);
|
||||||
|
|
||||||
|
|
|
@ -297,7 +297,7 @@ gimp_lcms_profile_set_tag (cmsHPROFILE profile,
|
||||||
* Since: GIMP 2.10
|
* Since: GIMP 2.10
|
||||||
**/
|
**/
|
||||||
GimpColorProfile
|
GimpColorProfile
|
||||||
gimp_lcms_create_srgb_profile (void)
|
gimp_lcms_create_srgb_profile (guint8 *md5_digest)
|
||||||
{
|
{
|
||||||
cmsHPROFILE srgb_profile;
|
cmsHPROFILE srgb_profile;
|
||||||
cmsCIExyY d65_srgb_specs = { 0.3127, 0.3290, 1.0 };
|
cmsCIExyY d65_srgb_specs = { 0.3127, 0.3290, 1.0 };
|
||||||
|
@ -345,5 +345,25 @@ gimp_lcms_create_srgb_profile (void)
|
||||||
* cmsSetProfileVersion (srgb_profile, 2.1);
|
* cmsSetProfileVersion (srgb_profile, 2.1);
|
||||||
**/
|
**/
|
||||||
|
|
||||||
|
if (md5_digest)
|
||||||
|
{
|
||||||
|
md5_digest[0] = 0xcb;
|
||||||
|
md5_digest[1] = 0x63;
|
||||||
|
md5_digest[2] = 0x14;
|
||||||
|
md5_digest[3] = 0x56;
|
||||||
|
md5_digest[4] = 0xd4;
|
||||||
|
md5_digest[5] = 0x0a;
|
||||||
|
md5_digest[6] = 0x01;
|
||||||
|
md5_digest[7] = 0x62;
|
||||||
|
md5_digest[8] = 0xa0;
|
||||||
|
md5_digest[9] = 0xdb;
|
||||||
|
md5_digest[10] = 0xe6;
|
||||||
|
md5_digest[11] = 0x32;
|
||||||
|
md5_digest[12] = 0x8b;
|
||||||
|
md5_digest[13] = 0xea;
|
||||||
|
md5_digest[14] = 0x1a;
|
||||||
|
md5_digest[15] = 0x89;
|
||||||
|
}
|
||||||
|
|
||||||
return srgb_profile;
|
return srgb_profile;
|
||||||
}
|
}
|
||||||
|
|
|
@ -53,7 +53,7 @@ gchar * gimp_lcms_profile_get_summary (GimpColorProfile profil
|
||||||
gboolean gimp_lcms_profile_is_rgb (GimpColorProfile profile);
|
gboolean gimp_lcms_profile_is_rgb (GimpColorProfile profile);
|
||||||
gboolean gimp_lcms_profile_is_cmyk (GimpColorProfile profile);
|
gboolean gimp_lcms_profile_is_cmyk (GimpColorProfile profile);
|
||||||
|
|
||||||
GimpColorProfile gimp_lcms_create_srgb_profile (void);
|
GimpColorProfile gimp_lcms_create_srgb_profile (guint8 *md5_digest);
|
||||||
|
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
|
|
@ -357,7 +357,7 @@ color_config_get_rgb_profile (GimpColorConfig *config)
|
||||||
if (config->rgb_profile)
|
if (config->rgb_profile)
|
||||||
profile = cmsOpenProfileFromFile (config->rgb_profile, "r");
|
profile = cmsOpenProfileFromFile (config->rgb_profile, "r");
|
||||||
|
|
||||||
return profile ? profile : gimp_lcms_create_srgb_profile ();
|
return profile ? profile : gimp_lcms_create_srgb_profile (NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
static cmsHPROFILE
|
static cmsHPROFILE
|
||||||
|
|
|
@ -318,10 +318,10 @@ cdisplay_lcms_changed (GimpColorDisplay *display)
|
||||||
cmsUInt32Number softproof_flags = 0;
|
cmsUInt32Number softproof_flags = 0;
|
||||||
|
|
||||||
if (! src_profile)
|
if (! src_profile)
|
||||||
src_profile = gimp_lcms_create_srgb_profile ();
|
src_profile = gimp_lcms_create_srgb_profile (NULL);
|
||||||
|
|
||||||
if (! dest_profile)
|
if (! dest_profile)
|
||||||
dest_profile = gimp_lcms_create_srgb_profile ();
|
dest_profile = gimp_lcms_create_srgb_profile (NULL);
|
||||||
|
|
||||||
softproof_flags |= cmsFLAGS_SOFTPROOFING;
|
softproof_flags |= cmsFLAGS_SOFTPROOFING;
|
||||||
|
|
||||||
|
@ -358,10 +358,10 @@ cdisplay_lcms_changed (GimpColorDisplay *display)
|
||||||
cmsUInt32Number display_flags = 0;
|
cmsUInt32Number display_flags = 0;
|
||||||
|
|
||||||
if (! src_profile)
|
if (! src_profile)
|
||||||
src_profile = gimp_lcms_create_srgb_profile ();
|
src_profile = gimp_lcms_create_srgb_profile (NULL);
|
||||||
|
|
||||||
if (! dest_profile)
|
if (! dest_profile)
|
||||||
dest_profile = gimp_lcms_create_srgb_profile ();
|
dest_profile = gimp_lcms_create_srgb_profile (NULL);
|
||||||
|
|
||||||
if (config->display_use_black_point_compensation)
|
if (config->display_use_black_point_compensation)
|
||||||
{
|
{
|
||||||
|
|
|
@ -384,7 +384,7 @@ cdisplay_proof_changed (GimpColorDisplay *display)
|
||||||
if (! proof->profile)
|
if (! proof->profile)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
rgb_profile = gimp_lcms_create_srgb_profile ();
|
rgb_profile = gimp_lcms_create_srgb_profile (NULL);
|
||||||
|
|
||||||
proof_profile = cmsOpenProfileFromFile (proof->profile, "r");
|
proof_profile = cmsOpenProfileFromFile (proof->profile, "r");
|
||||||
|
|
||||||
|
|
|
@ -136,7 +136,6 @@ static void lcms_image_transform_indexed (gint32 image,
|
||||||
cmsHPROFILE dest_profile,
|
cmsHPROFILE dest_profile,
|
||||||
GimpColorRenderingIntent intent,
|
GimpColorRenderingIntent intent,
|
||||||
gboolean bpc);
|
gboolean bpc);
|
||||||
static void lcms_sRGB_checksum (guchar *digest);
|
|
||||||
|
|
||||||
static gboolean lcms_icc_apply_dialog (gint32 image,
|
static gboolean lcms_icc_apply_dialog (gint32 image,
|
||||||
cmsHPROFILE src_profile,
|
cmsHPROFILE src_profile,
|
||||||
|
@ -577,16 +576,10 @@ lcms_icc_apply (GimpColorConfig *config,
|
||||||
return GIMP_PDB_SUCCESS;
|
return GIMP_PDB_SUCCESS;
|
||||||
|
|
||||||
if (! src_profile)
|
if (! src_profile)
|
||||||
{
|
src_profile = gimp_lcms_create_srgb_profile (src_md5);
|
||||||
src_profile = gimp_lcms_create_srgb_profile ();
|
|
||||||
lcms_sRGB_checksum (src_md5);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (! dest_profile)
|
if (! dest_profile)
|
||||||
{
|
dest_profile = gimp_lcms_create_srgb_profile (dest_md5);
|
||||||
dest_profile = gimp_lcms_create_srgb_profile ();
|
|
||||||
lcms_sRGB_checksum (dest_md5);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (memcmp (src_md5, dest_md5, GIMP_LCMS_MD5_DIGEST_LENGTH) == 0)
|
if (memcmp (src_md5, dest_md5, GIMP_LCMS_MD5_DIGEST_LENGTH) == 0)
|
||||||
{
|
{
|
||||||
|
@ -648,7 +641,7 @@ lcms_icc_info (GimpColorConfig *config,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! profile)
|
if (! profile)
|
||||||
profile = gimp_lcms_create_srgb_profile ();
|
profile = gimp_lcms_create_srgb_profile (NULL);
|
||||||
|
|
||||||
if (name) *name = gimp_lcms_profile_get_model (profile);
|
if (name) *name = gimp_lcms_profile_get_model (profile);
|
||||||
if (desc) *desc = gimp_lcms_profile_get_description (profile);
|
if (desc) *desc = gimp_lcms_profile_get_description (profile);
|
||||||
|
@ -682,27 +675,6 @@ lcms_icc_file_info (const gchar *filename,
|
||||||
return GIMP_PDB_SUCCESS;
|
return GIMP_PDB_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
|
||||||
lcms_sRGB_checksum (guchar *digest)
|
|
||||||
{
|
|
||||||
digest[0] = 0xcb;
|
|
||||||
digest[1] = 0x63;
|
|
||||||
digest[2] = 0x14;
|
|
||||||
digest[3] = 0x56;
|
|
||||||
digest[4] = 0xd4;
|
|
||||||
digest[5] = 0x0a;
|
|
||||||
digest[6] = 0x01;
|
|
||||||
digest[7] = 0x62;
|
|
||||||
digest[8] = 0xa0;
|
|
||||||
digest[9] = 0xdb;
|
|
||||||
digest[10] = 0xe6;
|
|
||||||
digest[11] = 0x32;
|
|
||||||
digest[12] = 0x8b;
|
|
||||||
digest[13] = 0xea;
|
|
||||||
digest[14] = 0x1a;
|
|
||||||
digest[15] = 0x89;
|
|
||||||
}
|
|
||||||
|
|
||||||
static cmsHPROFILE
|
static cmsHPROFILE
|
||||||
lcms_image_get_profile (GimpColorConfig *config,
|
lcms_image_get_profile (GimpColorConfig *config,
|
||||||
gint32 image,
|
gint32 image,
|
||||||
|
@ -1340,7 +1312,7 @@ lcms_icc_combo_box_new (GimpColorConfig *config,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! profile)
|
if (! profile)
|
||||||
profile = gimp_lcms_create_srgb_profile ();
|
profile = gimp_lcms_create_srgb_profile (NULL);
|
||||||
|
|
||||||
name = gimp_lcms_profile_get_description (profile);
|
name = gimp_lcms_profile_get_description (profile);
|
||||||
if (! name)
|
if (! name)
|
||||||
|
@ -1391,7 +1363,7 @@ lcms_dialog (GimpColorConfig *config,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! src_profile)
|
if (! src_profile)
|
||||||
src_profile = gimp_lcms_create_srgb_profile ();
|
src_profile = gimp_lcms_create_srgb_profile (NULL);
|
||||||
|
|
||||||
gimp_ui_init (PLUG_IN_BINARY, FALSE);
|
gimp_ui_init (PLUG_IN_BINARY, FALSE);
|
||||||
|
|
||||||
|
@ -1510,7 +1482,7 @@ lcms_dialog (GimpColorConfig *config,
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
dest_profile = gimp_lcms_create_srgb_profile ();
|
dest_profile = gimp_lcms_create_srgb_profile (NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dest_profile)
|
if (dest_profile)
|
||||||
|
|
|
@ -648,7 +648,7 @@ jpeg_load_cmyk_transform (guint8 *profile_data,
|
||||||
/* make the real sRGB profile as a fallback */
|
/* make the real sRGB profile as a fallback */
|
||||||
if (! rgb_profile)
|
if (! rgb_profile)
|
||||||
{
|
{
|
||||||
rgb_profile = gimp_lcms_create_srgb_profile ();
|
rgb_profile = gimp_lcms_create_srgb_profile (NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (config->display_intent ==
|
if (config->display_intent ==
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue