[gimp] libgimpwidgets: change parameters of gimp_widget_get_color_transform()



commit fd0203ce80ef22b817543fa72df034c995844c2d
Author: Michael Natterer <mitch gimp org>
Date:   Tue Sep 1 23:40:57 2015 +0200

    libgimpwidgets: change parameters of gimp_widget_get_color_transform()
    
    Change GimpColorManaged to GimpColorProfile.

 app/display/gimpdisplayshell-profile.c |   20 ++++++++++----------
 libgimpwidgets/gimpwidgetsutils.c      |    7 ++-----
 libgimpwidgets/gimpwidgetsutils.h      |    2 +-
 modules/display-filter-lcms.c          |   11 ++++++++---
 4 files changed, 21 insertions(+), 19 deletions(-)
---
diff --git a/app/display/gimpdisplayshell-profile.c b/app/display/gimpdisplayshell-profile.c
index 8157639..cf12f9f 100644
--- a/app/display/gimpdisplayshell-profile.c
+++ b/app/display/gimpdisplayshell-profile.c
@@ -69,12 +69,11 @@ gimp_display_shell_profile_dispose (GimpDisplayShell *shell)
 void
 gimp_display_shell_profile_update (GimpDisplayShell *shell)
 {
-  GimpImage         *image;
-  GimpDisplayConfig *display_config;
-  GimpColorConfig   *config;
-  GimpColorManaged  *managed;
-  const Babl        *src_format;
-  const Babl        *dest_format;
+  GimpImage        *image;
+  GimpColorConfig  *config;
+  GimpColorProfile *src_profile;
+  const Babl       *src_format;
+  const Babl       *dest_format;
 
   gimp_display_shell_profile_dispose (shell);
 
@@ -85,9 +84,9 @@ gimp_display_shell_profile_update (GimpDisplayShell *shell)
   if (! image)
     return;
 
-  display_config = shell->display->config;
-  config         = GIMP_CORE_CONFIG (display_config)->color_management;
-  managed        = GIMP_COLOR_MANAGED (shell);
+  config = GIMP_CORE_CONFIG (shell->display->config)->color_management;
+
+  src_profile = gimp_color_managed_get_color_profile (GIMP_COLOR_MANAGED (shell));
 
   src_format = gimp_babl_format (GIMP_RGB,
                                  gimp_image_get_precision (image),
@@ -108,7 +107,8 @@ gimp_display_shell_profile_update (GimpDisplayShell *shell)
 
   shell->profile_transform =
     gimp_widget_get_color_transform (gtk_widget_get_toplevel (GTK_WIDGET (shell)),
-                                     managed, config,
+                                     config,
+                                     src_profile,
                                      &src_format,
                                      &dest_format);
 
diff --git a/libgimpwidgets/gimpwidgetsutils.c b/libgimpwidgets/gimpwidgetsutils.c
index bd211a8..457ac0b 100644
--- a/libgimpwidgets/gimpwidgetsutils.c
+++ b/libgimpwidgets/gimpwidgetsutils.c
@@ -480,13 +480,12 @@ get_display_profile (GtkWidget       *widget,
 
 GimpColorTransform
 gimp_widget_get_color_transform (GtkWidget         *widget,
-                                 GimpColorManaged  *managed,
                                  GimpColorConfig   *config,
+                                 GimpColorProfile  *src_profile,
                                  const Babl       **src_format,
                                  const Babl       **dest_format)
 {
   GimpColorTransform  transform     = NULL;
-  GimpColorProfile   *src_profile   = NULL;
   GimpColorProfile   *dest_profile  = NULL;
   GimpColorProfile   *proof_profile = NULL;
   cmsHPROFILE         src_lcms;
@@ -496,7 +495,7 @@ gimp_widget_get_color_transform (GtkWidget         *widget,
   cmsUInt16Number     alarmCodes[cmsMAXCHANNELS] = { 0, };
 
   g_return_val_if_fail (widget == NULL || GTK_IS_WIDGET (widget), NULL);
-  g_return_val_if_fail (GIMP_IS_COLOR_MANAGED (managed), NULL);
+  g_return_val_if_fail (GIMP_IS_COLOR_PROFILE (src_profile), NULL);
   g_return_val_if_fail (GIMP_IS_COLOR_CONFIG (config), NULL);
   g_return_val_if_fail (src_format != NULL, NULL);
   g_return_val_if_fail (dest_format != NULL, NULL);
@@ -511,7 +510,6 @@ gimp_widget_get_color_transform (GtkWidget         *widget,
       /*  fallthru  */
 
     case GIMP_COLOR_MANAGEMENT_DISPLAY:
-      src_profile  = gimp_color_managed_get_color_profile (managed);
       dest_profile = get_display_profile (widget, config);
       break;
     }
@@ -573,7 +571,6 @@ gimp_widget_get_color_transform (GtkWidget         *widget,
                                       display_flags);
     }
 
-  g_object_unref (src_profile);
   g_object_unref (dest_profile);
 
   return transform;
diff --git a/libgimpwidgets/gimpwidgetsutils.h b/libgimpwidgets/gimpwidgetsutils.h
index 8cbc44f..cb32f10 100644
--- a/libgimpwidgets/gimpwidgetsutils.h
+++ b/libgimpwidgets/gimpwidgetsutils.h
@@ -49,8 +49,8 @@ gint                 gimp_get_monitor_at_pointer     (GdkScreen        **screen)
 GimpColorProfile   * gimp_widget_get_color_profile   (GtkWidget         *widget);
 
 GimpColorTransform   gimp_widget_get_color_transform (GtkWidget         *widget,
-                                                      GimpColorManaged  *managed,
                                                       GimpColorConfig   *config,
+                                                      GimpColorProfile  *src_profile,
                                                       const Babl       **src_format,
                                                       const Babl       **dest_format);
 
diff --git a/modules/display-filter-lcms.c b/modules/display-filter-lcms.c
index 8d032f3..0ce53d1 100644
--- a/modules/display-filter-lcms.c
+++ b/modules/display-filter-lcms.c
@@ -257,8 +257,9 @@ cdisplay_lcms_changed (GimpColorDisplay *display)
 {
   CdisplayLcms     *lcms   = CDISPLAY_LCMS (display);
   GtkWidget        *widget = NULL;
-  GimpColorManaged *managed;
   GimpColorConfig  *config;
+  GimpColorManaged *managed;
+  GimpColorProfile *src_profile;
 
   if (lcms->transform)
     {
@@ -266,8 +267,8 @@ cdisplay_lcms_changed (GimpColorDisplay *display)
       lcms->transform = NULL;
     }
 
-  managed = gimp_color_display_get_managed (display);
   config  = gimp_color_display_get_config (display);
+  managed = gimp_color_display_get_managed (display);
 
   if (! config || ! managed)
     return;
@@ -275,13 +276,17 @@ cdisplay_lcms_changed (GimpColorDisplay *display)
   if (GTK_IS_WIDGET (managed))
     widget = gtk_widget_get_toplevel (GTK_WIDGET (managed));
 
+  src_profile = gimp_color_managed_get_color_profile (managed);
+
   lcms->src_format  = babl_format ("R'G'B'A float");
   lcms->dest_format = babl_format ("R'G'B'A float");
 
   lcms->transform = gimp_widget_get_color_transform (widget,
-                                                     managed, config,
+                                                     config, src_profile,
                                                      &lcms->src_format,
                                                      &lcms->dest_format);
+
+  g_object_unref (src_profile);
 }
 
 static GimpColorProfile *


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]