[KPhotoAlbum] Performance problem with viewing images

Robert Krawitz rlk at alum.mit.edu
Sat Nov 3 20:21:11 GMT 2007


This appears to work well.

The way it works is that we set priority when we're actually trying to
display an image, but otherwise not.  In addition, the request queue
code should not drop a high priority request on the floor just because
a low priority request for the same item is already pending.

Index: ImageManager/RequestQueue.cpp
===================================================================
--- ImageManager/RequestQueue.cpp       (revision 732389)
+++ ImageManager/RequestQueue.cpp       (working copy)
@@ -23,7 +23,7 @@
 
 void ImageManager::RequestQueue::addRequest( ImageRequest* request )
 {
-    if ( _uniquePending.contains( request ) ) {
+    if ( _uniquePending.contains( request ) && ! request->priority() ) {
         delete request;
         return;
     }
Index: Viewer/ImageDisplay.cpp
===================================================================
--- Viewer/ImageDisplay.cpp     (revision 732389)
+++ Viewer/ImageDisplay.cpp     (working copy)
@@ -239,7 +239,7 @@
         emit imageReady();
     }
     else {
-        requestImage( info );
+        requestImage( info, true );
         busy();
     }
     _forward = forward;
@@ -628,7 +628,7 @@
     return res;
 }
 
-void Viewer::ImageDisplay::requestImage( const DB::ImageInfoPtr& info )
+void Viewer::ImageDisplay::requestImage( const DB::ImageInfoPtr& info, bool priority )
 {
     Settings::StandardViewSize viewSize = Settings::SettingsData::instance()->viewerStandardSize();
     QSize s = size();
@@ -637,7 +637,8 @@
 
     ImageManager::ImageRequest* request = new ImageManager::ImageRequest( info->fileName(), s, info->angle(), this );
     request->setUpScale( viewSize == Settings::FullSize );
-    request->setPriority();
+    if (priority)
+        request->setPriority();
     ImageManager::Manager::instance()->load( request );
 }
 
Index: Viewer/ImageDisplay.h
===================================================================
--- Viewer/ImageDisplay.h       (revision 732389)
+++ Viewer/ImageDisplay.h       (working copy)
@@ -100,7 +100,7 @@
     void cropAndScale();
     void updatePreload();
     int indexOf( const QString& fileName );
-    void requestImage( const DB::ImageInfoPtr& info );
+    void requestImage( const DB::ImageInfoPtr& info, bool priority = false );
 
     /** display zoom factor in title of display window */
     void updateZoomCaption();



More information about the Kphotoalbum mailing list