Commit f63b87ed authored by Boudewijn Rempt's avatar Boudewijn Rempt

uncompress the channel data

parent 1912514d
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
#include "psd_pattern.h" #include "psd_pattern.h"
#include "psd_utils.h" #include "psd_utils.h"
#include "compression.h"
#include <QImage> #include <QImage>
#include <QDebug> #include <QDebug>
...@@ -108,6 +109,8 @@ bool psd_read_pattern(QIODevice *io) ...@@ -108,6 +109,8 @@ bool psd_read_pattern(QIODevice *io)
qint32 max_channels; qint32 max_channels;
psdread(io, &max_channels); psdread(io, &max_channels);
QVector<QByteArray> channelData;
for (int i = 0; i < max_channels; ++i) { for (int i = 0; i < max_channels; ++i) {
quint32 written; quint32 written;
qint32 len; qint32 len;
...@@ -149,7 +152,6 @@ bool psd_read_pattern(QIODevice *io) ...@@ -149,7 +152,6 @@ bool psd_read_pattern(QIODevice *io)
psdread(io, &compression_mode); psdread(io, &compression_mode);
quint32 per_channel_length = 0; quint32 per_channel_length = 0;
quint8 *temp_channel_data = new quint8(len);
if (written > 0) { if (written > 0) {
if (pattern.channel_number == 0) { if (pattern.channel_number == 0) {
...@@ -170,7 +172,7 @@ bool psd_read_pattern(QIODevice *io) ...@@ -170,7 +172,7 @@ bool psd_read_pattern(QIODevice *io)
return false; return false;
} }
quint32 per_channel_length = length; per_channel_length = length;
switch(pattern.color_mode) { switch(pattern.color_mode) {
case Bitmap: case Bitmap:
...@@ -193,17 +195,18 @@ bool psd_read_pattern(QIODevice *io) ...@@ -193,17 +195,18 @@ bool psd_read_pattern(QIODevice *io)
length *= 4; length *= 4;
default: default:
qDebug() << "Impossible color mode" << pattern.color_mode; qDebug() << "Impossible color mode" << pattern.color_mode;
delete temp_channel_data;
return false; return false;
} }
QByteArray ba = io->read(len);
channelData << Compression::uncompress(length, ba, compression_mode);
} }
} }
delete temp_channel_data;
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment