Fixed a bug on bytesperline for rgb images.
authorviric@llimona
Thu, 15 Nov 2007 18:47:08 +0100
changeset 215 d3973f7ea877
parent 214 4f8e0b41c1a5
child 216 95cdc556c93f
Fixed a bug on bytesperline for rgb images.
qjpeg/gui/QChain-image.cpp
qjpeg/gui/QImagePtr.h
--- a/qjpeg/gui/QChain-image.cpp	Wed Nov 14 14:57:33 2007 +0100
+++ b/qjpeg/gui/QChain-image.cpp	Thu Nov 15 18:47:08 2007 +0100
@@ -45,7 +45,7 @@
 
         delete out;
         img = new QImagePtr((uchar *) rgb->data(), rgb->getWidth(),
-            rgb->getHeight(), QImage::Format_RGB32);
+            rgb->getHeight(), rgb->getWidth()*4, QImage::Format_RGB32);
         delete rgb;
     } else if (out->getComponents() == 1)
     {
@@ -53,7 +53,7 @@
         delete out;
 
         img = new QImagePtr((uchar *) gray->data(), gray->getWidth(),
-            gray->getHeight(), QImage::Format_Indexed8);
+            gray->getHeight(), gray->getWidth(), QImage::Format_Indexed8);
         img->setColorTable(getGrayscale());
         delete gray;
     } else
--- a/qjpeg/gui/QImagePtr.h	Wed Nov 14 14:57:33 2007 +0100
+++ b/qjpeg/gui/QImagePtr.h	Thu Nov 15 18:47:08 2007 +0100
@@ -3,10 +3,12 @@
 class QImagePtr : public QImage
 {
 public:
-    QImagePtr ( uchar * data, int width, int height, Format format )
-        : QImage(data, width, height, width, format) {};
-    QImagePtr ( const uchar * data, int width, int height, Format format )
-        : QImage(data, width, height, width, format) {};
+    QImagePtr ( uchar * data, int width, int height, int bytesperline,
+            Format format )
+        : QImage(data, width, height, bytesperline, format) {};
+    QImagePtr ( const uchar * data, int width, int height, int bytesperline,
+            Format format )
+        : QImage(data, width, height, bytesperline, format) {};
     ~QImagePtr() {
         delete[] bits();
     };