[gimp/gtk3-port: 240/249] app: remove gimp_rgb_get,set_gdk_color()



commit 462305b8fd52f7a90dba3f9bf11f5a579673b9e1
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 24eb9cb..dab695b 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 5b706af..ed6f3c3 100644
--- a/app/widgets/gimptexttag.c
+++ b/app/widgets/gimptexttag.c
@@ -27,7 +27,6 @@
 #include "widgets-types.h"
 
 #include "gimptexttag.h"
-#include "gimpwidgets-utils.h"
 
 
 gint
@@ -85,12 +84,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 ac6d8cd..116dad5 100644
--- a/app/widgets/gimpwidgets-utils.c
+++ b/app/widgets/gimpwidgets-utils.c
@@ -751,56 +751,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 aec2ef8..ee41d99 100644
--- a/app/widgets/gimpwidgets-utils.h
+++ b/app/widgets/gimpwidgets-utils.h
@@ -63,10 +63,6 @@ gchar           * gimp_suggest_modifiers           (const gchar          *messag
 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]