[gimp] libgimpwidgets: simplify gimp_widget_get_color_transform()
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] libgimpwidgets: simplify gimp_widget_get_color_transform()
- Date: Fri, 29 May 2015 23:09:02 +0000 (UTC)
commit 263fabbb9b53c9dec9ebb21f7393d35113b6b69d
Author: Michael Natterer <mitch gimp org>
Date: Sat May 30 01:07:34 2015 +0200
libgimpwidgets: simplify gimp_widget_get_color_transform()
Make sure src_profile and dest_profile always exist. Also optimize
things by not returning a transform if the profiles are equal.
libgimpwidgets/gimpwidgetsutils.c | 24 ++++++------------------
1 files changed, 6 insertions(+), 18 deletions(-)
---
diff --git a/libgimpwidgets/gimpwidgetsutils.c b/libgimpwidgets/gimpwidgetsutils.c
index a3341d4..a0d973e 100644
--- a/libgimpwidgets/gimpwidgetsutils.c
+++ b/libgimpwidgets/gimpwidgetsutils.c
@@ -471,6 +471,9 @@ get_display_profile (GtkWidget *widget,
if (! profile)
profile = gimp_color_config_get_display_profile (config, NULL);
+ if (! profile)
+ profile = gimp_lcms_create_srgb_profile ();
+
return profile;
}
@@ -517,12 +520,6 @@ gimp_widget_get_color_transform (GtkWidget *widget,
{
cmsUInt32Number softproof_flags = 0;
- if (! src_profile)
- src_profile = gimp_lcms_create_srgb_profile ();
-
- if (! dest_profile)
- dest_profile = gimp_lcms_create_srgb_profile ();
-
softproof_flags |= cmsFLAGS_SOFTPROOFING;
if (config->simulation_use_black_point_compensation)
@@ -555,16 +552,10 @@ gimp_widget_get_color_transform (GtkWidget *widget,
gimp_lcms_profile_close (proof_profile);
}
- else if (src_profile || dest_profile)
+ else if (! gimp_lcms_profile_is_equal (src_profile, dest_profile))
{
cmsUInt32Number display_flags = 0;
- if (! src_profile)
- src_profile = gimp_lcms_create_srgb_profile ();
-
- if (! dest_profile)
- dest_profile = gimp_lcms_create_srgb_profile ();
-
if (config->display_use_black_point_compensation)
{
display_flags |= cmsFLAGS_BLACKPOINTCOMPENSATION;
@@ -577,11 +568,8 @@ gimp_widget_get_color_transform (GtkWidget *widget,
display_flags);
}
- if (src_profile)
- gimp_lcms_profile_close (src_profile);
-
- if (dest_profile)
- gimp_lcms_profile_close (dest_profile);
+ gimp_lcms_profile_close (src_profile);
+ gimp_lcms_profile_close (dest_profile);
return transform;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]