From kde-commits Thu Jul 31 21:37:13 2003 From: =?utf-8?q?Aur=C3=A9lien=20G=C3=A2teau?= Date: Thu, 31 Jul 2003 21:37:13 +0000 To: kde-commits Subject: kdeextragear-1/gwenview X-MARC-Message: https://marc.info/?l=kde-commits&m=105968747123018 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");