[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-core-devel
Subject:    Re: icon loading (app startup) speed (longer)
From:       Antonio Larrosa =?iso-8859-1?q?Jim=E9nez?= <larrosa () kde ! org>
Date:       2001-08-11 3:13:58
[Download RAW message or body]

El S=E1b 11 Ago 2001 04:57, Antonio Larrosa Jim=E9nez escribi=F3:
> Well, this is an update with the comments from Richard, Matthias and
> Marc Mutz.
>

Sorry, I forgot to attach the test I used.

--
Antonio Larrosa Jimenez
KDE Core developer  - larrosa@kde.org
http://perso.wanadoo.es/antlarr
KDE - The development framework of the future, today.

["kiconloader2.cpp.diff" (text/x-diff)]

Index: kiconloader.cpp
===================================================================
RCS file: /home/kde/kdelibs/kdecore/kiconloader.cpp,v
retrieving revision 1.164
diff -u -p -r1.164 kiconloader.cpp
--- kiconloader.cpp	2001/08/10 17:36:53	1.164
+++ kiconloader.cpp	2001/08/11 02:47:03
@@ -39,6 +39,7 @@
 #include <stdlib.h>	//for abs
 #include <dirent.h>
 
+#include "gear.cpp"
 
 /*** KIconThemeNode: A node in the icon theme dependancy tree. ***/
 
@@ -149,6 +150,7 @@ struct KIconLoaderPrivate
     QString lastImageKey; // key for icon without effect
     bool lastIconType; // see KIcon::type
     bool lastIconThreshold; // see KIcon::threshold
+    int count;
 };
 
 /*** KIconLoader: the icon loader ***/
@@ -169,6 +171,7 @@ void KIconLoader::init( const QString& _
     d = new KIconLoaderPrivate;
     d->imgDict.setAutoDelete( true );
     d->imgCache.setAutoDelete( true );
+    d->count=0;
 
     if (_dirs)
 	d->mpDirs = _dirs;
@@ -252,6 +255,7 @@ KIconLoader::~KIconLoader()
 {
     delete d->mpThemeRoot;
     delete[] d->mpGroups;
+    printf("Number of icons loaded : %d\n",d->count);
     delete d;
 }
 
@@ -397,10 +401,27 @@ QPixmap KIconLoader::loadIcon(const QStr
 {
     QString name = _name;
     QPixmap pix;
-    QString key;
     bool absolutePath=false;
 
-    if (d->mpThemeRoot == 0L)
+    d->count++;
+    if (size == 0)
+    {
+	size = d->mpGroups[group].size;
+    }
+
+    QString key = (size==32) ? "gear32" : "gear22";
+
+    if (QPixmapCache::find(key, pix)) return pix;
+
+    QImage img(qembed_findImage(key.latin1()));
+    
+    pix.convertFromImage(img);
+
+    QPixmapCache::insert(key, pix);
+
+    return pix;
+
+/*    if (d->mpThemeRoot == 0L)
 	return pix;
 
     // Special case for absolute path icons.
@@ -619,6 +640,7 @@ QPixmap KIconLoader::loadIcon(const QStr
 
     QPixmapCache::insert(key, pix);
     return pix;
+    */
 }
 
 QImage *KIconLoader::loadOverlay(const QString &name, int size) const


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic