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

List:       kde-commits
Subject:    kdeextragear-1/gwenview
From:       Aurélien Gâteau <aurelien.gateau () mail ! dotcom ! fr>
Date:       2003-07-31 21:37:13
[Download RAW message or body]

CVS commit by gateau: 

Fixed a bug in libexif 0.5.10 which caused Gwenview to freeze when generating
the thumbnail for non JPEG files. This gave me the idea to not try to get EXIF
data from non JPEG files, thus optimizing the thumbnail generation a little
bit.


  M +1 -1      libgvexif/exif-data.c   1.3
  M +10 -7     src/thumbnailloadjob.cpp   1.20


--- kdeextragear-1/gwenview/libgvexif/exif-data.c  #1.2:1.3
@@ -659,5 +659,5 @@ exif_data_new_from_file (const char *pat
         while (1) {
                 size = fread (data, 1, 1024, f);
-                if (size < 0) break;
+                if (size <= 0) break;
                 if (!exif_loader_write (loader, data, size)) break;
         }

--- kdeextragear-1/gwenview/src/thumbnailloadjob.cpp  #1.19:1.20
@@ -267,15 +267,18 @@ void ThumbnailLoadJob::createThumbnail(c
         bool loaded=false;
         
-        // Try to load smaller jpeg file
-        // if it fails, load file using Qt
-        if (isJPEG(pixPath)) loaded=loadJPEG(pixPath, img);
+        // If it's a JPEG, try to load a small image directly from the file
+        if (isJPEG(pixPath)) {
+                loaded=loadJPEG(pixPath, img);
+                if (loaded) {
+                        // Rotate if necessary
+                        GVImageUtils::Orientation orientation=GVImageUtils::getOrientation(pixPath);
+                        img=GVImageUtils::rotate(img,orientation);
+                }
+        }
 
+        // File is not a JPEG, or JPEG optimized load failed, load file using Qt
         if (!loaded) {
                 if (!loadThumbnail(pixPath, img)) return;
         }
-
-        // Rotate if necessary
-        GVImageUtils::Orientation orientation=GVImageUtils::getOrientation(pixPath);
-        img=GVImageUtils::rotate(img,orientation);
         
         img.save(mCacheDir + "/" + mCurrentURL.fileName(),"PNG");


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

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