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

List:       kde-commits
Subject:    kdebase/kioslave/thumbnail
From:       Brad Hards <bradh () frogmouth ! net>
Date:       2004-09-07 15:54:56
Message-ID: 20040907155456.51680E76 () office ! kde ! org
[Download RAW message or body]

CVS commit by bhards: 

User feedback (from "Double Negative Visual Effects") is that rendering
thumbnails for large EXR images slows the machine to a crawl. So you
have to set the maximum file size very low. However extracting thumbnails
that are embedded in the header is pretty cheap, so we want to ignore 
the maximum file size limit for those files.
Actual implementation is to ignore the limit for all files, test if 
there is a thumbnail embedded, and then use the file size limit if 
there is no thumbnail embedded.


  M +20 -4     exrcreator.cpp   1.2
  M +1 -0      exrthumbnail.desktop   1.4


--- kdebase/kioslave/thumbnail/exrcreator.cpp  #1.1:1.2
@@ -22,4 +22,7 @@
 #include <kimageio.h>
 #include <kdebug.h>
+#include <kconfig.h>
+#include <kglobal.h>
+#include <qfile.h>
 
 #include <ImfInputFile.h>
@@ -55,10 +58,23 @@ bool EXRCreator::create(const QString &p
     } else {
         // do it the hard way
+        // We ignore maximum size when just extracting the thumnail
+        // from the header, but it is very expensive to render large
+        // EXR images just to turn it into an icon, so we go back
+        // to honouring it in here.
         kdDebug() << "EXRcreator - using original image" << endl;
-        if (!img.load( path ))
+        KConfig * config = KGlobal::config();
+        KConfigGroupSaver cgs( config, "PreviewSettings" );
+        unsigned long long maxSize = config->readNumEntry( "MaximumSize", 1024*1024 /* 1MB */ );
+        unsigned long long fileSize = QFile( path ).size();
+        if ( (fileSize > 0) && (fileSize < maxSize) ) {
+            if (!img.load( path )) {
             return false;
+            }
         if (img.depth() != 32)
             img = img.convertDepth( 32 );
         return true;
+        } else {
+            return false;
+        }
     }
 }

--- kdebase/kioslave/thumbnail/exrthumbnail.desktop  #1.3:1.4
@@ -9,2 +9,3 @@
 X-KDE-Library=exrthumbnail
 CacheThumbnail=true
+IgnoreMaximumSize=true


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

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