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

List:       klik-devel
Subject:    [klik-devel] [klikclient commit] r923 -
From:       codesite-noreply () google ! com
Date:       2008-01-27 16:41:48
Message-ID: 00163646d97f0444b6de2ab869605a0 () google ! com
[Download RAW message or body]

Author: lionel.tricon
Date: Sun Jan 27 08:41:22 2008
New Revision: 923

Modified:
   trunk/client/trunk/cmg_kthumbnail/src/isofscreator.cpp

Log:
If the icon size exceed the maximum width or height for the preview, we 
resize it thanks to QImage::smoothScale().


Modified: trunk/client/trunk/cmg_kthumbnail/src/isofscreator.cpp
==============================================================================
--- trunk/client/trunk/cmg_kthumbnail/src/isofscreator.cpp	(original)
+++ trunk/client/trunk/cmg_kthumbnail/src/isofscreator.cpp	Sun Jan 27 
08:41:22 2008
@@ -142,13 +142,12 @@
 bool
 IsoFsCreator::create(
  const QString &p_path,                                                
// path of the cmg file to open
-int p_width,                                                          
// unused ?
-int p_height,                                                         
// unused ?
+int p_width,                                                          
// maximum width for the preview
+int p_height,                                                         
// maximum height for the preview
  QImage &p_img                                                         
// location to fill with an image
 )
 {
     QString v_image = "/.DirIcon";
-    QImage v_img;

     // initialize the CIsoUtl class with the cmg file
     _isoUtl = new CIsoUtl(p_path.latin1());
@@ -168,14 +167,17 @@

     // load the image into the QImage buffer
     if (_buffer == NULL) return false;
-    if (!v_img.loadFromData((const uchar *)_buffer,_size))
+    if (!p_img.loadFromData((const uchar *)_buffer,_size))
     {
         free(_buffer);
         _buffer = NULL;
         return false;
     }
-    if (v_img.depth() != 32) v_img=v_img.convertDepth(32);
-    p_img = v_img.smoothScale(p_width, p_height);
+    if (p_img.depth() != 32) p_img=p_img.convertDepth(32);
+    if (p_img.width()>p_width || p_img.height()>p_height)
+    {
+        p_img = p_img.smoothScale(p_width, p_height, QImage::ScaleMin);
+    }

     free(_buffer);
     return true;
_______________________________________________
klik-devel mailing list
klik-devel@kde.org
https://mail.kde.org/mailman/listinfo/klik-devel
[prev in list] [next in list] [prev in thread] [next in thread] 

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