summaryrefslogtreecommitdiff
path: root/gdk/gdkrgb.c
diff options
context:
space:
mode:
authorManish Singh <yosh@gimp.org>2002-11-17 22:04:03 +0000
committerManish Singh <yosh@src.gnome.org>2002-11-17 22:04:03 +0000
commit89fd6ad3de860129877c65a95b68ba6a6c503706 (patch)
tree0ab6fea0e35535806a748d3b76bb94f3fbcad5f5 /gdk/gdkrgb.c
parent1d2c2268be0179b534e390e954a173c553ff091a (diff)
downloadgdk-pixbuf-89fd6ad3de860129877c65a95b68ba6a6c503706.tar.gz
add -DGDK_DISABLE_DEPRECATED
Sun Nov 17 13:45:08 2002 Manish Singh <yosh@gimp.org> * gdk/Makefile.am: add -DGDK_DISABLE_DEPRECATED * gdk/gdk.c (gdk_exit): remove obsolete comment * gdk/gdk.h: declare gdk_input_add_full if GTK_COMPILATION for gtk_input_add_full * gdk/gdkcolor.c (gdk_color_white, gdk_color_black): use gdk_colormap_alloc_color instead of gdk_color_alloc * gdk/gdkcolor.h: declare gdk_colormap_change if GDK_COMPILATION for gdk_colors_store. Also, gdk_colors_{alloc,free} for gdk_rgb_try_colormap * gdk/gdkdrawable.h: declare gdk_draw_string if GTK_COMPILATION for gtk_default_draw_string. Also, gdk_draw_text and gdk_draw_text_wc if GDK_COMPILATION for the respective gdk_window_ and gdk_pixmap_ functions. * gdk/gdkfont.c: #undef GDK_DISABLE_DEPRECATED, completely compat code here * gdk/gdkfont.h: allow the GdkFont structure and a few gdk_font_ functions for compat code in GDK_COMPILATION and GTK_COMPILATION. * gdk/gdkrgb.c (gdk_rgb_cmap_fail, gdk_rgb_try_colormap): use gdk_colormap_free_colors instead of gdk_colors_free. * gdk/gdkrgb.c (gdk_draw_rgb_image_core): no need to set fg/bg for own_gc, unused. * gdk/gdkwindow.h: declare gdk_window_get_deskrelative_origin if GTK_COMPILATION for gtk_handle_box_button_changed. * gdk/x11/Makefile.am: add -DGDK_DISABLE_DEPRECATED, renmae -DINSIDE_GDK_X11 to -DGDK_COMPILATION * gdk/x11/gdkcolor-x11.c: remove duplicate doc string for gdk_colormap_alloc_colors. * gdk/x11/gdkfont-x11.c: #undef GDK_DISABLE_DEPRECATED, completely compat code here * gdk/x11/gdkx.h: use GDK_COMPILATION instead of INSIDE_GDK_X11, allow a few gdk_x11_font_ functions if GDK_COMPILATION for compat code * gtk/Makefile.am: add -DGDK_DISABLE_DEPRECATED * gtk/gtkclist.c * gtk/gtkctree.c * gtk/gtkpixmap.c * gtk/gtkpreview.c * gtk/gtktext.c: #undef GDK_DISABLE_DEPRECATED, deprecated widget * gtk/gtkhandlebox.c (gtk_handle_box_motion): use gdk_window_set_geometry_hints instead of gdk_window_set_hints. * gtk/gtkmain.c (gtk_exit): call exit directly * gtktipsquery.c (gtk_tips_query_real_start_query) * gtk/gtktreeitem.c (gtk_tree_item_add_pixmaps): remove some deprecated GDK usage.
Diffstat (limited to 'gdk/gdkrgb.c')
-rw-r--r--gdk/gdkrgb.c44
1 files changed, 20 insertions, 24 deletions
diff --git a/gdk/gdkrgb.c b/gdk/gdkrgb.c
index 9d80cd424..20f1eef31 100644
--- a/gdk/gdkrgb.c
+++ b/gdk/gdkrgb.c
@@ -146,7 +146,7 @@ static gboolean gdk_rgb_verbose = FALSE;
static gint
gdk_rgb_cmap_fail (const char *msg, GdkColormap *cmap, gulong *pixels)
{
- gulong free_pixels[256];
+ GdkColor free_colors[256];
gint n_free;
gint i;
@@ -156,9 +156,9 @@ gdk_rgb_cmap_fail (const char *msg, GdkColormap *cmap, gulong *pixels)
n_free = 0;
for (i = 0; i < 256; i++)
if (pixels[i] < 256)
- free_pixels[n_free++] = pixels[i];
+ free_colors[n_free++].pixel = pixels[i];
if (n_free)
- gdk_colors_free (cmap, free_pixels, n_free, 0);
+ gdk_colormap_free_colors (cmap, free_colors, n_free);
return 0;
}
@@ -257,18 +257,22 @@ gdk_rgb_try_colormap (GdkRgbInfo *image_info, gboolean force,
b0 = bi * 255 / (nb - 1);
idx = ((ri * nr) + gi) * nb + bi;
d2 = (r - r0) * (r - r0) + (g - g0) * (g - g0) + (b - b0) * (b - b0);
- if (d2 < best[idx]) {
- if (pixels[idx] < 256)
- gdk_colors_free (cmap, pixels + idx, 1, 0);
- else
- colors_needed--;
- color = cmap->colors[i];
- if (!gdk_colormap_alloc_color (cmap, &color, FALSE, FALSE))
- return gdk_rgb_cmap_fail ("error allocating system color\n",
- cmap, pixels);
- pixels[idx] = color.pixel; /* which is almost certainly i */
- best[idx] = d2;
- }
+ if (d2 < best[idx])
+ {
+ if (pixels[idx] < 256)
+ {
+ color.pixel = pixels[idx];
+ gdk_colormap_free_colors (cmap, &color, 1);
+ }
+ else
+ colors_needed--;
+ color = cmap->colors[i];
+ if (!gdk_colormap_alloc_color (cmap, &color, FALSE, FALSE))
+ return gdk_rgb_cmap_fail ("error allocating system color\n",
+ cmap, pixels);
+ pixels[idx] = color.pixel; /* which is almost certainly i */
+ best[idx] = d2;
+ }
}
#endif
@@ -3108,15 +3112,7 @@ gdk_draw_rgb_image_core (GdkRgbInfo *image_info,
if (image_info->bitmap)
{
if (image_info->own_gc == NULL)
- {
- GdkColor color;
-
- image_info->own_gc = gdk_gc_new (drawable);
- gdk_color_white (image_info->cmap, &color);
- gdk_gc_set_foreground (image_info->own_gc, &color);
- gdk_color_black (image_info->cmap, &color);
- gdk_gc_set_background (image_info->own_gc, &color);
- }
+ image_info->own_gc = gdk_gc_new (drawable);
gc = image_info->own_gc;
}
for (y0 = 0; y0 < height; y0 += GDK_SCRATCH_IMAGE_HEIGHT)