Re: pixbuf<->cairo_surface_t conversion



On Fri, Sep 03, 2010 at 08:17:04AM +0000, Benjamin Otte wrote:

> - We convert pixbufs every single time we paint them

> This is important for performance considerations: We convert the
> pixbuf to an image surface every single time we paint it. So
> whatever we end up doing, it won't get any worse. Also, no one has
> complained yet.

Well, this is probably not so noticeable in a desktop system, but we
ran into this problem in Maemo-GTK.

When scrolling up and down quickly large lists of icons (e.g. this
one: http://www.flickr.com/photos/themarina/4435741512/) there was a
single function that was eating up way more CPU than any other, and it
was gdk_cairo_set_source_pixbuf()

So we wanted to cache the cairo surfaces to avoid having to create
them once and again. But since we couldn't guarantee that pixbufs were
not going to have their pixels accessed and we also didn't want to
keep the cached surfaces in memory all the time, we ended up flushing
them after handling all pending redraws. And that fixed the problem
for the most part:

http://maemo.gitorious.org/hildon/gtk/commit/71b25471293a51f21192044beb688108fd2802b5

Berto


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