[gimp/gtk3-port: 193/391] app: remove gimp_rgb_get,set_gdk_color()
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp/gtk3-port: 193/391] app: remove gimp_rgb_get,set_gdk_color()
- Date: Thu, 10 May 2018 16:06:51 +0000 (UTC)
commit 6268d3e3a1830aab80a9dd601d469af12d9709c8
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 | 13 +++++++---
app/widgets/gimptexttag.c | 17 +++++++++----
app/widgets/gimpwidgets-utils.c | 50 ---------------------------------------
app/widgets/gimpwidgets-utils.h | 4 ---
4 files changed, 21 insertions(+), 63 deletions(-)
---
diff --git a/app/widgets/gimptextbuffer.c b/app/widgets/gimptextbuffer.c
index ddb2434..50ced78 100644
--- a/app/widgets/gimptextbuffer.c
+++ b/app/widgets/gimptextbuffer.c
@@ -33,7 +33,6 @@
#include "gimptextbuffer.h"
#include "gimptextbuffer-serialize.h"
#include "gimptexttag.h"
-#include "gimpwidgets-utils.h"
#include "gimp-intl.h"
@@ -991,7 +990,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,
@@ -1075,7 +1076,9 @@ gimp_text_buffer_get_preedit_color_tag (GimpTextBuffer *buffer,
g_snprintf (name, sizeof (name), "preedit-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,
@@ -1157,7 +1160,9 @@ gimp_text_buffer_get_preedit_bg_color_tag (GimpTextBuffer *buffer,
g_snprintf (name, sizeof (name), "bg-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 60fc46c..5cf7681 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
@@ -87,14 +86,18 @@ gimp_text_tag_get_fg_color (GtkTextTag *tag,
{
GdkColor *gdk_color;
gboolean set;
+ guchar r, g, b;
g_object_get (tag,
"foreground-set", &set,
GIMP_TEXT_PROP_NAME_FG_COLOR, &gdk_color,
NULL);
- if (set)
- 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);
@@ -107,14 +110,18 @@ gimp_text_tag_get_bg_color (GtkTextTag *tag,
{
GdkColor *gdk_color;
gboolean set;
+ guchar r, g, b;
g_object_get (tag,
"background-set", &set,
GIMP_TEXT_PROP_NAME_BG_COLOR, &gdk_color,
NULL);
- if (set)
- 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 6394f87..e457040 100644
--- a/app/widgets/gimpwidgets-utils.c
+++ b/app/widgets/gimpwidgets-utils.c
@@ -837,56 +837,6 @@ gimp_get_monitor_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 66b2a16..651db74 100644
--- a/app/widgets/gimpwidgets-utils.h
+++ b/app/widgets/gimpwidgets-utils.h
@@ -73,10 +73,6 @@ void gimp_get_monitor_resolution (GdkScreen *screen
gint monitor,
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]