[Fwd: Re: [maybe OT?] Code excerpts from the GIMP]

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

[Fwd: Re: [maybe OT?] Code excerpts from the GIMP]

Tom Copeland
-------- Forwarded Message --------

> From: Sven Neumann <[hidden email]>
>  gimp-2.2.4/app/core/gimppreviewcache.c uses a GSList as a sort of
>     size-based queue; it holds image previews in a GSList and uses
>     g_slist_insert_sorted to insert the smaller images first. Oddly,
>     another function in the same file trims the cache by iterating
>     over the same GSList and comparing each item to find the smallest
>     one to remove. Might be a possibility for some optimization there.
> The function preview_cache_remove_smallest() which is used to trim the
> cache actually uses a different comparison than what is used to keep
> the list sorted. Whether this is what the author intended, I don't know.

Ah, you're right, it uses the area vs an x1 > x2 and y1 > y2 comparison.
I've corrected that comment, thanks much!


> It might be of interest to your readers to also include GimpList as an
> implementation of the GimpContainer class.

That is interesting.  Backed by a GList, and sortable, and does unique
names too, huh?  Pretty cool.  



Gimp-developer mailing list
[hidden email]