loading pixmap from file slow



I am learning GTK+ and writing my first program with it.  I am finding 
that loading a pixmap from a file is intolerably slow.  For example, the 
following pixmap is about 50x50:

-rw-rw-r--   1 andrew   andrew      33876 Jun  9 04:37 eye.xpm

I load it with the code:

void hello(GtkWidget *widget, gpointer data)
{
    GtkWidget *canvas;
    GdkPixmap *pixmap;
    GdkBitmap *mask;

    canvas = GTK_WIDGET(data);
    g_print("one...\n");
    pixmap = gdk_pixmap_create_from_xpm(window->window, &mask,
        &window->style->bg[GTK_STATE_NORMAL], "./eye.xpm");
    g_print("two\n");
}

Some seconds elapse between one and two.  window is a normal toplevel
GtkWindow (made global for this example).  I don't see any reason to
think I'm doing something unusual that would cause this.  The image loads
just fine (and quickly) in GIMP and xv.  I haven't looked at the gdk code
(I'd have to download it over a slow link), but I will if I don't hear an
answer. 

Let me also say that GTK+, though underdocumented in many areas, has
performed flawlessly up to this point.  The beautiful design and
extensive widget set make it a joy to program.  The only thing I miss
from other toolkits I've used is Tk's structured graphics Canvas. 

Thanks in advance,
Andrew



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