Releasing client-side pixmaps
- From: Dag Helstad <dag helstad kreatel se>
 
- To: "'gtk-list gnome org'" <gtk-list gnome org>
 
- Subject: Releasing client-side pixmaps
 
- Date: Wed, 23 Oct 2002 15:16:20 +0200
 
Hi, I'm trying to minimize the memory usage of a GTK application which uses
a GtkPixmap to show a background pixmap. 
The X server keeps a server-side copy of the pixmap, but it seems a
client-side copy is kept in my application.
Here is the code fragment which creates a gtk_pixmap from my bitmap (which
is stored in PNG format):
/****************************/
GtkWidget* LoadImage(const std::string& location)
{
   GtkWidget* widget = NULL;
   GdkPixbuf* image = NULL;
   GdkPixmap* pixmap = NULL;
   GdkBitmap* mask = NULL;
   image=gdk_pixbuf_new_from_file(location.c_str());
   gdk_pixbuf_render_pixmap_and_mask(image, &pixmap, &mask, 100);
   widget = gtk_pixmap_new(pixmap, mask);
   gdk_pixmap_unref(pixmap);
   gdk_bitmap_unref(mask);
   gdk_pixbuf_unref(image);
   
   return widget;
}
/****************************/
I unref() the GdkPixbuf, GdkPixmap and GdkBitmap. Does the GtkPixmap widget
keep a client-side copy of the pixmap? Can I free the client-side pixmap
without destroying my GtkPixmap widget?
Regards, 
Dag Helstad
[
Date Prev][
Date Next]   [
Thread Prev][
Thread Next]   
[
Thread Index]
[
Date Index]
[
Author Index]