Commit a2d12994 authored by Owen Taylor's avatar Owen Taylor Committed by Owen Taylor

Make gdk_colormap_sync private since it was never exported in a header

Fri Feb  2 17:16:09 2001  Owen Taylor  <otaylor@redhat.com>

	* gdk/x11/gdkcolor-x11.c (gdk_colormap_sync): Make
	gdk_colormap_sync private since it was never exported
	in a header file.

	* gdk/x11/gdkcolor-x11.c (gdk_colormap_new): Fill in
	colormap->colors[] for StaticGray, StaticColor colormaps.

	* gdk/gdkpixbuf-drawable.c: Fix problems where image->bpp
	was being used as if it was image->bits_per_pixel.

	* gdk/gdkimage.h, gdk/x11/gdkimage-x11.c: Save the bits-per-pixel
	for the image in the GdkImage structure since it isn't
	reconstructable, and we need it to handle packed types

	* gdk/win32/gdkimage-win32.c: Set image->bits_per_pixel. (I'm making
	the assumption that on Win32 image->bits_per_pixel == image->depth,
	always.

	* gdk/linux-fb/gdkimage-fb.c: Set image->bits_per_pixel.

	* gdk/gdkrgb.c (gdk_rgb_select_conv): Exit with an informative
	warning message if no converter can be found.
parent a1a252ce
Fri Feb 2 17:16:09 2001 Owen Taylor <otaylor@redhat.com>
* gdk/x11/gdkcolor-x11.c (gdk_colormap_sync): Make
gdk_colormap_sync private since it was never exported
in a header file.
* gdk/x11/gdkcolor-x11.c (gdk_colormap_new): Fill in
colormap->colors[] for StaticGray, StaticColor colormaps.
* gdk/gdkpixbuf-drawable.c: Fix problems where image->bpp
was being used as if it was image->bits_per_pixel.
* gdk/gdkimage.h, gdk/x11/gdkimage-x11.c: Save the bits-per-pixel
for the image in the GdkImage structure since it isn't
reconstructable, and we need it to handle packed types
* gdk/win32/gdkimage-win32.c: Set image->bits_per_pixel. (I'm making
the assumption that on Win32 image->bits_per_pixel == image->depth,
always.
* gdk/linux-fb/gdkimage-fb.c: Set image->bits_per_pixel.
* gdk/gdkrgb.c (gdk_rgb_select_conv): Exit with an informative
warning message if no converter can be found.
Fri Feb 2 15:09:51 2001 Owen Taylor <otaylor@redhat.com>
* gtk/fnmatch.c (FOLD): Fix problem with passing signed
chars to isupper() / tolower(). (#567)
* examples/packer/pack.c: Add GINT_TO_POINTER, GPOINTER_TO_INT
to clear up 64-bit warnings. (#567)
Fri Feb 2 12:26:50 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkrc.c (gtk_rc_add_initial_default_files): Get rid of
......
Fri Feb 2 17:16:09 2001 Owen Taylor <otaylor@redhat.com>
* gdk/x11/gdkcolor-x11.c (gdk_colormap_sync): Make
gdk_colormap_sync private since it was never exported
in a header file.
* gdk/x11/gdkcolor-x11.c (gdk_colormap_new): Fill in
colormap->colors[] for StaticGray, StaticColor colormaps.
* gdk/gdkpixbuf-drawable.c: Fix problems where image->bpp
was being used as if it was image->bits_per_pixel.
* gdk/gdkimage.h, gdk/x11/gdkimage-x11.c: Save the bits-per-pixel
for the image in the GdkImage structure since it isn't
reconstructable, and we need it to handle packed types
* gdk/win32/gdkimage-win32.c: Set image->bits_per_pixel. (I'm making
the assumption that on Win32 image->bits_per_pixel == image->depth,
always.
* gdk/linux-fb/gdkimage-fb.c: Set image->bits_per_pixel.
* gdk/gdkrgb.c (gdk_rgb_select_conv): Exit with an informative
warning message if no converter can be found.
Fri Feb 2 15:09:51 2001 Owen Taylor <otaylor@redhat.com>
* gtk/fnmatch.c (FOLD): Fix problem with passing signed
chars to isupper() / tolower(). (#567)
* examples/packer/pack.c: Add GINT_TO_POINTER, GPOINTER_TO_INT
to clear up 64-bit warnings. (#567)
Fri Feb 2 12:26:50 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkrc.c (gtk_rc_add_initial_default_files): Get rid of
......
Fri Feb 2 17:16:09 2001 Owen Taylor <otaylor@redhat.com>
* gdk/x11/gdkcolor-x11.c (gdk_colormap_sync): Make
gdk_colormap_sync private since it was never exported
in a header file.
* gdk/x11/gdkcolor-x11.c (gdk_colormap_new): Fill in
colormap->colors[] for StaticGray, StaticColor colormaps.
* gdk/gdkpixbuf-drawable.c: Fix problems where image->bpp
was being used as if it was image->bits_per_pixel.
* gdk/gdkimage.h, gdk/x11/gdkimage-x11.c: Save the bits-per-pixel
for the image in the GdkImage structure since it isn't
reconstructable, and we need it to handle packed types
* gdk/win32/gdkimage-win32.c: Set image->bits_per_pixel. (I'm making
the assumption that on Win32 image->bits_per_pixel == image->depth,
always.
* gdk/linux-fb/gdkimage-fb.c: Set image->bits_per_pixel.
* gdk/gdkrgb.c (gdk_rgb_select_conv): Exit with an informative
warning message if no converter can be found.
Fri Feb 2 15:09:51 2001 Owen Taylor <otaylor@redhat.com>
* gtk/fnmatch.c (FOLD): Fix problem with passing signed
chars to isupper() / tolower(). (#567)
* examples/packer/pack.c: Add GINT_TO_POINTER, GPOINTER_TO_INT
to clear up 64-bit warnings. (#567)
Fri Feb 2 12:26:50 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkrc.c (gtk_rc_add_initial_default_files): Get rid of
......
Fri Feb 2 17:16:09 2001 Owen Taylor <otaylor@redhat.com>
* gdk/x11/gdkcolor-x11.c (gdk_colormap_sync): Make
gdk_colormap_sync private since it was never exported
in a header file.
* gdk/x11/gdkcolor-x11.c (gdk_colormap_new): Fill in
colormap->colors[] for StaticGray, StaticColor colormaps.
* gdk/gdkpixbuf-drawable.c: Fix problems where image->bpp
was being used as if it was image->bits_per_pixel.
* gdk/gdkimage.h, gdk/x11/gdkimage-x11.c: Save the bits-per-pixel
for the image in the GdkImage structure since it isn't
reconstructable, and we need it to handle packed types
* gdk/win32/gdkimage-win32.c: Set image->bits_per_pixel. (I'm making
the assumption that on Win32 image->bits_per_pixel == image->depth,
always.
* gdk/linux-fb/gdkimage-fb.c: Set image->bits_per_pixel.
* gdk/gdkrgb.c (gdk_rgb_select_conv): Exit with an informative
warning message if no converter can be found.
Fri Feb 2 15:09:51 2001 Owen Taylor <otaylor@redhat.com>
* gtk/fnmatch.c (FOLD): Fix problem with passing signed
chars to isupper() / tolower(). (#567)
* examples/packer/pack.c: Add GINT_TO_POINTER, GPOINTER_TO_INT
to clear up 64-bit warnings. (#567)
Fri Feb 2 12:26:50 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkrc.c (gtk_rc_add_initial_default_files): Get rid of
......
Fri Feb 2 17:16:09 2001 Owen Taylor <otaylor@redhat.com>
* gdk/x11/gdkcolor-x11.c (gdk_colormap_sync): Make
gdk_colormap_sync private since it was never exported
in a header file.
* gdk/x11/gdkcolor-x11.c (gdk_colormap_new): Fill in
colormap->colors[] for StaticGray, StaticColor colormaps.
* gdk/gdkpixbuf-drawable.c: Fix problems where image->bpp
was being used as if it was image->bits_per_pixel.
* gdk/gdkimage.h, gdk/x11/gdkimage-x11.c: Save the bits-per-pixel
for the image in the GdkImage structure since it isn't
reconstructable, and we need it to handle packed types
* gdk/win32/gdkimage-win32.c: Set image->bits_per_pixel. (I'm making
the assumption that on Win32 image->bits_per_pixel == image->depth,
always.
* gdk/linux-fb/gdkimage-fb.c: Set image->bits_per_pixel.
* gdk/gdkrgb.c (gdk_rgb_select_conv): Exit with an informative
warning message if no converter can be found.
Fri Feb 2 15:09:51 2001 Owen Taylor <otaylor@redhat.com>
* gtk/fnmatch.c (FOLD): Fix problem with passing signed
chars to isupper() / tolower(). (#567)
* examples/packer/pack.c: Add GINT_TO_POINTER, GPOINTER_TO_INT
to clear up 64-bit warnings. (#567)
Fri Feb 2 12:26:50 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkrc.c (gtk_rc_add_initial_default_files): Get rid of
......
Fri Feb 2 17:16:09 2001 Owen Taylor <otaylor@redhat.com>
* gdk/x11/gdkcolor-x11.c (gdk_colormap_sync): Make
gdk_colormap_sync private since it was never exported
in a header file.
* gdk/x11/gdkcolor-x11.c (gdk_colormap_new): Fill in
colormap->colors[] for StaticGray, StaticColor colormaps.
* gdk/gdkpixbuf-drawable.c: Fix problems where image->bpp
was being used as if it was image->bits_per_pixel.
* gdk/gdkimage.h, gdk/x11/gdkimage-x11.c: Save the bits-per-pixel
for the image in the GdkImage structure since it isn't
reconstructable, and we need it to handle packed types
* gdk/win32/gdkimage-win32.c: Set image->bits_per_pixel. (I'm making
the assumption that on Win32 image->bits_per_pixel == image->depth,
always.
* gdk/linux-fb/gdkimage-fb.c: Set image->bits_per_pixel.
* gdk/gdkrgb.c (gdk_rgb_select_conv): Exit with an informative
warning message if no converter can be found.
Fri Feb 2 15:09:51 2001 Owen Taylor <otaylor@redhat.com>
* gtk/fnmatch.c (FOLD): Fix problem with passing signed
chars to isupper() / tolower(). (#567)
* examples/packer/pack.c: Add GINT_TO_POINTER, GPOINTER_TO_INT
to clear up 64-bit warnings. (#567)
Fri Feb 2 12:26:50 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkrc.c (gtk_rc_add_initial_default_files): Get rid of
......
Fri Feb 2 17:16:09 2001 Owen Taylor <otaylor@redhat.com>
* gdk/x11/gdkcolor-x11.c (gdk_colormap_sync): Make
gdk_colormap_sync private since it was never exported
in a header file.
* gdk/x11/gdkcolor-x11.c (gdk_colormap_new): Fill in
colormap->colors[] for StaticGray, StaticColor colormaps.
* gdk/gdkpixbuf-drawable.c: Fix problems where image->bpp
was being used as if it was image->bits_per_pixel.
* gdk/gdkimage.h, gdk/x11/gdkimage-x11.c: Save the bits-per-pixel
for the image in the GdkImage structure since it isn't
reconstructable, and we need it to handle packed types
* gdk/win32/gdkimage-win32.c: Set image->bits_per_pixel. (I'm making
the assumption that on Win32 image->bits_per_pixel == image->depth,
always.
* gdk/linux-fb/gdkimage-fb.c: Set image->bits_per_pixel.
* gdk/gdkrgb.c (gdk_rgb_select_conv): Exit with an informative
warning message if no converter can be found.
Fri Feb 2 15:09:51 2001 Owen Taylor <otaylor@redhat.com>
* gtk/fnmatch.c (FOLD): Fix problem with passing signed
chars to isupper() / tolower(). (#567)
* examples/packer/pack.c: Add GINT_TO_POINTER, GPOINTER_TO_INT
to clear up 64-bit warnings. (#567)
Fri Feb 2 12:26:50 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkrc.c (gtk_rc_add_initial_default_files): Get rid of
......
......@@ -159,10 +159,10 @@ main (int argv, char **argc)
button_left = gtk_toggle_button_new_with_label("Left");
button_right = gtk_toggle_button_new_with_label("Right");
gtk_object_set_data(GTK_OBJECT(button_top), "side", (gpointer) GTK_SIDE_TOP);
gtk_object_set_data(GTK_OBJECT(button_bottom), "side", (gpointer) GTK_SIDE_BOTTOM);
gtk_object_set_data(GTK_OBJECT(button_left), "side", (gpointer) GTK_SIDE_LEFT);
gtk_object_set_data(GTK_OBJECT(button_right), "side", (gpointer) GTK_SIDE_RIGHT);
gtk_object_set_data(GTK_OBJECT(button_top), "side", GINT_TO_POINTER (GTK_SIDE_TOP));
gtk_object_set_data(GTK_OBJECT(button_bottom), "side", GINT_TO_POINTER (GTK_SIDE_BOTTOM));
gtk_object_set_data(GTK_OBJECT(button_left), "side", GINT_TO_POINTER (GTK_SIDE_LEFT));
gtk_object_set_data(GTK_OBJECT(button_right), "side", GINT_TO_POINTER (GTK_SIDE_RIGHT));
gtk_widget_set_usize(button_top, 50, -1);
gtk_widget_set_usize(button_bottom, 50, -1);
......@@ -230,15 +230,15 @@ main (int argv, char **argc)
button_sw = gtk_toggle_button_new_with_label("SW");
button_center = gtk_toggle_button_new_with_label("");
gtk_object_set_data(GTK_OBJECT(button_n), "anchor", (gpointer) GTK_ANCHOR_N);
gtk_object_set_data(GTK_OBJECT(button_nw), "anchor", (gpointer) GTK_ANCHOR_NW);
gtk_object_set_data(GTK_OBJECT(button_ne), "anchor", (gpointer) GTK_ANCHOR_NE);
gtk_object_set_data(GTK_OBJECT(button_s), "anchor", (gpointer) GTK_ANCHOR_S);
gtk_object_set_data(GTK_OBJECT(button_sw), "anchor", (gpointer) GTK_ANCHOR_SW);
gtk_object_set_data(GTK_OBJECT(button_se), "anchor", (gpointer) GTK_ANCHOR_SE);
gtk_object_set_data(GTK_OBJECT(button_w), "anchor", (gpointer) GTK_ANCHOR_W);
gtk_object_set_data(GTK_OBJECT(button_e), "anchor", (gpointer) GTK_ANCHOR_E);
gtk_object_set_data(GTK_OBJECT(button_center), "anchor", (gpointer) GTK_ANCHOR_CENTER);
gtk_object_set_data(GTK_OBJECT(button_n), "anchor", GINT_TO_POINTER (GTK_ANCHOR_N));
gtk_object_set_data(GTK_OBJECT(button_nw), "anchor", GINT_TO_POINTER (GTK_ANCHOR_NW));
gtk_object_set_data(GTK_OBJECT(button_ne), "anchor", GINT_TO_POINTER (GTK_ANCHOR_NE));
gtk_object_set_data(GTK_OBJECT(button_s), "anchor", GINT_TO_POINTER (GTK_ANCHOR_S));
gtk_object_set_data(GTK_OBJECT(button_sw), "anchor", GINT_TO_POINTER (GTK_ANCHOR_SW));
gtk_object_set_data(GTK_OBJECT(button_se), "anchor", GINT_TO_POINTER (GTK_ANCHOR_SE));
gtk_object_set_data(GTK_OBJECT(button_w), "anchor", GINT_TO_POINTER (GTK_ANCHOR_W));
gtk_object_set_data(GTK_OBJECT(button_e), "anchor", GINT_TO_POINTER (GTK_ANCHOR_E));
gtk_object_set_data(GTK_OBJECT(button_center), "anchor", GINT_TO_POINTER (GTK_ANCHOR_CENTER));
gtk_signal_connect (GTK_OBJECT (button_n), "toggled",
GTK_SIGNAL_FUNC (toggle_anchor), (gpointer) info);
......@@ -321,9 +321,9 @@ main (int argv, char **argc)
GTK_FILL_X | GTK_PACK_EXPAND,
0, 10, 5, 0, 0);
gtk_object_set_data(GTK_OBJECT(button_fillx), "option", (gpointer) GTK_FILL_X);
gtk_object_set_data(GTK_OBJECT(button_filly), "option", (gpointer) GTK_FILL_Y);
gtk_object_set_data(GTK_OBJECT(button_expand), "option", (gpointer) GTK_PACK_EXPAND);
gtk_object_set_data(GTK_OBJECT(button_fillx), "option", GINT_TO_POINTER (GTK_FILL_X));
gtk_object_set_data(GTK_OBJECT(button_filly), "option", GINT_TO_POINTER (GTK_FILL_Y));
gtk_object_set_data(GTK_OBJECT(button_expand), "option", GINT_TO_POINTER (GTK_PACK_EXPAND));
gtk_signal_connect (GTK_OBJECT (button_fillx), "toggled",
GTK_SIGNAL_FUNC (toggle_options), (gpointer) info);
......@@ -373,7 +373,7 @@ toggle_options (GtkWidget *widget, gpointer data)
info = (Info*) data;
option = (gint) gtk_object_get_data(GTK_OBJECT(widget), "option");
option = GPOINTER_TO_INT (gtk_object_get_data(GTK_OBJECT(widget), "option"));
pchild = info->pchild;
if (pchild == NULL) {
......@@ -412,7 +412,7 @@ toggle_anchor (GtkWidget *widget, gpointer data)
info = (Info*) data;
if (GTK_TOGGLE_BUTTON(widget)->active) {
anchor = (gint) gtk_object_get_data(GTK_OBJECT(widget), "anchor");
anchor = GPOINTER_TO_INT (gtk_object_get_data(GTK_OBJECT(widget), "anchor"));
pchild = info->pchild;
if (pchild == NULL) {
......@@ -483,7 +483,7 @@ toggle_side (GtkWidget *widget, gpointer data)
if (GTK_TOGGLE_BUTTON(widget)->active) {
side = (gint) gtk_object_get_data(GTK_OBJECT(widget), "side");
side = GPOINTER_TO_INT (gtk_object_get_data(GTK_OBJECT(widget), "side"));
pchild = info->pchild;
if (pchild == NULL) {
......
......@@ -44,8 +44,9 @@ struct _GdkImage
gint width;
gint height;
guint16 depth;
guint16 bpp; /* bytes per pixel */
guint16 bpl; /* bytes per line */
guint16 bpp; /* bytes per pixel */
guint16 bpl; /* bytes per line */
guint16 bits_per_pixel; /* bits per pixel */
gpointer mem;
gpointer windowing_data;
......
......@@ -1078,7 +1078,7 @@ rgbconvert (GdkImage *image,
GdkVisual *v = gdk_colormap_get_visual(cmap);
d(printf("masks = %x:%x:%x\n", v->red_mask, v->green_mask, v->blue_mask));
d(printf("image depth = %d, bpp = %d\n", image->depth, image->bpp));
d(printf("image depth = %d, bits per pixel = %d\n", image->depth, image->bits_per_pixel));
switch (v->type)
{
......@@ -1087,13 +1087,14 @@ rgbconvert (GdkImage *image,
case GDK_VISUAL_GRAYSCALE:
case GDK_VISUAL_STATIC_COLOR:
case GDK_VISUAL_PSEUDO_COLOR:
switch (image->bpp)
switch (image->bits_per_pixel)
{
case 1:
bank = 0;
break;
case 8:
bank = 1;
if (image->depth == 8)
bank = 1;
break;
}
break;
......@@ -1102,18 +1103,18 @@ rgbconvert (GdkImage *image,
{
case 15:
if (v->red_mask == 0x7c00 && v->green_mask == 0x3e0 && v->blue_mask == 0x1f
&& image->bpp == 16)
&& image->bits_per_pixel == 16)
bank = 2;
break;
case 16:
if (v->red_mask == 0xf800 && v->green_mask == 0x7e0 && v->blue_mask == 0x1f
&& image->bpp == 16)
&& image->bits_per_pixel == 16)
bank = 3;
break;
case 24:
case 32:
if (v->red_mask == 0xff0000 && v->green_mask == 0xff00 && v->blue_mask == 0xff
&& image->bpp == 32)
&& image->bits_per_pixel == 32)
bank = 4;
break;
}
......
......@@ -2872,13 +2872,7 @@ gdk_rgb_select_conv (GdkRgbInfo *image_info, GdkImage *image)
depth = image_info->visual->depth;
/* FIXME: save the bpp in the image; this is hack that works for
* common visuals, not otherwise.
*/
if (depth <= 8)
bpp = depth;
else
bpp = 8 * image->bpp;
bpp = image->bits_per_pixel;
byte_order = image->byte_order;
if (gdk_rgb_verbose)
......@@ -3031,6 +3025,16 @@ gdk_rgb_select_conv (GdkRgbInfo *image_info, GdkImage *image)
conv_d = gdk_rgb_convert_gray4_d_pack;
}
if (!conv)
{
g_warning ("Visual type=%s depth=%d, image bpp=%d, %s first\n"
"is not supported by GdkRGB. Please submit a bug report\n"
"with the above values to bugzilla.gnome.org",
visual_names[vtype], depth, bpp,
byte_order == GDK_LSB_FIRST ? "lsb" : "msb");
exit (1);
}
if (conv_d == NULL)
conv_d = conv;
......
......@@ -122,6 +122,7 @@ gdk_image_new_bitmap(GdkVisual *visual,
image->depth = 1;
image->byte_order = 1 /* MSBFirst */;
image->bits_per_pixel = 1;
image->bpp = 1;
image->bpl = (w+7)/8;
image->mem = g_malloc (image->bpl * h / 8);
......@@ -148,6 +149,7 @@ gdk_image_new (GdkImageType type,
image->depth = visual->depth;
image->byte_order = 0;
image->bits_per_pixel = image->depth;
image->bpp = image->depth/8;
image->bpl = (width * image->depth + 7) / 8;
image->mem = g_malloc (image->bpl * height);
......@@ -164,7 +166,7 @@ _gdk_fb_get_image (GdkDrawable *drawable,
{
GdkImage *image;
GdkImagePrivateFB *private;
gint bits_per_pixel = GDK_DRAWABLE_IMPL_FBDATA (gdk_parent_root)->depth;
gint bits_per_pixel =
GdkPixmapFBData fbd;
g_return_val_if_fail (drawable != NULL, NULL);
......@@ -176,13 +178,14 @@ _gdk_fb_get_image (GdkDrawable *drawable,
image->visual = gdk_drawable_get_visual (drawable);
image->width = width;
image->height = height;
image->depth = bits_per_pixel;
image->bits_per_pixel = GDK_DRAWABLE_IMPL_FBDATA (gdk_parent_root)->depth;
image->depth = image->bits_per_pixel;
if (bits_per_pixel <= 8)
if (image->bits_per_pixel <= 8)
image->bpp = 1;
else if (bits_per_pixel <= 16)
else if (image->bits_per_pixel <= 16)
image->bpp = 2;
else if (bits_per_pixel <= 24)
else if (image->bits_per_pixel <= 24)
image->bpp = 3;
else
image->bpp = 4;
......
......@@ -180,6 +180,7 @@ gdk_image_new_bitmap (GdkVisual *visual,
image->bpl = bpl32;
image->byte_order = GDK_MSB_FIRST;
image->bits_per_pixel = 1;
image->bpp = 1;
return(image);
} /* gdk_image_new_bitmap() */
......@@ -307,6 +308,7 @@ gdk_image_new (GdkImageType type,
g_warning ("gdk_image_new: depth = %d", image->depth);
g_assert_not_reached ();
}
image->bits_per_pixel = image->depth;
image->byte_order = GDK_LSB_FIRST;
if (image->depth == 1)
image->bpl = ((width-1)/32 + 1)*4;
......@@ -547,6 +549,7 @@ _gdk_win32_get_image (GdkDrawable *drawable,
g_warning ("gdk_image_get: image->depth = %d", image->depth);
g_assert_not_reached ();
}
image->bits_per_pixel = image->depth;
image->byte_order = GDK_LSB_FIRST;
if (image->depth == 1)
image->bpl = ((width - 1)/32 + 1)*4;
......
......@@ -212,6 +212,14 @@ gdk_colormap_new (GdkVisual *visual,
case GDK_VISUAL_STATIC_GRAY:
case GDK_VISUAL_STATIC_COLOR:
private->private_val = FALSE;
private->xcolormap = XCreateColormap (private->xdisplay, gdk_root_window,
xvisual, AllocNone);
colormap->colors = g_new (GdkColor, colormap->size);
gdk_colormap_sync (colormap);
break;
case GDK_VISUAL_TRUE_COLOR:
private->private_val = FALSE;
private->xcolormap = XCreateColormap (private->xdisplay, gdk_root_window,
......@@ -226,7 +234,7 @@ gdk_colormap_new (GdkVisual *visual,
#define MIN_SYNC_TIME 2
void
static void
gdk_colormap_sync (GdkColormap *colormap,
gboolean force)
{
......@@ -249,7 +257,7 @@ gdk_colormap_sync (GdkColormap *colormap,
for (i = 0; i < colormap->size; i++)
{
if (private->info[i].ref_count == 0)
if (!private->info || private->info[i].ref_count == 0)
{
xpalette[nlookup].pixel = i;
xpalette[nlookup].red = 0;
......@@ -297,16 +305,22 @@ gdk_colormap_get_system (void)
colormap->colors = NULL;
colormap->size = colormap->visual->colormap_size;
if ((colormap->visual->type == GDK_VISUAL_GRAYSCALE) ||
(colormap->visual->type == GDK_VISUAL_PSEUDO_COLOR))
switch (colormap->visual->type)
{
case GDK_VISUAL_GRAYSCALE:
case GDK_VISUAL_PSEUDO_COLOR:
private->info = g_new0 (GdkColorInfo, colormap->size);
colormap->colors = g_new (GdkColor, colormap->size);
private->hash = g_hash_table_new ((GHashFunc) gdk_color_hash,
(GEqualFunc) gdk_color_equal);
/* Fall through */
case GDK_VISUAL_STATIC_GRAY:
case GDK_VISUAL_STATIC_COLOR:
colormap->colors = g_new (GdkColor, colormap->size);
gdk_colormap_sync (colormap, TRUE);
case GDK_VISUAL_DIRECT_COLOR:
case GDK_VISUAL_TRUE_COLOR:
break;
}
gdk_colormap_add (colormap);
......
......@@ -155,6 +155,7 @@ gdk_image_new_bitmap(GdkVisual *visual, gpointer data, gint w, gint h)
image->width = w;
image->height = h;
image->depth = 1;
image->bits_per_pixel = 1;
xvisual = ((GdkVisualPrivate*) visual)->xvisual;
private->ximage = XCreateImage(private->xdisplay, xvisual, 1, XYBitmap,
0, 0, w ,h, 8, 0);
......@@ -364,6 +365,7 @@ gdk_image_new (GdkImageType type,
image->mem = private->ximage->data;
image->bpl = private->ximage->bytes_per_line;
image->bpp = (private->ximage->bits_per_pixel + 7) / 8;
image->bits_per_pixel = private->ximage->bits_per_pixel;
}
}
......@@ -415,14 +417,8 @@ _gdk_x11_get_image (GdkDrawable *drawable,
image->mem = private->ximage->data;
image->bpl = private->ximage->bytes_per_line;
if (private->ximage->bits_per_pixel <= 8)
image->bpp = 1;
else if (private->ximage->bits_per_pixel <= 16)
image->bpp = 2;
else if (private->ximage->bits_per_pixel <= 24)
image->bpp = 3;
else
image->bpp = 4;
image->bits_per_pixel = private->ximage->bits_per_pixel;
image->bpp = (private->ximage->bits_per_pixel + 7) / 8;
image->byte_order = private->ximage->byte_order;
return image;
......
......@@ -68,9 +68,9 @@ fnmatch (pattern, string, flags)
/* Note that this evalutes C many times. */
#if !defined(G_OS_WIN32) && !defined(G_WITH_CYGWIN)
#define FOLD(c) ((flags & FNM_CASEFOLD) && isupper (c) ? tolower (c) : (c))
#define FOLD(c) ((flags & FNM_CASEFOLD) && isupper ((unsigned char )(c)) ? tolower ((unsigned char)(c)) : (c))
#else
#define FOLD(c) (tolower (c))
#define FOLD(c) (tolower ((unsigned char)(c)))
#endif
while ((c = *p++) != '\0')
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment