116{
117 quint8 val;
118 quint8 code;
119
120 QByteArray lineArray;
121 lineArray.resize(4 * width);
122 quint8 *image = (quint8 *)lineArray.data();
123
124 for (int cline = 0; cline < height; cline++) {
125
129 continue;
130 }
131
132 s >> val;
133
134 if (s.atEnd()) {
135 return true;
136 }
137
138 if (val != 2) {
139 s.device()->ungetChar(val);
142 continue;
143 }
144
145 s >> image[1];
146 s >> image[2];
147 s >> image[3];
148
149 if (s.atEnd()) {
150 return true;
151 }
152
153 if ((image[1] != 2) || (image[2] & 128)) {
154 image[0] = 2;
157 continue;
158 }
159
160 if ((image[2] << 8 | image[3]) != width) {
161 dbgFile <<
"Line of pixels had width" << (image[2] << 8 | image[3]) <<
"instead of" << width;
162 return false;
163 }
164
165
166 for (int i = 0; i < 4; i++) {
167 for (int j = 0; j < width;) {
168 s >> code;
169 if (s.atEnd()) {
170 dbgFile <<
"Truncated HDR file";
171 return false;
172 }
173 if (code > 128) {
174
175 code &= 127;
176 s >> val;
177 while (code != 0) {
178 image[i + j * 4] = val;
179 j++;
180 code--;
181 }
182 } else {
183
184 while (code != 0) {
185 s >> image[i + j * 4];
186 j++;
187 code--;
188 }
189 }
190 }
191 }
192
194 }
195
196 return true;
197}
static void RGBEToPaintDevice(quint8 *image, int width, KisSequentialIterator &it)
static bool ReadOldLine(quint8 *image, int width, QDataStream &s)