[gtk+/rendering-cleanup: 23/113] Replace gdk_rgb_find_color()



commit f2ceef0051967e97069f67faae60f478142cef21
Author: Benjamin Otte <otte redhat com>
Date:   Tue Jul 13 15:52:56 2010 +0200

    Replace gdk_rgb_find_color()
    
    Use gdk_colormap_alloc_color() instead.

 gdk/gdkgc.c         |    7 ++++---
 gtk/gtkstyle.c      |    2 +-
 tests/testwindows.c |    3 ++-
 3 files changed, 7 insertions(+), 5 deletions(-)
---
diff --git a/gdk/gdkgc.c b/gdk/gdkgc.c
index f20ba51..3eb5416 100644
--- a/gdk/gdkgc.c
+++ b/gdk/gdkgc.c
@@ -31,7 +31,6 @@
 #include "gdkgc.h"
 #include "gdkinternals.h"
 #include "gdkpixmap.h"
-#include "gdkrgb.h"
 #include "gdkprivate.h"
 
 
@@ -1200,7 +1199,8 @@ gdk_gc_set_rgb_fg_color (GdkGC          *gc,
     return;
 
   tmp_color = *color;
-  gdk_rgb_find_color (cmap, &tmp_color);
+  if (!gdk_colormap_alloc_color (cmap, &tmp_color, FALSE, TRUE))
+    return;
   gdk_gc_set_foreground (gc, &tmp_color);
 }
 
@@ -1232,7 +1232,8 @@ gdk_gc_set_rgb_bg_color (GdkGC          *gc,
     return;
 
   tmp_color = *color;
-  gdk_rgb_find_color (cmap, &tmp_color);
+  if (!gdk_colormap_alloc_color (cmap, &tmp_color, FALSE, TRUE))
+    return;
   gdk_gc_set_background (gc, &tmp_color);
 }
 
diff --git a/gtk/gtkstyle.c b/gtk/gtkstyle.c
index 836de8a..08f5d13 100644
--- a/gtk/gtkstyle.c
+++ b/gtk/gtkstyle.c
@@ -6101,7 +6101,7 @@ make_cursor_gc (GtkWidget      *widget,
   else
     gc_values.foreground = *fallback;
   
-  gdk_rgb_find_color (widget->style->colormap, &gc_values.foreground);
+  gdk_colormap_alloc_color (widget->style->colormap, &gc_values.foreground, FALSE, TRUE);
   return gtk_gc_get (widget->style->depth, widget->style->colormap, &gc_values, gc_values_mask);
 }
 
diff --git a/tests/testwindows.c b/tests/testwindows.c
index 457072a..93ca976 100644
--- a/tests/testwindows.c
+++ b/tests/testwindows.c
@@ -51,7 +51,8 @@ create_window (GdkWindow *parent,
       bg->green = g_random_int_range (0, 0xffff);;
     }
   
-  gdk_rgb_find_color (gtk_widget_get_colormap (darea), bg);
+  if (!gdk_colormap_alloc_color (gtk_widget_get_colormap (darea), bg, FALSE, TRUE))
+    g_assert_not_reached ();
   gdk_window_set_background (window, bg);
   g_object_set_data_full (G_OBJECT (window), "color", bg, g_free);
   



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