[PATCH] Cache returned KIconLoader pixmaps in 4.5.2

Michael Pyne mpyne at kde.org
Sun Sep 12 00:17:12 BST 2010

Hi all,

I'm emailing about a commit I recently made to trunk (r1174319) that causes 
pixmaps that are loaded by KIconLoader from the process-shared icon cause to 
also be cached (think QPixmapCache).

This pixmap cache is /already present and used/ in KIconLoader. The patch 
simply adds one more method of adding pixmaps to it.

The problem is that the current KIconLoader code only adds entries to the 
pixmap cache (which is local to every individual process) when adding items to 
the process-shared cache.

For frequently-used icons that don't get evicted it is likely you could run an 
entire KDE session for days without having a single process actually fall 
under this condition. What happens instead is that KIconLoader looks in the 
shared cache, finds the image data, converts it to a pixmap and returns it. It 
does this every time the process requests the same icon.

My patch adds the generated pixmap to the pixmap cache just before returning 
it to allow for skipping the image->pixmap conversion in the future for that 

I would like to backport this to 4.5.2 even though it's not technically a 
bugfix as it could represent a significant performance improvement for icon-
heavy applications like Dolphin, and poses little risk of additional breakage. 
All tests cases for KIconLoader continue to pass and I've been testing this 
patch for most of the day with no issues.

 - Michael Pyne
-------------- next part --------------
A non-text attachment was scrubbed...
Name: kdelibs-kiconloader-cache_returned_pixmaps.patch
Type: text/x-patch
Size: 670 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20100911/a51e2db8/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20100911/a51e2db8/attachment.sig>

More information about the kde-core-devel mailing list