slow performance with gnomecanvaspixbuf



To whom it may concern,
 
 
Recently I am wirting a program which use gnome canvas to display images and the tools I use to display/load image is gdk_imlib_load_image/gdk_imlib_load_alpha. The performance for using gdk_imlib to load the image is very good. But unfortunately after I use the program to load a number of image (It will change the image if key event occur). It eat up most of my memory and doesn't release it. I try to use the function gdk_imlib_destroy_image to free the memory used. But whenever I tried to load the program that function just crash my program. (it work fine if the function gdk_imlib_destroy_image not used.)
 
following is my code.
 
GnomeCanvasItem *drawImage(GnomeCanvasGroup *rtgrp, gchar *image_name, int x, int y)
{
    GnomeCanvasItem *item;
    GdkimlibImage *image;
 
    image = gdk_imlib_load_image(image_name);
    item = gnome_canvas_item_new(rtgrp, gnome_canvas_image_get_type,
        "image", image,
        "x", (double) x,
        "y", (double) y,
        "width", image->rgb_width,
        "height", image->rgb_height,
        "anchor", GTK_ANCHOR_NW,
        NULL);
    gdk_imlib_destroy_image(image);
    return(item);
}
 
I wish someone can give me any solution regarding to the above code. As I also tried to use gnome_canvas_pixbuf instead of gnome_canvas_image. But I find out that when I first run my program it just eat up most of my memory and the performance to load image is terriblly slow.
 
I am using Red Hat 7.0 with CLE installed and gtk+ and glib version 1.2.8.
 
Therefore I hope someone may give me any solution to my problem.
 
P.S., I also wish to know how to upgrade gnome to 1.2.8 as I have another computer with Red Hat 6.2 with kernal upgraded to 2.4.0 with gtk+  and glib upgraded from 1.2.6 to 1.2.8. But the version for gnome is 1.0.1.
 
many thanks,
 
Kalvin
 
 


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