On Thu, Dec 25, 2008 at 12:09 PM, Christian Hoff <christian_h...@gmx.net> wrote:
>
> You're right the effect only shows up if you have a large number of rows. But 
> not storing the images as a pixbuf leads to a considerable performance 
> improvement. I used my EAN13 class in a treeview that had about 10.000 rows. 
> In earlier versions it was derived from CellRendererPixbuf and the load was 
> awfully slow(about 30 seconds!) because Gtk+ renders not just the visible 
> cells, but instead all of them.

But how many unique icons are there? If 5000 of the cells share the
same icon, shouldn't it only need to be generated once then stored as
a pixbuf and displayed for the rest of them?

> That's why I tested the approach to subclass directly from CellRenderer and 
> create the image in the render method using Cairo. And suddenly everything 
> was 10 times faster(yes it was really that much a difference). BTW the 
> CellRendererPixbuf uses cairo as well:
>
>  cr = gdk_cairo_create (window);
>
>  gdk_cairo_set_source_pixbuf (cr, pixbuf, pix_rect.x, pix_rect.y);
>  gdk_cairo_rectangle (cr, &draw_rect);
>  cairo_fill (cr);
>
>  cairo_destroy (cr);

That's interesting. Good to know.
_______________________________________________
Gtk-sharp-list maillist  -  Gtk-sharp-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/gtk-sharp-list

Reply via email to