gdk_pixbuf_get_from_drawable buggy ?
- From: Frédéric Terraza <fterraza free fr>
- To: gtk-list gnome org
- Subject: gdk_pixbuf_get_from_drawable buggy ?
- Date: Sat, 24 Sep 2005 00:44:14 +0200
Hello,
I wrote something that crashes (no error message) my machine when used
three or four times. After investigations, the crash occur on that :
temp_pixbuf = gdk_pixbuf_get_from_drawable(NULL, temp_pixmap, cmap, 0,
0, 0, 0, sx, sy) ;
I made test to verify that temp_pixmap and cmap are not NULL, and sx and
sy are what expected. I think I'm using gdk_pixbuf_get_from_drawable
correctly (but maybe not ?)
So I wonder if gdk_pixbuf_get_from_drawable was buggy ? I use GTK+ 2.6.8
on Windows.
Here's the code of the function, for the case I am the buggy thing :
GdkPixbuf *gdk_pixbuf_new_from_text ( gchar *text, GtkWidget *widget ) {
GdkPixmap *temp_pixmap ;
GdkPixbuf *temp_pixbuf = NULL ;
PangoLayout *layout ;
GdkGC *gc ;
GdkColormap *cmap ;
GdkColor *fg, *bg ;
int sx, sy ;
/* foreground and background colors */
fg = gdk_color_new_from_RGB(255, 0, 0) ;
bg = gdk_color_new_from_RGB(0, 0, 0) ;
/* render layout to temp_pixmap */
layout = gtk_widget_create_pango_layout(widget, text) ;
pango_layout_get_pixel_size(layout, &sx, &sy) ;
temp_pixmap = gdk_pixmap_new(NULL, sx, sy, 24) ;
gc = gdk_gc_new(temp_pixmap) ;
gdk_gc_set_foreground(gc, fg) ;
gdk_gc_set_background(gc, bg) ;
gdk_draw_layout( temp_pixmap, gc, 0, 0, layout) ;
/* render temp_pixmap to temp_pixbuf */
cmap = gdk_colormap_get_system() ;
if (cmap==NULL) printf("cmap NULL\n") ;
if (temp_pixmap==NULL) printf("temp_pixmap NULL\n") ;
temp_pixbuf = gdk_pixbuf_get_from_drawable(NULL, temp_pixmap, cmap, 0,
0, 0, 0, sx, sy) ;
return temp_pixbuf ;
}
Thanks in advance...
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]