Skip to content

armgit / krita

Public Imported from GitHub
0

Krita is a free and open source cross-platform application that offers an end-to-end solution for creating digital art files from scratch built on the KDE and Qt frameworks.

C++

ASL: Fix reading single plane rgb patterns

Halla Rempt3c1f663df29f
diff --git a/libs/psdutils/asl/kis_asl_reader.cpp b/libs/psdutils/asl/kis_asl_reader.cpp
index 50357cefd3..b2d5189bcd 100644
--- a/libs/psdutils/asl/kis_asl_reader.cpp
+++ b/libs/psdutils/asl/kis_asl_reader.cpp
@@ -247,10 +247,10 @@ QImage readVirtualArrayList(QIODevice &device, int numPlanes, const QVector<QRgb
throw ASLParseException("VAList: Krita doesn't support ASL files with 'numberOfChannels' flag not equal to 24 (it is not documented)!");
}
- // dbgKrita << ppVar(arrayVersion);
- // dbgKrita << ppVar(arrayLength);
- // dbgKrita << ppVar(arrayRect);
- // dbgKrita << ppVar(numberOfChannels);
+ dbgKrita << ppVar(arrayVersion);
+ dbgKrita << ppVar(arrayLength);
+ dbgKrita << ppVar(arrayRect);
+ dbgKrita << ppVar(numberOfChannels);
if (numPlanes != 1 && numPlanes != 3) {
throw ASLParseException("VAList: unsupported number of planes!");
@@ -397,8 +397,18 @@ QImage readVirtualArrayList(QIODevice &device, int numPlanes, const QVector<QRgb
for (int i = 0; i < dataLength; i++) {
for (int j = 2; j >= 0; j--) {
- const int plane = qMin(numPlanes, j);
- *dstPtr++ = dataPlanes[plane][i];
+ int plane;
+ if (numPlanes == 1) {
+ plane = 0;
+ }
+ else {
+ plane = j;
+ }
+
+ QByteArray ba = dataPlanes[plane];
+ Q_ASSERT(ba.size() == dataLength);
+ Q_ASSERT(ba.size() > i);
+ *dstPtr++ = ba[i];
}
*dstPtr++ = 0xFF;
}