Problem with gdk_pixmap_create_from_data()



I am trying to covert from using gdk_pixmap_create_from_xdm() so that I
don't have to use an external pixmap file (i.e. everything in one
executable).  I opened the .XPM file in GIMP and saved it as a .C file
structure (logo.c).

--- From interface.c (originally code generated by glade) ---

#include "logo.c"
:
  GtkWidget *window1;
  GtkStyle *style;
  GdkPixmap *gdkpix;
:
  window1 = gtk_window_new (GTK_WINDOW_TOPLEVEL);
:
  style = gtk_widget_get_style (window1);
  gdkpix = gdk_pixmap_create_from_data (NULL, logo.pixel_data, logo.width,
                                        logo.height, logo.bytes_per_pixel,
                                        &style->fg[GTK_STATE_NORMAL],
&style->bg[GTK_STATE_NORMAL]);


--- Contents of logo.c: ---

/* GIMP RGBA C-Source image dump (logo.c) */

static const struct {
gint width;
gint height;
gint bytes_per_pixel;
gchar pixel_data[128 * 128 * 4];
} logo = {
128, 128, 4,
"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
<SNIP>


When run (with --sync option), I get:

Gdk-ERROR **: BadValue (integer parameter out of range for operation)
  serial 67 error_code 2 require_code 53 minor_code 0

I ran using gdb and set a breakpoint at this line.  The values for the gc's,
height, width and depth all looked fine to me.  Is there any way in gdb to
determine which parameter is a problem -- or if it is something else causing
the crash?  I try changing the logo.c file to only be 1x1 pixel with 4 data
bytes (RGBA) thinking it may be a problem with the data portion, but I got
the same error.


Gordon Durnell - Megavolt





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