[Digikam-devel] extragear/graphics/digikam/libs/dimg/loaders

Gilles Caulier caulier.gilles at free.fr
Fri Mar 10 11:42:11 GMT 2006


SVN commit 517215 by cgilles:

digiKam from trunk : bugfix in Dimg::QImageLoader : wrong 32 bits image data conversion.

CCMAIL: digikam-devel at kde.org

 M  +18 -11    qimageloader.cpp  
 M  +4 -0      qimageloader.h  


--- trunk/extragear/graphics/digikam/libs/dimg/loaders/qimageloader.cpp #517214:517215
@@ -1,10 +1,12 @@
 /* ============================================================
  * Author: Renchi Raju <renchi at pooh.tam.uiuc.edu>
+ *         Gilles Caulier <caulier dot gilles at kdemail dot net> 
  * Date  : 2005-06-14
- * Description : 
+ * Description : A QImage loader for DImg framework.
  * 
  * Copyright 2005 by Renchi Raju
-
+ * Copyright 2006 by Caulier Gilles
+ *
  * This program is free software; you can redistribute it
  * and/or modify it under the terms of the GNU General
  * Public License as published by the Free Software Foundation;
@@ -22,6 +24,10 @@
 
 #include <qimage.h>
 
+// KDE includes.
+
+#include <kdebug.h>
+
 // Local includes.
 
 #include "dimg.h"
@@ -45,17 +51,18 @@
         observer->progressInfo(m_image, 0.9);
 
     if (image.isNull())
+    {
+        kdDebug() << "Cannot loading \"filePath\" using DImg::QImageLoader!" << endl;
         return false;
+    }
 
-    m_hasAlpha = image.hasAlphaBuffer();
+    m_hasAlpha    = image.hasAlphaBuffer();
+    QImage target = image.convertDepth(32);
     
-    uint w              = image.width();
-    uint h              = image.height();
-    unsigned char* data = new unsigned char[w*h*4];
-
-    image.convertDepth(32);
-
-    uint*  sptr = (uint*)image.bits();
+    uint w      = target.width();
+    uint h      = target.height();
+    uchar* data = new uchar[w*h*4];
+    uint*  sptr = (uint*)target.bits();
     uchar* dptr = data;
     
     for (uint i = 0 ; i < w*h ; i++)
@@ -93,7 +100,7 @@
         quality = 100;
 
     QVariant formatAttr = imageGetAttribute("format");
-    QCString format = formatAttr.toCString();
+    QCString format     = formatAttr.toCString();
 
     QImage image = m_image->copyQImage();
 
--- trunk/extragear/graphics/digikam/libs/dimg/loaders/qimageloader.h #517214:517215
@@ -1,7 +1,11 @@
 /* ============================================================
  * Author: Renchi Raju <renchi at pooh.tam.uiuc.edu>
+ *         Gilles Caulier <caulier dot gilles at kdemail dot net> 
  * Date  : 2005-06-14
+ * Description : A QImage loader for DImg framework.
+ * 
  * Copyright 2005 by Renchi Raju
+ * Copyright 2006 by Caulier Gilles
  *
  * This program is free software; you can redistribute it
  * and/or modify it under the terms of the GNU General



More information about the Digikam-devel mailing list