[gimp/gtk3-port: 203/228] app: remove gimp_rgb_get,set_gdk_color()



commit 1e6bf66008f31d6aaa948b60af522e4a672150b6
Author: Michael Natterer <mitch gimp org>
Date:   Wed Feb 23 08:57:00 2011 +0100

    app: remove gimp_rgb_get,set_gdk_color()
    
    and inline the few lines into their only users.

 app/widgets/gimptextbuffer.c    |    5 ++-
 app/widgets/gimptexttag.c       |    8 ++++-
 app/widgets/gimpwidgets-utils.c |   50 ---------------------------------------
 app/widgets/gimpwidgets-utils.h |    4 ---
 4 files changed, 9 insertions(+), 58 deletions(-)
---
diff --git a/app/widgets/gimptextbuffer.c b/app/widgets/gimptextbuffer.c
index 6a4cfad..43e658e 100644
--- a/app/widgets/gimptextbuffer.c
+++ b/app/widgets/gimptextbuffer.c
@@ -49,7 +49,6 @@
 #include "gimptextbuffer.h"
 #include "gimptextbuffer-serialize.h"
 #include "gimptexttag.h"
-#include "gimpwidgets-utils.h"
 
 #include "gimp-intl.h"
 
@@ -966,7 +965,9 @@ gimp_text_buffer_get_color_tag (GimpTextBuffer *buffer,
   g_snprintf (name, sizeof (name), "color-#%02x%02x%02x",
               r, g, b);
 
-  gimp_rgb_get_gdk_color (color, &gdk_color);
+  gdk_color.red   = (r << 8) | r;
+  gdk_color.green = (g << 8) | g;
+  gdk_color.blue  = (b << 8) | b;
 
   tag = gtk_text_buffer_create_tag (GTK_TEXT_BUFFER (buffer),
                                     name,
diff --git a/app/widgets/gimptexttag.c b/app/widgets/gimptexttag.c
index dee775b..ec6d2b2 100644
--- a/app/widgets/gimptexttag.c
+++ b/app/widgets/gimptexttag.c
@@ -28,7 +28,6 @@
 #include "widgets-types.h"
 
 #include "gimptexttag.h"
-#include "gimpwidgets-utils.h"
 
 
 gint
@@ -86,12 +85,17 @@ gimp_text_tag_get_color (GtkTextTag *tag,
                          GimpRGB    *color)
 {
   GdkColor *gdk_color;
+  guchar    r, g, b;
 
   g_object_get (tag,
                 GIMP_TEXT_PROP_NAME_COLOR, &gdk_color,
                 NULL);
 
-  gimp_rgb_set_gdk_color (color, gdk_color);
+  r = gdk_color->red   >> 8;
+  g = gdk_color->green >> 8;
+  b = gdk_color->blue  >> 8;
+
+  gimp_rgb_set_uchar (color, r, g, b);
 
   gdk_color_free (gdk_color);
 }
diff --git a/app/widgets/gimpwidgets-utils.c b/app/widgets/gimpwidgets-utils.c
index 3b16f4f..1588434 100644
--- a/app/widgets/gimpwidgets-utils.c
+++ b/app/widgets/gimpwidgets-utils.c
@@ -779,56 +779,6 @@ gimp_get_screen_resolution (GdkScreen *screen,
   *yres = ROUND (y);
 }
 
-
-/**
- * gimp_rgb_get_gdk_color:
- * @rgb: the source color as #GimpRGB
- * @gdk_color: pointer to a #GdkColor
- *
- * Initializes @gdk_color from a #GimpRGB. This function does not
- * allocate the color for you. Depending on how you want to use it,
- * you may have to call gdk_colormap_alloc_color().
- **/
-void
-gimp_rgb_get_gdk_color (const GimpRGB *rgb,
-                        GdkColor      *gdk_color)
-{
-  guchar r, g, b;
-
-  g_return_if_fail (rgb != NULL);
-  g_return_if_fail (gdk_color != NULL);
-
-  gimp_rgb_get_uchar (rgb, &r, &g, &b);
-
-  gdk_color->red   = (r << 8) | r;
-  gdk_color->green = (g << 8) | g;
-  gdk_color->blue  = (b << 8) | b;
-}
-
-/**
- * gimp_rgb_set_gdk_color:
- * @rgb: a #GimpRGB that is to be set
- * @gdk_color: pointer to the source #GdkColor
- *
- * Initializes @rgb from a #GdkColor. This function does not touch
- * the alpha value of @rgb.
- **/
-void
-gimp_rgb_set_gdk_color (GimpRGB        *rgb,
-                        const GdkColor *gdk_color)
-{
-  guchar r, g, b;
-
-  g_return_if_fail (rgb != NULL);
-  g_return_if_fail (gdk_color != NULL);
-
-  r = gdk_color->red   >> 8;
-  g = gdk_color->green >> 8;
-  b = gdk_color->blue  >> 8;
-
-  gimp_rgb_set_uchar (rgb, r, g, b);
-}
-
 gboolean
 gimp_get_style_color (GtkWidget   *widget,
                       const gchar *property_name,
diff --git a/app/widgets/gimpwidgets-utils.h b/app/widgets/gimpwidgets-utils.h
index 22417b6..29b10d7 100644
--- a/app/widgets/gimpwidgets-utils.h
+++ b/app/widgets/gimpwidgets-utils.h
@@ -68,10 +68,6 @@ GdkModifierType   gimp_get_all_modifiers_mask      (void);
 void              gimp_get_screen_resolution       (GdkScreen            *screen,
                                                     gdouble              *xres,
                                                     gdouble              *yres);
-void              gimp_rgb_get_gdk_color           (const GimpRGB        *rgb,
-                                                    GdkColor             *gdk_color);
-void              gimp_rgb_set_gdk_color           (GimpRGB              *rgb,
-                                                    const GdkColor       *gdk_color);
 gboolean          gimp_get_style_color             (GtkWidget            *widget,
                                                     const gchar          *property_name,
                                                     GdkRGBA              *color);



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