pixmap caching?




 Hi,

 I've got a problem with pixmap caching. I wanna make a static pixmap array
 where I could store two or more pixmaps. Dunno, what kind of. I tried to
 make it with GNOME_PIXMAPs, but the changing of them was hard.

Like this.. (global variable...)

GtkWidget * cachedpix[2];

The loading:

        if (cachedpix[i])
                g_free(cachedpix[i]);
         if (g_file_exists(prop->filename[i]))
		cachedpix[0] = gnome_pixmap_new_from_file(prop->filename[i]);

But when I wanna change an icon, I bang to a wall of types.

 gtk_pixmap_set(GTK_PIXMAP(pixmap),GNOME_PIXMAP(cachedpix[curpix])->pixmap,
		GNOME_PIXMAP(cachedpix[curpix])->mask);
 gtk_widget_draw(GNOME_PIXMAP(pixmap),NULL);

That was the last try, it's bad, of course. I wrote that to explain what I
want to do. I hope it was right. Can you help me?

This will change a pixmap on an applet, so I want to cache, because the
 gnome_pixmap_load_file (GNOME_PIXMAP (pixmap), prop->filename[i]);
is slow. Too slow.

Is there intelligent way? (I could hack, with memcpy(), poiners, etc..)

--
Szabolcs Ban - Shooby Ban - bansz@szif.hu - http://tai2.szif.hu/~bansz/
LSC - Linux Supporting Center - http://lsc.kva.hu/



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