Commit a09d09c3 authored by Halla Rempt's avatar Halla Rempt
Browse files

BUG:331702 Don't crash when saving 16 bits/channel PSD

We need to order channels by display position, not byte position...
parent 7d16117d
...@@ -637,11 +637,12 @@ bool PSDLayerRecord::writePixelData(QIODevice *io) ...@@ -637,11 +637,12 @@ bool PSDLayerRecord::writePixelData(QIODevice *io)
// then reorder the planes to fit the psd model -- alpha first, then display order // then reorder the planes to fit the psd model -- alpha first, then display order
QVector<quint8* > planes; QVector<quint8* > planes;
foreach(KoChannelInfo *ch, KoChannelInfo::displayOrderSorted(dev->colorSpace()->channels())) { foreach(KoChannelInfo *ch, KoChannelInfo::displayOrderSorted(dev->colorSpace()->channels())) {
qDebug() << ">>>\t" << ch->name() << ch->displayPosition() << ch->channelType();
if (ch->channelType() == KoChannelInfo::ALPHA) { if (ch->channelType() == KoChannelInfo::ALPHA) {
planes.insert(0, tmp[ch->pos()]); planes.insert(0, tmp[ch->displayPosition()]);
} }
else { else {
planes.append(tmp[ch->pos()]); planes.append(tmp[ch->displayPosition()]);
} }
} }
......
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