Commit 5f4d1e76 authored by C. Boemann's avatar C. Boemann Committed by Jos van den Oever
Browse files

Make saving 16 and 32 bit psd files work

BUG: 316477
parent dd497123
......@@ -243,6 +243,22 @@ bool PSDImageData::write(QIODevice *io, KisPaintDeviceSP dev)
for (qint32 row = 0; row < rc.height(); ++row) {
QByteArray uncompressed = QByteArray::fromRawData((const char*)plane + row * stride, stride);
if (channelInfo->size() == 1) {
} else if (channelInfo->size() == 2) {
quint16 *dataPtr = reinterpret_cast<quint16 *>(uncompressed.data());
for (int i = 0; i < rc.width(); i++) {
quint16 val = htons(*dataPtr);
*dataPtr = val;
++dataPtr;
}
} else if (channelInfo->size() == 4) {
quint32 *dataPtr = reinterpret_cast<quint32 *>(uncompressed.data());
for (int i = 0; i < rc.width(); i++) {
quint32 val = htonl(*dataPtr);
*dataPtr = val;
++dataPtr;
}
}
QByteArray compressed = Compression::compress(uncompressed, Compression::RLE);
io->seek(channelLengthPos);
......
Supports Markdown
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