image/qimage.cpp

Switch to Source codePreprocessed file
LineSource CodeCoverage
1 -
2 -
3 -
4 -
5 -
6 -
7 -
8 -
9static inline bool isLocked(QImageData *data) -
10{ -
11 return data != 0 && data->is_locked;
executed: return data != 0 && data->is_locked;
Execution Count:59298
59298
12} -
13static QImage rotated90(const QImage &src); -
14static QImage rotated180(const QImage &src); -
15static QImage rotated270(const QImage &src); -
16 -
17QBasicAtomicInt qimage_serial_number = { (1) }; -
18 -
19QImageData::QImageData() -
20 : ref(0), width(0), height(0), depth(0), nbytes(0), devicePixelRatio(1.0), data(0), -
21 format(QImage::Format_ARGB32), bytes_per_line(0), -
22 ser_no(qimage_serial_number.fetchAndAddRelaxed(1)), -
23 detach_no(0), -
24 dpmx(qt_defaultDpiX() * 100 / qreal(2.54)), -
25 dpmy(qt_defaultDpiY() * 100 / qreal(2.54)), -
26 offset(0, 0), own_data(true), ro_data(false), has_alpha_clut(false), -
27 is_cached(false), is_locked(false), cleanupFunction(0), cleanupInfo(0), -
28 paintEngine(0) -
29{ -
30}
executed: }
Execution Count:182740
182740
31QImageData * QImageData::create(const QSize &size, QImage::Format format, int numColors) -
32{ -
33 if (!size.isValid() || numColors < 0 || format == QImage::Format_Invalid)
partially evaluated: !size.isValid()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:44420
partially evaluated: numColors < 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:44420
partially evaluated: format == QImage::Format_Invalid
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:44420
0-44420
34 return 0;
never executed: return 0;
0
35 -
36 uint width = size.width(); -
37 uint height = size.height(); -
38 uint depth = qt_depthForFormat(format); -
39 -
40 switch (format) { -
41 case QImage::Format_Mono: -
42 case QImage::Format_MonoLSB: -
43 numColors = 2; -
44 break;
executed: break;
Execution Count:10648
10648
45 case QImage::Format_Indexed8: -
46 numColors = qBound(0, numColors, 256); -
47 break;
executed: break;
Execution Count:2881
2881
48 default: -
49 numColors = 0; -
50 break;
executed: break;
Execution Count:30891
30891
51 } -
52 -
53 const int bytes_per_line = ((width * depth + 31) >> 5) << 2; -
54 -
55 -
56 if (2147483647/depth < width
partially evaluated: 2147483647/depth < width
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:44420
0-44420
57 || bytes_per_line <= 0
evaluated: bytes_per_line <= 0
TRUEFALSE
yes
Evaluation Count:259
yes
Evaluation Count:44161
259-44161
58 || height <= 0
partially evaluated: height <= 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:44161
0-44161
59 || 2147483647/uint(bytes_per_line) < height
evaluated: 2147483647/uint(bytes_per_line) < height
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:44160
1-44160
60 || 2147483647/sizeof(uchar *) < uint(height))
partially evaluated: 2147483647/sizeof(uchar *) < uint(height)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:44160
0-44160
61 return 0;
executed: return 0;
Execution Count:260
260
62 -
63 QScopedPointer<QImageData> d(new QImageData); -
64 d->colortable.resize(numColors); -
65 if (depth == 1) {
evaluated: depth == 1
TRUEFALSE
yes
Evaluation Count:10535
yes
Evaluation Count:33625
10535-33625
66 d->colortable[0] = QColor(Qt::black).rgba(); -
67 d->colortable[1] = QColor(Qt::white).rgba(); -
68 } else {
executed: }
Execution Count:10535
10535
69 for (int i = 0; i < numColors; ++i)
partially evaluated: i < numColors
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:33625
0-33625
70 d->colortable[i] = 0;
never executed: d->colortable[i] = 0;
0
71 }
executed: }
Execution Count:33625
33625
72 -
73 d->width = width; -
74 d->height = height; -
75 d->depth = depth; -
76 d->format = format; -
77 d->has_alpha_clut = false; -
78 d->is_cached = false; -
79 -
80 d->bytes_per_line = bytes_per_line; -
81 -
82 d->nbytes = d->bytes_per_line*height; -
83 d->data = (uchar *)malloc(d->nbytes); -
84 -
85 if (!d->data) {
partially evaluated: !d->data
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:44160
0-44160
86 return 0;
never executed: return 0;
0
87 } -
88 -
89 d->ref.ref(); -
90 return d.take();
executed: return d.take();
Execution Count:44160
44160
91 -
92} -
93 -
94QImageData::~QImageData() -
95{ -
96 if (cleanupFunction)
evaluated: cleanupFunction
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:182714
2-182714
97 cleanupFunction(cleanupInfo);
executed: cleanupFunction(cleanupInfo);
Execution Count:2
2
98 if (is_cached)
partially evaluated: is_cached
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:182716
0-182716
99 QImagePixmapCleanupHooks::executeImageHooks((((qint64) ser_no) << 32) | ((qint64) detach_no));
never executed: QImagePixmapCleanupHooks::executeImageHooks((((qint64) ser_no) << 32) | ((qint64) detach_no));
0
100 delete paintEngine; -
101 if (data && own_data)
partially evaluated: data
TRUEFALSE
yes
Evaluation Count:182716
no
Evaluation Count:0
evaluated: own_data
TRUEFALSE
yes
Evaluation Count:44137
yes
Evaluation Count:138579
0-182716
102 free(data);
executed: free(data);
Execution Count:44137
44137
103 data = 0; -
104}
executed: }
Execution Count:182716
182716
105 -
106 -
107bool QImageData::checkForAlphaPixels() const -
108{ -
109 bool has_alpha_pixels = false; -
110 -
111 switch (format) { -
112 -
113 case QImage::Format_Mono: -
114 case QImage::Format_MonoLSB: -
115 case QImage::Format_Indexed8: -
116 has_alpha_pixels = has_alpha_clut; -
117 break;
executed: break;
Execution Count:2098
2098
118 -
119 case QImage::Format_ARGB32: -
120 case QImage::Format_ARGB32_Premultiplied: { -
121 uchar *bits = data; -
122 for (int y=0; y<height && !has_alpha_pixels; ++y) {
evaluated: y<height
TRUEFALSE
yes
Evaluation Count:84197
yes
Evaluation Count:1244
evaluated: !has_alpha_pixels
TRUEFALSE
yes
Evaluation Count:83717
yes
Evaluation Count:480
480-84197
123 for (int x=0; x<width; ++x)
evaluated: x<width
TRUEFALSE
yes
Evaluation Count:7636036
yes
Evaluation Count:83717
83717-7636036
124 has_alpha_pixels |= (((uint *)bits)[x] & 0xff000000) != 0xff000000;
executed: has_alpha_pixels |= (((uint *)bits)[x] & 0xff000000) != 0xff000000;
Execution Count:7636036
7636036
125 bits += bytes_per_line; -
126 }
executed: }
Execution Count:83717
83717
127 } break;
executed: break;
Execution Count:1724
1724
128 -
129 case QImage::Format_ARGB8555_Premultiplied: -
130 case QImage::Format_ARGB8565_Premultiplied: { -
131 uchar *bits = data; -
132 uchar *end_bits = data + bytes_per_line; -
133 -
134 for (int y=0; y<height && !has_alpha_pixels; ++y) {
never evaluated: y<height
never evaluated: !has_alpha_pixels
0
135 while (bits < end_bits) {
never evaluated: bits < end_bits
0
136 has_alpha_pixels |= bits[0] != 0; -
137 bits += 3; -
138 }
never executed: }
0
139 bits = end_bits; -
140 end_bits += bytes_per_line; -
141 }
never executed: }
0
142 } break;
never executed: break;
0
143 -
144 case QImage::Format_ARGB6666_Premultiplied: { -
145 uchar *bits = data; -
146 uchar *end_bits = data + bytes_per_line; -
147 -
148 for (int y=0; y<height && !has_alpha_pixels; ++y) {
never evaluated: y<height
never evaluated: !has_alpha_pixels
0
149 while (bits < end_bits) {
never evaluated: bits < end_bits
0
150 has_alpha_pixels |= (bits[0] & 0xfc) != 0; -
151 bits += 3; -
152 }
never executed: }
0
153 bits = end_bits; -
154 end_bits += bytes_per_line; -
155 }
never executed: }
0
156 } break;
never executed: break;
0
157 -
158 case QImage::Format_ARGB4444_Premultiplied: { -
159 uchar *bits = data; -
160 uchar *end_bits = data + bytes_per_line; -
161 -
162 for (int y=0; y<height && !has_alpha_pixels; ++y) {
never evaluated: y<height
never evaluated: !has_alpha_pixels
0
163 while (bits < end_bits) {
never evaluated: bits < end_bits
0
164 has_alpha_pixels |= (bits[0] & 0xf0) != 0; -
165 bits += 2; -
166 }
never executed: }
0
167 bits = end_bits; -
168 end_bits += bytes_per_line; -
169 }
never executed: }
0
170 } break;
never executed: break;
0
171 -
172 default: -
173 break;
never executed: break;
0
174 } -
175 -
176 return has_alpha_pixels;
executed: return has_alpha_pixels;
Execution Count:3822
3822
177} -
178static const uchar bitflip[256] = { -
179 0, 128, 64, 192, 32, 160, 96, 224, 16, 144, 80, 208, 48, 176, 112, 240, -
180 8, 136, 72, 200, 40, 168, 104, 232, 24, 152, 88, 216, 56, 184, 120, 248, -
181 4, 132, 68, 196, 36, 164, 100, 228, 20, 148, 84, 212, 52, 180, 116, 244, -
182 12, 140, 76, 204, 44, 172, 108, 236, 28, 156, 92, 220, 60, 188, 124, 252, -
183 2, 130, 66, 194, 34, 162, 98, 226, 18, 146, 82, 210, 50, 178, 114, 242, -
184 10, 138, 74, 202, 42, 170, 106, 234, 26, 154, 90, 218, 58, 186, 122, 250, -
185 6, 134, 70, 198, 38, 166, 102, 230, 22, 150, 86, 214, 54, 182, 118, 246, -
186 14, 142, 78, 206, 46, 174, 110, 238, 30, 158, 94, 222, 62, 190, 126, 254, -
187 1, 129, 65, 193, 33, 161, 97, 225, 17, 145, 81, 209, 49, 177, 113, 241, -
188 9, 137, 73, 201, 41, 169, 105, 233, 25, 153, 89, 217, 57, 185, 121, 249, -
189 5, 133, 69, 197, 37, 165, 101, 229, 21, 149, 85, 213, 53, 181, 117, 245, -
190 13, 141, 77, 205, 45, 173, 109, 237, 29, 157, 93, 221, 61, 189, 125, 253, -
191 3, 131, 67, 195, 35, 163, 99, 227, 19, 147, 83, 211, 51, 179, 115, 243, -
192 11, 139, 75, 203, 43, 171, 107, 235, 27, 155, 91, 219, 59, 187, 123, 251, -
193 7, 135, 71, 199, 39, 167, 103, 231, 23, 151, 87, 215, 55, 183, 119, 247, -
194 15, 143, 79, 207, 47, 175, 111, 239, 31, 159, 95, 223, 63, 191, 127, 255 -
195}; -
196 -
197const uchar *qt_get_bitflip_array() -
198{ -
199 return bitflip;
never executed: return bitflip;
0
200} -
201QImage::QImage() -
202 : QPaintDevice() -
203{ -
204 d = 0; -
205}
executed: }
Execution Count:155712
155712
206QImage::QImage(int width, int height, Format format) -
207 : QPaintDevice() -
208{ -
209 d = QImageData::create(QSize(width, height), format, 0); -
210}
executed: }
Execution Count:33742
33742
211QImage::QImage(const QSize &size, Format format) -
212 : QPaintDevice() -
213{ -
214 d = QImageData::create(size, format, 0); -
215}
executed: }
Execution Count:10556
10556
216 -
217 -
218 -
219QImageData *QImageData::create(uchar *data, int width, int height, int bpl, QImage::Format format, bool readOnly, QImageCleanupFunction cleanupFunction, void *cleanupInfo) -
220{ -
221 QImageData *d = 0; -
222 -
223 if (format == QImage::Format_Invalid)
partially evaluated: format == QImage::Format_Invalid
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:138580
0-138580
224 return d;
never executed: return d;
0
225 -
226 const int depth = qt_depthForFormat(format); -
227 const int calc_bytes_per_line = ((width * depth + 31)/32) * 4; -
228 const int min_bytes_per_line = (width * depth + 7)/8; -
229 -
230 if (bpl <= 0)
evaluated: bpl <= 0
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:138576
4-138576
231 bpl = calc_bytes_per_line;
executed: bpl = calc_bytes_per_line;
Execution Count:4
4
232 -
233 if (width <= 0 || height <= 0 || !data
partially evaluated: width <= 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:138580
partially evaluated: height <= 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:138580
partially evaluated: !data
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:138580
0-138580
234 || 2147483647/sizeof(uchar *) < uint(height)
partially evaluated: 2147483647/sizeof(uchar *) < uint(height)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:138580
0-138580
235 || 2147483647/uint(depth) < uint(width)
partially evaluated: 2147483647/uint(depth) < uint(width)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:138580
0-138580
236 || bpl <= 0
partially evaluated: bpl <= 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:138580
0-138580
237 || height <= 0
partially evaluated: height <= 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:138580
0-138580
238 || bpl < min_bytes_per_line
partially evaluated: bpl < min_bytes_per_line
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:138580
0-138580
239 || 2147483647/uint(bpl) < uint(height))
partially evaluated: 2147483647/uint(bpl) < uint(height)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:138580
0-138580
240 return d;
never executed: return d;
0
241 -
242 d = new QImageData; -
243 d->ref.ref(); -
244 -
245 d->own_data = false; -
246 d->ro_data = readOnly; -
247 d->data = data; -
248 d->width = width; -
249 d->height = height; -
250 d->depth = depth; -
251 d->format = format; -
252 -
253 d->bytes_per_line = bpl; -
254 d->nbytes = d->bytes_per_line * height; -
255 -
256 d->cleanupFunction = cleanupFunction; -
257 d->cleanupInfo = cleanupInfo; -
258 -
259 return d;
executed: return d;
Execution Count:138580
138580
260} -
261QImage::QImage(uchar* data, int width, int height, Format format, QImageCleanupFunction cleanupFunction, void *cleanupInfo) -
262 : QPaintDevice() -
263{ -
264 d = QImageData::create(data, width, height, 0, format, false, cleanupFunction, cleanupInfo); -
265}
executed: }
Execution Count:4
4
266QImage::QImage(const uchar* data, int width, int height, Format format, QImageCleanupFunction cleanupFunction, void *cleanupInfo) -
267 : QPaintDevice() -
268{ -
269 d = QImageData::create(const_cast<uchar*>(data), width, height, 0, format, true, cleanupFunction, cleanupInfo); -
270}
never executed: }
0
271QImage::QImage(uchar *data, int width, int height, int bytesPerLine, Format format, QImageCleanupFunction cleanupFunction, void *cleanupInfo) -
272 :QPaintDevice() -
273{ -
274 d = QImageData::create(data, width, height, bytesPerLine, format, false, cleanupFunction, cleanupInfo); -
275}
executed: }
Execution Count:137090
137090
276QImage::QImage(const uchar *data, int width, int height, int bytesPerLine, Format format, QImageCleanupFunction cleanupFunction, void *cleanupInfo) -
277 :QPaintDevice() -
278{ -
279 d = QImageData::create(const_cast<uchar*>(data), width, height, bytesPerLine, format, true, cleanupFunction, cleanupInfo); -
280}
executed: }
Execution Count:1486
1486
281QImage::QImage(const QString &fileName, const char *format) -
282 : QPaintDevice() -
283{ -
284 d = 0; -
285 load(fileName, format); -
286}
executed: }
Execution Count:172
172
287 -
288 -
289extern bool qt_read_xpm_image_or_array(QIODevice *device, const char * const *source, QImage &image); -
290QImage::QImage(const char * const xpm[]) -
291 : QPaintDevice() -
292{ -
293 d = 0; -
294 if (!xpm)
partially evaluated: !xpm
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2071
0-2071
295 return;
never executed: return;
0
296 if (!qt_read_xpm_image_or_array(0, xpm, *this))
evaluated: !qt_read_xpm_image_or_array(0, xpm, *this)
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:2070
1-2070
297 -
298 QMessageLogger("image/qimage.cpp", 968, __PRETTY_FUNCTION__).warning("QImage::QImage(), XPM is not supported");
executed: QMessageLogger("image/qimage.cpp", 968, __PRETTY_FUNCTION__).warning("QImage::QImage(), XPM is not supported");
Execution Count:1
1
299}
executed: }
Execution Count:2071
2071
300QImage::QImage(const QImage &image) -
301 : QPaintDevice() -
302{ -
303 if (image.paintingActive() || isLocked(image.d)) {
evaluated: image.paintingActive()
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:54831
partially evaluated: isLocked(image.d)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:54831
0-54831
304 d = 0; -
305 image.copy().swap(*this); -
306 } else {
executed: }
Execution Count:1
1
307 d = image.d; -
308 if (d)
evaluated: d
TRUEFALSE
yes
Evaluation Count:54799
yes
Evaluation Count:32
32-54799
309 d->ref.ref();
executed: d->ref.ref();
Execution Count:54799
54799
310 }
executed: }
Execution Count:54831
54831
311} -
312 -
313 -
314 -
315 -
316 -
317QImage::~QImage() -
318{ -
319 if (d && !d->ref.deref())
evaluated: d
TRUEFALSE
yes
Evaluation Count:239303
yes
Evaluation Count:156304
evaluated: !d->ref.deref()
TRUEFALSE
yes
Evaluation Count:180520
yes
Evaluation Count:58783
58783-239303
320 delete d;
executed: delete d;
Execution Count:180520
180520
321}
executed: }
Execution Count:395607
395607
322QImage &QImage::operator=(const QImage &image) -
323{ -
324 if (image.paintingActive() || isLocked(image.d)) {
evaluated: image.paintingActive()
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:4467
partially evaluated: isLocked(image.d)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:4467
0-4467
325 operator=(image.copy()); -
326 } else {
executed: }
Execution Count:2
2
327 if (image.d)
evaluated: image.d
TRUEFALSE
yes
Evaluation Count:4414
yes
Evaluation Count:53
53-4414
328 image.d->ref.ref();
executed: image.d->ref.ref();
Execution Count:4414
4414
329 if (d && !d->ref.deref())
evaluated: d
TRUEFALSE
yes
Evaluation Count:2504
yes
Evaluation Count:1963
evaluated: !d->ref.deref()
TRUEFALSE
yes
Evaluation Count:2074
yes
Evaluation Count:430
430-2504
330 delete d;
executed: delete d;
Execution Count:2074
2074
331 d = image.d; -
332 }
executed: }
Execution Count:4467
4467
333 return *this;
executed: return *this;
Execution Count:4469
4469
334} -
335int QImage::devType() const -
336{ -
337 return QInternal::Image;
executed: return QInternal::Image;
Execution Count:122264
122264
338} -
339 -
340 -
341 -
342 -
343QImage::operator QVariant() const -
344{ -
345 return QVariant(QVariant::Image, this);
executed: return QVariant(QVariant::Image, this);
Execution Count:146
146
346} -
347void QImage::detach() -
348{ -
349 if (d) {
evaluated: d
TRUEFALSE
yes
Evaluation Count:4368345
yes
Evaluation Count:187
187-4368345
350 if (d->is_cached && d->ref.load() == 1)
partially evaluated: d->is_cached
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:4368345
never evaluated: d->ref.load() == 1
0-4368345
351 QImagePixmapCleanupHooks::executeImageHooks(cacheKey());
never executed: QImagePixmapCleanupHooks::executeImageHooks(cacheKey());
0
352 -
353 if (d->ref.load() != 1 || d->ro_data)
evaluated: d->ref.load() != 1
TRUEFALSE
yes
Evaluation Count:11052
yes
Evaluation Count:4357293
evaluated: d->ro_data
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:4357292
1-4357293
354 *this = copy();
executed: *this = copy();
Execution Count:11053
11053
355 -
356 if (d)
partially evaluated: d
TRUEFALSE
yes
Evaluation Count:4368345
no
Evaluation Count:0
0-4368345
357 ++d->detach_no;
executed: ++d->detach_no;
Execution Count:4368345
4368345
358 }
executed: }
Execution Count:4368345
4368345
359}
executed: }
Execution Count:4368532
4368532
360QImage QImage::copy(const QRect& r) const -
361{ -
362 if (!d)
partially evaluated: !d
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:15156
0-15156
363 return QImage();
never executed: return QImage();
0
364 -
365 if (r.isNull()) {
evaluated: r.isNull()
TRUEFALSE
yes
Evaluation Count:11167
yes
Evaluation Count:3989
3989-11167
366 QImage image(d->width, d->height, d->format); -
367 if (image.isNull())
partially evaluated: image.isNull()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:11167
0-11167
368 return image;
never executed: return image;
0
369 -
370 -
371 -
372 if (image.d->nbytes != d->nbytes) {
evaluated: image.d->nbytes != d->nbytes
TRUEFALSE
yes
Evaluation Count:9603
yes
Evaluation Count:1564
1564-9603
373 int bpl = qMin(bytesPerLine(), image.bytesPerLine()); -
374 for (int i = 0; i < height(); i++)
evaluated: i < height()
TRUEFALSE
yes
Evaluation Count:77900
yes
Evaluation Count:9603
9603-77900
375 memcpy(image.scanLine(i), scanLine(i), bpl);
executed: memcpy(image.scanLine(i), scanLine(i), bpl);
Execution Count:77900
77900
376 } else
executed: }
Execution Count:9603
9603
377 memcpy(image.bits(), bits(), d->nbytes);
executed: memcpy(image.bits(), bits(), d->nbytes);
Execution Count:1564
1564
378 image.d->colortable = d->colortable; -
379 image.d->dpmx = d->dpmx; -
380 image.d->dpmy = d->dpmy; -
381 image.d->offset = d->offset; -
382 image.d->has_alpha_clut = d->has_alpha_clut; -
383 image.d->text = d->text; -
384 return image;
executed: return image;
Execution Count:11167
11167
385 } -
386 -
387 int x = r.x(); -
388 int y = r.y(); -
389 int w = r.width(); -
390 int h = r.height(); -
391 -
392 int dx = 0; -
393 int dy = 0; -
394 if (w <= 0 || h <= 0)
partially evaluated: w <= 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:3989
partially evaluated: h <= 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:3989
0-3989
395 return QImage();
never executed: return QImage();
0
396 -
397 QImage image(w, h, d->format); -
398 if (image.isNull())
partially evaluated: image.isNull()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:3989
0-3989
399 return image;
never executed: return image;
0
400 -
401 if (x < 0 || y < 0 || x + w > d->width || y + h > d->height) {
partially evaluated: x < 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:3989
partially evaluated: y < 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:3989
evaluated: x + w > d->width
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:3986
evaluated: y + h > d->height
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:3984
0-3989
402 -
403 image.fill(0); -
404 if (x < 0) {
partially evaluated: x < 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:5
0-5
405 dx = -x; -
406 x = 0; -
407 }
never executed: }
0
408 if (y < 0) {
partially evaluated: y < 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:5
0-5
409 dy = -y; -
410 y = 0; -
411 }
never executed: }
0
412 }
executed: }
Execution Count:5
5
413 -
414 image.d->colortable = d->colortable; -
415 -
416 int pixels_to_copy = qMax(w - dx, 0); -
417 if (x > d->width)
evaluated: x > d->width
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:3988
1-3988
418 pixels_to_copy = 0;
executed: pixels_to_copy = 0;
Execution Count:1
1
419 else if (pixels_to_copy > d->width - x)
evaluated: pixels_to_copy > d->width - x
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:3986
2-3986
420 pixels_to_copy = d->width - x;
executed: pixels_to_copy = d->width - x;
Execution Count:2
2
421 int lines_to_copy = qMax(h - dy, 0); -
422 if (y > d->height)
partially evaluated: y > d->height
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:3989
0-3989
423 lines_to_copy = 0;
never executed: lines_to_copy = 0;
0
424 else if (lines_to_copy > d->height - y)
evaluated: lines_to_copy > d->height - y
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:3985
4-3985
425 lines_to_copy = d->height - y;
executed: lines_to_copy = d->height - y;
Execution Count:4
4
426 -
427 bool byteAligned = true; -
428 if (d->format == Format_Mono || d->format == Format_MonoLSB)
partially evaluated: d->format == Format_Mono
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:3989
evaluated: d->format == Format_MonoLSB
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:3986
0-3989
429 byteAligned = !(dx & 7) && !(x & 7) && !(pixels_to_copy & 7);
partially evaluated: !(dx & 7)
TRUEFALSE
yes
Evaluation Count:3
no
Evaluation Count:0
partially evaluated: !(x & 7)
TRUEFALSE
yes
Evaluation Count:3
no
Evaluation Count:0
partially evaluated: !(pixels_to_copy & 7)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:3
executed: byteAligned = !(dx & 7) && !(x & 7) && !(pixels_to_copy & 7);
Execution Count:3
0-3
430 -
431 if (byteAligned) {
evaluated: byteAligned
TRUEFALSE
yes
Evaluation Count:3986
yes
Evaluation Count:3
3-3986
432 const uchar *src = d->data + ((x * d->depth) >> 3) + y * d->bytes_per_line; -
433 uchar *dest = image.d->data + ((dx * d->depth) >> 3) + dy * image.d->bytes_per_line; -
434 const int bytes_to_copy = (pixels_to_copy * d->depth) >> 3; -
435 for (int i = 0; i < lines_to_copy; ++i) {
evaluated: i < lines_to_copy
TRUEFALSE
yes
Evaluation Count:6904
yes
Evaluation Count:3986
3986-6904
436 memcpy(dest, src, bytes_to_copy); -
437 src += d->bytes_per_line; -
438 dest += image.d->bytes_per_line; -
439 }
executed: }
Execution Count:6904
6904
440 } else if (d->format == Format_Mono) {
executed: }
Execution Count:3986
partially evaluated: d->format == Format_Mono
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:3
0-3986
441 const uchar *src = d->data + y * d->bytes_per_line; -
442 uchar *dest = image.d->data + dy * image.d->bytes_per_line; -
443 for (int i = 0; i < lines_to_copy; ++i) {
never evaluated: i < lines_to_copy
0
444 for (int j = 0; j < pixels_to_copy; ++j) {
never evaluated: j < pixels_to_copy
0
445 if (src[(x + j) >> 3] & (0x80 >> ((x + j) & 7)))
never evaluated: src[(x + j) >> 3] & (0x80 >> ((x + j) & 7))
0
446 dest[(dx + j) >> 3] |= (0x80 >> ((dx + j) & 7));
never executed: dest[(dx + j) >> 3] |= (0x80 >> ((dx + j) & 7));
0
447 else -
448 dest[(dx + j) >> 3] &= ~(0x80 >> ((dx + j) & 7));
never executed: dest[(dx + j) >> 3] &= ~(0x80 >> ((dx + j) & 7));
0
449 } -
450 src += d->bytes_per_line; -
451 dest += image.d->bytes_per_line; -
452 }
never executed: }
0
453 } else {
never executed: }
0
454 qt_noop(); -
455 const uchar *src = d->data + y * d->bytes_per_line; -
456 uchar *dest = image.d->data + dy * image.d->bytes_per_line; -
457 for (int i = 0; i < lines_to_copy; ++i) {
evaluated: i < lines_to_copy
TRUEFALSE
yes
Evaluation Count:110
yes
Evaluation Count:3
3-110
458 for (int j = 0; j < pixels_to_copy; ++j) {
evaluated: j < pixels_to_copy
TRUEFALSE
yes
Evaluation Count:5100
yes
Evaluation Count:110
110-5100
459 if (src[(x + j) >> 3] & (0x1 << ((x + j) & 7)))
evaluated: src[(x + j) >> 3] & (0x1 << ((x + j) & 7))
TRUEFALSE
yes
Evaluation Count:4222
yes
Evaluation Count:878
878-4222
460 dest[(dx + j) >> 3] |= (0x1 << ((dx + j) & 7));
executed: dest[(dx + j) >> 3] |= (0x1 << ((dx + j) & 7));
Execution Count:4222
4222
461 else -
462 dest[(dx + j) >> 3] &= ~(0x1 << ((dx + j) & 7));
executed: dest[(dx + j) >> 3] &= ~(0x1 << ((dx + j) & 7));
Execution Count:878
878
463 } -
464 src += d->bytes_per_line; -
465 dest += image.d->bytes_per_line; -
466 }
executed: }
Execution Count:110
110
467 }
executed: }
Execution Count:3
3
468 -
469 image.d->dpmx = dotsPerMeterX(); -
470 image.d->dpmy = dotsPerMeterY(); -
471 image.d->devicePixelRatio = devicePixelRatio(); -
472 image.d->offset = offset(); -
473 image.d->has_alpha_clut = d->has_alpha_clut; -
474 image.d->text = d->text; -
475 return image;
executed: return image;
Execution Count:3989
3989
476} -
477bool QImage::isNull() const -
478{ -
479 return !d;
executed: return !d;
Execution Count:211210
211210
480} -
481int QImage::width() const -
482{ -
483 return d ? d->width : 0;
executed: return d ? d->width : 0;
Execution Count:23073868
23073868
484} -
485int QImage::height() const -
486{ -
487 return d ? d->height : 0;
executed: return d ? d->height : 0;
Execution Count:33833904
33833904
488} -
489QSize QImage::size() const -
490{ -
491 return d ? QSize(d->width, d->height) : QSize(0, 0);
executed: return d ? QSize(d->width, d->height) : QSize(0, 0);
Execution Count:30289
30289
492} -
493QRect QImage::rect() const -
494{ -
495 return d ? QRect(0, 0, d->width, d->height) : QRect();
executed: return d ? QRect(0, 0, d->width, d->height) : QRect();
Execution Count:18229
18229
496} -
497int QImage::depth() const -
498{ -
499 return d ? d->depth : 0;
executed: return d ? d->depth : 0;
Execution Count:248231
248231
500} -
501int QImage::colorCount() const -
502{ -
503 return d ? d->colortable.size() : 0;
executed: return d ? d->colortable.size() : 0;
Execution Count:4863
4863
504} -
505void QImage::setColorTable(const QVector<QRgb> colors) -
506{ -
507 if (!d)
partially evaluated: !d
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:24
0-24
508 return;
never executed: return;
0
509 detach(); -
510 -
511 -
512 if (!d)
partially evaluated: !d
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:24
0-24
513 return;
never executed: return;
0
514 -
515 d->colortable = colors; -
516 d->has_alpha_clut = false; -
517 for (int i = 0; i < d->colortable.size(); ++i) {
evaluated: i < d->colortable.size()
TRUEFALSE
yes
Evaluation Count:2855
yes
Evaluation Count:14
14-2855
518 if (qAlpha(d->colortable.at(i)) != 255) {
evaluated: qAlpha(d->colortable.at(i)) != 255
TRUEFALSE
yes
Evaluation Count:10
yes
Evaluation Count:2845
10-2845
519 d->has_alpha_clut = true; -
520 break;
executed: break;
Execution Count:10
10
521 } -
522 }
executed: }
Execution Count:2845
2845
523}
executed: }
Execution Count:24
24
524 -
525 -
526 -
527 -
528 -
529 -
530 -
531QVector<QRgb> QImage::colorTable() const -
532{ -
533 return d ? d->colortable : QVector<QRgb>();
executed: return d ? d->colortable : QVector<QRgb>();
Execution Count:524
524
534} -
535qreal QImage::devicePixelRatio() const -
536{ -
537 if (!d)
partially evaluated: !d
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:31838
0-31838
538 return 1.0;
never executed: return 1.0;
0
539 return d->devicePixelRatio;
executed: return d->devicePixelRatio;
Execution Count:31838
31838
540} -
541void QImage::setDevicePixelRatio(qreal scaleFactor) -
542{ -
543 if (!d)
partially evaluated: !d
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:9323
0-9323
544 return;
never executed: return;
0
545 detach(); -
546 d->devicePixelRatio = scaleFactor; -
547}
executed: }
Execution Count:9323
9323
548int QImage::byteCount() const -
549{ -
550 return d ? d->nbytes : 0;
executed: return d ? d->nbytes : 0;
Execution Count:201
201
551} -
552int QImage::bytesPerLine() const -
553{ -
554 return (d && d->height) ? d->nbytes / d->height : 0;
executed: return (d && d->height) ? d->nbytes / d->height : 0;
Execution Count:177604
177604
555} -
556QRgb QImage::color(int i) const -
557{ -
558 qt_noop(); -
559 return d ? d->colortable.at(i) : QRgb(uint(-1));
executed: return d ? d->colortable.at(i) : QRgb(uint(-1));
Execution Count:788
788
560} -
561void QImage::setColor(int i, QRgb c) -
562{ -
563 if (!d)
evaluated: !d
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:85574
1-85574
564 return;
executed: return;
Execution Count:1
1
565 if (i < 0 || d->depth > 8 || i >= 1<<d->depth) {
partially evaluated: i < 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:85574
partially evaluated: d->depth > 8
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:85574
partially evaluated: i >= 1<<d->depth
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:85574
0-85574
566 QMessageLogger("image/qimage.cpp", 1478, __PRETTY_FUNCTION__).warning("QImage::setColor: Index out of bound %d", i); -
567 return;
never executed: return;
0
568 } -
569 detach(); -
570 -
571 -
572 if (!d)
partially evaluated: !d
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:85574
0-85574
573 return;
never executed: return;
0
574 -
575 if (i >= d->colortable.size())
evaluated: i >= d->colortable.size()
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:85573
1-85573
576 setColorCount(i+1);
executed: setColorCount(i+1);
Execution Count:1
1
577 d->colortable[i] = c; -
578 d->has_alpha_clut |= (qAlpha(c) != 255); -
579}
executed: }
Execution Count:85574
85574
580uchar *QImage::scanLine(int i) -
581{ -
582 if (!d)
partially evaluated: !d
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:4070292
0-4070292
583 return 0;
never executed: return 0;
0
584 -
585 detach(); -
586 -
587 -
588 if (!d)
partially evaluated: !d
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:4070292
0-4070292
589 return 0;
never executed: return 0;
0
590 -
591 return d->data + i * d->bytes_per_line;
executed: return d->data + i * d->bytes_per_line;
Execution Count:4070292
4070292
592} -
593 -
594 -
595 -
596 -
597const uchar *QImage::scanLine(int i) const -
598{ -
599 if (!d)
partially evaluated: !d
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:12307698
0-12307698
600 return 0;
never executed: return 0;
0
601 -
602 qt_noop(); -
603 return d->data + i * d->bytes_per_line;
executed: return d->data + i * d->bytes_per_line;
Execution Count:12307698
12307698
604} -
605const uchar *QImage::constScanLine(int i) const -
606{ -
607 if (!d)
partially evaluated: !d
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:15916470
0-15916470
608 return 0;
never executed: return 0;
0
609 -
610 qt_noop(); -
611 return d->data + i * d->bytes_per_line;
executed: return d->data + i * d->bytes_per_line;
Execution Count:15916470
15916470
612} -
613uchar *QImage::bits() -
614{ -
615 if (!d)
evaluated: !d
TRUEFALSE
yes
Evaluation Count:190
yes
Evaluation Count:143445
190-143445
616 return 0;
executed: return 0;
Execution Count:190
190
617 detach(); -
618 -
619 -
620 if (!d)
partially evaluated: !d
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:143445
0-143445
621 return 0;
never executed: return 0;
0
622 -
623 return d->data;
executed: return d->data;
Execution Count:143445
143445
624} -
625const uchar *QImage::bits() const -
626{ -
627 return d ? d->data : 0;
executed: return d ? d->data : 0;
Execution Count:16422
16422
628} -
629const uchar *QImage::constBits() const -
630{ -
631 return d ? d->data : 0;
executed: return d ? d->data : 0;
Execution Count:26
26
632} -
633void QImage::fill(uint pixel) -
634{ -
635 if (!d)
partially evaluated: !d
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:5358
0-5358
636 return;
never executed: return;
0
637 -
638 detach(); -
639 -
640 -
641 if (!d)
partially evaluated: !d
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:5358
0-5358
642 return;
never executed: return;
0
643 -
644 if (d->depth == 1 || d->depth == 8) {
evaluated: d->depth == 1
TRUEFALSE
yes
Evaluation Count:174
yes
Evaluation Count:5184
evaluated: d->depth == 8
TRUEFALSE
yes
Evaluation Count:33
yes
Evaluation Count:5151
33-5184
645 int w = d->width; -
646 if (d->depth == 1) {
evaluated: d->depth == 1
TRUEFALSE
yes
Evaluation Count:174
yes
Evaluation Count:33
33-174
647 if (pixel & 1)
evaluated: pixel & 1
TRUEFALSE
yes
Evaluation Count:13
yes
Evaluation Count:161
13-161
648 pixel = 0xffffffff;
executed: pixel = 0xffffffff;
Execution Count:13
13
649 else -
650 pixel = 0;
executed: pixel = 0;
Execution Count:161
161
651 w = (w + 7) / 8; -
652 } else {
executed: }
Execution Count:174
174
653 pixel &= 0xff; -
654 }
executed: }
Execution Count:33
33
655 qt_rectfill<quint8>(d->data, pixel, 0, 0, -
656 w, d->height, d->bytes_per_line); -
657 return;
executed: return;
Execution Count:207
207
658 } else if (d->depth == 16) {
evaluated: d->depth == 16
TRUEFALSE
yes
Evaluation Count:38
yes
Evaluation Count:5113
38-5113
659 qt_rectfill<quint16>(reinterpret_cast<quint16*>(d->data), pixel, -
660 0, 0, d->width, d->height, d->bytes_per_line); -
661 return;
executed: return;
Execution Count:38
38
662 } else if (d->depth == 24) {
evaluated: d->depth == 24
TRUEFALSE
yes
Evaluation Count:61
yes
Evaluation Count:5052
61-5052
663 qt_rectfill<quint24>(reinterpret_cast<quint24*>(d->data), pixel, -
664 0, 0, d->width, d->height, d->bytes_per_line); -
665 return;
executed: return;
Execution Count:61
61
666 } -
667 -
668 if (d->format == Format_RGB32)
evaluated: d->format == Format_RGB32
TRUEFALSE
yes
Evaluation Count:2126
yes
Evaluation Count:2926
2126-2926
669 pixel |= 0xff000000;
executed: pixel |= 0xff000000;
Execution Count:2126
2126
670 -
671 qt_rectfill<uint>(reinterpret_cast<uint*>(d->data), pixel, -
672 0, 0, d->width, d->height, d->bytes_per_line); -
673}
executed: }
Execution Count:5052
5052
674void QImage::fill(Qt::GlobalColor color) -
675{ -
676 fill(QColor(color)); -
677}
executed: }
Execution Count:83
83
678void QImage::fill(const QColor &color) -
679{ -
680 if (!d)
partially evaluated: !d
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:175
0-175
681 return;
never executed: return;
0
682 detach(); -
683 -
684 -
685 if (!d)
partially evaluated: !d
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:175
0-175
686 return;
never executed: return;
0
687 -
688 if (d->depth == 32) {
evaluated: d->depth == 32
TRUEFALSE
yes
Evaluation Count:46
yes
Evaluation Count:129
46-129
689 uint pixel = color.rgba(); -
690 if (d->format == QImage::Format_ARGB32_Premultiplied)
evaluated: d->format == QImage::Format_ARGB32_Premultiplied
TRUEFALSE
yes
Evaluation Count:16
yes
Evaluation Count:30
16-30
691 pixel = PREMUL(pixel);
executed: pixel = PREMUL(pixel);
Execution Count:16
16
692 fill((uint) pixel); -
693 -
694 } else if (d->format == QImage::Format_RGB16) {
executed: }
Execution Count:46
evaluated: d->format == QImage::Format_RGB16
TRUEFALSE
yes
Evaluation Count:12
yes
Evaluation Count:117
12-117
695 fill((uint) qConvertRgb32To16(color.rgba())); -
696 -
697 } else if (d->depth == 1) {
executed: }
Execution Count:12
evaluated: d->depth == 1
TRUEFALSE
yes
Evaluation Count:10
yes
Evaluation Count:107
10-107
698 if (color == Qt::color1)
evaluated: color == Qt::color1
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:6
4-6
699 fill((uint) 1);
executed: fill((uint) 1);
Execution Count:4
4
700 else -
701 fill((uint) 0);
executed: fill((uint) 0);
Execution Count:6
6
702 -
703 } else if (d->depth == 8) {
evaluated: d->depth == 8
TRUEFALSE
yes
Evaluation Count:10
yes
Evaluation Count:97
10-97
704 uint pixel = 0; -
705 for (int i=0; i<d->colortable.size(); ++i) {
partially evaluated: i<d->colortable.size()
TRUEFALSE
yes
Evaluation Count:30
no
Evaluation Count:0
0-30
706 if (color.rgba() == d->colortable.at(i)) {
evaluated: color.rgba() == d->colortable.at(i)
TRUEFALSE
yes
Evaluation Count:10
yes
Evaluation Count:20
10-20
707 pixel = i; -
708 break;
executed: break;
Execution Count:10
10
709 } -
710 }
executed: }
Execution Count:20
20
711 fill(pixel); -
712 -
713 } else {
executed: }
Execution Count:10
10
714 QPainter p(this); -
715 p.setCompositionMode(QPainter::CompositionMode_Source); -
716 p.fillRect(rect(), color); -
717 }
executed: }
Execution Count:97
97
718 -
719} -
720void QImage::invertPixels(InvertMode mode) -
721{ -
722 if (!d)
partially evaluated: !d
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:4
0-4
723 return;
never executed: return;
0
724 -
725 detach(); -
726 -
727 -
728 if (!d)
partially evaluated: !d
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:4
0-4
729 return;
never executed: return;
0
730 -
731 if (depth() != 32) {
evaluated: depth() != 32
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:1
1-3
732 -
733 int bpl = (d->width * d->depth + 7) / 8; -
734 int pad = d->bytes_per_line - bpl; -
735 uchar *sl = d->data; -
736 for (int y=0; y<d->height; ++y) {
evaluated: y<d->height
TRUEFALSE
yes
Evaluation Count:9
yes
Evaluation Count:3
3-9
737 for (int x=0; x<bpl; ++x)
evaluated: x<bpl
TRUEFALSE
yes
Evaluation Count:9
yes
Evaluation Count:9
9
738 *sl++ ^= 0xff;
executed: *sl++ ^= 0xff;
Execution Count:9
9
739 sl += pad; -
740 }
executed: }
Execution Count:9
9
741 } else {
executed: }
Execution Count:3
3
742 quint32 *p = (quint32*)d->data; -
743 quint32 *end = (quint32*)(d->data + d->nbytes); -
744 uint xorbits = (mode == InvertRgba) ? 0xffffffff : 0x00ffffff;
partially evaluated: (mode == InvertRgba)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1
0-1
745 while (p < end)
evaluated: p < end
TRUEFALSE
yes
Evaluation Count:10000
yes
Evaluation Count:1
1-10000
746 *p++ ^= xorbits;
executed: *p++ ^= xorbits;
Execution Count:10000
10000
747 }
executed: }
Execution Count:1
1
748} -
749void QImage::setColorCount(int colorCount) -
750{ -
751 if (!d) {
evaluated: !d
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:2782
2-2782
752 QMessageLogger("image/qimage.cpp", 1829, __PRETTY_FUNCTION__).warning("QImage::setColorCount: null image"); -
753 return;
executed: return;
Execution Count:2
2
754 } -
755 -
756 detach(); -
757 -
758 -
759 if (!d)
partially evaluated: !d
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2782
0-2782
760 return;
never executed: return;
0
761 -
762 if (colorCount == d->colortable.size())
evaluated: colorCount == d->colortable.size()
TRUEFALSE
yes
Evaluation Count:204
yes
Evaluation Count:2578
204-2578
763 return;
executed: return;
Execution Count:204
204
764 if (colorCount <= 0) {
partially evaluated: colorCount <= 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2578
0-2578
765 d->colortable = QVector<QRgb>(); -
766 return;
never executed: return;
0
767 } -
768 int nc = d->colortable.size(); -
769 d->colortable.resize(colorCount); -
770 for (int i = nc; i < colorCount; ++i)
evaluated: i < colorCount
TRUEFALSE
yes
Evaluation Count:90676
yes
Evaluation Count:2578
2578-90676
771 d->colortable[i] = 0;
executed: d->colortable[i] = 0;
Execution Count:90676
90676
772}
executed: }
Execution Count:2578
2578
773 -
774 -
775 -
776 -
777 -
778 -
779QImage::Format QImage::format() const -
780{ -
781 return d ? d->format : Format_Invalid;
executed: return d ? d->format : Format_Invalid;
Execution Count:78494
78494
782} -
783 -
784 -
785 -
786 -
787 -
788 -
789 -
790typedef void (*Image_Converter)(QImageData *dest, const QImageData *src, Qt::ImageConversionFlags); -
791 -
792typedef bool (*InPlace_Image_Converter)(QImageData *data, Qt::ImageConversionFlags); -
793 -
794static void convert_ARGB_to_ARGB_PM(QImageData *dest, const QImageData *src, Qt::ImageConversionFlags) -
795{ -
796 qt_noop(); -
797 qt_noop(); -
798 qt_noop(); -
799 qt_noop(); -
800 -
801 const int src_pad = (src->bytes_per_line >> 2) - src->width; -
802 const int dest_pad = (dest->bytes_per_line >> 2) - dest->width; -
803 const QRgb *src_data = (QRgb *) src->data; -
804 QRgb *dest_data = (QRgb *) dest->data; -
805 -
806 for (int i = 0; i < src->height; ++i) {
evaluated: i < src->height
TRUEFALSE
yes
Evaluation Count:208698
yes
Evaluation Count:210
210-208698
807 const QRgb *end = src_data + src->width; -
808 while (src_data < end) {
evaluated: src_data < end
TRUEFALSE
yes
Evaluation Count:2616069
yes
Evaluation Count:208698
208698-2616069
809 *dest_data = PREMUL(*src_data); -
810 ++src_data; -
811 ++dest_data; -
812 }
executed: }
Execution Count:2616069
2616069
813 src_data += src_pad; -
814 dest_data += dest_pad; -
815 }
executed: }
Execution Count:208698
208698
816}
executed: }
Execution Count:210
210
817 -
818static bool convert_ARGB_to_ARGB_PM_inplace(QImageData *data, Qt::ImageConversionFlags) -
819{ -
820 qt_noop(); -
821 -
822 const int pad = (data->bytes_per_line >> 2) - data->width; -
823 QRgb *rgb_data = (QRgb *) data->data; -
824 -
825 for (int i = 0; i < data->height; ++i) {
never evaluated: i < data->height
0
826 const QRgb *end = rgb_data + data->width; -
827 while (rgb_data < end) {
never evaluated: rgb_data < end
0
828 *rgb_data = PREMUL(*rgb_data); -
829 ++rgb_data; -
830 }
never executed: }
0
831 rgb_data += pad; -
832 }
never executed: }
0
833 data->format = QImage::Format_ARGB32_Premultiplied; -
834 return true;
never executed: return true;
0
835} -
836 -
837static bool convert_indexed8_to_ARGB_PM_inplace(QImageData *data, Qt::ImageConversionFlags) -
838{ -
839 qt_noop(); -
840 const int depth = 32; -
841 -
842 const int dst_bytes_per_line = ((data->width * depth + 31) >> 5) << 2; -
843 const int nbytes = dst_bytes_per_line * data->height; -
844 uchar *const newData = (uchar *)realloc(data->data, nbytes); -
845 if (!newData)
partially evaluated: !newData
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2
0-2
846 return false;
never executed: return false;
0
847 -
848 data->data = newData; -
849 -
850 -
851 uchar *src_data = newData + data->nbytes; -
852 quint32 *dest_data = (quint32 *) (newData + nbytes); -
853 const int width = data->width; -
854 const int src_pad = data->bytes_per_line - width; -
855 const int dest_pad = (dst_bytes_per_line >> 2) - width; -
856 if (data->colortable.size() == 0) {
partially evaluated: data->colortable.size() == 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2
0-2
857 data->colortable.resize(256); -
858 for (int i = 0; i < 256; ++i)
never evaluated: i < 256
0
859 data->colortable[i] = qRgb(i, i, i);
never executed: data->colortable[i] = qRgb(i, i, i);
0
860 } else {
never executed: }
0
861 for (int i = 0; i < data->colortable.size(); ++i)
evaluated: i < data->colortable.size()
TRUEFALSE
yes
Evaluation Count:66
yes
Evaluation Count:2
2-66
862 data->colortable[i] = PREMUL(data->colortable.at(i));
executed: data->colortable[i] = PREMUL(data->colortable.at(i));
Execution Count:66
66
863 -
864 -
865 const int oldSize = data->colortable.size(); -
866 const QRgb lastColor = data->colortable.at(oldSize - 1); -
867 data->colortable.insert(oldSize, 256 - oldSize, lastColor); -
868 }
executed: }
Execution Count:2
2
869 -
870 for (int i = 0; i < data->height; ++i) {
evaluated: i < data->height
TRUEFALSE
yes
Evaluation Count:256
yes
Evaluation Count:2
2-256
871 src_data -= src_pad; -
872 dest_data -= dest_pad; -
873 for (int pixI = 0; pixI < width; ++pixI) {
evaluated: pixI < width
TRUEFALSE
yes
Evaluation Count:32768
yes
Evaluation Count:256
256-32768
874 --src_data; -
875 --dest_data; -
876 *dest_data = data->colortable.at(*src_data); -
877 }
executed: }
Execution Count:32768
32768
878 }
executed: }
Execution Count:256
256
879 -
880 data->colortable = QVector<QRgb>(); -
881 data->format = QImage::Format_ARGB32_Premultiplied; -
882 data->bytes_per_line = dst_bytes_per_line; -
883 data->depth = depth; -
884 data->nbytes = nbytes; -
885 -
886 return true;
executed: return true;
Execution Count:2
2
887} -
888 -
889static bool convert_indexed8_to_RGB_inplace(QImageData *data, Qt::ImageConversionFlags) -
890{ -
891 qt_noop(); -
892 const int depth = 32; -
893 -
894 const int dst_bytes_per_line = ((data->width * depth + 31) >> 5) << 2; -
895 const int nbytes = dst_bytes_per_line * data->height; -
896 uchar *const newData = (uchar *)realloc(data->data, nbytes); -
897 if (!newData)
never evaluated: !newData
0
898 return false;
never executed: return false;
0
899 -
900 data->data = newData; -
901 -
902 -
903 uchar *src_data = newData + data->nbytes; -
904 quint32 *dest_data = (quint32 *) (newData + nbytes); -
905 const int width = data->width; -
906 const int src_pad = data->bytes_per_line - width; -
907 const int dest_pad = (dst_bytes_per_line >> 2) - width; -
908 if (data->colortable.size() == 0) {
never evaluated: data->colortable.size() == 0
0
909 data->colortable.resize(256); -
910 for (int i = 0; i < 256; ++i)
never evaluated: i < 256
0
911 data->colortable[i] = qRgb(i, i, i);
never executed: data->colortable[i] = qRgb(i, i, i);
0
912 } else {
never executed: }
0
913 -
914 const int oldSize = data->colortable.size(); -
915 const QRgb lastColor = data->colortable.at(oldSize - 1); -
916 data->colortable.insert(oldSize, 256 - oldSize, lastColor); -
917 }
never executed: }
0
918 -
919 for (int i = 0; i < data->height; ++i) {
never evaluated: i < data->height
0
920 src_data -= src_pad; -
921 dest_data -= dest_pad; -
922 for (int pixI = 0; pixI < width; ++pixI) {
never evaluated: pixI < width
0
923 --src_data; -
924 --dest_data; -
925 *dest_data = (quint32) data->colortable.at(*src_data); -
926 }
never executed: }
0
927 }
never executed: }
0
928 -
929 data->colortable = QVector<QRgb>(); -
930 data->format = QImage::Format_RGB32; -
931 data->bytes_per_line = dst_bytes_per_line; -
932 data->depth = depth; -
933 data->nbytes = nbytes; -
934 -
935 return true;
never executed: return true;
0
936} -
937 -
938static bool convert_indexed8_to_RGB16_inplace(QImageData *data, Qt::ImageConversionFlags) -
939{ -
940 qt_noop(); -
941 const int depth = 16; -
942 -
943 const int dst_bytes_per_line = ((data->width * depth + 31) >> 5) << 2; -
944 const int nbytes = dst_bytes_per_line * data->height; -
945 uchar *const newData = (uchar *)realloc(data->data, nbytes); -
946 if (!newData)
never evaluated: !newData
0
947 return false;
never executed: return false;
0
948 -
949 data->data = newData; -
950 -
951 -
952 uchar *src_data = newData + data->nbytes; -
953 quint16 *dest_data = (quint16 *) (newData + nbytes); -
954 const int width = data->width; -
955 const int src_pad = data->bytes_per_line - width; -
956 const int dest_pad = (dst_bytes_per_line >> 1) - width; -
957 -
958 quint16 colorTableRGB16[256]; -
959 if (data->colortable.isEmpty()) {
never evaluated: data->colortable.isEmpty()
0
960 for (int i = 0; i < 256; ++i)
never evaluated: i < 256
0
961 colorTableRGB16[i] = qConvertRgb32To16(qRgb(i, i, i));
never executed: colorTableRGB16[i] = qConvertRgb32To16(qRgb(i, i, i));
0
962 } else {
never executed: }
0
963 -
964 const int tableSize = data->colortable.size(); -
965 for (int i = 0; i < tableSize; ++i)
never evaluated: i < tableSize
0
966 colorTableRGB16[i] = qConvertRgb32To16(data->colortable.at(i));
never executed: colorTableRGB16[i] = qConvertRgb32To16(data->colortable.at(i));
0
967 data->colortable = QVector<QRgb>(); -
968 -
969 -
970 const quint16 lastColor = colorTableRGB16[tableSize - 1]; -
971 for (int i = tableSize; i < 256; ++i)
never evaluated: i < 256
0
972 colorTableRGB16[i] = lastColor;
never executed: colorTableRGB16[i] = lastColor;
0
973 }
never executed: }
0
974 -
975 for (int i = 0; i < data->height; ++i) {
never evaluated: i < data->height
0
976 src_data -= src_pad; -
977 dest_data -= dest_pad; -
978 for (int pixI = 0; pixI < width; ++pixI) {
never evaluated: pixI < width
0
979 --src_data; -
980 --dest_data; -
981 *dest_data = colorTableRGB16[*src_data]; -
982 }
never executed: }
0
983 }
never executed: }
0
984 -
985 data->format = QImage::Format_RGB16; -
986 data->bytes_per_line = dst_bytes_per_line; -
987 data->depth = depth; -
988 data->nbytes = nbytes; -
989 -
990 return true;
never executed: return true;
0
991} -
992 -
993static bool convert_RGB_to_RGB16_inplace(QImageData *data, Qt::ImageConversionFlags) -
994{ -
995 qt_noop(); -
996 const int depth = 16; -
997 -
998 const int dst_bytes_per_line = ((data->width * depth + 31) >> 5) << 2; -
999 const int src_bytes_per_line = data->bytes_per_line; -
1000 quint32 *src_data = (quint32 *) data->data; -
1001 quint16 *dst_data = (quint16 *) data->data; -
1002 -
1003 for (int i = 0; i < data->height; ++i) {
never evaluated: i < data->height
0
1004 for (int j = 0; j < data->width; ++j)
never evaluated: j < data->width
0
1005 dst_data[j] = qConvertRgb32To16(src_data[j]);
never executed: dst_data[j] = qConvertRgb32To16(src_data[j]);
0
1006 src_data = (quint32 *) (((char*)src_data) + src_bytes_per_line); -
1007 dst_data = (quint16 *) (((char*)dst_data) + dst_bytes_per_line); -
1008 }
never executed: }
0
1009 data->format = QImage::Format_RGB16; -
1010 data->bytes_per_line = dst_bytes_per_line; -
1011 data->depth = depth; -
1012 data->nbytes = dst_bytes_per_line * data->height; -
1013 uchar *const newData = (uchar *)realloc(data->data, data->nbytes); -
1014 if (newData) {
never evaluated: newData
0
1015 data->data = newData; -
1016 return true;
never executed: return true;
0
1017 } else { -
1018 return false;
never executed: return false;
0
1019 } -
1020} -
1021 -
1022static void convert_ARGB_PM_to_ARGB(QImageData *dest, const QImageData *src, Qt::ImageConversionFlags) -
1023{ -
1024 qt_noop(); -
1025 qt_noop(); -
1026 qt_noop(); -
1027 qt_noop(); -
1028 -
1029 const int src_pad = (src->bytes_per_line >> 2) - src->width; -
1030 const int dest_pad = (dest->bytes_per_line >> 2) - dest->width; -
1031 const QRgb *src_data = (QRgb *) src->data; -
1032 QRgb *dest_data = (QRgb *) dest->data; -
1033 -
1034 for (int i = 0; i < src->height; ++i) {
evaluated: i < src->height
TRUEFALSE
yes
Evaluation Count:11544
yes
Evaluation Count:2262
2262-11544
1035 const QRgb *end = src_data + src->width; -
1036 while (src_data < end) {
evaluated: src_data < end
TRUEFALSE
yes
Evaluation Count:2089530
yes
Evaluation Count:11544
11544-2089530
1037 *dest_data = (qAlpha(*src_data) == 0 ? 0 : ((qAlpha(*src_data) << 24) | (((255*qRed(*src_data))/ qAlpha(*src_data)) << 16) | (((255*qGreen(*src_data)) / qAlpha(*src_data)) << 8) | ((255*qBlue(*src_data)) / qAlpha(*src_data))));
evaluated: qAlpha(*src_data) == 0
TRUEFALSE
yes
Evaluation Count:207109
yes
Evaluation Count:1882421
207109-1882421
1038 ++src_data; -
1039 ++dest_data; -
1040 }
executed: }
Execution Count:2089530
2089530
1041 src_data += src_pad; -
1042 dest_data += dest_pad; -
1043 }
executed: }
Execution Count:11544
11544
1044}
executed: }
Execution Count:2262
2262
1045 -
1046static void convert_ARGB_PM_to_RGB(QImageData *dest, const QImageData *src, Qt::ImageConversionFlags) -
1047{ -
1048 qt_noop(); -
1049 qt_noop(); -
1050 qt_noop(); -
1051 qt_noop(); -
1052 -
1053 const int src_pad = (src->bytes_per_line >> 2) - src->width; -
1054 const int dest_pad = (dest->bytes_per_line >> 2) - dest->width; -
1055 const QRgb *src_data = (QRgb *) src->data; -
1056 QRgb *dest_data = (QRgb *) dest->data; -
1057 -
1058 for (int i = 0; i < src->height; ++i) {
evaluated: i < src->height
TRUEFALSE
yes
Evaluation Count:915
yes
Evaluation Count:21
21-915
1059 const QRgb *end = src_data + src->width; -
1060 while (src_data < end) {
evaluated: src_data < end
TRUEFALSE
yes
Evaluation Count:56690
yes
Evaluation Count:915
915-56690
1061 *dest_data = 0xff000000 | (qAlpha(*src_data) == 0 ? 0 : ((qAlpha(*src_data) << 24) | (((255*qRed(*src_data))/ qAlpha(*src_data)) << 16) | (((255*qGreen(*src_data)) / qAlpha(*src_data)) << 8) | ((255*qBlue(*src_data)) / qAlpha(*src_data)))); -
1062 ++src_data; -
1063 ++dest_data; -
1064 }
executed: }
Execution Count:56690
56690
1065 src_data += src_pad; -
1066 dest_data += dest_pad; -
1067 }
executed: }
Execution Count:915
915
1068}
executed: }
Execution Count:21
21
1069 -
1070static void swap_bit_order(QImageData *dest, const QImageData *src, Qt::ImageConversionFlags) -
1071{ -
1072 qt_noop(); -
1073 qt_noop(); -
1074 qt_noop(); -
1075 qt_noop(); -
1076 qt_noop(); -
1077 qt_noop(); -
1078 -
1079 dest->colortable = src->colortable; -
1080 -
1081 const uchar *src_data = src->data; -
1082 const uchar *end = src->data + src->nbytes; -
1083 uchar *dest_data = dest->data; -
1084 while (src_data < end) {
evaluated: src_data < end
TRUEFALSE
yes
Evaluation Count:3712
yes
Evaluation Count:22
22-3712
1085 *dest_data = bitflip[*src_data]; -
1086 ++src_data; -
1087 ++dest_data; -
1088 }
executed: }
Execution Count:3712
3712
1089}
executed: }
Execution Count:22
22
1090 -
1091static void mask_alpha_converter(QImageData *dest, const QImageData *src, Qt::ImageConversionFlags) -
1092{ -
1093 qt_noop(); -
1094 qt_noop(); -
1095 -
1096 const int src_pad = (src->bytes_per_line >> 2) - src->width; -
1097 const int dest_pad = (dest->bytes_per_line >> 2) - dest->width; -
1098 const uint *src_data = (const uint *)src->data; -
1099 uint *dest_data = (uint *)dest->data; -
1100 -
1101 for (int i = 0; i < src->height; ++i) {
evaluated: i < src->height
TRUEFALSE
yes
Evaluation Count:16607
yes
Evaluation Count:340
340-16607
1102 const uint *end = src_data + src->width; -
1103 while (src_data < end) {
evaluated: src_data < end
TRUEFALSE
yes
Evaluation Count:2750324
yes
Evaluation Count:16607
16607-2750324
1104 *dest_data = *src_data | 0xff000000; -
1105 ++src_data; -
1106 ++dest_data; -
1107 }
executed: }
Execution Count:2750324
2750324
1108 src_data += src_pad; -
1109 dest_data += dest_pad; -
1110 }
executed: }
Execution Count:16607
16607
1111}
executed: }
Execution Count:340
340
1112 -
1113static QVector<QRgb> fix_color_table(const QVector<QRgb> &ctbl, QImage::Format format) -
1114{ -
1115 QVector<QRgb> colorTable = ctbl; -
1116 if (format == QImage::Format_RGB32) {
evaluated: format == QImage::Format_RGB32
TRUEFALSE
yes
Evaluation Count:195
yes
Evaluation Count:2291
195-2291
1117 -
1118 for (int i = 0; i < colorTable.size(); ++i)
evaluated: i < colorTable.size()
TRUEFALSE
yes
Evaluation Count:6362
yes
Evaluation Count:195
195-6362
1119 if (qAlpha(colorTable.at(i) != 0xff))
partially evaluated: qAlpha(colorTable.at(i) != 0xff)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:6362
0-6362
1120 colorTable[i] = colorTable.at(i) | 0xff000000;
never executed: colorTable[i] = colorTable.at(i) | 0xff000000;
0
1121 } else if (format == QImage::Format_ARGB32_Premultiplied) {
executed: }
Execution Count:195
evaluated: format == QImage::Format_ARGB32_Premultiplied
TRUEFALSE
yes
Evaluation Count:2272
yes
Evaluation Count:19
19-2272
1122 -
1123 for (int i = 0; i < colorTable.size(); ++i)
evaluated: i < colorTable.size()
TRUEFALSE
yes
Evaluation Count:31280
yes
Evaluation Count:2272
2272-31280
1124 colorTable[i] = PREMUL(colorTable.at(i));
executed: colorTable[i] = PREMUL(colorTable.at(i));
Execution Count:31280
31280
1125 }
executed: }
Execution Count:2272
2272
1126 return colorTable;
executed: return colorTable;
Execution Count:2486
2486
1127} -
1128 -
1129 -
1130 -
1131 -
1132 -
1133static void dither_to_Mono(QImageData *dst, const QImageData *src, -
1134 Qt::ImageConversionFlags flags, bool fromalpha) -
1135{ -
1136 qt_noop(); -
1137 qt_noop(); -
1138 qt_noop(); -
1139 -
1140 dst->colortable.clear(); -
1141 dst->colortable.append(0xffffffff); -
1142 dst->colortable.append(0xff000000); -
1143 -
1144 enum { Threshold, Ordered, Diffuse } dithermode; -
1145 -
1146 if (fromalpha) {
evaluated: fromalpha
TRUEFALSE
yes
Evaluation Count:246
yes
Evaluation Count:311
246-311
1147 if ((flags & Qt::AlphaDither_Mask) == Qt::DiffuseAlphaDither)
partially evaluated: (flags & Qt::AlphaDither_Mask) == Qt::DiffuseAlphaDither
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:246
0-246
1148 dithermode = Diffuse;
never executed: dithermode = Diffuse;
0
1149 else if ((flags & Qt::AlphaDither_Mask) == Qt::OrderedAlphaDither)
evaluated: (flags & Qt::AlphaDither_Mask) == Qt::OrderedAlphaDither
TRUEFALSE
yes
Evaluation Count:54
yes
Evaluation Count:192
54-192
1150 dithermode = Ordered;
executed: dithermode = Ordered;
Execution Count:54
54
1151 else -
1152 dithermode = Threshold;
executed: dithermode = Threshold;
Execution Count:192
192
1153 } else { -
1154 if ((flags & Qt::Dither_Mask) == Qt::ThresholdDither)
evaluated: (flags & Qt::Dither_Mask) == Qt::ThresholdDither
TRUEFALSE
yes
Evaluation Count:54
yes
Evaluation Count:257
54-257
1155 dithermode = Threshold;
executed: dithermode = Threshold;
Execution Count:54
54
1156 else if ((flags & Qt::Dither_Mask) == Qt::OrderedDither)
partially evaluated: (flags & Qt::Dither_Mask) == Qt::OrderedDither
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:257
0-257
1157 dithermode = Ordered;
never executed: dithermode = Ordered;
0
1158 else -
1159 dithermode = Diffuse;
executed: dithermode = Diffuse;
Execution Count:257
257
1160 } -
1161 -
1162 int w = src->width; -
1163 int h = src->height; -
1164 int d = src->depth; -
1165 uchar gray[256]; -
1166 bool use_gray = (d == 8); -
1167 if (use_gray) {
evaluated: use_gray
TRUEFALSE
yes
Evaluation Count:193
yes
Evaluation Count:364
193-364
1168 if (fromalpha) {
evaluated: fromalpha
TRUEFALSE
yes
Evaluation Count:136
yes
Evaluation Count:57
57-136
1169 -
1170 -
1171 for (int i = 0; i < src->colortable.size(); i++)
evaluated: i < src->colortable.size()
TRUEFALSE
yes
Evaluation Count:272
yes
Evaluation Count:136
136-272
1172 gray[i] = (255 - (src->colortable.at(i) >> 24));
executed: gray[i] = (255 - (src->colortable.at(i) >> 24));
Execution Count:272
272
1173 } else {
executed: }
Execution Count:136
136
1174 -
1175 -
1176 for (int i = 0; i < src->colortable.size(); i++)
evaluated: i < src->colortable.size()
TRUEFALSE
yes
Evaluation Count:13830
yes
Evaluation Count:57
57-13830
1177 gray[i] = qGray(src->colortable.at(i));
executed: gray[i] = qGray(src->colortable.at(i));
Execution Count:13830
13830
1178 }
executed: }
Execution Count:57
57
1179 } -
1180 -
1181 uchar *dst_data = dst->data; -
1182 int dst_bpl = dst->bytes_per_line; -
1183 const uchar *src_data = src->data; -
1184 int src_bpl = src->bytes_per_line; -
1185 -
1186 switch (dithermode) { -
1187 case Diffuse: { -
1188 QScopedArrayPointer<int> lineBuffer(new int[w * 2]); -
1189 int *line1 = lineBuffer.data(); -
1190 int *line2 = lineBuffer.data() + w; -
1191 int bmwidth = (w+7)/8; -
1192 -
1193 int *b1, *b2; -
1194 int wbytes = w * (d/8); -
1195 register const uchar *p = src->data; -
1196 const uchar *end = p + wbytes; -
1197 b2 = line2; -
1198 if (use_gray) {
evaluated: use_gray
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:254
3-254
1199 while (p < end)
evaluated: p < end
TRUEFALSE
yes
Evaluation Count:144
yes
Evaluation Count:3
3-144
1200 *b2++ = gray[*p++];
executed: *b2++ = gray[*p++];
Execution Count:144
144
1201 } else {
executed: }
Execution Count:3
3
1202 if (fromalpha) {
partially evaluated: fromalpha
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:254
0-254
1203 while (p < end) {
never evaluated: p < end
0
1204 *b2++ = 255 - (*(uint*)p >> 24); -
1205 p += 4; -
1206 }
never executed: }
0
1207 } else {
never executed: }
0
1208 while (p < end) {
evaluated: p < end
TRUEFALSE
yes
Evaluation Count:8598
yes
Evaluation Count:254
254-8598
1209 *b2++ = qGray(*(uint*)p); -
1210 p += 4; -
1211 }
executed: }
Execution Count:8598
8598
1212 }
executed: }
Execution Count:254
254
1213 } -
1214 for (int y=0; y<h; y++) {
evaluated: y<h
TRUEFALSE
yes
Evaluation Count:8098
yes
Evaluation Count:257
257-8098
1215 int *tmp = line1; line1 = line2; line2 = tmp; -
1216 bool not_last_line = y < h - 1; -
1217 if (not_last_line) {
evaluated: not_last_line
TRUEFALSE
yes
Evaluation Count:7841
yes
Evaluation Count:257
257-7841
1218 p = src->data + (y+1)*src->bytes_per_line; -
1219 end = p + wbytes; -
1220 b2 = line2; -
1221 if (use_gray) {
evaluated: use_gray
TRUEFALSE
yes
Evaluation Count:141
yes
Evaluation Count:7700
141-7700
1222 while (p < end)
evaluated: p < end
TRUEFALSE
yes
Evaluation Count:9672
yes
Evaluation Count:141
141-9672
1223 *b2++ = gray[*p++];
executed: *b2++ = gray[*p++];
Execution Count:9672
9672
1224 } else {
executed: }
Execution Count:141
141
1225 if (fromalpha) {
partially evaluated: fromalpha
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:7700
0-7700
1226 while (p < end) {
never evaluated: p < end
0
1227 *b2++ = 255 - (*(uint*)p >> 24); -
1228 p += 4; -
1229 }
never executed: }
0
1230 } else {
never executed: }
0
1231 while (p < end) {
evaluated: p < end
TRUEFALSE
yes
Evaluation Count:399630
yes
Evaluation Count:7700
7700-399630
1232 *b2++ = qGray(*(uint*)p); -
1233 p += 4; -
1234 }
executed: }
Execution Count:399630
399630
1235 }
executed: }
Execution Count:7700
7700
1236 } -
1237 } -
1238 -
1239 int err; -
1240 uchar *p = dst->data + y*dst->bytes_per_line; -
1241 memset(p, 0, bmwidth); -
1242 b1 = line1; -
1243 b2 = line2; -
1244 int bit = 7; -
1245 for (int x=1; x<=w; x++) {
evaluated: x<=w
TRUEFALSE
yes
Evaluation Count:418044
yes
Evaluation Count:8098
8098-418044
1246 if (*b1 < 128) {
evaluated: *b1 < 128
TRUEFALSE
yes
Evaluation Count:211573
yes
Evaluation Count:206471
206471-211573
1247 err = *b1++; -
1248 *p |= 1 << bit; -
1249 } else {
executed: }
Execution Count:211573
211573
1250 err = *b1++ - 255; -
1251 }
executed: }
Execution Count:206471
206471
1252 if (bit == 0) {
evaluated: bit == 0
TRUEFALSE
yes
Evaluation Count:50506
yes
Evaluation Count:367538
50506-367538
1253 p++; -
1254 bit = 7; -
1255 } else {
executed: }
Execution Count:50506
50506
1256 bit--; -
1257 }
executed: }
Execution Count:367538
367538
1258 if (x < w)
evaluated: x < w
TRUEFALSE
yes
Evaluation Count:409946
yes
Evaluation Count:8098
8098-409946
1259 *b1 += (err*7)>>4;
executed: *b1 += (err*7)>>4;
Execution Count:409946
409946
1260 if (not_last_line) {
evaluated: not_last_line
TRUEFALSE
yes
Evaluation Count:409302
yes
Evaluation Count:8742
8742-409302
1261 b2[0] += (err*5)>>4; -
1262 if (x > 1)
evaluated: x > 1
TRUEFALSE
yes
Evaluation Count:401461
yes
Evaluation Count:7841
7841-401461
1263 b2[-1] += (err*3)>>4;
executed: b2[-1] += (err*3)>>4;
Execution Count:401461
401461
1264 if (x < w)
evaluated: x < w
TRUEFALSE
yes
Evaluation Count:401461
yes
Evaluation Count:7841
7841-401461
1265 b2[1] += err>>4;
executed: b2[1] += err>>4;
Execution Count:401461
401461
1266 }
executed: }
Execution Count:409302
409302
1267 b2++; -
1268 }
executed: }
Execution Count:418044
418044
1269 }
executed: }
Execution Count:8098
8098
1270 } break;
executed: break;
Execution Count:257
257
1271 case Ordered: { -
1272 -
1273 memset(dst->data, 0, dst->nbytes); -
1274 if (d == 32) {
partially evaluated: d == 32
TRUEFALSE
yes
Evaluation Count:54
no
Evaluation Count:0
0-54
1275 for (int i=0; i<h; i++) {
evaluated: i<h
TRUEFALSE
yes
Evaluation Count:13770
yes
Evaluation Count:54
54-13770
1276 const uint *p = (const uint *)src_data; -
1277 const uint *end = p + w; -
1278 uchar *m = dst_data; -
1279 int bit = 7; -
1280 int j = 0; -
1281 if (fromalpha) {
partially evaluated: fromalpha
TRUEFALSE
yes
Evaluation Count:13770
no
Evaluation Count:0
0-13770
1282 while (p < end) {
evaluated: p < end
TRUEFALSE
yes
Evaluation Count:3511350
yes
Evaluation Count:13770
13770-3511350
1283 if ((*p++ >> 24) >= qt_bayer_matrix[j++&15][i&15])
evaluated: (*p++ >> 24) >= qt_bayer_matrix[j++&15][i&15]
TRUEFALSE
yes
Evaluation Count:1755684
yes
Evaluation Count:1755666
1755666-1755684
1284 *m |= 1 << bit;
executed: *m |= 1 << bit;
Execution Count:1755684
1755684
1285 if (bit == 0) {
evaluated: bit == 0
TRUEFALSE
yes
Evaluation Count:426870
yes
Evaluation Count:3084480
426870-3084480
1286 m++; -
1287 bit = 7; -
1288 } else {
executed: }
Execution Count:426870
426870
1289 bit--; -
1290 }
executed: }
Execution Count:3084480
3084480
1291 } -
1292 } else {
executed: }
Execution Count:13770
13770
1293 while (p < end) {
never evaluated: p < end
0
1294 if ((uint)qGray(*p++) < qt_bayer_matrix[j++&15][i&15])
never evaluated: (uint)qGray(*p++) < qt_bayer_matrix[j++&15][i&15]
0
1295 *m |= 1 << bit;
never executed: *m |= 1 << bit;
0
1296 if (bit == 0) {
never evaluated: bit == 0
0
1297 m++; -
1298 bit = 7; -
1299 } else {
never executed: }
0
1300 bit--; -
1301 }
never executed: }
0
1302 } -
1303 }
never executed: }
0
1304 dst_data += dst_bpl; -
1305 src_data += src_bpl; -
1306 }
executed: }
Execution Count:13770
13770
1307 } else
executed: }
Execution Count:54
54
1308 { -
1309 for (int i=0; i<h; i++) {
never evaluated: i<h
0
1310 const uchar *p = src_data; -
1311 const uchar *end = p + w; -
1312 uchar *m = dst_data; -
1313 int bit = 7; -
1314 int j = 0; -
1315 while (p < end) {
never evaluated: p < end
0
1316 if ((uint)gray[*p++] < qt_bayer_matrix[j++&15][i&15])
never evaluated: (uint)gray[*p++] < qt_bayer_matrix[j++&15][i&15]
0
1317 *m |= 1 << bit;
never executed: *m |= 1 << bit;
0
1318 if (bit == 0) {
never evaluated: bit == 0
0
1319 m++; -
1320 bit = 7; -
1321 } else {
never executed: }
0
1322 bit--; -
1323 }
never executed: }
0
1324 } -
1325 dst_data += dst_bpl; -
1326 src_data += src_bpl; -
1327 }
never executed: }
0
1328 }
never executed: }
0
1329 } break;
executed: break;
Execution Count:54
54
1330 default: { -
1331 memset(dst->data, 0, dst->nbytes); -
1332 if (d == 32) {
evaluated: d == 32
TRUEFALSE
yes
Evaluation Count:56
yes
Evaluation Count:190
56-190
1333 for (int i=0; i<h; i++) {
evaluated: i<h
TRUEFALSE
yes
Evaluation Count:932
yes
Evaluation Count:56
56-932
1334 const uint *p = (const uint *)src_data; -
1335 const uint *end = p + w; -
1336 uchar *m = dst_data; -
1337 int bit = 7; -
1338 if (fromalpha) {
partially evaluated: fromalpha
TRUEFALSE
yes
Evaluation Count:932
no
Evaluation Count:0
0-932
1339 while (p < end) {
evaluated: p < end
TRUEFALSE
yes
Evaluation Count:85892
yes
Evaluation Count:932
932-85892
1340 if ((*p++ >> 24) >= 128)
evaluated: (*p++ >> 24) >= 128
TRUEFALSE
yes
Evaluation Count:26928
yes
Evaluation Count:58964
26928-58964
1341 *m |= 1 << bit;
executed: *m |= 1 << bit;
Execution Count:26928
26928
1342 if (bit == 0) {
evaluated: bit == 0
TRUEFALSE
yes
Evaluation Count:10604
yes
Evaluation Count:75288
10604-75288
1343 m++; -
1344 bit = 7; -
1345 } else {
executed: }
Execution Count:10604
10604
1346 bit--; -
1347 }
executed: }
Execution Count:75288
75288
1348 } -
1349 } else {
executed: }
Execution Count:932
932
1350 while (p < end) {
never evaluated: p < end
0
1351 if (qGray(*p++) < 128)
never evaluated: qGray(*p++) < 128
0
1352 *m |= 1 << bit;
never executed: *m |= 1 << bit;
0
1353 if (bit == 0) {
never evaluated: bit == 0
0
1354 m++; -
1355 bit = 7; -
1356 } else {
never executed: }
0
1357 bit--; -
1358 }
never executed: }
0
1359 } -
1360 }
never executed: }
0
1361 dst_data += dst_bpl; -
1362 src_data += src_bpl; -
1363 }
executed: }
Execution Count:932
932
1364 } else
executed: }
Execution Count:56
56
1365 if (d == 8) {
partially evaluated: d == 8
TRUEFALSE
yes
Evaluation Count:190
no
Evaluation Count:0
0-190
1366 for (int i=0; i<h; i++) {
evaluated: i<h
TRUEFALSE
yes
Evaluation Count:838
yes
Evaluation Count:190
190-838
1367 const uchar *p = src_data; -
1368 const uchar *end = p + w; -
1369 uchar *m = dst_data; -
1370 int bit = 7; -
1371 while (p < end) {
evaluated: p < end
TRUEFALSE
yes
Evaluation Count:13408
yes
Evaluation Count:838
838-13408
1372 if (gray[*p++] < 128)
evaluated: gray[*p++] < 128
TRUEFALSE
yes
Evaluation Count:5362
yes
Evaluation Count:8046
5362-8046
1373 *m |= 1 << bit;
executed: *m |= 1 << bit;
Execution Count:5362
5362
1374 if (bit == 0) {
evaluated: bit == 0
TRUEFALSE
yes
Evaluation Count:1676
yes
Evaluation Count:11732
1676-11732
1375 m++; -
1376 bit = 7; -
1377 } else {
executed: }
Execution Count:1676
1676
1378 bit--; -
1379 }
executed: }
Execution Count:11732
11732
1380 } -
1381 dst_data += dst_bpl; -
1382 src_data += src_bpl; -
1383 }
executed: }
Execution Count:838
838
1384 }
executed: }
Execution Count:190
190
1385 } -
1386 } -
1387 -
1388 if (dst->format == QImage::Format_MonoLSB) {
evaluated: dst->format == QImage::Format_MonoLSB
TRUEFALSE
yes
Evaluation Count:380
yes
Evaluation Count:177
177-380
1389 -
1390 uchar *sl = dst->data; -
1391 int bpl = (dst->width + 7) * dst->depth / 8; -
1392 int pad = dst->bytes_per_line - bpl; -
1393 for (int y=0; y<dst->height; ++y) {
evaluated: y<dst->height
TRUEFALSE
yes
Evaluation Count:18752
yes
Evaluation Count:380
380-18752
1394 for (int x=0; x<bpl; ++x) {
evaluated: x<bpl
TRUEFALSE
yes
Evaluation Count:469274
yes
Evaluation Count:18752
18752-469274
1395 *sl = bitflip[*sl]; -
1396 ++sl; -
1397 }
executed: }
Execution Count:469274
469274
1398 sl += pad; -
1399 }
executed: }
Execution Count:18752
18752
1400 }
executed: }
Execution Count:380
380
1401}
executed: }
Execution Count:557
557
1402 -
1403static void convert_X_to_Mono(QImageData *dst, const QImageData *src, Qt::ImageConversionFlags flags) -
1404{ -
1405 dither_to_Mono(dst, src, flags, false); -
1406}
executed: }
Execution Count:299
299
1407 -
1408static void convert_ARGB_PM_to_Mono(QImageData *dst, const QImageData *src, Qt::ImageConversionFlags flags) -
1409{ -
1410 QScopedPointer<QImageData> tmp(QImageData::create(QSize(src->width, src->height), QImage::Format_ARGB32)); -
1411 convert_ARGB_PM_to_ARGB(tmp.data(), src, flags); -
1412 dither_to_Mono(dst, tmp.data(), flags, false); -
1413}
executed: }
Execution Count:12
12
1414struct QRgbMap { -
1415 inline QRgbMap() : used(0) { }
executed: }
Execution Count:113658
113658
1416 uchar pix; -
1417 uchar used; -
1418 QRgb rgb; -
1419}; -
1420 -
1421static void convert_RGB_to_Indexed8(QImageData *dst, const QImageData *src, Qt::ImageConversionFlags flags) -
1422{ -
1423 qt_noop(); -
1424 qt_noop(); -
1425 qt_noop(); -
1426 qt_noop(); -
1427 -
1428 bool do_quant = (flags & Qt::DitherMode_Mask) == Qt::PreferDither
partially evaluated: (flags & Qt::DitherMode_Mask) == Qt::PreferDither
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:114
0-114
1429 || src->format == QImage::Format_ARGB32;
evaluated: src->format == QImage::Format_ARGB32
TRUEFALSE
yes
Evaluation Count:56
yes
Evaluation Count:58
56-58
1430 uint alpha_mask = src->format == QImage::Format_RGB32 ? 0xff000000 : 0;
evaluated: src->format == QImage::Format_RGB32
TRUEFALSE
yes
Evaluation Count:58
yes
Evaluation Count:56
56-58
1431 -
1432 const int tablesize = 997; -
1433 QRgbMap table[tablesize]; -
1434 int pix=0; -
1435 -
1436 if (!dst->colortable.isEmpty()) {
partially evaluated: !dst->colortable.isEmpty()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:114
0-114
1437 QVector<QRgb> ctbl = dst->colortable; -
1438 dst->colortable.resize(256); -
1439 -
1440 -
1441 for (int i = 0; i < dst->colortable.size(); ++i) {
never evaluated: i < dst->colortable.size()
0
1442 -
1443 QRgb p = ctbl.at(i) | alpha_mask; -
1444 int hash = p % tablesize; -
1445 for (;;) { -
1446 if (table[hash].used) {
never evaluated: table[hash].used
0
1447 if (table[hash].rgb == p) {
never evaluated: table[hash].rgb == p
0
1448 -
1449 break;
never executed: break;
0
1450 } else { -
1451 -
1452 if (++hash == tablesize) hash = 0;
never executed: hash = 0;
never evaluated: ++hash == tablesize
0
1453 }
never executed: }
0
1454 } else { -
1455 -
1456 qt_noop(); -
1457 -
1458 dst->colortable[pix] = p; -
1459 table[hash].pix = pix++; -
1460 table[hash].rgb = p; -
1461 table[hash].used = 1; -
1462 break;
never executed: break;
0
1463 } -
1464 } -
1465 }
never executed: }
0
1466 }
never executed: }
0
1467 -
1468 if ((flags & Qt::DitherMode_Mask) != Qt::PreferDither) {
partially evaluated: (flags & Qt::DitherMode_Mask) != Qt::PreferDither
TRUEFALSE
yes
Evaluation Count:114
no
Evaluation Count:0
0-114
1469 dst->colortable.resize(256); -
1470 const uchar *src_data = src->data; -
1471 uchar *dest_data = dst->data; -
1472 for (int y = 0; y < src->height; y++) {
evaluated: y < src->height
TRUEFALSE
yes
Evaluation Count:2087
yes
Evaluation Count:114
114-2087
1473 const QRgb *s = (const QRgb *)src_data; -
1474 uchar *b = dest_data; -
1475 for (int x = 0; x < src->width; ++x) {
evaluated: x < src->width
TRUEFALSE
yes
Evaluation Count:64740
yes
Evaluation Count:2087
2087-64740
1476 QRgb p = s[x] | alpha_mask; -
1477 int hash = p % tablesize; -
1478 for (;;) { -
1479 if (table[hash].used) {
evaluated: table[hash].used
TRUEFALSE
yes
Evaluation Count:64177
yes
Evaluation Count:641
641-64177
1480 if (table[hash].rgb == (p)) {
evaluated: table[hash].rgb == (p)
TRUEFALSE
yes
Evaluation Count:64099
yes
Evaluation Count:78
78-64099
1481 -
1482 break;
executed: break;
Execution Count:64099
64099
1483 } else { -
1484 -
1485 if (++hash == tablesize) hash = 0;
never executed: hash = 0;
partially evaluated: ++hash == tablesize
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:78
0-78
1486 }
executed: }
Execution Count:78
78
1487 } else { -
1488 -
1489 if (pix == 256) {
evaluated: pix == 256
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:640
1-640
1490 do_quant = true; -
1491 -
1492 x = src->width; -
1493 y = src->height; -
1494 } else {
executed: }
Execution Count:1
1
1495 -
1496 dst->colortable[pix] = p; -
1497 table[hash].pix = pix++; -
1498 table[hash].rgb = p; -
1499 table[hash].used = 1; -
1500 }
executed: }
Execution Count:640
640
1501 break;
executed: break;
Execution Count:641
641
1502 } -
1503 } -
1504 *b++ = table[hash].pix; -
1505 }
executed: }
Execution Count:64740
64740
1506 src_data += src->bytes_per_line; -
1507 dest_data += dst->bytes_per_line; -
1508 }
executed: }
Execution Count:2087
2087
1509 }
executed: }
Execution Count:114
114
1510 int numColors = do_quant ? 256 : pix;
evaluated: do_quant
TRUEFALSE
yes
Evaluation Count:56
yes
Evaluation Count:58
56-58
1511 -
1512 dst->colortable.resize(numColors); -
1513 -
1514 if (do_quant) {
evaluated: do_quant
TRUEFALSE
yes
Evaluation Count:56
yes
Evaluation Count:58
56-58
1515 -
1516 -
1517 -
1518 -
1519 -
1520 -
1521 for (int rc=0; rc<=5; rc++)
evaluated: rc<=5
TRUEFALSE
yes
Evaluation Count:336
yes
Evaluation Count:56
56-336
1522 for (int gc=0; gc<=5; gc++)
evaluated: gc<=5
TRUEFALSE
yes
Evaluation Count:2016
yes
Evaluation Count:336
336-2016
1523 for (int bc=0; bc<=5; bc++)
evaluated: bc<=5
TRUEFALSE
yes
Evaluation Count:12096
yes
Evaluation Count:2016
2016-12096
1524 dst->colortable[(((rc)*(5 +1)+(gc))*(5 +1)+(bc))] = 0xff000000 | qRgb(rc*255/5, gc*255/5, bc*255/5);
executed: dst->colortable[(((rc)*(5 +1)+(gc))*(5 +1)+(bc))] = 0xff000000 | qRgb(rc*255/5, gc*255/5, bc*255/5);
Execution Count:12096
12096
1525 -
1526 const uchar *src_data = src->data; -
1527 uchar *dest_data = dst->data; -
1528 if ((flags & Qt::Dither_Mask) == Qt::ThresholdDither) {
evaluated: (flags & Qt::Dither_Mask) == Qt::ThresholdDither
TRUEFALSE
yes
Evaluation Count:54
yes
Evaluation Count:2
2-54
1529 for (int y = 0; y < src->height; y++) {
evaluated: y < src->height
TRUEFALSE
yes
Evaluation Count:702
yes
Evaluation Count:54
54-702
1530 const QRgb *p = (const QRgb *)src_data; -
1531 const QRgb *end = p + src->width; -
1532 uchar *b = dest_data; -
1533 -
1534 while (p < end) {
evaluated: p < end
TRUEFALSE
yes
Evaluation Count:11232
yes
Evaluation Count:702
702-11232
1535 -
1536 *b++ = -
1537 (((((uchar) ((qRed(*p) * (5) + 127) / 255)))*(5 +1)+(((uchar) ((qGreen(*p) * (5) + 127) / 255))))*(5 +1)+(((uchar) ((qBlue(*p) * (5) + 127) / 255)))); -
1538 -
1539 -
1540 -
1541 -
1542 -
1543 p++; -
1544 }
executed: }
Execution Count:11232
11232
1545 src_data += src->bytes_per_line; -
1546 dest_data += dst->bytes_per_line; -
1547 }
executed: }
Execution Count:702
702
1548 } else if ((flags & Qt::Dither_Mask) == Qt::DiffuseDither) {
partially evaluated: (flags & Qt::Dither_Mask) == Qt::DiffuseDither
TRUEFALSE
yes
Evaluation Count:2
no
Evaluation Count:0
executed: }
Execution Count:54
0-54
1549 int* line1[3]; -
1550 int* line2[3]; -
1551 int* pv[3]; -
1552 QScopedArrayPointer<int> lineBuffer(new int[src->width * 9]); -
1553 line1[0] = lineBuffer.data(); -
1554 line2[0] = lineBuffer.data() + src->width; -
1555 line1[1] = lineBuffer.data() + src->width * 2; -
1556 line2[1] = lineBuffer.data() + src->width * 3; -
1557 line1[2] = lineBuffer.data() + src->width * 4; -
1558 line2[2] = lineBuffer.data() + src->width * 5; -
1559 pv[0] = lineBuffer.data() + src->width * 6; -
1560 pv[1] = lineBuffer.data() + src->width * 7; -
1561 pv[2] = lineBuffer.data() + src->width * 8; -
1562 -
1563 int endian = (QSysInfo::ByteOrder == QSysInfo::BigEndian); -
1564 for (int y = 0; y < src->height; y++) {
evaluated: y < src->height
TRUEFALSE
yes
Evaluation Count:230
yes
Evaluation Count:2
2-230
1565 const uchar* q = src_data; -
1566 const uchar* q2 = y < src->height - 1 ? q + src->bytes_per_line : src->data;
evaluated: y < src->height - 1
TRUEFALSE
yes
Evaluation Count:228
yes
Evaluation Count:2
2-228
1567 uchar *b = dest_data; -
1568 for (int chan = 0; chan < 3; chan++) {
evaluated: chan < 3
TRUEFALSE
yes
Evaluation Count:690
yes
Evaluation Count:230
230-690
1569 int *l1 = (y&1) ? line2[chan] : line1[chan];
evaluated: (y&1)
TRUEFALSE
yes
Evaluation Count:345
yes
Evaluation Count:345
345
1570 int *l2 = (y&1) ? line1[chan] : line2[chan];
evaluated: (y&1)
TRUEFALSE
yes
Evaluation Count:345
yes
Evaluation Count:345
345
1571 if (y == 0) {
evaluated: y == 0
TRUEFALSE
yes
Evaluation Count:6
yes
Evaluation Count:684
6-684
1572 for (int i = 0; i < src->width; i++)
evaluated: i < src->width
TRUEFALSE
yes
Evaluation Count:1518
yes
Evaluation Count:6
6-1518
1573 l1[i] = q[i*4+chan+endian];
executed: l1[i] = q[i*4+chan+endian];
Execution Count:1518
1518
1574 }
executed: }
Execution Count:6
6
1575 if (y+1 < src->height) {
evaluated: y+1 < src->height
TRUEFALSE
yes
Evaluation Count:684
yes
Evaluation Count:6
6-684
1576 for (int i = 0; i < src->width; i++)
evaluated: i < src->width
TRUEFALSE
yes
Evaluation Count:222462
yes
Evaluation Count:684
684-222462
1577 l2[i] = q2[i*4+chan+endian];
executed: l2[i] = q2[i*4+chan+endian];
Execution Count:222462
222462
1578 }
executed: }
Execution Count:684
684
1579 -
1580 if (y&1) {
evaluated: y&1
TRUEFALSE
yes
Evaluation Count:345
yes
Evaluation Count:345
345
1581 for (int x = 0; x < src->width; x++) {
evaluated: x < src->width
TRUEFALSE
yes
Evaluation Count:111990
yes
Evaluation Count:345
345-111990
1582 int pix = qMax(qMin(5, (l1[x] * 5 + 128)/ 255), 0); -
1583 int err = l1[x] - pix * 255 / 5; -
1584 pv[chan][x] = pix; -
1585 -
1586 -
1587 if (x + 1< src->width) {
evaluated: x + 1< src->width
TRUEFALSE
yes
Evaluation Count:111645
yes
Evaluation Count:345
345-111645
1588 l1[x+1] += (err*7)>>4; -
1589 l2[x+1] += err>>4; -
1590 }
executed: }
Execution Count:111645
111645
1591 l2[x]+=(err*5)>>4; -
1592 if (x>1)
evaluated: x>1
TRUEFALSE
yes
Evaluation Count:111300
yes
Evaluation Count:690
690-111300
1593 l2[x-1]+=(err*3)>>4;
executed: l2[x-1]+=(err*3)>>4;
Execution Count:111300
111300
1594 }
executed: }
Execution Count:111990
111990
1595 } else {
executed: }
Execution Count:345
345
1596 for (int x = src->width; x-- > 0;) {
evaluated: x-- > 0
TRUEFALSE
yes
Evaluation Count:111990
yes
Evaluation Count:345
345-111990
1597 int pix = qMax(qMin(5, (l1[x] * 5 + 128)/ 255), 0); -
1598 int err = l1[x] - pix * 255 / 5; -
1599 pv[chan][x] = pix; -
1600 -
1601 -
1602 if (x > 0) {
evaluated: x > 0
TRUEFALSE
yes
Evaluation Count:111645
yes
Evaluation Count:345
345-111645
1603 l1[x-1] += (err*7)>>4; -
1604 l2[x-1] += err>>4; -
1605 }
executed: }
Execution Count:111645
111645
1606 l2[x]+=(err*5)>>4; -
1607 if (x + 1 < src->width)
evaluated: x + 1 < src->width
TRUEFALSE
yes
Evaluation Count:111645
yes
Evaluation Count:345
345-111645
1608 l2[x+1]+=(err*3)>>4;
executed: l2[x+1]+=(err*3)>>4;
Execution Count:111645
111645
1609 }
executed: }
Execution Count:111990
111990
1610 }
executed: }
Execution Count:345
345
1611 } -
1612 if (endian) {
partially evaluated: endian
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:230
0-230
1613 for (int x = 0; x < src->width; x++) {
never evaluated: x < src->width
0
1614 *b++ = (((pv[0][x])*(5 +1)+(pv[1][x]))*(5 +1)+(pv[2][x])); -
1615 }
never executed: }
0
1616 } else {
never executed: }
0
1617 for (int x = 0; x < src->width; x++) {
evaluated: x < src->width
TRUEFALSE
yes
Evaluation Count:74660
yes
Evaluation Count:230
230-74660
1618 *b++ = (((pv[2][x])*(5 +1)+(pv[1][x]))*(5 +1)+(pv[0][x])); -
1619 }
executed: }
Execution Count:74660
74660
1620 }
executed: }
Execution Count:230
230
1621 src_data += src->bytes_per_line; -
1622 dest_data += dst->bytes_per_line; -
1623 }
executed: }
Execution Count:230
230
1624 } else {
executed: }
Execution Count:2
2
1625 for (int y = 0; y < src->height; y++) {
never evaluated: y < src->height
0
1626 const QRgb *p = (const QRgb *)src_data; -
1627 const QRgb *end = p + src->width; -
1628 uchar *b = dest_data; -
1629 -
1630 int x = 0; -
1631 while (p < end) {
never evaluated: p < end
0
1632 uint d = qt_bayer_matrix[y & 15][x & 15] << 8; -
1633 -
1634 -
1635 *b++ = -
1636 (((((uchar) ((((256 * (5) + (5) + 1)) * (qRed(*p)) + (d)) >> 16)))*(5 +1)+(((uchar) ((((256 * (5) + (5) + 1)) * (qGreen(*p)) + (d)) >> 16))))*(5 +1)+(((uchar) ((((256 * (5) + (5) + 1)) * (qBlue(*p)) + (d)) >> 16)))); -
1637 -
1638 -
1639 -
1640 -
1641 -
1642 -
1643 p++; -
1644 x++; -
1645 }
never executed: }
0
1646 src_data += src->bytes_per_line; -
1647 dest_data += dst->bytes_per_line; -
1648 }
never executed: }
0
1649 }
never executed: }
0
1650 -
1651 if (src->format != QImage::Format_RGB32
partially evaluated: src->format != QImage::Format_RGB32
TRUEFALSE
yes
Evaluation Count:56
no
Evaluation Count:0
0-56
1652 && src->format != QImage::Format_RGB16) {
partially evaluated: src->format != QImage::Format_RGB16
TRUEFALSE
yes
Evaluation Count:56
no
Evaluation Count:0
0-56
1653 const int trans = 216; -
1654 qt_noop(); -
1655 dst->colortable[trans] = 0; -
1656 QScopedPointer<QImageData> mask(QImageData::create(QSize(src->width, src->height), QImage::Format_Mono)); -
1657 dither_to_Mono(mask.data(), src, flags, true); -
1658 uchar *dst_data = dst->data; -
1659 const uchar *mask_data = mask->data; -
1660 for (int y = 0; y < src->height; y++) {
evaluated: y < src->height
TRUEFALSE
yes
Evaluation Count:932
yes
Evaluation Count:56
56-932
1661 for (int x = 0; x < src->width ; x++) {
evaluated: x < src->width
TRUEFALSE
yes
Evaluation Count:85892
yes
Evaluation Count:932
932-85892
1662 if (!(mask_data[x>>3] & (0x80 >> (x & 7))))
evaluated: !(mask_data[x>>3] & (0x80 >> (x & 7)))
TRUEFALSE
yes
Evaluation Count:58964
yes
Evaluation Count:26928
26928-58964
1663 dst_data[x] = trans;
executed: dst_data[x] = trans;
Execution Count:58964
58964
1664 }
executed: }
Execution Count:85892
85892
1665 mask_data += mask->bytes_per_line; -
1666 dst_data += dst->bytes_per_line; -
1667 }
executed: }
Execution Count:932
932
1668 dst->has_alpha_clut = true; -
1669 }
executed: }
Execution Count:56
56
1670 -
1671 -
1672 -
1673 -
1674 -
1675 -
1676 }
executed: }
Execution Count:56
56
1677}
executed: }
Execution Count:114
114
1678 -
1679static void convert_ARGB_PM_to_Indexed8(QImageData *dst, const QImageData *src, Qt::ImageConversionFlags flags) -
1680{ -
1681 QScopedPointer<QImageData> tmp(QImageData::create(QSize(src->width, src->height), QImage::Format_ARGB32)); -
1682 convert_ARGB_PM_to_ARGB(tmp.data(), src, flags); -
1683 convert_RGB_to_Indexed8(dst, tmp.data(), flags); -
1684}
executed: }
Execution Count:54
54
1685 -
1686static void convert_ARGB_to_Indexed8(QImageData *dst, const QImageData *src, Qt::ImageConversionFlags flags) -
1687{ -
1688 convert_RGB_to_Indexed8(dst, src, flags); -
1689}
executed: }
Execution Count:2
2
1690 -
1691static void convert_Indexed8_to_X32(QImageData *dest, const QImageData *src, Qt::ImageConversionFlags) -
1692{ -
1693 qt_noop(); -
1694 qt_noop(); -
1695 -
1696 -
1697 qt_noop(); -
1698 qt_noop(); -
1699 -
1700 QVector<QRgb> colorTable = fix_color_table(src->colortable, dest->format); -
1701 if (colorTable.size() == 0) {
evaluated: colorTable.size() == 0
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:2146
1-2146
1702 colorTable.resize(256); -
1703 for (int i=0; i<256; ++i)
evaluated: i<256
TRUEFALSE
yes
Evaluation Count:256
yes
Evaluation Count:1
1-256
1704 colorTable[i] = qRgb(i, i, i);
executed: colorTable[i] = qRgb(i, i, i);
Execution Count:256
256
1705 }
executed: }
Execution Count:1
1
1706 -
1707 int w = src->width; -
1708 const uchar *src_data = src->data; -
1709 uchar *dest_data = dest->data; -
1710 int tableSize = colorTable.size() - 1; -
1711 for (int y = 0; y < src->height; y++) {
evaluated: y < src->height
TRUEFALSE
yes
Evaluation Count:32149
yes
Evaluation Count:2147
2147-32149
1712 uint *p = (uint *)dest_data; -
1713 const uchar *b = src_data; -
1714 uint *end = p + w; -
1715 -
1716 while (p < end)
evaluated: p < end
TRUEFALSE
yes
Evaluation Count:2035905
yes
Evaluation Count:32149
32149-2035905
1717 *p++ = colorTable.at(qMin<int>(tableSize, *b++));
executed: *p++ = colorTable.at(qMin<int>(tableSize, *b++));
Execution Count:2035905
2035905
1718 -
1719 src_data += src->bytes_per_line; -
1720 dest_data += dest->bytes_per_line; -
1721 }
executed: }
Execution Count:32149
32149
1722}
executed: }
Execution Count:2147
2147
1723 -
1724static void convert_Mono_to_X32(QImageData *dest, const QImageData *src, Qt::ImageConversionFlags) -
1725{ -
1726 qt_noop(); -
1727 qt_noop(); -
1728 -
1729 -
1730 qt_noop(); -
1731 qt_noop(); -
1732 -
1733 QVector<QRgb> colorTable = fix_color_table(src->colortable, dest->format); -
1734 -
1735 -
1736 if (colorTable.size() < 2) {
partially evaluated: colorTable.size() < 2
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:339
0-339
1737 if (colorTable.size() == 0)
never evaluated: colorTable.size() == 0
0
1738 colorTable << 0xff000000;
never executed: colorTable << 0xff000000;
0
1739 colorTable << 0xffffffff; -
1740 }
never executed: }
0
1741 -
1742 const uchar *src_data = src->data; -
1743 uchar *dest_data = dest->data; -
1744 if (src->format == QImage::Format_Mono) {
evaluated: src->format == QImage::Format_Mono
TRUEFALSE
yes
Evaluation Count:171
yes
Evaluation Count:168
168-171
1745 for (int y = 0; y < dest->height; y++) {
evaluated: y < dest->height
TRUEFALSE
yes
Evaluation Count:1101
yes
Evaluation Count:171
171-1101
1746 register uint *p = (uint *)dest_data; -
1747 for (int x = 0; x < dest->width; x++)
evaluated: x < dest->width
TRUEFALSE
yes
Evaluation Count:232825
yes
Evaluation Count:1101
1101-232825
1748 *p++ = colorTable.at((src_data[x>>3] >> (7 - (x & 7))) & 1);
executed: *p++ = colorTable.at((src_data[x>>3] >> (7 - (x & 7))) & 1);
Execution Count:232825
232825
1749 -
1750 src_data += src->bytes_per_line; -
1751 dest_data += dest->bytes_per_line; -
1752 }
executed: }
Execution Count:1101
1101
1753 } else {
executed: }
Execution Count:171
171
1754 for (int y = 0; y < dest->height; y++) {
evaluated: y < dest->height
TRUEFALSE
yes
Evaluation Count:2223
yes
Evaluation Count:168
168-2223
1755 register uint *p = (uint *)dest_data; -
1756 for (int x = 0; x < dest->width; x++)
evaluated: x < dest->width
TRUEFALSE
yes
Evaluation Count:631065
yes
Evaluation Count:2223
2223-631065
1757 *p++ = colorTable.at((src_data[x>>3] >> (x & 7)) & 1);
executed: *p++ = colorTable.at((src_data[x>>3] >> (x & 7)) & 1);
Execution Count:631065
631065
1758 -
1759 src_data += src->bytes_per_line; -
1760 dest_data += dest->bytes_per_line; -
1761 }
executed: }
Execution Count:2223
2223
1762 }
executed: }
Execution Count:168
168
1763} -
1764 -
1765 -
1766static void convert_Mono_to_Indexed8(QImageData *dest, const QImageData *src, Qt::ImageConversionFlags) -
1767{ -
1768 qt_noop(); -
1769 qt_noop(); -
1770 qt_noop(); -
1771 qt_noop(); -
1772 -
1773 QVector<QRgb> ctbl = src->colortable; -
1774 if (ctbl.size() > 2) {
partially evaluated: ctbl.size() > 2
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:138
0-138
1775 ctbl.resize(2); -
1776 } else if (ctbl.size() < 2) {
never executed: }
partially evaluated: ctbl.size() < 2
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:138
0-138
1777 if (ctbl.size() == 0)
never evaluated: ctbl.size() == 0
0
1778 ctbl << 0xff000000;
never executed: ctbl << 0xff000000;
0
1779 ctbl << 0xffffffff; -
1780 }
never executed: }
0
1781 dest->colortable = ctbl; -
1782 dest->has_alpha_clut = src->has_alpha_clut; -
1783 -
1784 -
1785 const uchar *src_data = src->data; -
1786 uchar *dest_data = dest->data; -
1787 if (src->format == QImage::Format_Mono) {
evaluated: src->format == QImage::Format_Mono
TRUEFALSE
yes
Evaluation Count:137
yes
Evaluation Count:1
1-137
1788 for (int y = 0; y < dest->height; y++) {
evaluated: y < dest->height
TRUEFALSE
yes
Evaluation Count:206
yes
Evaluation Count:137
137-206
1789 register uchar *p = dest_data; -
1790 for (int x = 0; x < dest->width; x++)
evaluated: x < dest->width
TRUEFALSE
yes
Evaluation Count:7076
yes
Evaluation Count:206
206-7076
1791 *p++ = (src_data[x>>3] >> (7 - (x & 7))) & 1;
executed: *p++ = (src_data[x>>3] >> (7 - (x & 7))) & 1;
Execution Count:7076
7076
1792 src_data += src->bytes_per_line; -
1793 dest_data += dest->bytes_per_line; -
1794 }
executed: }
Execution Count:206
206
1795 } else {
executed: }
Execution Count:137
137
1796 for (int y = 0; y < dest->height; y++) {
evaluated: y < dest->height
TRUEFALSE
yes
Evaluation Count:70
yes
Evaluation Count:1
1-70
1797 register uchar *p = dest_data; -
1798 for (int x = 0; x < dest->width; x++)
evaluated: x < dest->width
TRUEFALSE
yes
Evaluation Count:4900
yes
Evaluation Count:70
70-4900
1799 *p++ = (src_data[x>>3] >> (x & 7)) & 1;
executed: *p++ = (src_data[x>>3] >> (x & 7)) & 1;
Execution Count:4900
4900
1800 src_data += src->bytes_per_line; -
1801 dest_data += dest->bytes_per_line; -
1802 }
executed: }
Execution Count:70
70
1803 }
executed: }
Execution Count:1
1
1804} -
1805 -
1806 -
1807static void convert_generic(QImageData *dest, const QImageData *src, Qt::ImageConversionFlags) -
1808{ -
1809 const int buffer_size = 2048; -
1810 uint buffer[buffer_size]; -
1811 const QPixelLayout *srcLayout = &qPixelLayouts[src->format]; -
1812 const QPixelLayout *destLayout = &qPixelLayouts[dest->format]; -
1813 const uchar *srcData = src->data; -
1814 uchar *destData = dest->data; -
1815 -
1816 FetchPixelsFunc fetch = qFetchPixels[srcLayout->bpp]; -
1817 StorePixelsFunc store = qStorePixels[destLayout->bpp]; -
1818 -
1819 for (int y = 0; y < src->height; ++y) {
evaluated: y < src->height
TRUEFALSE
yes
Evaluation Count:57205
yes
Evaluation Count:3454
3454-57205
1820 int x = 0; -
1821 while (x < src->width) {
evaluated: x < src->width
TRUEFALSE
yes
Evaluation Count:57205
yes
Evaluation Count:57205
57205
1822 int l = qMin(src->width - x, buffer_size); -
1823 const uint *ptr = fetch(buffer, srcData, x, l); -
1824 ptr = srcLayout->convertToARGB32PM(buffer, ptr, l, srcLayout, 0); -
1825 ptr = destLayout->convertFromARGB32PM(buffer, ptr, l, destLayout, 0); -
1826 store(destData, ptr, x, l); -
1827 x += l; -
1828 }
executed: }
Execution Count:57205
57205
1829 srcData += src->bytes_per_line; -
1830 destData += dest->bytes_per_line; -
1831 }
executed: }
Execution Count:57205
57205
1832}
executed: }
Execution Count:3454
3454
1833 -
1834 -
1835 -
1836static Image_Converter converter_map[QImage::NImageFormats][QImage::NImageFormats] = -
1837{ -
1838 { -
1839 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 -
1840 }, -
1841 { -
1842 0, -
1843 0, -
1844 swap_bit_order, -
1845 convert_Mono_to_Indexed8, -
1846 convert_Mono_to_X32, -
1847 convert_Mono_to_X32, -
1848 convert_Mono_to_X32, -
1849 0, -
1850 0, -
1851 0, -
1852 0, -
1853 0, -
1854 0, -
1855 0, -
1856 0, -
1857 0 -
1858 }, -
1859 -
1860 { -
1861 0, -
1862 swap_bit_order, -
1863 0, -
1864 convert_Mono_to_Indexed8, -
1865 convert_Mono_to_X32, -
1866 convert_Mono_to_X32, -
1867 convert_Mono_to_X32, -
1868 0, -
1869 0, -
1870 0, -
1871 0, -
1872 0, -
1873 0, -
1874 0, -
1875 0, -
1876 0 -
1877 }, -
1878 -
1879 { -
1880 0, -
1881 convert_X_to_Mono, -
1882 convert_X_to_Mono, -
1883 0, -
1884 convert_Indexed8_to_X32, -
1885 convert_Indexed8_to_X32, -
1886 convert_Indexed8_to_X32, -
1887 0, -
1888 0, -
1889 0, -
1890 0, -
1891 0, -
1892 0, -
1893 0, -
1894 0, -
1895 0 -
1896 }, -
1897 -
1898 { -
1899 0, -
1900 convert_X_to_Mono, -
1901 convert_X_to_Mono, -
1902 convert_RGB_to_Indexed8, -
1903 0, -
1904 mask_alpha_converter, -
1905 mask_alpha_converter, -
1906 convert_generic, -
1907 convert_generic, -
1908 convert_generic, -
1909 convert_generic, -
1910 convert_generic, -
1911 convert_generic, -
1912 convert_generic, -
1913 convert_generic, -
1914 convert_generic -
1915 }, -
1916 -
1917 { -
1918 0, -
1919 convert_X_to_Mono, -
1920 convert_X_to_Mono, -
1921 convert_ARGB_to_Indexed8, -
1922 mask_alpha_converter, -
1923 0, -
1924 convert_ARGB_to_ARGB_PM, -
1925 convert_generic, -
1926 convert_generic, -
1927 convert_generic, -
1928 convert_generic, -
1929 convert_generic, -
1930 convert_generic, -
1931 convert_generic, -
1932 convert_generic, -
1933 convert_generic -
1934 }, -
1935 -
1936 { -
1937 0, -
1938 convert_ARGB_PM_to_Mono, -
1939 convert_ARGB_PM_to_Mono, -
1940 convert_ARGB_PM_to_Indexed8, -
1941 convert_ARGB_PM_to_RGB, -
1942 convert_ARGB_PM_to_ARGB, -
1943 0, -
1944 0, -
1945 0, -
1946 0, -
1947 0, -
1948 0, -
1949 0, -
1950 0, -
1951 0, -
1952 0 -
1953 }, -
1954 -
1955 { -
1956 0, -
1957 0, -
1958 0, -
1959 0, -
1960 convert_generic, -
1961 convert_generic, -
1962 convert_generic, -
1963 0, -
1964 0, -
1965 0, -
1966 0, -
1967 -
1968 -
1969 -
1970 0, -
1971 -
1972 0, -
1973 0, -
1974 0, -
1975 0 -
1976 }, -
1977 -
1978 { -
1979 0, -
1980 0, -
1981 0, -
1982 0, -
1983 convert_generic, -
1984 convert_generic, -
1985 convert_generic, -
1986 0, -
1987 0, -
1988 0, -
1989 0, -
1990 0, -
1991 0, -
1992 0, -
1993 0, -
1994 0 -
1995 }, -
1996 -
1997 { -
1998 0, -
1999 0, -
2000 0, -
2001 0, -
2002 convert_generic, -
2003 convert_generic, -
2004 convert_generic, -
2005 0, -
2006 0, -
2007 0, -
2008 0, -
2009 0, -
2010 0, -
2011 0, -
2012 0, -
2013 0 -
2014 }, -
2015 -
2016 { -
2017 0, -
2018 0, -
2019 0, -
2020 0, -
2021 convert_generic, -
2022 convert_generic, -
2023 convert_generic, -
2024 0, -
2025 0, -
2026 0, -
2027 0, -
2028 0, -
2029 0, -
2030 0, -
2031 0, -
2032 0 -
2033 }, -
2034 -
2035 { -
2036 0, -
2037 0, -
2038 0, -
2039 0, -
2040 convert_generic, -
2041 convert_generic, -
2042 convert_generic, -
2043 -
2044 -
2045 -
2046 0, -
2047 -
2048 0, -
2049 0, -
2050 0, -
2051 0, -
2052 0, -
2053 0, -
2054 0, -
2055 0 -
2056 }, -
2057 -
2058 { -
2059 0, -
2060 0, -
2061 0, -
2062 0, -
2063 convert_generic, -
2064 convert_generic, -
2065 convert_generic, -
2066 0, -
2067 0, -
2068 0, -
2069 0, -
2070 0, -
2071 0, -
2072 0, -
2073 0, -
2074 0 -
2075 }, -
2076 -
2077 { -
2078 0, -
2079 0, -
2080 0, -
2081 0, -
2082 convert_generic, -
2083 convert_generic, -
2084 convert_generic, -
2085 0, -
2086 0, -
2087 0, -
2088 0, -
2089 0, -
2090 0, -
2091 0, -
2092 0, -
2093 0 -
2094 }, -
2095 -
2096 { -
2097 0, -
2098 0, -
2099 0, -
2100 0, -
2101 convert_generic, -
2102 convert_generic, -
2103 convert_generic, -
2104 0, -
2105 0, -
2106 0, -
2107 0, -
2108 0, -
2109 0, -
2110 0, -
2111 0, -
2112 0 -
2113 }, -
2114 -
2115 { -
2116 0, -
2117 0, -
2118 0, -
2119 0, -
2120 convert_generic, -
2121 convert_generic, -
2122 convert_generic, -
2123 0, -
2124 0, -
2125 0, -
2126 0, -
2127 0, -
2128 0, -
2129 0, -
2130 0, -
2131 0 -
2132 } -
2133}; -
2134 -
2135static InPlace_Image_Converter inplace_converter_map[QImage::NImageFormats][QImage::NImageFormats] = -
2136{ -
2137 { -
2138 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 -
2139 }, -
2140 { -
2141 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 -
2142 }, -
2143 { -
2144 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 -
2145 }, -
2146 { -
2147 0, -
2148 0, -
2149 0, -
2150 0, -
2151 0, -
2152 convert_indexed8_to_RGB_inplace, -
2153 convert_indexed8_to_ARGB_PM_inplace, -
2154 convert_indexed8_to_RGB16_inplace, -
2155 0, -
2156 0, -
2157 0, -
2158 0, -
2159 0, -
2160 0, -
2161 0, -
2162 0, -
2163 }, -
2164 { -
2165 0, -
2166 0, -
2167 0, -
2168 0, -
2169 0, -
2170 0, -
2171 0, -
2172 convert_RGB_to_RGB16_inplace, -
2173 0, -
2174 0, -
2175 0, -
2176 0, -
2177 0, -
2178 0, -
2179 0, -
2180 0, -
2181 }, -
2182 { -
2183 0, -
2184 0, -
2185 0, -
2186 0, -
2187 0, -
2188 0, -
2189 convert_ARGB_to_ARGB_PM_inplace, -
2190 0, -
2191 0, -
2192 0, -
2193 0, -
2194 0, -
2195 0, -
2196 0, -
2197 0, -
2198 0, -
2199 }, -
2200 { -
2201 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 -
2202 }, -
2203 { -
2204 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 -
2205 }, -
2206 { -
2207 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 -
2208 }, -
2209 { -
2210 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 -
2211 }, -
2212 { -
2213 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 -
2214 }, -
2215 { -
2216 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 -
2217 }, -
2218 { -
2219 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 -
2220 }, -
2221 { -
2222 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 -
2223 }, -
2224 { -
2225 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 -
2226 }, -
2227 { -
2228 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 -
2229 } -
2230}; -
2231 -
2232void qInitImageConversions() -
2233{ -
2234 -
2235 if (qCpuHasFeature(AVX)) {
partially evaluated: qCpuHasFeature(AVX)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:289
0-289
2236 extern bool convert_ARGB_to_ARGB_PM_inplace_avx(QImageData *data, Qt::ImageConversionFlags); -
2237 inplace_converter_map[QImage::Format_ARGB32][QImage::Format_ARGB32_Premultiplied] = convert_ARGB_to_ARGB_PM_inplace_avx; -
2238 -
2239 extern void convert_RGB888_to_RGB32_avx(QImageData *dest, const QImageData *src, Qt::ImageConversionFlags); -
2240 converter_map[QImage::Format_RGB888][QImage::Format_RGB32] = convert_RGB888_to_RGB32_avx; -
2241 converter_map[QImage::Format_RGB888][QImage::Format_ARGB32] = convert_RGB888_to_RGB32_avx; -
2242 converter_map[QImage::Format_RGB888][QImage::Format_ARGB32_Premultiplied] = convert_RGB888_to_RGB32_avx; -
2243 return;
never executed: return;
0
2244 } -
2245 -
2246 -
2247 -
2248 if (qCpuHasFeature(SSE2)) {
partially evaluated: qCpuHasFeature(SSE2)
TRUEFALSE
yes
Evaluation Count:289
no
Evaluation Count:0
0-289
2249 extern bool convert_ARGB_to_ARGB_PM_inplace_sse2(QImageData *data, Qt::ImageConversionFlags); -
2250 inplace_converter_map[QImage::Format_ARGB32][QImage::Format_ARGB32_Premultiplied] = convert_ARGB_to_ARGB_PM_inplace_sse2; -
2251 -
2252 if (qCpuHasFeature(SSSE3)) {
partially evaluated: qCpuHasFeature(SSSE3)
TRUEFALSE
yes
Evaluation Count:289
no
Evaluation Count:0
0-289
2253 extern void convert_RGB888_to_RGB32_ssse3(QImageData *dest, const QImageData *src, Qt::ImageConversionFlags); -
2254 converter_map[QImage::Format_RGB888][QImage::Format_RGB32] = convert_RGB888_to_RGB32_ssse3; -
2255 converter_map[QImage::Format_RGB888][QImage::Format_ARGB32] = convert_RGB888_to_RGB32_ssse3; -
2256 converter_map[QImage::Format_RGB888][QImage::Format_ARGB32_Premultiplied] = convert_RGB888_to_RGB32_ssse3; -
2257 }
executed: }
Execution Count:289
289
2258 -
2259 return;
executed: return;
Execution Count:289
289
2260 } -
2261}
never executed: }
0
2262 -
2263extern const uchar *qt_pow_rgb_gamma(); -
2264 -
2265void qGamma_correct_back_to_linear_cs(QImage *image) -
2266{ -
2267 const QDrawHelperGammaTables *tables = QGuiApplicationPrivate::instance()->gammaTables(); -
2268 if (!tables)
never evaluated: !tables
0
2269 return;
never executed: return;
0
2270 const uchar *gamma = tables->qt_pow_rgb_gamma; -
2271 -
2272 int h = image->height(); -
2273 int w = image->width(); -
2274 -
2275 for (int y=0; y<h; ++y) {
never evaluated: y<h
0
2276 uint *pixels = (uint *) image->scanLine(y); -
2277 for (int x=0; x<w; ++x) {
never evaluated: x<w
0
2278 uint p = pixels[x]; -
2279 uint r = gamma[qRed(p)]; -
2280 uint g = gamma[qGreen(p)]; -
2281 uint b = gamma[qBlue(p)]; -
2282 pixels[x] = (r << 16) | (g << 8) | b | 0xff000000; -
2283 }
never executed: }
0
2284 }
never executed: }
0
2285}
never executed: }
0
2286QImage QImage::convertToFormat(Format format, Qt::ImageConversionFlags flags) const -
2287{ -
2288 if (!d || d->format == format)
evaluated: !d
TRUEFALSE
yes
Evaluation Count:9
yes
Evaluation Count:20228
evaluated: d->format == format
TRUEFALSE
yes
Evaluation Count:10820
yes
Evaluation Count:9408
9-20228
2289 return *this;
executed: return *this;
Execution Count:10829
10829
2290 -
2291 if (format == Format_Invalid || d->format == Format_Invalid)
partially evaluated: format == Format_Invalid
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:9408
partially evaluated: d->format == Format_Invalid
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:9408
0-9408
2292 return QImage();
never executed: return QImage();
0
2293 -
2294 const Image_Converter *converterPtr = &converter_map[d->format][format]; -
2295 Image_Converter converter = *converterPtr; -
2296 if (converter) {
evaluated: converter
TRUEFALSE
yes
Evaluation Count:9301
yes
Evaluation Count:107
107-9301
2297 QImage image(d->width, d->height, format); -
2298 -
2299 if ((image).isNull()) { QMessageLogger("image/qimage.cpp", 3405, __PRETTY_FUNCTION__).warning("QImage: out of memory, returning null image"); return QImage(); };
never executed: return QImage();
partially evaluated: (image).isNull()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:9301
0-9301
2300 -
2301 image.setDotsPerMeterY(dotsPerMeterY()); -
2302 image.setDotsPerMeterX(dotsPerMeterX()); -
2303 image.setDevicePixelRatio(devicePixelRatio()); -
2304 -
2305 image.d->text = d->text; -
2306 -
2307 converter(image.d, d, flags); -
2308 return image;
executed: return image;
Execution Count:9301
9301
2309 } -
2310 -
2311 qt_noop(); -
2312 qt_noop(); -
2313 -
2314 QImage image = convertToFormat(Format_ARGB32, flags); -
2315 return image.convertToFormat(format, flags);
executed: return image.convertToFormat(format, flags);
Execution Count:107
107
2316} -
2317 -
2318 -
2319 -
2320static inline int pixel_distance(QRgb p1, QRgb p2) { -
2321 int r1 = qRed(p1); -
2322 int g1 = qGreen(p1); -
2323 int b1 = qBlue(p1); -
2324 int a1 = qAlpha(p1); -
2325 -
2326 int r2 = qRed(p2); -
2327 int g2 = qGreen(p2); -
2328 int b2 = qBlue(p2); -
2329 int a2 = qAlpha(p2); -
2330 -
2331 return abs(r1 - r2) + abs(g1 - g2) + abs(b1 - b2) + abs(a1 - a2);
executed: return abs(r1 - r2) + abs(g1 - g2) + abs(b1 - b2) + abs(a1 - a2);
Execution Count:2
2
2332} -
2333 -
2334static inline int closestMatch(QRgb pixel, const QVector<QRgb> &clut) { -
2335 int idx = 0; -
2336 int current_distance = 2147483647; -
2337 for (int i=0; i<clut.size(); ++i) {
evaluated: i<clut.size()
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:1
1-2
2338 int dist = pixel_distance(pixel, clut.at(i)); -
2339 if (dist < current_distance) {
evaluated: dist < current_distance
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:1
1
2340 current_distance = dist; -
2341 idx = i; -
2342 }
executed: }
Execution Count:1
1
2343 }
executed: }
Execution Count:2
2
2344 return idx;
executed: return idx;
Execution Count:1
1
2345} -
2346 -
2347static QImage convertWithPalette(const QImage &src, QImage::Format format, -
2348 const QVector<QRgb> &clut) { -
2349 QImage dest(src.size(), format); -
2350 dest.setColorTable(clut); -
2351 -
2352 QString textsKeys = src.text(); -
2353 QStringList textKeyList = textsKeys.split(QLatin1Char('\n'), QString::SkipEmptyParts); -
2354 for (QForeachContainer<__typeof__(textKeyList)> _container_(textKeyList); !_container_.brk && _container_.i != _container_.e; __extension__ ({ ++_container_.brk; ++_container_.i; })) for (const QString &textKey = *_container_.i;; __extension__ ({--_container_.brk; break;})) { -
2355 QStringList textKeySplitted = textKey.split(QLatin1String(": ")); -
2356 dest.setText(textKeySplitted[0], textKeySplitted[1]); -
2357 }
executed: }
Execution Count:2
2
2358 -
2359 int h = src.height(); -
2360 int w = src.width(); -
2361 -
2362 QHash<QRgb, int> cache; -
2363 -
2364 if (format == QImage::Format_Indexed8) {
partially evaluated: format == QImage::Format_Indexed8
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1
0-1
2365 for (int y=0; y<h; ++y) {
never evaluated: y<h
0
2366 QRgb *src_pixels = (QRgb *) src.scanLine(y); -
2367 uchar *dest_pixels = (uchar *) dest.scanLine(y); -
2368 for (int x=0; x<w; ++x) {
never evaluated: x<w
0
2369 int src_pixel = src_pixels[x]; -
2370 int value = cache.value(src_pixel, -1); -
2371 if (value == -1) {
never evaluated: value == -1
0
2372 value = closestMatch(src_pixel, clut); -
2373 cache.insert(src_pixel, value); -
2374 }
never executed: }
0
2375 dest_pixels[x] = (uchar) value; -
2376 }
never executed: }
0
2377 }
never executed: }
0
2378 } else {
never executed: }
0
2379 QVector<QRgb> table = clut; -
2380 table.resize(2); -
2381 for (int y=0; y<h; ++y) {
evaluated: y<h
TRUEFALSE
yes
Evaluation Count:100
yes
Evaluation Count:1
1-100
2382 QRgb *src_pixels = (QRgb *) src.scanLine(y); -
2383 for (int x=0; x<w; ++x) {
evaluated: x<w
TRUEFALSE
yes
Evaluation Count:10000
yes
Evaluation Count:100
100-10000
2384 int src_pixel = src_pixels[x]; -
2385 int value = cache.value(src_pixel, -1); -
2386 if (value == -1) {
evaluated: value == -1
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:9999
1-9999
2387 value = closestMatch(src_pixel, table); -
2388 cache.insert(src_pixel, value); -
2389 }
executed: }
Execution Count:1
1
2390 dest.setPixel(x, y, value); -
2391 }
executed: }
Execution Count:10000
10000
2392 }
executed: }
Execution Count:100
100
2393 }
executed: }
Execution Count:1
1
2394 -
2395 return dest;
executed: return dest;
Execution Count:1
1
2396} -
2397QImage QImage::convertToFormat(Format format, const QVector<QRgb> &colorTable, Qt::ImageConversionFlags flags) const -
2398{ -
2399 if (d->format == format)
partially evaluated: d->format == format
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1
0-1
2400 return *this;
never executed: return *this;
0
2401 -
2402 if (format <= QImage::Format_Indexed8 && depth() == 32) {
partially evaluated: format <= QImage::Format_Indexed8
TRUEFALSE
yes
Evaluation Count:1
no
Evaluation Count:0
partially evaluated: depth() == 32
TRUEFALSE
yes
Evaluation Count:1
no
Evaluation Count:0
0-1
2403 return convertWithPalette(*this, format, colorTable);
executed: return convertWithPalette(*this, format, colorTable);
Execution Count:1
1
2404 } -
2405 -
2406 const Image_Converter *converterPtr = &converter_map[d->format][format]; -
2407 Image_Converter converter = *converterPtr; -
2408 if (!converter)
never evaluated: !converter
0
2409 return QImage();
never executed: return QImage();
0
2410 -
2411 QImage image(d->width, d->height, format); -
2412 if ((image).isNull()) { QMessageLogger("image/qimage.cpp", 3529, __PRETTY_FUNCTION__).warning("QImage: out of memory, returning null image"); return QImage(); };
never executed: return QImage();
never evaluated: (image).isNull()
0
2413 image.setDevicePixelRatio(devicePixelRatio()); -
2414 -
2415 image.d->text = d->text; -
2416 -
2417 converter(image.d, d, flags); -
2418 return image;
never executed: return image;
0
2419} -
2420bool QImage::valid(int x, int y) const -
2421{ -
2422 return d 8
2423 && x >= 0 && x < d->width 8
2424 && y >= 0 && y < d->height;
executed: return d && x >= 0 && x < d->width && y >= 0 && y < d->height;
Execution Count:8
8
2425} -
2426int QImage::pixelIndex(int x, int y) const -
2427{ -
2428 if (!d || x < 0 || x >= d->width || y < 0 || y >= height()) {
partially evaluated: !d
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:12036472
partially evaluated: x < 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:12036472
partially evaluated: x >= d->width
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:12036472
partially evaluated: y < 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:12036472
partially evaluated: y >= height()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:12036472
0-12036472
2429 QMessageLogger("image/qimage.cpp", 3579, __PRETTY_FUNCTION__).warning("QImage::pixelIndex: coordinate (%d,%d) out of range", x, y); -
2430 return -12345;
never executed: return -12345;
0
2431 } -
2432 const uchar * s = scanLine(y); -
2433 switch(d->format) { -
2434 case Format_Mono: -
2435 return (*(s + (x >> 3)) >> (7- (x & 7))) & 1;
executed: return (*(s + (x >> 3)) >> (7- (x & 7))) & 1;
Execution Count:42214
42214
2436 case Format_MonoLSB: -
2437 return (*(s + (x >> 3)) >> (x & 7)) & 1;
executed: return (*(s + (x >> 3)) >> (x & 7)) & 1;
Execution Count:4947834
4947834
2438 case Format_Indexed8: -
2439 return (int)s[x];
executed: return (int)s[x];
Execution Count:7046424
7046424
2440 default: -
2441 QMessageLogger("image/qimage.cpp", 3591, __PRETTY_FUNCTION__).warning("QImage::pixelIndex: Not applicable for %d-bpp images (no palette)", d->depth); -
2442 }
never executed: }
0
2443 return 0;
never executed: return 0;
0
2444} -
2445QRgb QImage::pixel(int x, int y) const -
2446{ -
2447 if (!d || x < 0 || x >= d->width || y < 0 || y >= height()) {
partially evaluated: !d
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:15901355
partially evaluated: x < 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:15901355
partially evaluated: x >= d->width
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:15901355
partially evaluated: y < 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:15901355
partially evaluated: y >= height()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:15901355
0-15901355
2448 QMessageLogger("image/qimage.cpp", 3619, __PRETTY_FUNCTION__).warning("QImage::pixel: coordinate (%d,%d) out of range", x, y); -
2449 return 12345;
never executed: return 12345;
0
2450 } -
2451 -
2452 const uchar * s = constScanLine(y); -
2453 switch(d->format) { -
2454 case Format_Mono: -
2455 return d->colortable.at((*(s + (x >> 3)) >> (~x & 7)) & 1);
executed: return d->colortable.at((*(s + (x >> 3)) >> (~x & 7)) & 1);
Execution Count:175484
175484
2456 case Format_MonoLSB: -
2457 return d->colortable.at((*(s + (x >> 3)) >> (x & 7)) & 1);
executed: return d->colortable.at((*(s + (x >> 3)) >> (x & 7)) & 1);
Execution Count:97109
97109
2458 case Format_Indexed8: -
2459 return d->colortable.at((int)s[x]);
executed: return d->colortable.at((int)s[x]);
Execution Count:78624
78624
2460 case Format_RGB32: -
2461 case Format_ARGB32: -
2462 case Format_ARGB32_Premultiplied: -
2463 return reinterpret_cast<const QRgb *>(s)[x];
executed: return reinterpret_cast<const QRgb *>(s)[x];
Execution Count:14000258
14000258
2464 case Format_RGB16: -
2465 return qConvertRgb16To32(reinterpret_cast<const quint16 *>(s)[x]);
executed: return qConvertRgb16To32(reinterpret_cast<const quint16 *>(s)[x]);
Execution Count:111681
111681
2466 default: -
2467 break;
executed: break;
Execution Count:1438199
1438199
2468 } -
2469 const QPixelLayout *layout = &qPixelLayouts[d->format]; -
2470 uint result; -
2471 const uint *ptr = qFetchPixels[layout->bpp](&result, s, x, 1); -
2472 return *layout->convertToARGB32PM(&result, ptr, 1, layout, 0);
executed: return *layout->convertToARGB32PM(&result, ptr, 1, layout, 0);
Execution Count:1438199
1438199
2473} -
2474void QImage::setPixel(int x, int y, uint index_or_rgb) -
2475{ -
2476 if (!d || x < 0 || x >= width() || y < 0 || y >= height()) {
partially evaluated: !d
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:3691350
partially evaluated: x < 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:3691350
partially evaluated: x >= width()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:3691350
partially evaluated: y < 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:3691350
partially evaluated: y >= height()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:3691350
0-3691350
2477 QMessageLogger("image/qimage.cpp", 3677, __PRETTY_FUNCTION__).warning("QImage::setPixel: coordinate (%d,%d) out of range", x, y); -
2478 return;
never executed: return;
0
2479 } -
2480 -
2481 uchar * s = scanLine(y); -
2482 switch(d->format) { -
2483 case Format_Mono: -
2484 case Format_MonoLSB: -
2485 if (index_or_rgb > 1) {
partially evaluated: index_or_rgb > 1
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:14100
0-14100
2486 QMessageLogger("image/qimage.cpp", 3686, __PRETTY_FUNCTION__).warning("QImage::setPixel: Index %d out of range", index_or_rgb); -
2487 } else if (format() == Format_MonoLSB) {
evaluated: format() == Format_MonoLSB
TRUEFALSE
yes
Evaluation Count:11024
yes
Evaluation Count:3076
never executed: }
0-11024
2488 if (index_or_rgb==0)
evaluated: index_or_rgb==0
TRUEFALSE
yes
Evaluation Count:10000
yes
Evaluation Count:1024
1024-10000
2489 *(s + (x >> 3)) &= ~(1 << (x & 7));
executed: *(s + (x >> 3)) &= ~(1 << (x & 7));
Execution Count:10000
10000
2490 else -
2491 *(s + (x >> 3)) |= (1 << (x & 7));
executed: *(s + (x >> 3)) |= (1 << (x & 7));
Execution Count:1024
1024
2492 } else { -
2493 if (index_or_rgb==0)
evaluated: index_or_rgb==0
TRUEFALSE
yes
Evaluation Count:1024
yes
Evaluation Count:2052
1024-2052
2494 *(s + (x >> 3)) &= ~(1 << (7-(x & 7)));
executed: *(s + (x >> 3)) &= ~(1 << (7-(x & 7)));
Execution Count:1024
1024
2495 else -
2496 *(s + (x >> 3)) |= (1 << (7-(x & 7)));
executed: *(s + (x >> 3)) |= (1 << (7-(x & 7)));
Execution Count:2052
2052
2497 } -
2498 return;
executed: return;
Execution Count:14100
14100
2499 case Format_Indexed8: -
2500 if (index_or_rgb >= (uint)d->colortable.size()) {
partially evaluated: index_or_rgb >= (uint)d->colortable.size()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1187
0-1187
2501 QMessageLogger("image/qimage.cpp", 3701, __PRETTY_FUNCTION__).warning("QImage::setPixel: Index %d out of range", index_or_rgb); -
2502 return;
never executed: return;
0
2503 } -
2504 s[x] = index_or_rgb; -
2505 return;
executed: return;
Execution Count:1187
1187
2506 case Format_RGB32: -
2507 -
2508 -
2509 ((uint *)s)[x] = uint(255 << 24) | index_or_rgb; -
2510 return;
executed: return;
Execution Count:51621
51621
2511 case Format_ARGB32: -
2512 case Format_ARGB32_Premultiplied: -
2513 ((uint *)s)[x] = index_or_rgb; -
2514 return;
executed: return;
Execution Count:3582900
3582900
2515 case Format_RGB16: -
2516 ((quint16 *)s)[x] = qConvertRgb32To16((qAlpha(index_or_rgb) == 0 ? 0 : ((qAlpha(index_or_rgb) << 24) | (((255*qRed(index_or_rgb))/ qAlpha(index_or_rgb)) << 16) | (((255*qGreen(index_or_rgb)) / qAlpha(index_or_rgb)) << 8) | ((255*qBlue(index_or_rgb)) / qAlpha(index_or_rgb))))); -
2517 return;
executed: return;
Execution Count:20577
20577
2518 case Format_Invalid: -
2519 case NImageFormats: -
2520 qt_noop(); -
2521 return;
never executed: return;
0
2522 default: -
2523 break;
executed: break;
Execution Count:20965
20965
2524 } -
2525 -
2526 const QPixelLayout *layout = &qPixelLayouts[d->format]; -
2527 uint result; -
2528 const uint *ptr = layout->convertFromARGB32PM(&result, &index_or_rgb, 1, layout, 0); -
2529 qStorePixels[layout->bpp](s, ptr, x, 1); -
2530}
executed: }
Execution Count:20965
20965
2531bool QImage::allGray() const -
2532{ -
2533 if (!d)
never evaluated: !d
0
2534 return true;
never executed: return true;
0
2535 -
2536 switch (d->format) { -
2537 case Format_Mono: -
2538 case Format_MonoLSB: -
2539 case Format_Indexed8: -
2540 for (int i = 0; i < d->colortable.size(); ++i) {
never evaluated: i < d->colortable.size()
0
2541 if (!qIsGray(d->colortable.at(i)))
never evaluated: !qIsGray(d->colortable.at(i))
0
2542 return false;
never executed: return false;
0
2543 }
never executed: }
0
2544 return true;
never executed: return true;
0
2545 case Format_RGB32: -
2546 case Format_ARGB32: -
2547 case Format_ARGB32_Premultiplied: -
2548 for (int j = 0; j < d->height; ++j) {
never evaluated: j < d->height
0
2549 const QRgb *b = (const QRgb *)constScanLine(j); -
2550 for (int i = 0; i < d->width; ++i) {
never evaluated: i < d->width
0
2551 if (!qIsGray(b[i]))
never evaluated: !qIsGray(b[i])
0
2552 return false;
never executed: return false;
0
2553 }
never executed: }
0
2554 }
never executed: }
0
2555 return true;
never executed: return true;
0
2556 case Format_RGB16: -
2557 for (int j = 0; j < d->height; ++j) {
never evaluated: j < d->height
0
2558 const quint16 *b = (const quint16 *)constScanLine(j); -
2559 for (int i = 0; i < d->width; ++i) {
never evaluated: i < d->width
0
2560 if (!qIsGray(qConvertRgb16To32(b[i])))
never evaluated: !qIsGray(qConvertRgb16To32(b[i]))
0
2561 return false;
never executed: return false;
0
2562 }
never executed: }
0
2563 }
never executed: }
0
2564 return true;
never executed: return true;
0
2565 default: -
2566 break;
never executed: break;
0
2567 } -
2568 -
2569 const int buffer_size = 2048; -
2570 uint buffer[buffer_size]; -
2571 const QPixelLayout *layout = &qPixelLayouts[d->format]; -
2572 FetchPixelsFunc fetch = qFetchPixels[layout->bpp]; -
2573 for (int j = 0; j < d->height; ++j) {
never evaluated: j < d->height
0
2574 const uchar *b = constScanLine(j); -
2575 int x = 0; -
2576 while (x < d->width) {
never evaluated: x < d->width
0
2577 int l = qMin(d->width - x, buffer_size); -
2578 const uint *ptr = fetch(buffer, b, x, l); -
2579 ptr = layout->convertToARGB32PM(buffer, ptr, l, layout, 0); -
2580 for (int i = 0; i < l; ++i) {
never evaluated: i < l
0
2581 if (!qIsGray(ptr[i]))
never evaluated: !qIsGray(ptr[i])
0
2582 return false;
never executed: return false;
0
2583 }
never executed: }
0
2584 x += l; -
2585 }
never executed: }
0
2586 }
never executed: }
0
2587 return true;
never executed: return true;
0
2588} -
2589bool QImage::isGrayscale() const -
2590{ -
2591 if (!d)
partially evaluated: !d
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:37
0-37
2592 return false;
never executed: return false;
0
2593 -
2594 switch (depth()) { -
2595 case 32: -
2596 case 24: -
2597 case 16: -
2598 return allGray();
never executed: return allGray();
0
2599 case 8: { -
2600 for (int i = 0; i < colorCount(); i++)
evaluated: i < colorCount()
TRUEFALSE
yes
Evaluation Count:3082
yes
Evaluation Count:12
12-3082
2601 if (d->colortable.at(i) != qRgb(i,i,i))
evaluated: d->colortable.at(i) != qRgb(i,i,i)
TRUEFALSE
yes
Evaluation Count:8
yes
Evaluation Count:3074
8-3074
2602 return false;
executed: return false;
Execution Count:8
8
2603 return true;
executed: return true;
Execution Count:12
12
2604 } -
2605 } -
2606 return false;
executed: return false;
Execution Count:17
17
2607} -
2608QImage QImage::scaled(const QSize& s, Qt::AspectRatioMode aspectMode, Qt::TransformationMode mode) const -
2609{ -
2610 if (!d) {
partially evaluated: !d
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:169
0-169
2611 QMessageLogger("image/qimage.cpp", 3870, __PRETTY_FUNCTION__).warning("QImage::scaled: Image is a null image"); -
2612 return QImage();
never executed: return QImage();
0
2613 } -
2614 if (s.isEmpty())
evaluated: s.isEmpty()
TRUEFALSE
yes
Evaluation Count:19
yes
Evaluation Count:150
19-150
2615 return QImage();
executed: return QImage();
Execution Count:19
19
2616 -
2617 QSize newSize = size(); -
2618 newSize.scale(s, aspectMode); -
2619 newSize.rwidth() = qMax(newSize.width(), 1); -
2620 newSize.rheight() = qMax(newSize.height(), 1); -
2621 if (newSize == size())
evaluated: newSize == size()
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:148
2-148
2622 return *this;
executed: return *this;
Execution Count:2
2
2623 -
2624 QTransform wm = QTransform::fromScale((qreal)newSize.width() / width(), (qreal)newSize.height() / height()); -
2625 QImage img = transformed(wm, mode); -
2626 return img;
executed: return img;
Execution Count:148
148
2627} -
2628QImage QImage::scaledToWidth(int w, Qt::TransformationMode mode) const -
2629{ -
2630 if (!d) {
never evaluated: !d
0
2631 QMessageLogger("image/qimage.cpp", 3905, __PRETTY_FUNCTION__).warning("QImage::scaleWidth: Image is a null image"); -
2632 return QImage();
never executed: return QImage();
0
2633 } -
2634 if (w <= 0)
never evaluated: w <= 0
0
2635 return QImage();
never executed: return QImage();
0
2636 -
2637 qreal factor = (qreal) w / width(); -
2638 QTransform wm = QTransform::fromScale(factor, factor); -
2639 return transformed(wm, mode);
never executed: return transformed(wm, mode);
0
2640} -
2641QImage QImage::scaledToHeight(int h, Qt::TransformationMode mode) const -
2642{ -
2643 if (!d) {
never evaluated: !d
0
2644 QMessageLogger("image/qimage.cpp", 3933, __PRETTY_FUNCTION__).warning("QImage::scaleHeight: Image is a null image"); -
2645 return QImage();
never executed: return QImage();
0
2646 } -
2647 if (h <= 0)
never evaluated: h <= 0
0
2648 return QImage();
never executed: return QImage();
0
2649 -
2650 qreal factor = (qreal) h / height(); -
2651 QTransform wm = QTransform::fromScale(factor, factor); -
2652 return transformed(wm, mode);
never executed: return transformed(wm, mode);
0
2653} -
2654QMatrix QImage::trueMatrix(const QMatrix &matrix, int w, int h) -
2655{ -
2656 return trueMatrix(QTransform(matrix), w, h).toAffine();
never executed: return trueMatrix(QTransform(matrix), w, h).toAffine();
0
2657} -
2658QImage QImage::transformed(const QMatrix &matrix, Qt::TransformationMode mode) const -
2659{ -
2660 return transformed(QTransform(matrix), mode);
executed: return transformed(QTransform(matrix), mode);
Execution Count:320
320
2661} -
2662QImage QImage::createAlphaMask(Qt::ImageConversionFlags flags) const -
2663{ -
2664 if (!d || d->format == QImage::Format_RGB32)
partially evaluated: !d
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:326
partially evaluated: d->format == QImage::Format_RGB32
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:326
0-326
2665 return QImage();
never executed: return QImage();
0
2666 -
2667 if (d->depth == 1) {
evaluated: d->depth == 1
TRUEFALSE
yes
Evaluation Count:136
yes
Evaluation Count:190
136-190
2668 -
2669 -
2670 return convertToFormat(Format_Indexed8, flags).createAlphaMask(flags);
executed: return convertToFormat(Format_Indexed8, flags).createAlphaMask(flags);
Execution Count:136
136
2671 } -
2672 -
2673 QImage mask(d->width, d->height, Format_MonoLSB); -
2674 if (!mask.isNull())
partially evaluated: !mask.isNull()
TRUEFALSE
yes
Evaluation Count:190
no
Evaluation Count:0
0-190
2675 dither_to_Mono(mask.d, d, flags, true);
executed: dither_to_Mono(mask.d, d, flags, true);
Execution Count:190
190
2676 return mask;
executed: return mask;
Execution Count:190
190
2677} -
2678QImage QImage::createHeuristicMask(bool clipTight) const -
2679{ -
2680 if (!d)
partially evaluated: !d
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2
0-2
2681 return QImage();
never executed: return QImage();
0
2682 -
2683 if (d->depth != 32) {
evaluated: d->depth != 32
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:1
1
2684 QImage img32 = convertToFormat(Format_RGB32); -
2685 return img32.createHeuristicMask(clipTight);
executed: return img32.createHeuristicMask(clipTight);
Execution Count:1
1
2686 } -
2687 -
2688 -
2689 -
2690 int w = width(); -
2691 int h = height(); -
2692 QImage m(w, h, Format_MonoLSB); -
2693 if ((m).isNull()) { QMessageLogger("image/qimage.cpp", 4058, __PRETTY_FUNCTION__).warning("QImage: out of memory, returning null image"); return QImage(); };
never executed: return QImage();
partially evaluated: (m).isNull()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1
0-1
2694 m.setColorCount(2); -
2695 m.setColor(0, QColor(Qt::color0).rgba()); -
2696 m.setColor(1, QColor(Qt::color1).rgba()); -
2697 m.fill(0xff); -
2698 -
2699 QRgb background = (*((QRgb*)scanLine(0)+0) & 0x00ffffff); -
2700 if (background != (*((QRgb*)scanLine(0)+w-1) & 0x00ffffff) &&
partially evaluated: background != (*((QRgb*)scanLine(0)+w-1) & 0x00ffffff)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1
0-1
2701 background != (*((QRgb*)scanLine(h-1)+0) & 0x00ffffff) &&
never evaluated: background != (*((QRgb*)scanLine(h-1)+0) & 0x00ffffff)
0
2702 background != (*((QRgb*)scanLine(h-1)+w-1) & 0x00ffffff)) {
never evaluated: background != (*((QRgb*)scanLine(h-1)+w-1) & 0x00ffffff)
0
2703 background = (*((QRgb*)scanLine(0)+w-1) & 0x00ffffff); -
2704 if (background != (*((QRgb*)scanLine(h-1)+w-1) & 0x00ffffff) &&
never evaluated: background != (*((QRgb*)scanLine(h-1)+w-1) & 0x00ffffff)
0
2705 background != (*((QRgb*)scanLine(h-1)+0) & 0x00ffffff) &&
never evaluated: background != (*((QRgb*)scanLine(h-1)+0) & 0x00ffffff)
0
2706 (*((QRgb*)scanLine(h-1)+0) & 0x00ffffff) == (*((QRgb*)scanLine(h-1)+w-1) & 0x00ffffff)) {
never evaluated: (*((QRgb*)scanLine(h-1)+0) & 0x00ffffff) == (*((QRgb*)scanLine(h-1)+w-1) & 0x00ffffff)
0
2707 background = (*((QRgb*)scanLine(h-1)+w-1) & 0x00ffffff); -
2708 }
never executed: }
0
2709 }
never executed: }
0
2710 -
2711 int x,y; -
2712 bool done = false; -
2713 uchar *ypp, *ypc, *ypn; -
2714 while(!done) {
evaluated: !done
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:1
1-2
2715 done = true; -
2716 ypn = m.scanLine(0); -
2717 ypc = 0; -
2718 for (y = 0; y < h; y++) {
evaluated: y < h
TRUEFALSE
yes
Evaluation Count:8
yes
Evaluation Count:2
2-8
2719 ypp = ypc; -
2720 ypc = ypn; -
2721 ypn = (y == h-1) ? 0 : m.scanLine(y+1);
evaluated: (y == h-1)
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:6
2-6
2722 QRgb *p = (QRgb *)scanLine(y); -
2723 for (x = 0; x < w; x++) {
evaluated: x < w
TRUEFALSE
yes
Evaluation Count:32
yes
Evaluation Count:8
8-32
2724 -
2725 -
2726 if ((x == 0 || y == 0 || x == w-1 || y == h-1 ||
evaluated: x == 0
TRUEFALSE
yes
Evaluation Count:8
yes
Evaluation Count:24
evaluated: y == 0
TRUEFALSE
yes
Evaluation Count:6
yes
Evaluation Count:18
evaluated: x == w-1
TRUEFALSE
yes
Evaluation Count:6
yes
Evaluation Count:12
evaluated: y == h-1
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:8
4-24
2727 !(*(ypc + ((x-1) >> 3)) & (1 << ((x-1) & 7))) ||
evaluated: !(*(ypc + ((x-1) >> 3)) & (1 << ((x-1) & 7)))
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:4
4
2728 !(*(ypc + ((x+1) >> 3)) & (1 << ((x+1) & 7))) ||
evaluated: !(*(ypc + ((x+1) >> 3)) & (1 << ((x+1) & 7)))
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:2
2
2729 !(*(ypp + (x >> 3)) & (1 << (x & 7))) ||
evaluated: !(*(ypp + (x >> 3)) & (1 << (x & 7)))
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:1
1
2730 !(*(ypn + (x >> 3)) & (1 << (x & 7)))) &&
partially evaluated: !(*(ypn + (x >> 3)) & (1 << (x & 7)))
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1
0-1
2731 ( (*(ypc + (x >> 3)) & (1 << (x & 7)))) &&
evaluated: ( (*(ypc + (x >> 3)) & (1 << (x & 7))))
TRUEFALSE
yes
Evaluation Count:19
yes
Evaluation Count:12
12-19
2732 ((*p & 0x00ffffff) == background)) {
evaluated: ((*p & 0x00ffffff) == background)
TRUEFALSE
yes
Evaluation Count:12
yes
Evaluation Count:7
7-12
2733 done = false; -
2734 *(ypc + (x >> 3)) &= ~(1 << (x & 7)); -
2735 }
executed: }
Execution Count:12
12
2736 p++; -
2737 }
executed: }
Execution Count:32
32
2738 }
executed: }
Execution Count:8
8
2739 }
executed: }
Execution Count:2
2
2740 -
2741 if (!clipTight) {
partially evaluated: !clipTight
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1
0-1
2742 ypn = m.scanLine(0); -
2743 ypc = 0; -
2744 for (y = 0; y < h; y++) {
never evaluated: y < h
0
2745 ypp = ypc; -
2746 ypc = ypn; -
2747 ypn = (y == h-1) ? 0 : m.scanLine(y+1);
never evaluated: (y == h-1)
0
2748 QRgb *p = (QRgb *)scanLine(y); -
2749 for (x = 0; x < w; x++) {
never evaluated: x < w
0
2750 if ((*p & 0x00ffffff) != background) {
never evaluated: (*p & 0x00ffffff) != background
0
2751 if (x > 0)
never evaluated: x > 0
0
2752 *(ypc + ((x-1) >> 3)) |= (1 << ((x-1) & 7));
never executed: *(ypc + ((x-1) >> 3)) |= (1 << ((x-1) & 7));
0
2753 if (x < w-1)
never evaluated: x < w-1
0
2754 *(ypc + ((x+1) >> 3)) |= (1 << ((x+1) & 7));
never executed: *(ypc + ((x+1) >> 3)) |= (1 << ((x+1) & 7));
0
2755 if (y > 0)
never evaluated: y > 0
0
2756 *(ypp + (x >> 3)) |= (1 << (x & 7));
never executed: *(ypp + (x >> 3)) |= (1 << (x & 7));
0
2757 if (y < h-1)
never evaluated: y < h-1
0
2758 *(ypn + (x >> 3)) |= (1 << (x & 7));
never executed: *(ypn + (x >> 3)) |= (1 << (x & 7));
0
2759 }
never executed: }
0
2760 p++; -
2761 }
never executed: }
0
2762 }
never executed: }
0
2763 }
never executed: }
0
2764 -
2765 -
2766 -
2767 return m;
executed: return m;
Execution Count:1
1
2768} -
2769QImage QImage::createMaskFromColor(QRgb color, Qt::MaskMode mode) const -
2770{ -
2771 if (!d)
partially evaluated: !d
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:4
0-4
2772 return QImage();
never executed: return QImage();
0
2773 QImage maskImage(size(), QImage::Format_MonoLSB); -
2774 if ((maskImage).isNull()) { QMessageLogger("image/qimage.cpp", 4151, __PRETTY_FUNCTION__).warning("QImage: out of memory, returning null image"); return QImage(); };
never executed: return QImage();
partially evaluated: (maskImage).isNull()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:4
0-4
2775 maskImage.fill(0); -
2776 uchar *s = maskImage.bits(); -
2777 -
2778 if (depth() == 32) {
evaluated: depth() == 32
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:1
1-3
2779 for (int h = 0; h < d->height; h++) {
evaluated: h < d->height
TRUEFALSE
yes
Evaluation Count:106
yes
Evaluation Count:3
3-106
2780 const uint *sl = (uint *) scanLine(h); -
2781 for (int w = 0; w < d->width; w++) {
evaluated: w < d->width
TRUEFALSE
yes
Evaluation Count:10018
yes
Evaluation Count:106
106-10018
2782 if (sl[w] == color)
evaluated: sl[w] == color
TRUEFALSE
yes
Evaluation Count:10002
yes
Evaluation Count:16
16-10002
2783 *(s + (w >> 3)) |= (1 << (w & 7));
executed: *(s + (w >> 3)) |= (1 << (w & 7));
Execution Count:10002
10002
2784 }
executed: }
Execution Count:10018
10018
2785 s += maskImage.bytesPerLine(); -
2786 }
executed: }
Execution Count:106
106
2787 } else {
executed: }
Execution Count:3
3
2788 for (int h = 0; h < d->height; h++) {
evaluated: h < d->height
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:1
1-3
2789 for (int w = 0; w < d->width; w++) {
evaluated: w < d->width
TRUEFALSE
yes
Evaluation Count:9
yes
Evaluation Count:3
3-9
2790 if ((uint) pixel(w, h) == color)
evaluated: (uint) pixel(w, h) == color
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:8
1-8
2791 *(s + (w >> 3)) |= (1 << (w & 7));
executed: *(s + (w >> 3)) |= (1 << (w & 7));
Execution Count:1
1
2792 }
executed: }
Execution Count:9
9
2793 s += maskImage.bytesPerLine(); -
2794 }
executed: }
Execution Count:3
3
2795 }
executed: }
Execution Count:1
1
2796 if (mode == Qt::MaskOutColor)
evaluated: mode == Qt::MaskOutColor
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:3
1-3
2797 maskImage.invertPixels();
executed: maskImage.invertPixels();
Execution Count:1
1
2798 return maskImage;
executed: return maskImage;
Execution Count:4
4
2799} -
2800QImage QImage::mirrored(bool horizontal, bool vertical) const -
2801{ -
2802 if (!d)
partially evaluated: !d
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:129
0-129
2803 return QImage();
never executed: return QImage();
0
2804 -
2805 if ((d->width <= 1 && d->height <= 1) || (!horizontal && !vertical))
partially evaluated: d->width <= 1
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:129
never evaluated: d->height <= 1
partially evaluated: !horizontal
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:129
never evaluated: !vertical
0-129
2806 return *this;
never executed: return *this;
0
2807 -
2808 int w = d->width; -
2809 int h = d->height; -
2810 -
2811 QImage result(d->width, d->height, d->format); -
2812 if ((result).isNull()) { QMessageLogger("image/qimage.cpp", 4206, __PRETTY_FUNCTION__).warning("QImage: out of memory, returning null image"); return QImage(); };
never executed: return QImage();
partially evaluated: (result).isNull()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:129
0-129
2813 -
2814 -
2815 if (!result.d)
partially evaluated: !result.d
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:129
0-129
2816 return QImage();
never executed: return QImage();
0
2817 -
2818 result.d->colortable = d->colortable; -
2819 result.d->has_alpha_clut = d->has_alpha_clut; -
2820 result.d->devicePixelRatio = d->devicePixelRatio; -
2821 -
2822 if (depth() == 1)
partially evaluated: depth() == 1
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:129
0-129
2823 w = (w+7)/8;
never executed: w = (w+7)/8;
0
2824 int dxi = horizontal ? -1 : 1;
partially evaluated: horizontal
TRUEFALSE
yes
Evaluation Count:129
no
Evaluation Count:0
0-129
2825 int dxs = horizontal ? w-1 : 0;
partially evaluated: horizontal
TRUEFALSE
yes
Evaluation Count:129
no
Evaluation Count:0
0-129
2826 int dyi = vertical ? -1 : 1;
partially evaluated: vertical
TRUEFALSE
yes
Evaluation Count:129
no
Evaluation Count:0
0-129
2827 int dy = vertical ? h-1: 0;
partially evaluated: vertical
TRUEFALSE
yes
Evaluation Count:129
no
Evaluation Count:0
0-129
2828 -
2829 -
2830 if (d->depth == 1 || d->depth == 8) {
partially evaluated: d->depth == 1
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:129
evaluated: d->depth == 8
TRUEFALSE
yes
Evaluation Count:12
yes
Evaluation Count:117
0-129
2831 for (int sy = 0; sy < h; sy++, dy += dyi) {
evaluated: sy < h
TRUEFALSE
yes
Evaluation Count:156
yes
Evaluation Count:12
12-156
2832 quint8* ssl = (quint8*)(d->data + sy*d->bytes_per_line); -
2833 quint8* dsl = (quint8*)(result.d->data + dy*result.d->bytes_per_line); -
2834 int dx = dxs; -
2835 for (int sx = 0; sx < w; sx++, dx += dxi)
evaluated: sx < w
TRUEFALSE
yes
Evaluation Count:8424
yes
Evaluation Count:156
156-8424
2836 dsl[dx] = ssl[sx];
executed: dsl[dx] = ssl[sx];
Execution Count:8424
8424
2837 }
executed: }
Execution Count:156
156
2838 }
executed: }
Execution Count:12
12
2839 -
2840 else if (d->depth == 16) {
evaluated: d->depth == 16
TRUEFALSE
yes
Evaluation Count:24
yes
Evaluation Count:93
24-93
2841 for (int sy = 0; sy < h; sy++, dy += dyi) {
evaluated: sy < h
TRUEFALSE
yes
Evaluation Count:312
yes
Evaluation Count:24
24-312
2842 quint16* ssl = (quint16*)(d->data + sy*d->bytes_per_line); -
2843 quint16* dsl = (quint16*)(result.d->data + dy*result.d->bytes_per_line); -
2844 int dx = dxs; -
2845 for (int sx = 0; sx < w; sx++, dx += dxi)
evaluated: sx < w
TRUEFALSE
yes
Evaluation Count:16848
yes
Evaluation Count:312
312-16848
2846 dsl[dx] = ssl[sx];
executed: dsl[dx] = ssl[sx];
Execution Count:16848
16848
2847 }
executed: }
Execution Count:312
312
2848 }
executed: }
Execution Count:24
24
2849 -
2850 else if (d->depth == 24) {
evaluated: d->depth == 24
TRUEFALSE
yes
Evaluation Count:48
yes
Evaluation Count:45
45-48
2851 for (int sy = 0; sy < h; sy++, dy += dyi) {
evaluated: sy < h
TRUEFALSE
yes
Evaluation Count:624
yes
Evaluation Count:48
48-624
2852 quint24* ssl = (quint24*)(d->data + sy*d->bytes_per_line); -
2853 quint24* dsl = (quint24*)(result.d->data + dy*result.d->bytes_per_line); -
2854 int dx = dxs; -
2855 for (int sx = 0; sx < w; sx++, dx += dxi)
evaluated: sx < w
TRUEFALSE
yes
Evaluation Count:33696
yes
Evaluation Count:624
624-33696
2856 dsl[dx] = ssl[sx];
executed: dsl[dx] = ssl[sx];
Execution Count:33696
33696
2857 }
executed: }
Execution Count:624
624
2858 }
executed: }
Execution Count:48
48
2859 -
2860 else if (d->depth == 32) {
partially evaluated: d->depth == 32
TRUEFALSE
yes
Evaluation Count:45
no
Evaluation Count:0
0-45
2861 for (int sy = 0; sy < h; sy++, dy += dyi) {
evaluated: sy < h
TRUEFALSE
yes
Evaluation Count:666
yes
Evaluation Count:45
45-666
2862 quint32* ssl = (quint32*)(d->data + sy*d->bytes_per_line); -
2863 quint32* dsl = (quint32*)(result.d->data + dy*result.d->bytes_per_line); -
2864 int dx = dxs; -
2865 for (int sx = 0; sx < w; sx++, dx += dxi)
evaluated: sx < w
TRUEFALSE
yes
Evaluation Count:43932
yes
Evaluation Count:666
666-43932
2866 dsl[dx] = ssl[sx];
executed: dsl[dx] = ssl[sx];
Execution Count:43932
43932
2867 }
executed: }
Execution Count:666
666
2868 }
executed: }
Execution Count:45
45
2869 -
2870 -
2871 if (horizontal && d->depth == 1) {
partially evaluated: horizontal
TRUEFALSE
yes
Evaluation Count:129
no
Evaluation Count:0
partially evaluated: d->depth == 1
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:129
0-129
2872 int shift = width() % 8; -
2873 for (int y = h-1; y >= 0; y--) {
never evaluated: y >= 0
0
2874 quint8* a0 = (quint8*)(result.d->data + y*d->bytes_per_line); -
2875 -
2876 quint8* a = a0+dxs; -
2877 while (a >= a0) {
never evaluated: a >= a0
0
2878 *a = bitflip[*a]; -
2879 a--; -
2880 }
never executed: }
0
2881 -
2882 if (shift != 0) {
never evaluated: shift != 0
0
2883 a = a0+dxs; -
2884 quint8 c = 0; -
2885 if (format() == Format_MonoLSB) {
never evaluated: format() == Format_MonoLSB
0
2886 while (a >= a0) {
never evaluated: a >= a0
0
2887 quint8 nc = *a << shift; -
2888 *a = (*a >> (8-shift)) | c; -
2889 --a; -
2890 c = nc; -
2891 }
never executed: }
0
2892 } else {
never executed: }
0
2893 while (a >= a0) {
never evaluated: a >= a0
0
2894 quint8 nc = *a >> shift; -
2895 *a = (*a << (8-shift)) | c; -
2896 --a; -
2897 c = nc; -
2898 }
never executed: }
0
2899 }
never executed: }
0
2900 } -
2901 }
never executed: }
0
2902 }
never executed: }
0
2903 -
2904 return result;
executed: return result;
Execution Count:129
129
2905} -
2906QImage QImage::rgbSwapped() const -
2907{ -
2908 if (isNull())
partially evaluated: isNull()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:26
0-26
2909 return *this;
never executed: return *this;
0
2910 QImage res; -
2911 switch (d->format) { -
2912 case Format_Invalid: -
2913 case NImageFormats: -
2914 qt_noop(); -
2915 return res;
never executed: return res;
0
2916 case Format_Mono: -
2917 case Format_MonoLSB: -
2918 case Format_Indexed8: -
2919 res = copy(); -
2920 for (int i = 0; i < res.d->colortable.size(); i++) {
evaluated: i < res.d->colortable.size()
TRUEFALSE
yes
Evaluation Count:200
yes
Evaluation Count:2
2-200
2921 QRgb c = res.d->colortable.at(i); -
2922 res.d->colortable[i] = QRgb(((c << 16) & 0xff0000) | ((c >> 16) & 0xff) | (c & 0xff00ff00)); -
2923 }
executed: }
Execution Count:200
200
2924 return res;
executed: return res;
Execution Count:2
2
2925 case Format_RGB32: -
2926 case Format_ARGB32: -
2927 case Format_ARGB32_Premultiplied: -
2928 res = QImage(d->width, d->height, d->format); -
2929 if ((res).isNull()) { QMessageLogger("image/qimage.cpp", 4333, __PRETTY_FUNCTION__).warning("QImage: out of memory, returning null image"); return QImage(); };
never executed: return QImage();
partially evaluated: (res).isNull()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:6
0-6
2930 for (int i = 0; i < d->height; i++) {
evaluated: i < d->height
TRUEFALSE
yes
Evaluation Count:6
yes
Evaluation Count:6
6
2931 uint *q = (uint*)res.scanLine(i); -
2932 uint *p = (uint*)constScanLine(i); -
2933 uint *end = p + d->width; -
2934 while (p < end) {
evaluated: p < end
TRUEFALSE
yes
Evaluation Count:600
yes
Evaluation Count:6
6-600
2935 *q = ((*p << 16) & 0xff0000) | ((*p >> 16) & 0xff) | (*p & 0xff00ff00); -
2936 p++; -
2937 q++; -
2938 }
executed: }
Execution Count:600
600
2939 }
executed: }
Execution Count:6
6
2940 return res;
executed: return res;
Execution Count:6
6
2941 case Format_RGB16: -
2942 res = QImage(d->width, d->height, d->format); -
2943 if ((res).isNull()) { QMessageLogger("image/qimage.cpp", 4347, __PRETTY_FUNCTION__).warning("QImage: out of memory, returning null image"); return QImage(); };
never executed: return QImage();
partially evaluated: (res).isNull()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2
0-2
2944 for (int i = 0; i < d->height; i++) {
evaluated: i < d->height
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:2
2
2945 ushort *q = (ushort*)res.scanLine(i); -
2946 const ushort *p = (const ushort*)constScanLine(i); -
2947 const ushort *end = p + d->width; -
2948 while (p < end) {
evaluated: p < end
TRUEFALSE
yes
Evaluation Count:200
yes
Evaluation Count:2
2-200
2949 *q = ((*p << 11) & 0xf800) | ((*p >> 11) & 0x1f) | (*p & 0x07e0); -
2950 p++; -
2951 q++; -
2952 }
executed: }
Execution Count:200
200
2953 }
executed: }
Execution Count:2
2
2954 return res;
executed: return res;
Execution Count:2
2
2955 default: -
2956 break;
executed: break;
Execution Count:16
16
2957 } -
2958 -
2959 res = QImage(d->width, d->height, d->format); -
2960 if ((res).isNull()) { QMessageLogger("image/qimage.cpp", 4364, __PRETTY_FUNCTION__).warning("QImage: out of memory, returning null image"); return QImage(); };
never executed: return QImage();
partially evaluated: (res).isNull()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:16
0-16
2961 const QPixelLayout *layout = &qPixelLayouts[d->format]; -
2962 qt_noop(); -
2963 FetchPixelsFunc fetch = qFetchPixels[layout->bpp]; -
2964 StorePixelsFunc store = qStorePixels[layout->bpp]; -
2965 -
2966 const uint redBlueMask = (1 << layout->redWidth) - 1; -
2967 const uint alphaGreenMask = (((1 << layout->alphaWidth) - 1) << layout->alphaShift) -
2968 | (((1 << layout->greenWidth) - 1) << layout->greenShift); -
2969 -
2970 const int buffer_size = 2048; -
2971 uint buffer[buffer_size]; -
2972 for (int i = 0; i < d->height; ++i) {
evaluated: i < d->height
TRUEFALSE
yes
Evaluation Count:16
yes
Evaluation Count:16
16
2973 uchar *q = res.scanLine(i); -
2974 const uchar *p = constScanLine(i); -
2975 int x = 0; -
2976 while (x < d->width) {
evaluated: x < d->width
TRUEFALSE
yes
Evaluation Count:16
yes
Evaluation Count:16
16
2977 int l = qMin(d->width - x, buffer_size); -
2978 const uint *ptr = fetch(buffer, p, x, l); -
2979 for (int j = 0; j < l; ++j) {
evaluated: j < l
TRUEFALSE
yes
Evaluation Count:1600
yes
Evaluation Count:16
16-1600
2980 uint red = (ptr[j] >> layout->redShift) & redBlueMask; -
2981 uint blue = (ptr[j] >> layout->blueShift) & redBlueMask; -
2982 buffer[j] = (ptr[j] & alphaGreenMask) -
2983 | (red << layout->blueShift) -
2984 | (blue << layout->redShift); -
2985 }
executed: }
Execution Count:1600
1600
2986 store(q, buffer, x, l); -
2987 x += l; -
2988 }
executed: }
Execution Count:16
16
2989 }
executed: }
Execution Count:16
16
2990 return res;
executed: return res;
Execution Count:16
16
2991} -
2992bool QImage::load(const QString &fileName, const char* format) -
2993{ -
2994 QImage image = QImageReader(fileName, format).read(); -
2995 operator=(image); -
2996 return !isNull();
executed: return !isNull();
Execution Count:190
190
2997} -
2998bool QImage::load(QIODevice* device, const char* format) -
2999{ -
3000 QImage image = QImageReader(device, format).read(); -
3001 operator=(image); -
3002 return !isNull();
executed: return !isNull();
Execution Count:2
2
3003} -
3004bool QImage::loadFromData(const uchar *data, int len, const char *format) -
3005{ -
3006 QImage image = fromData(data, len, format); -
3007 operator=(image); -
3008 return !isNull();
executed: return !isNull();
Execution Count:40
40
3009} -
3010QImage QImage::fromData(const uchar *data, int size, const char *format) -
3011{ -
3012 QByteArray a = QByteArray::fromRawData(reinterpret_cast<const char *>(data), size); -
3013 QBuffer b; -
3014 b.setData(a); -
3015 b.open(QIODevice::ReadOnly); -
3016 return QImageReader(&b, format).read();
executed: return QImageReader(&b, format).read();
Execution Count:68
68
3017} -
3018bool QImage::save(const QString &fileName, const char *format, int quality) const -
3019{ -
3020 if (isNull())
partially evaluated: isNull()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:278
0-278
3021 return false;
never executed: return false;
0
3022 QImageWriter writer(fileName, format); -
3023 return d->doImageIO(this, &writer, quality);
executed: return d->doImageIO(this, &writer, quality);
Execution Count:278
278
3024} -
3025bool QImage::save(QIODevice* device, const char* format, int quality) const -
3026{ -
3027 if (isNull())
partially evaluated: isNull()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:30
0-30
3028 return false;
never executed: return false;
0
3029 QImageWriter writer(device, format); -
3030 return d->doImageIO(this, &writer, quality);
executed: return d->doImageIO(this, &writer, quality);
Execution Count:30
30
3031} -
3032 -
3033 -
3034 -
3035 -
3036bool QImageData::doImageIO(const QImage *image, QImageWriter *writer, int quality) const -
3037{ -
3038 if (quality > 100 || quality < -1)
partially evaluated: quality > 100
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:308
partially evaluated: quality < -1
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:308
0-308
3039 QMessageLogger("image/qimage.cpp", 4551, __PRETTY_FUNCTION__).warning("QPixmap::save: Quality out of range [-1, 100]");
never executed: QMessageLogger("image/qimage.cpp", 4551, __PRETTY_FUNCTION__).warning("QPixmap::save: Quality out of range [-1, 100]");
0
3040 if (quality >= 0)
partially evaluated: quality >= 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:308
0-308
3041 writer->setQuality(qMin(quality,100));
never executed: writer->setQuality(qMin(quality,100));
0
3042 return writer->write(*image);
executed: return writer->write(*image);
Execution Count:308
308
3043} -
3044QDataStream &operator<<(QDataStream &s, const QImage &image) -
3045{ -
3046 if (s.version() >= 5) {
partially evaluated: s.version() >= 5
TRUEFALSE
yes
Evaluation Count:67
no
Evaluation Count:0
0-67
3047 if (image.isNull()) {
evaluated: image.isNull()
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:64
3-64
3048 s << (qint32) 0; -
3049 return s;
executed: return s;
Execution Count:3
3
3050 } else { -
3051 s << (qint32) 1; -
3052 -
3053 }
executed: }
Execution Count:64
64
3054 } -
3055 QImageWriter writer(s.device(), s.version() == 1 ? "bmp" : "png"); -
3056 writer.write(image); -
3057 return s;
executed: return s;
Execution Count:64
64
3058} -
3059QDataStream &operator>>(QDataStream &s, QImage &image) -
3060{ -
3061 if (s.version() >= 5) {
partially evaluated: s.version() >= 5
TRUEFALSE
yes
Evaluation Count:67
no
Evaluation Count:0
0-67
3062 qint32 nullMarker; -
3063 s >> nullMarker; -
3064 if (!nullMarker) {
evaluated: !nullMarker
TRUEFALSE
yes
Evaluation Count:5
yes
Evaluation Count:62
5-62
3065 image = QImage(); -
3066 return s;
executed: return s;
Execution Count:5
5
3067 } -
3068 }
executed: }
Execution Count:62
62
3069 image = QImageReader(s.device(), 0).read(); -
3070 return s;
executed: return s;
Execution Count:62
62
3071} -
3072bool QImage::operator==(const QImage & i) const -
3073{ -
3074 -
3075 if (i.d == d)
evaluated: i.d == d
TRUEFALSE
yes
Evaluation Count:103
yes
Evaluation Count:1544
103-1544
3076 return true;
executed: return true;
Execution Count:103
103
3077 if (!i.d || !d)
partially evaluated: !i.d
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1544
partially evaluated: !d
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1544
0-1544
3078 return false;
never executed: return false;
0
3079 -
3080 -
3081 if (i.d->height != d->height || i.d->width != d->width || i.d->format != d->format)
evaluated: i.d->height != d->height
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:1543
partially evaluated: i.d->width != d->width
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1543
partially evaluated: i.d->format != d->format
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1543
0-1543
3082 return false;
executed: return false;
Execution Count:1
1
3083 -
3084 if (d->format != Format_RGB32) {
evaluated: d->format != Format_RGB32
TRUEFALSE
yes
Evaluation Count:1150
yes
Evaluation Count:393
393-1150
3085 if (d->format >= Format_ARGB32) {
evaluated: d->format >= Format_ARGB32
TRUEFALSE
yes
Evaluation Count:994
yes
Evaluation Count:156
156-994
3086 const int n = d->width * d->depth / 8; -
3087 if (n == d->bytes_per_line && n == i.d->bytes_per_line) {
evaluated: n == d->bytes_per_line
TRUEFALSE
yes
Evaluation Count:649
yes
Evaluation Count:345
evaluated: n == i.d->bytes_per_line
TRUEFALSE
yes
Evaluation Count:584
yes
Evaluation Count:65
65-649
3088 if (memcmp(bits(), i.bits(), d->nbytes))
evaluated: memcmp(bits(), i.bits(), d->nbytes)
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:581
3-581
3089 return false;
executed: return false;
Execution Count:3
3
3090 } else {
executed: }
Execution Count:581
581
3091 for (int y = 0; y < d->height; ++y) {
evaluated: y < d->height
TRUEFALSE
yes
Evaluation Count:33491
yes
Evaluation Count:410
410-33491
3092 if (memcmp(scanLine(y), i.scanLine(y), n))
partially evaluated: memcmp(scanLine(y), i.scanLine(y), n)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:33491
0-33491
3093 return false;
never executed: return false;
0
3094 }
executed: }
Execution Count:33491
33491
3095 }
executed: }
Execution Count:410
410
3096 } else { -
3097 const int w = width(); -
3098 const int h = height(); -
3099 const QVector<QRgb> &colortable = d->colortable; -
3100 const QVector<QRgb> &icolortable = i.d->colortable; -
3101 for (int y=0; y<h; ++y) {
evaluated: y<h
TRUEFALSE
yes
Evaluation Count:13772
yes
Evaluation Count:156
156-13772
3102 for (int x=0; x<w; ++x) {
evaluated: x<w
TRUEFALSE
yes
Evaluation Count:4142555
yes
Evaluation Count:13772
13772-4142555
3103 if (colortable[pixelIndex(x, y)] != icolortable[i.pixelIndex(x, y)])
partially evaluated: colortable[pixelIndex(x, y)] != icolortable[i.pixelIndex(x, y)]
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:4142555
0-4142555
3104 return false;
never executed: return false;
0
3105 }
executed: }
Execution Count:4142555
4142555
3106 }
executed: }
Execution Count:13772
13772
3107 }
executed: }
Execution Count:156
156
3108 } else { -
3109 -
3110 for(int l = 0; l < d->height; l++) {
evaluated: l < d->height
TRUEFALSE
yes
Evaluation Count:62263
yes
Evaluation Count:382
382-62263
3111 int w = d->width; -
3112 const uint *p1 = reinterpret_cast<const uint*>(scanLine(l)); -
3113 const uint *p2 = reinterpret_cast<const uint*>(i.scanLine(l)); -
3114 while (w--) {
evaluated: w--
TRUEFALSE
yes
Evaluation Count:23558363
yes
Evaluation Count:62252
62252-23558363
3115 if ((*p1++ & 0x00ffffff) != (*p2++ & 0x00ffffff))
evaluated: (*p1++ & 0x00ffffff) != (*p2++ & 0x00ffffff)
TRUEFALSE
yes
Evaluation Count:11
yes
Evaluation Count:23558352
11-23558352
3116 return false;
executed: return false;
Execution Count:11
11
3117 }
executed: }
Execution Count:23558352
23558352
3118 }
executed: }
Execution Count:62252
62252
3119 }
executed: }
Execution Count:382
382
3120 return true;
executed: return true;
Execution Count:1529
1529
3121} -
3122bool QImage::operator!=(const QImage & i) const -
3123{ -
3124 return !(*this == i);
executed: return !(*this == i);
Execution Count:21
21
3125} -
3126int QImage::dotsPerMeterX() const -
3127{ -
3128 return d ? qRound(d->dpmx) : 0;
executed: return d ? qRound(d->dpmx) : 0;
Execution Count:13732
13732
3129} -
3130int QImage::dotsPerMeterY() const -
3131{ -
3132 return d ? qRound(d->dpmy) : 0;
executed: return d ? qRound(d->dpmy) : 0;
Execution Count:13609
13609
3133} -
3134void QImage::setDotsPerMeterX(int x) -
3135{ -
3136 if (!d || !x)
partially evaluated: !d
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:10123
evaluated: !x
TRUEFALSE
yes
Evaluation Count:220
yes
Evaluation Count:9903
0-10123
3137 return;
executed: return;
Execution Count:220
220
3138 detach(); -
3139 -
3140 if (d)
partially evaluated: d
TRUEFALSE
yes
Evaluation Count:9903
no
Evaluation Count:0
0-9903
3141 d->dpmx = x;
executed: d->dpmx = x;
Execution Count:9903
9903
3142}
executed: }
Execution Count:9903
9903
3143void QImage::setDotsPerMeterY(int y) -
3144{ -
3145 if (!d || !y)
partially evaluated: !d
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:10123
evaluated: !y
TRUEFALSE
yes
Evaluation Count:220
yes
Evaluation Count:9903
0-10123
3146 return;
executed: return;
Execution Count:220
220
3147 detach(); -
3148 -
3149 if (d)
partially evaluated: d
TRUEFALSE
yes
Evaluation Count:9903
no
Evaluation Count:0
0-9903
3150 d->dpmy = y;
executed: d->dpmy = y;
Execution Count:9903
9903
3151}
executed: }
Execution Count:9903
9903
3152QPoint QImage::offset() const -
3153{ -
3154 return d ? d->offset : QPoint();
executed: return d ? d->offset : QPoint();
Execution Count:4112
4112
3155} -
3156void QImage::setOffset(const QPoint& p) -
3157{ -
3158 if (!d)
never evaluated: !d
0
3159 return;
never executed: return;
0
3160 detach(); -
3161 -
3162 if (d)
never evaluated: d
0
3163 d->offset = p;
never executed: d->offset = p;
0
3164}
never executed: }
0
3165QStringList QImage::textKeys() const -
3166{ -
3167 return d ? QStringList(d->text.keys()) : QStringList();
executed: return d ? QStringList(d->text.keys()) : QStringList();
Execution Count:155
155
3168} -
3169QString QImage::text(const QString &key) const -
3170{ -
3171 if (!d)
partially evaluated: !d
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:145
0-145
3172 return QString();
never executed: return QString();
0
3173 -
3174 if (!key.isEmpty())
evaluated: !key.isEmpty()
TRUEFALSE
yes
Evaluation Count:142
yes
Evaluation Count:3
3-142
3175 return d->text.value(key);
executed: return d->text.value(key);
Execution Count:142
142
3176 -
3177 QString tmp; -
3178 for (QForeachContainer<__typeof__(d->text.keys())> _container_(d->text.keys()); !_container_.brk && _container_.i != _container_.e; __extension__ ({ ++_container_.brk; ++_container_.i; })) for (const QString &key = *_container_.i;; __extension__ ({--_container_.brk; break;})) { -
3179 if (!tmp.isEmpty())
evaluated: !tmp.isEmpty()
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:3
3
3180 tmp += QLatin1String("\n\n");
executed: tmp += QLatin1String("\n\n");
Execution Count:3
3
3181 tmp += key + QLatin1String(": ") + d->text.value(key).simplified(); -
3182 }
executed: }
Execution Count:6
6
3183 return tmp;
executed: return tmp;
Execution Count:3
3
3184} -
3185void QImage::setText(const QString &key, const QString &value) -
3186{ -
3187 if (!d)
partially evaluated: !d
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:319
0-319
3188 return;
never executed: return;
0
3189 detach(); -
3190 -
3191 if (d)
partially evaluated: d
TRUEFALSE
yes
Evaluation Count:319
no
Evaluation Count:0
0-319
3192 d->text.insert(key, value);
executed: d->text.insert(key, value);
Execution Count:319
319
3193}
executed: }
Execution Count:319
319
3194QPaintEngine *QImage::paintEngine() const -
3195{ -
3196 if (!d)
evaluated: !d
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:78076
1-78076
3197 return 0;
executed: return 0;
Execution Count:1
1
3198 -
3199 if (!d->paintEngine) {
evaluated: !d->paintEngine
TRUEFALSE
yes
Evaluation Count:5615
yes
Evaluation Count:72461
5615-72461
3200 QPaintDevice *paintDevice = const_cast<QImage *>(this); -
3201 QPaintEngine *paintEngine = 0; -
3202 QPlatformIntegration *platformIntegration = QGuiApplicationPrivate::platformIntegration(); -
3203 if (platformIntegration)
evaluated: platformIntegration
TRUEFALSE
yes
Evaluation Count:5525
yes
Evaluation Count:90
90-5525
3204 paintEngine = platformIntegration->createImagePaintEngine(paintDevice);
executed: paintEngine = platformIntegration->createImagePaintEngine(paintDevice);
Execution Count:5525
5525
3205 d->paintEngine = paintEngine ? paintEngine : new QRasterPaintEngine(paintDevice);
partially evaluated: paintEngine
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:5615
0-5615
3206 }
executed: }
Execution Count:5614
5614
3207 -
3208 return d->paintEngine;
executed: return d->paintEngine;
Execution Count:78075
78075
3209} -
3210 -
3211 -
3212 -
3213 -
3214 -
3215 -
3216 -
3217int QImage::metric(PaintDeviceMetric metric) const -
3218{ -
3219 if (!d)
evaluated: !d
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:94656
2-94656
3220 return 0;
executed: return 0;
Execution Count:2
2
3221 -
3222 switch (metric) { -
3223 case PdmWidth: -
3224 return d->width;
executed: return d->width;
Execution Count:39268
39268
3225 -
3226 case PdmHeight: -
3227 return d->height;
executed: return d->height;
Execution Count:44882
44882
3228 -
3229 case PdmWidthMM: -
3230 return qRound(d->width * 1000 / d->dpmx);
never executed: return qRound(d->width * 1000 / d->dpmx);
0
3231 -
3232 case PdmHeightMM: -
3233 return qRound(d->height * 1000 / d->dpmy);
never executed: return qRound(d->height * 1000 / d->dpmy);
0
3234 -
3235 case PdmNumColors: -
3236 return d->colortable.size();
never executed: return d->colortable.size();
0
3237 -
3238 case PdmDepth: -
3239 return d->depth;
executed: return d->depth;
Execution Count:5615
5615
3240 -
3241 case PdmDpiX: -
3242 return qRound(d->dpmx * 0.0254);
executed: return qRound(d->dpmx * 0.0254);
Execution Count:2
2
3243 break;
dead code: break;
-
3244 -
3245 case PdmDpiY: -
3246 return qRound(d->dpmy * 0.0254);
executed: return qRound(d->dpmy * 0.0254);
Execution Count:4884
4884
3247 break;
dead code: break;
-
3248 -
3249 case PdmPhysicalDpiX: -
3250 return qRound(d->dpmx * 0.0254 * d->devicePixelRatio);
executed: return qRound(d->dpmx * 0.0254 * d->devicePixelRatio);
Execution Count:2
2
3251 break;
dead code: break;
-
3252 -
3253 case PdmPhysicalDpiY: -
3254 return qRound(d->dpmy * 0.0254 * d->devicePixelRatio);
executed: return qRound(d->dpmy * 0.0254 * d->devicePixelRatio);
Execution Count:3
3
3255 break;
dead code: break;
-
3256 default: -
3257 QMessageLogger("image/qimage.cpp", 5003, __PRETTY_FUNCTION__).warning("QImage::metric(): Unhandled metric type %d", metric); -
3258 break;
never executed: break;
0
3259 } -
3260 return 0;
never executed: return 0;
0
3261} -
3262bool qt_xForm_helper(const QTransform &trueMat, int xoffset, int type, int depth, -
3263 uchar *dptr, int dbpl, int p_inc, int dHeight, -
3264 const uchar *sptr, int sbpl, int sWidth, int sHeight) -
3265{ -
3266 int m11 = int(trueMat.m11()*4096.0); -
3267 int m12 = int(trueMat.m12()*4096.0); -
3268 int m21 = int(trueMat.m21()*4096.0); -
3269 int m22 = int(trueMat.m22()*4096.0); -
3270 int dx = qRound(trueMat.dx()*4096.0); -
3271 int dy = qRound(trueMat.dy()*4096.0); -
3272 -
3273 int m21ydx = dx + (xoffset<<16) + (m11 + m21) / 2; -
3274 int m22ydy = dy + (m12 + m22) / 2; -
3275 uint trigx; -
3276 uint trigy; -
3277 uint maxws = sWidth<<12; -
3278 uint maxhs = sHeight<<12; -
3279 -
3280 for (int y=0; y<dHeight; y++) {
evaluated: y<dHeight
TRUEFALSE
yes
Evaluation Count:19
yes
Evaluation Count:2
2-19
3281 trigx = m21ydx; -
3282 trigy = m22ydy; -
3283 uchar *maxp = dptr + dbpl; -
3284 if (depth != 1) {
partially evaluated: depth != 1
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:19
0-19
3285 switch (depth) { -
3286 case 8: -
3287 while (dptr < maxp) {
never evaluated: dptr < maxp
0
3288 if (trigx < maxws && trigy < maxhs)
never evaluated: trigx < maxws
never evaluated: trigy < maxhs
0
3289 *dptr = *(sptr+sbpl*(trigy>>12)+(trigx>>12));
never executed: *dptr = *(sptr+sbpl*(trigy>>12)+(trigx>>12));
0
3290 trigx += m11; -
3291 trigy += m12; -
3292 dptr++; -
3293 }
never executed: }
0
3294 break;
never executed: break;
0
3295 -
3296 case 16: -
3297 while (dptr < maxp) {
never evaluated: dptr < maxp
0
3298 if (trigx < maxws && trigy < maxhs)
never evaluated: trigx < maxws
never evaluated: trigy < maxhs
0
3299 *((ushort*)dptr) = *((ushort *)(sptr+sbpl*(trigy>>12) + 0
3300 ((trigx>>12)<<1)));
never executed: *((ushort*)dptr) = *((ushort *)(sptr+sbpl*(trigy>>12) + ((trigx>>12)<<1)));
0
3301 trigx += m11; -
3302 trigy += m12; -
3303 dptr++; -
3304 dptr++; -
3305 }
never executed: }
0
3306 break;
never executed: break;
0
3307 -
3308 case 24: -
3309 while (dptr < maxp) {
never evaluated: dptr < maxp
0
3310 if (trigx < maxws && trigy < maxhs) {
never evaluated: trigx < maxws
never evaluated: trigy < maxhs
0
3311 const uchar *p2 = sptr+sbpl*(trigy>>12) + ((trigx>>12)*3); -
3312 dptr[0] = p2[0]; -
3313 dptr[1] = p2[1]; -
3314 dptr[2] = p2[2]; -
3315 }
never executed: }
0
3316 trigx += m11; -
3317 trigy += m12; -
3318 dptr += 3; -
3319 }
never executed: }
0
3320 break;
never executed: break;
0
3321 -
3322 case 32: -
3323 while (dptr < maxp) {
never evaluated: dptr < maxp
0
3324 if (trigx < maxws && trigy < maxhs)
never evaluated: trigx < maxws
never evaluated: trigy < maxhs
0
3325 *((uint*)dptr) = *((uint *)(sptr+sbpl*(trigy>>12) + 0
3326 ((trigx>>12)<<2)));
never executed: *((uint*)dptr) = *((uint *)(sptr+sbpl*(trigy>>12) + ((trigx>>12)<<2)));
0
3327 trigx += m11; -
3328 trigy += m12; -
3329 dptr += 4; -
3330 }
never executed: }
0
3331 break;
never executed: break;
0
3332 -
3333 default: { -
3334 return false;
never executed: return false;
0
3335 } -
3336 } -
3337 } else {
never executed: }
0
3338 switch (type) { -
3339 case 0: -
3340 while (dptr < maxp) {
evaluated: dptr < maxp
TRUEFALSE
yes
Evaluation Count:2556
yes
Evaluation Count:19
19-2556
3341 if (trigx < maxws && trigy < maxhs) { if (*(sptr+sbpl*(trigy>>12)+(trigx>>15)) & (1 << (7-((trigx>>12)&7)))) *dptr |= 128; } trigx += m11; trigy += m12;;
evaluated: trigx < maxws
TRUEFALSE
yes
Evaluation Count:2518
yes
Evaluation Count:38
partially evaluated: trigy < maxhs
TRUEFALSE
yes
Evaluation Count:2518
no
Evaluation Count:0
executed: *dptr |= 128;
Execution Count:2512
executed: }
Execution Count:2518
evaluated: *(sptr+sbpl*(trigy>>12)+(trigx>>15)) & (1 << (7-((trigx>>12)&7)))
TRUEFALSE
yes
Evaluation Count:2512
yes
Evaluation Count:6
0-2518
3342 if (trigx < maxws && trigy < maxhs) { if (*(sptr+sbpl*(trigy>>12)+(trigx>>15)) & (1 << (7-((trigx>>12)&7)))) *dptr |= 64; } trigx += m11; trigy += m12;;
evaluated: trigx < maxws
TRUEFALSE
yes
Evaluation Count:2509
yes
Evaluation Count:47
partially evaluated: trigy < maxhs
TRUEFALSE
yes
Evaluation Count:2509
no
Evaluation Count:0
executed: *dptr |= 64;
Execution Count:2506
executed: }
Execution Count:2509
evaluated: *(sptr+sbpl*(trigy>>12)+(trigx>>15)) & (1 << (7-((trigx>>12)&7)))
TRUEFALSE
yes
Evaluation Count:2506
yes
Evaluation Count:3
0-2509
3343 if (trigx < maxws && trigy < maxhs) { if (*(sptr+sbpl*(trigy>>12)+(trigx>>15)) & (1 << (7-((trigx>>12)&7)))) *dptr |= 32; } trigx += m11; trigy += m12;;
evaluated: trigx < maxws
TRUEFALSE
yes
Evaluation Count:2509
yes
Evaluation Count:47
partially evaluated: trigy < maxhs
TRUEFALSE
yes
Evaluation Count:2509
no
Evaluation Count:0
executed: *dptr |= 32;
Execution Count:2506
executed: }
Execution Count:2509
evaluated: *(sptr+sbpl*(trigy>>12)+(trigx>>15)) & (1 << (7-((trigx>>12)&7)))
TRUEFALSE
yes
Evaluation Count:2506
yes
Evaluation Count:3
0-2509
3344 if (trigx < maxws && trigy < maxhs) { if (*(sptr+sbpl*(trigy>>12)+(trigx>>15)) & (1 << (7-((trigx>>12)&7)))) *dptr |= 16; } trigx += m11; trigy += m12;;
evaluated: trigx < maxws
TRUEFALSE
yes
Evaluation Count:2509
yes
Evaluation Count:47
partially evaluated: trigy < maxhs
TRUEFALSE
yes
Evaluation Count:2509
no
Evaluation Count:0
executed: *dptr |= 16;
Execution Count:2503
executed: }
Execution Count:2509
evaluated: *(sptr+sbpl*(trigy>>12)+(trigx>>15)) & (1 << (7-((trigx>>12)&7)))
TRUEFALSE
yes
Evaluation Count:2503
yes
Evaluation Count:6
0-2509
3345 if (trigx < maxws && trigy < maxhs) { if (*(sptr+sbpl*(trigy>>12)+(trigx>>15)) & (1 << (7-((trigx>>12)&7)))) *dptr |= 8; } trigx += m11; trigy += m12;;
evaluated: trigx < maxws
TRUEFALSE
yes
Evaluation Count:2509
yes
Evaluation Count:47
partially evaluated: trigy < maxhs
TRUEFALSE
yes
Evaluation Count:2509
no
Evaluation Count:0
executed: *dptr |= 8;
Execution Count:2503
executed: }
Execution Count:2509
evaluated: *(sptr+sbpl*(trigy>>12)+(trigx>>15)) & (1 << (7-((trigx>>12)&7)))
TRUEFALSE
yes
Evaluation Count:2503
yes
Evaluation Count:6
0-2509
3346 if (trigx < maxws && trigy < maxhs) { if (*(sptr+sbpl*(trigy>>12)+(trigx>>15)) & (1 << (7-((trigx>>12)&7)))) *dptr |= 4; } trigx += m11; trigy += m12;;
evaluated: trigx < maxws
TRUEFALSE
yes
Evaluation Count:2509
yes
Evaluation Count:47
partially evaluated: trigy < maxhs
TRUEFALSE
yes
Evaluation Count:2509
no
Evaluation Count:0
executed: *dptr |= 4;
Execution Count:2503
executed: }
Execution Count:2509
evaluated: *(sptr+sbpl*(trigy>>12)+(trigx>>15)) & (1 << (7-((trigx>>12)&7)))
TRUEFALSE
yes
Evaluation Count:2503
yes
Evaluation Count:6
0-2509
3347 if (trigx < maxws && trigy < maxhs) { if (*(sptr+sbpl*(trigy>>12)+(trigx>>15)) & (1 << (7-((trigx>>12)&7)))) *dptr |= 2; } trigx += m11; trigy += m12;;
evaluated: trigx < maxws
TRUEFALSE
yes
Evaluation Count:2509
yes
Evaluation Count:47
partially evaluated: trigy < maxhs
TRUEFALSE
yes
Evaluation Count:2509
no
Evaluation Count:0
executed: *dptr |= 2;
Execution Count:2506
executed: }
Execution Count:2509
evaluated: *(sptr+sbpl*(trigy>>12)+(trigx>>15)) & (1 << (7-((trigx>>12)&7)))
TRUEFALSE
yes
Evaluation Count:2506
yes
Evaluation Count:3
0-2509
3348 if (trigx < maxws && trigy < maxhs) { if (*(sptr+sbpl*(trigy>>12)+(trigx>>15)) & (1 << (7-((trigx>>12)&7)))) *dptr |= 1; } trigx += m11; trigy += m12;;
evaluated: trigx < maxws
TRUEFALSE
yes
Evaluation Count:2499
yes
Evaluation Count:57
partially evaluated: trigy < maxhs
TRUEFALSE
yes
Evaluation Count:2499
no
Evaluation Count:0
executed: *dptr |= 1;
Execution Count:2496
executed: }
Execution Count:2499
evaluated: *(sptr+sbpl*(trigy>>12)+(trigx>>15)) & (1 << (7-((trigx>>12)&7)))
TRUEFALSE
yes
Evaluation Count:2496
yes
Evaluation Count:3
0-2499
3349 dptr++; -
3350 }
executed: }
Execution Count:2556
2556
3351 break;
executed: break;
Execution Count:19
19
3352 case 1: -
3353 while (dptr < maxp) {
never evaluated: dptr < maxp
0
3354 if (trigx < maxws && trigy < maxhs) { if (*(sptr+sbpl*(trigy>>12)+(trigx>>15)) & (1 << ((trigx>>12)&7))) *dptr |= 1; } trigx += m11; trigy += m12;;
never evaluated: trigx < maxws
never evaluated: trigy < maxhs
never executed: *dptr |= 1;
never executed: }
never evaluated: *(sptr+sbpl*(trigy>>12)+(trigx>>15)) & (1 << ((trigx>>12)&7))
0
3355 if (trigx < maxws && trigy < maxhs) { if (*(sptr+sbpl*(trigy>>12)+(trigx>>15)) & (1 << ((trigx>>12)&7))) *dptr |= 2; } trigx += m11; trigy += m12;;
never evaluated: trigx < maxws
never evaluated: trigy < maxhs
never executed: *dptr |= 2;
never executed: }
never evaluated: *(sptr+sbpl*(trigy>>12)+(trigx>>15)) & (1 << ((trigx>>12)&7))
0
3356 if (trigx < maxws && trigy < maxhs) { if (*(sptr+sbpl*(trigy>>12)+(trigx>>15)) & (1 << ((trigx>>12)&7))) *dptr |= 4; } trigx += m11; trigy += m12;;
never evaluated: trigx < maxws
never evaluated: trigy < maxhs
never executed: *dptr |= 4;
never executed: }
never evaluated: *(sptr+sbpl*(trigy>>12)+(trigx>>15)) & (1 << ((trigx>>12)&7))
0
3357 if (trigx < maxws && trigy < maxhs) { if (*(sptr+sbpl*(trigy>>12)+(trigx>>15)) & (1 << ((trigx>>12)&7))) *dptr |= 8; } trigx += m11; trigy += m12;;
never evaluated: trigx < maxws
never evaluated: trigy < maxhs
never executed: *dptr |= 8;
never executed: }
never evaluated: *(sptr+sbpl*(trigy>>12)+(trigx>>15)) & (1 << ((trigx>>12)&7))
0
3358 if (trigx < maxws && trigy < maxhs) { if (*(sptr+sbpl*(trigy>>12)+(trigx>>15)) & (1 << ((trigx>>12)&7))) *dptr |= 16; } trigx += m11; trigy += m12;;
never evaluated: trigx < maxws
never evaluated: trigy < maxhs
never executed: *dptr |= 16;
never executed: }
never evaluated: *(sptr+sbpl*(trigy>>12)+(trigx>>15)) & (1 << ((trigx>>12)&7))
0
3359 if (trigx < maxws && trigy < maxhs) { if (*(sptr+sbpl*(trigy>>12)+(trigx>>15)) & (1 << ((trigx>>12)&7))) *dptr |= 32; } trigx += m11; trigy += m12;;
never evaluated: trigx < maxws
never evaluated: trigy < maxhs
never executed: *dptr |= 32;
never executed: }
never evaluated: *(sptr+sbpl*(trigy>>12)+(trigx>>15)) & (1 << ((trigx>>12)&7))
0
3360 if (trigx < maxws && trigy < maxhs) { if (*(sptr+sbpl*(trigy>>12)+(trigx>>15)) & (1 << ((trigx>>12)&7))) *dptr |= 64; } trigx += m11; trigy += m12;;
never evaluated: trigx < maxws
never evaluated: trigy < maxhs
never executed: *dptr |= 64;
never executed: }
never evaluated: *(sptr+sbpl*(trigy>>12)+(trigx>>15)) & (1 << ((trigx>>12)&7))
0
3361 if (trigx < maxws && trigy < maxhs) { if (*(sptr+sbpl*(trigy>>12)+(trigx>>15)) & (1 << ((trigx>>12)&7))) *dptr |= 128; } trigx += m11; trigy += m12;;
never evaluated: trigx < maxws
never evaluated: trigy < maxhs
never executed: *dptr |= 128;
never executed: }
never evaluated: *(sptr+sbpl*(trigy>>12)+(trigx>>15)) & (1 << ((trigx>>12)&7))
0
3362 dptr++; -
3363 }
never executed: }
0
3364 break;
never executed: break;
0
3365 } -
3366 }
executed: }
Execution Count:19
19
3367 m21ydx += m21; -
3368 m22ydy += m22; -
3369 dptr += p_inc; -
3370 }
executed: }
Execution Count:19
19
3371 return true;
executed: return true;
Execution Count:2
2
3372} -
3373qint64 QImage::cacheKey() const -
3374{ -
3375 if (!d)
evaluated: !d
TRUEFALSE
yes
Evaluation Count:256
yes
Evaluation Count:4974
256-4974
3376 return 0;
executed: return 0;
Execution Count:256
256
3377 else -
3378 return (((qint64) d->ser_no) << 32) | ((qint64) d->detach_no);
executed: return (((qint64) d->ser_no) << 32) | ((qint64) d->detach_no);
Execution Count:4974
4974
3379} -
3380bool QImage::isDetached() const -
3381{ -
3382 return d && d->ref.load() == 1;
never executed: return d && d->ref.load() == 1;
0
3383} -
3384void QImage::setAlphaChannel(const QImage &alphaChannel) -
3385{ -
3386 if (!d)
partially evaluated: !d
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:161
0-161
3387 return;
never executed: return;
0
3388 -
3389 int w = d->width; -
3390 int h = d->height; -
3391 -
3392 if (w != alphaChannel.d->width || h != alphaChannel.d->height) {
partially evaluated: w != alphaChannel.d->width
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:161
partially evaluated: h != alphaChannel.d->height
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:161
0-161
3393 QMessageLogger("image/qimage.cpp", 5249, __PRETTY_FUNCTION__).warning("QImage::setAlphaChannel: " -
3394 "Alpha channel must have same dimensions as the target image"); -
3395 return;
never executed: return;
0
3396 } -
3397 -
3398 if (d->paintEngine && d->paintEngine->isActive()) {
evaluated: d->paintEngine
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:160
partially evaluated: d->paintEngine->isActive()
TRUEFALSE
yes
Evaluation Count:1
no
Evaluation Count:0
0-160
3399 QMessageLogger("image/qimage.cpp", 5255, __PRETTY_FUNCTION__).warning("QImage::setAlphaChannel: " -
3400 "Unable to set alpha channel while image is being painted on"); -
3401 return;
executed: return;
Execution Count:1
1
3402 } -
3403 -
3404 if (d->format == QImage::Format_ARGB32_Premultiplied)
partially evaluated: d->format == QImage::Format_ARGB32_Premultiplied
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:160
0-160
3405 detach();
never executed: detach();
0
3406 else -
3407 *this = convertToFormat(QImage::Format_ARGB32_Premultiplied);
executed: *this = convertToFormat(QImage::Format_ARGB32_Premultiplied);
Execution Count:160
160
3408 -
3409 if (isNull())
partially evaluated: isNull()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:160
0-160
3410 return;
never executed: return;
0
3411 -
3412 -
3413 if (alphaChannel.d->depth == 8 && alphaChannel.isGrayscale()) {
evaluated: alphaChannel.d->depth == 8
TRUEFALSE
yes
Evaluation Count:12
yes
Evaluation Count:148
partially evaluated: alphaChannel.isGrayscale()
TRUEFALSE
yes
Evaluation Count:12
no
Evaluation Count:0
0-148
3414 const uchar *src_data = alphaChannel.d->data; -
3415 const uchar *dest_data = d->data; -
3416 for (int y=0; y<h; ++y) {
evaluated: y<h
TRUEFALSE
yes
Evaluation Count:1200
yes
Evaluation Count:12
12-1200
3417 const uchar *src = src_data; -
3418 QRgb *dest = (QRgb *)dest_data; -
3419 for (int x=0; x<w; ++x) {
evaluated: x<w
TRUEFALSE
yes
Evaluation Count:120000
yes
Evaluation Count:1200
1200-120000
3420 int alpha = *src; -
3421 int destAlpha = qt_div_255(alpha * qAlpha(*dest)); -
3422 *dest = ((destAlpha << 24) -
3423 | (qt_div_255(qRed(*dest) * alpha) << 16) -
3424 | (qt_div_255(qGreen(*dest) * alpha) << 8) -
3425 | (qt_div_255(qBlue(*dest) * alpha))); -
3426 ++dest; -
3427 ++src; -
3428 }
executed: }
Execution Count:120000
120000
3429 src_data += alphaChannel.d->bytes_per_line; -
3430 dest_data += d->bytes_per_line; -
3431 }
executed: }
Execution Count:1200
1200
3432 -
3433 } else {
executed: }
Execution Count:12
12
3434 const QImage sourceImage = alphaChannel.convertToFormat(QImage::Format_RGB32); -
3435 const uchar *src_data = sourceImage.d->data; -
3436 const uchar *dest_data = d->data; -
3437 for (int y=0; y<h; ++y) {
evaluated: y<h
TRUEFALSE
yes
Evaluation Count:1336
yes
Evaluation Count:148
148-1336
3438 const QRgb *src = (const QRgb *) src_data; -
3439 QRgb *dest = (QRgb *) dest_data; -
3440 for (int x=0; x<w; ++x) {
evaluated: x<w
TRUEFALSE
yes
Evaluation Count:122176
yes
Evaluation Count:1336
1336-122176
3441 int alpha = qGray(*src); -
3442 int destAlpha = qt_div_255(alpha * qAlpha(*dest)); -
3443 *dest = ((destAlpha << 24) -
3444 | (qt_div_255(qRed(*dest) * alpha) << 16) -
3445 | (qt_div_255(qGreen(*dest) * alpha) << 8) -
3446 | (qt_div_255(qBlue(*dest) * alpha))); -
3447 ++dest; -
3448 ++src; -
3449 }
executed: }
Execution Count:122176
122176
3450 src_data += sourceImage.d->bytes_per_line; -
3451 dest_data += d->bytes_per_line; -
3452 }
executed: }
Execution Count:1336
1336
3453 }
executed: }
Execution Count:148
148
3454} -
3455QImage QImage::alphaChannel() const -
3456{ -
3457 if (!d)
partially evaluated: !d
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:26
0-26
3458 return QImage();
never executed: return QImage();
0
3459 -
3460 int w = d->width; -
3461 int h = d->height; -
3462 -
3463 QImage image(w, h, Format_Indexed8); -
3464 image.setColorCount(256); -
3465 -
3466 -
3467 for (int i=0; i<256; ++i)
evaluated: i<256
TRUEFALSE
yes
Evaluation Count:6656
yes
Evaluation Count:26
26-6656
3468 image.setColor(i, qRgb(i, i, i));
executed: image.setColor(i, qRgb(i, i, i));
Execution Count:6656
6656
3469 -
3470 if (!hasAlphaChannel()) {
partially evaluated: !hasAlphaChannel()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:26
0-26
3471 image.fill(255); -
3472 return image;
never executed: return image;
0
3473 } -
3474 -
3475 if (d->format == Format_Indexed8) {
partially evaluated: d->format == Format_Indexed8
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:26
0-26
3476 const uchar *src_data = d->data; -
3477 uchar *dest_data = image.d->data; -
3478 for (int y=0; y<h; ++y) {
never evaluated: y<h
0
3479 const uchar *src = src_data; -
3480 uchar *dest = dest_data; -
3481 for (int x=0; x<w; ++x) {
never evaluated: x<w
0
3482 *dest = qAlpha(d->colortable.at(*src)); -
3483 ++dest; -
3484 ++src; -
3485 }
never executed: }
0
3486 src_data += d->bytes_per_line; -
3487 dest_data += image.d->bytes_per_line; -
3488 }
never executed: }
0
3489 } else {
never executed: }
0
3490 QImage alpha32 = *this; -
3491 if (d->format != Format_ARGB32 && d->format != Format_ARGB32_Premultiplied)
evaluated: d->format != Format_ARGB32
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:25
partially evaluated: d->format != Format_ARGB32_Premultiplied
TRUEFALSE
yes
Evaluation Count:1
no
Evaluation Count:0
0-25
3492 alpha32 = convertToFormat(Format_ARGB32);
executed: alpha32 = convertToFormat(Format_ARGB32);
Execution Count:1
1
3493 -
3494 const uchar *src_data = alpha32.d->data; -
3495 uchar *dest_data = image.d->data; -
3496 for (int y=0; y<h; ++y) {
evaluated: y<h
TRUEFALSE
yes
Evaluation Count:2420
yes
Evaluation Count:26
26-2420
3497 const QRgb *src = (const QRgb *) src_data; -
3498 uchar *dest = dest_data; -
3499 for (int x=0; x<w; ++x) {
evaluated: x<w
TRUEFALSE
yes
Evaluation Count:240200
yes
Evaluation Count:2420
2420-240200
3500 *dest = qAlpha(*src); -
3501 ++dest; -
3502 ++src; -
3503 }
executed: }
Execution Count:240200
240200
3504 src_data += alpha32.d->bytes_per_line; -
3505 dest_data += image.d->bytes_per_line; -
3506 }
executed: }
Execution Count:2420
2420
3507 }
executed: }
Execution Count:26
26
3508 -
3509 return image;
executed: return image;
Execution Count:26
26
3510} -
3511 -
3512 -
3513 -
3514 -
3515 -
3516 -
3517 -
3518bool QImage::hasAlphaChannel() const -
3519{ -
3520 return d && (d->format == Format_ARGB32_Premultiplied 21703
3521 || d->format == Format_ARGB32 21703
3522 || d->format == Format_ARGB8565_Premultiplied 21703
3523 || d->format == Format_ARGB8555_Premultiplied 21703
3524 || d->format == Format_ARGB6666_Premultiplied 21703
3525 || d->format == Format_ARGB4444_Premultiplied 21703
3526 || (d->has_alpha_clut && (d->format == Format_Indexed8 21703
3527 || d->format == Format_Mono 21703
3528 || d->format == Format_MonoLSB)));
executed: return d && (d->format == Format_ARGB32_Premultiplied || d->format == Format_ARGB32 || d->format == Format_ARGB8565_Premultiplied || d->format == Format_ARGB8555_Premultiplied || d->format == Format_ARGB6666_Premultiplied || d->format == Format_ARGB4444_Premultiplied || (d->has_alpha_clut && (d->format == Format_Indexed8 || d->format == Format_Mono || d->format == Format_MonoLSB)));
Execution Count:21703
21703
3529} -
3530int QImage::bitPlaneCount() const -
3531{ -
3532 if (!d)
never evaluated: !d
0
3533 return 0;
never executed: return 0;
0
3534 int bpc = 0; -
3535 switch (d->format) { -
3536 case QImage::Format_Invalid: -
3537 break;
never executed: break;
0
3538 case QImage::Format_RGB32: -
3539 bpc = 24; -
3540 break;
never executed: break;
0
3541 case QImage::Format_RGB666: -
3542 bpc = 18; -
3543 break;
never executed: break;
0
3544 case QImage::Format_RGB555: -
3545 bpc = 15; -
3546 break;
never executed: break;
0
3547 case QImage::Format_ARGB8555_Premultiplied: -
3548 bpc = 23; -
3549 break;
never executed: break;
0
3550 case QImage::Format_RGB444: -
3551 bpc = 12; -
3552 break;
never executed: break;
0
3553 default: -
3554 bpc = qt_depthForFormat(d->format); -
3555 break;
never executed: break;
0
3556 } -
3557 return bpc;
never executed: return bpc;
0
3558} -
3559 -
3560static QImage smoothScaled(const QImage &source, int w, int h) { -
3561 QImage src = source; -
3562 if (src.format() == QImage::Format_ARGB32)
evaluated: src.format() == QImage::Format_ARGB32
TRUEFALSE
yes
Evaluation Count:56
yes
Evaluation Count:180
56-180
3563 src = src.convertToFormat(QImage::Format_ARGB32_Premultiplied);
executed: src = src.convertToFormat(QImage::Format_ARGB32_Premultiplied);
Execution Count:56
56
3564 else if (src.depth() < 32) {
evaluated: src.depth() < 32
TRUEFALSE
yes
Evaluation Count:22
yes
Evaluation Count:158
22-158
3565 if (src.hasAlphaChannel())
partially evaluated: src.hasAlphaChannel()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:22
0-22
3566 src = src.convertToFormat(QImage::Format_ARGB32_Premultiplied);
never executed: src = src.convertToFormat(QImage::Format_ARGB32_Premultiplied);
0
3567 else -
3568 src = src.convertToFormat(QImage::Format_RGB32);
executed: src = src.convertToFormat(QImage::Format_RGB32);
Execution Count:22
22
3569 } -
3570 -
3571 return qSmoothScaleImage(src, w, h);
executed: return qSmoothScaleImage(src, w, h);
Execution Count:236
236
3572} -
3573 -
3574 -
3575static QImage rotated90(const QImage &image) { -
3576 QImage out(image.height(), image.width(), image.format()); -
3577 if (image.colorCount() > 0)
evaluated: image.colorCount() > 0
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:39
4-39
3578 out.setColorTable(image.colorTable());
executed: out.setColorTable(image.colorTable());
Execution Count:4
4
3579 int w = image.width(); -
3580 int h = image.height(); -
3581 switch (image.format()) { -
3582 case QImage::Format_RGB32: -
3583 case QImage::Format_ARGB32: -
3584 case QImage::Format_ARGB32_Premultiplied: -
3585 qt_memrotate270(reinterpret_cast<const quint32*>(image.bits()), -
3586 w, h, image.bytesPerLine(), -
3587 reinterpret_cast<quint32*>(out.bits()), -
3588 out.bytesPerLine()); -
3589 break;
executed: break;
Execution Count:15
15
3590 case QImage::Format_RGB666: -
3591 case QImage::Format_ARGB6666_Premultiplied: -
3592 case QImage::Format_ARGB8565_Premultiplied: -
3593 case QImage::Format_ARGB8555_Premultiplied: -
3594 case QImage::Format_RGB888: -
3595 qt_memrotate270(reinterpret_cast<const quint24*>(image.bits()), -
3596 w, h, image.bytesPerLine(), -
3597 reinterpret_cast<quint24*>(out.bits()), -
3598 out.bytesPerLine()); -
3599 break;
executed: break;
Execution Count:16
16
3600 case QImage::Format_RGB555: -
3601 case QImage::Format_RGB16: -
3602 case QImage::Format_ARGB4444_Premultiplied: -
3603 qt_memrotate270(reinterpret_cast<const quint16*>(image.bits()), -
3604 w, h, image.bytesPerLine(), -
3605 reinterpret_cast<quint16*>(out.bits()), -
3606 out.bytesPerLine()); -
3607 break;
executed: break;
Execution Count:8
8
3608 case QImage::Format_Indexed8: -
3609 qt_memrotate270(reinterpret_cast<const quint8*>(image.bits()), -
3610 w, h, image.bytesPerLine(), -
3611 reinterpret_cast<quint8*>(out.bits()), -
3612 out.bytesPerLine()); -
3613 break;
executed: break;
Execution Count:4
4
3614 default: -
3615 for (int y=0; y<h; ++y) {
never evaluated: y<h
0
3616 if (image.colorCount())
never evaluated: image.colorCount()
0
3617 for (int x=0; x<w; ++x)
never evaluated: x<w
0
3618 out.setPixel(h-y-1, x, image.pixelIndex(x, y));
never executed: out.setPixel(h-y-1, x, image.pixelIndex(x, y));
0
3619 else -
3620 for (int x=0; x<w; ++x)
never evaluated: x<w
0
3621 out.setPixel(h-y-1, x, image.pixel(x, y));
never executed: out.setPixel(h-y-1, x, image.pixel(x, y));
0
3622 } -
3623 break;
never executed: break;
0
3624 } -
3625 return out;
executed: return out;
Execution Count:43
43
3626} -
3627 -
3628 -
3629static QImage rotated180(const QImage &image) { -
3630 return image.mirrored(true, true);
executed: return image.mirrored(true, true);
Execution Count:126
126
3631} -
3632 -
3633 -
3634static QImage rotated270(const QImage &image) { -
3635 QImage out(image.height(), image.width(), image.format()); -
3636 if (image.colorCount() > 0)
evaluated: image.colorCount() > 0
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:39
4-39
3637 out.setColorTable(image.colorTable());
executed: out.setColorTable(image.colorTable());
Execution Count:4
4
3638 int w = image.width(); -
3639 int h = image.height(); -
3640 switch (image.format()) { -
3641 case QImage::Format_RGB32: -
3642 case QImage::Format_ARGB32: -
3643 case QImage::Format_ARGB32_Premultiplied: -
3644 qt_memrotate90(reinterpret_cast<const quint32*>(image.bits()), -
3645 w, h, image.bytesPerLine(), -
3646 reinterpret_cast<quint32*>(out.bits()), -
3647 out.bytesPerLine()); -
3648 break;
executed: break;
Execution Count:15
15
3649 case QImage::Format_RGB666: -
3650 case QImage::Format_ARGB6666_Premultiplied: -
3651 case QImage::Format_ARGB8565_Premultiplied: -
3652 case QImage::Format_ARGB8555_Premultiplied: -
3653 case QImage::Format_RGB888: -
3654 qt_memrotate90(reinterpret_cast<const quint24*>(image.bits()), -
3655 w, h, image.bytesPerLine(), -
3656 reinterpret_cast<quint24*>(out.bits()), -
3657 out.bytesPerLine()); -
3658 break;
executed: break;
Execution Count:16
16
3659 case QImage::Format_RGB555: -
3660 case QImage::Format_RGB16: -
3661 case QImage::Format_ARGB4444_Premultiplied: -
3662 qt_memrotate90(reinterpret_cast<const quint16*>(image.bits()), -
3663 w, h, image.bytesPerLine(), -
3664 reinterpret_cast<quint16*>(out.bits()), -
3665 out.bytesPerLine()); -
3666 break;
executed: break;
Execution Count:8
8
3667 case QImage::Format_Indexed8: -
3668 qt_memrotate90(reinterpret_cast<const quint8*>(image.bits()), -
3669 w, h, image.bytesPerLine(), -
3670 reinterpret_cast<quint8*>(out.bits()), -
3671 out.bytesPerLine()); -
3672 break;
executed: break;
Execution Count:4
4
3673 default: -
3674 for (int y=0; y<h; ++y) {
never evaluated: y<h
0
3675 if (image.colorCount())
never evaluated: image.colorCount()
0
3676 for (int x=0; x<w; ++x)
never evaluated: x<w
0
3677 out.setPixel(y, w-x-1, image.pixelIndex(x, y));
never executed: out.setPixel(y, w-x-1, image.pixelIndex(x, y));
0
3678 else -
3679 for (int x=0; x<w; ++x)
never evaluated: x<w
0
3680 out.setPixel(y, w-x-1, image.pixel(x, y));
never executed: out.setPixel(y, w-x-1, image.pixel(x, y));
0
3681 } -
3682 break;
never executed: break;
0
3683 } -
3684 return out;
executed: return out;
Execution Count:43
43
3685} -
3686QImage QImage::transformed(const QTransform &matrix, Qt::TransformationMode mode ) const -
3687{ -
3688 if (!d)
partially evaluated: !d
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:587
0-587
3689 return QImage();
never executed: return QImage();
0
3690 -
3691 -
3692 int ws = width(); -
3693 int hs = height(); -
3694 -
3695 -
3696 int wd; -
3697 int hd; -
3698 -
3699 -
3700 QTransform mat = trueMatrix(matrix, ws, hs); -
3701 bool complex_xform = false; -
3702 bool scale_xform = false; -
3703 if (mat.type() <= QTransform::TxScale) {
evaluated: mat.type() <= QTransform::TxScale
TRUEFALSE
yes
Evaluation Count:496
yes
Evaluation Count:91
91-496
3704 if (mat.type() == QTransform::TxNone)
evaluated: mat.type() == QTransform::TxNone
TRUEFALSE
yes
Evaluation Count:120
yes
Evaluation Count:376
120-376
3705 return *this;
executed: return *this;
Execution Count:120
120
3706 else if (mat.m11() == -1. && mat.m22() == -1.)
evaluated: mat.m11() == -1.
TRUEFALSE
yes
Evaluation Count:126
yes
Evaluation Count:250
partially evaluated: mat.m22() == -1.
TRUEFALSE
yes
Evaluation Count:126
no
Evaluation Count:0
0-250
3707 return rotated180(*this);
executed: return rotated180(*this);
Execution Count:126
126
3708 -
3709 if (mode == Qt::FastTransformation) {
evaluated: mode == Qt::FastTransformation
TRUEFALSE
yes
Evaluation Count:14
yes
Evaluation Count:236
14-236
3710 hd = qRound(qAbs(mat.m22()) * hs); -
3711 wd = qRound(qAbs(mat.m11()) * ws); -
3712 } else {
executed: }
Execution Count:14
14
3713 hd = int(qAbs(mat.m22()) * hs + 0.9999); -
3714 wd = int(qAbs(mat.m11()) * ws + 0.9999); -
3715 }
executed: }
Execution Count:236
236
3716 scale_xform = true; -
3717 } else {
executed: }
Execution Count:250
250
3718 if (mat.type() <= QTransform::TxRotate && mat.m11() == 0 && mat.m22() == 0) {
evaluated: mat.type() <= QTransform::TxRotate
TRUEFALSE
yes
Evaluation Count:89
yes
Evaluation Count:2
evaluated: mat.m11() == 0
TRUEFALSE
yes
Evaluation Count:88
yes
Evaluation Count:1
partially evaluated: mat.m22() == 0
TRUEFALSE
yes
Evaluation Count:88
no
Evaluation Count:0
0-89
3719 if (mat.m12() == 1. && mat.m21() == -1.)
evaluated: mat.m12() == 1.
TRUEFALSE
yes
Evaluation Count:43
yes
Evaluation Count:45
partially evaluated: mat.m21() == -1.
TRUEFALSE
yes
Evaluation Count:43
no
Evaluation Count:0
0-45
3720 return rotated90(*this);
executed: return rotated90(*this);
Execution Count:43
43
3721 else if (mat.m12() == -1. && mat.m21() == 1.)
evaluated: mat.m12() == -1.
TRUEFALSE
yes
Evaluation Count:43
yes
Evaluation Count:2
partially evaluated: mat.m21() == 1.
TRUEFALSE
yes
Evaluation Count:43
no
Evaluation Count:0
0-43
3722 return rotated270(*this);
executed: return rotated270(*this);
Execution Count:43
43
3723 } -
3724 -
3725 QPolygonF a(QRectF(0, 0, ws, hs)); -
3726 a = mat.map(a); -
3727 QRect r = a.boundingRect().toAlignedRect(); -
3728 wd = r.width(); -
3729 hd = r.height(); -
3730 complex_xform = true; -
3731 }
executed: }
Execution Count:5
5
3732 -
3733 if (wd == 0 || hd == 0)
partially evaluated: wd == 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:255
partially evaluated: hd == 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:255
0-255
3734 return QImage();
never executed: return QImage();
0
3735 -
3736 -
3737 if (scale_xform && mode == Qt::SmoothTransformation) {
evaluated: scale_xform
TRUEFALSE
yes
Evaluation Count:250
yes
Evaluation Count:5
evaluated: mode == Qt::SmoothTransformation
TRUEFALSE
yes
Evaluation Count:236
yes
Evaluation Count:14
5-250
3738 if (mat.m11() < 0.0F && mat.m22() < 0.0F) {
partially evaluated: mat.m11() < 0.0F
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:236
never evaluated: mat.m22() < 0.0F
0-236
3739 return smoothScaled(mirrored(true, true), wd, hd);
never executed: return smoothScaled(mirrored(true, true), wd, hd);
0
3740 } else if (mat.m11() < 0.0F) {
partially evaluated: mat.m11() < 0.0F
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:236
0-236
3741 return smoothScaled(mirrored(true, false), wd, hd);
never executed: return smoothScaled(mirrored(true, false), wd, hd);
0
3742 } else if (mat.m22() < 0.0F) {
partially evaluated: mat.m22() < 0.0F
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:236
0-236
3743 return smoothScaled(mirrored(false, true), wd, hd);
never executed: return smoothScaled(mirrored(false, true), wd, hd);
0
3744 } else { -
3745 return smoothScaled(*this, wd, hd);
executed: return smoothScaled(*this, wd, hd);
Execution Count:236
236
3746 } -
3747 } -
3748 -
3749 int bpp = depth(); -
3750 -
3751 int sbpl = bytesPerLine(); -
3752 const uchar *sptr = bits(); -
3753 -
3754 QImage::Format target_format = d->format; -
3755 -
3756 if (complex_xform || mode == Qt::SmoothTransformation) {
evaluated: complex_xform
TRUEFALSE
yes
Evaluation Count:5
yes
Evaluation Count:14
partially evaluated: mode == Qt::SmoothTransformation
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:14
0-14
3757 if (d->format < QImage::Format_RGB32 || !hasAlphaChannel()) {
evaluated: d->format < QImage::Format_RGB32
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:4
evaluated: !hasAlphaChannel()
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:3
1-4
3758 switch(d->format) { -
3759 case QImage::Format_RGB16: -
3760 target_format = Format_ARGB8565_Premultiplied; -
3761 break;
never executed: break;
0
3762 case QImage::Format_RGB555: -
3763 target_format = Format_ARGB8555_Premultiplied; -
3764 break;
never executed: break;
0
3765 case QImage::Format_RGB666: -
3766 target_format = Format_ARGB6666_Premultiplied; -
3767 break;
never executed: break;
0
3768 case QImage::Format_RGB444: -
3769 target_format = Format_ARGB4444_Premultiplied; -
3770 break;
never executed: break;
0
3771 default: -
3772 target_format = Format_ARGB32_Premultiplied; -
3773 break;
executed: break;
Execution Count:2
2
3774 } -
3775 }
executed: }
Execution Count:2
2
3776 }
executed: }
Execution Count:5
5
3777 -
3778 QImage dImage(wd, hd, target_format); -
3779 if ((dImage).isNull()) { QMessageLogger("image/qimage.cpp", 5689, __PRETTY_FUNCTION__).warning("QImage: out of memory, returning null image"); return QImage(); };
never executed: return QImage();
partially evaluated: (dImage).isNull()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:19
0-19
3780 -
3781 if (target_format == QImage::Format_MonoLSB
partially evaluated: target_format == QImage::Format_MonoLSB
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:19
0-19
3782 || target_format == QImage::Format_Mono
evaluated: target_format == QImage::Format_Mono
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:17
2-17
3783 || target_format == QImage::Format_Indexed8) {
partially evaluated: target_format == QImage::Format_Indexed8
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:17
0-17
3784 dImage.d->colortable = d->colortable; -
3785 dImage.d->has_alpha_clut = d->has_alpha_clut | complex_xform; -
3786 }
executed: }
Execution Count:2
2
3787 -
3788 dImage.d->dpmx = dotsPerMeterX(); -
3789 dImage.d->dpmy = dotsPerMeterY(); -
3790 dImage.d->devicePixelRatio = devicePixelRatio(); -
3791 -
3792 switch (bpp) { -
3793 -
3794 case 8: -
3795 if (dImage.d->colortable.size() < 256) {
never evaluated: dImage.d->colortable.size() < 256
0
3796 -
3797 dImage.d->colortable.append(0x0); -
3798 memset(dImage.bits(), dImage.d->colortable.size() - 1, dImage.byteCount()); -
3799 } else {
never executed: }
0
3800 memset(dImage.bits(), 0, dImage.byteCount()); -
3801 }
never executed: }
0
3802 break;
never executed: break;
0
3803 case 1: -
3804 case 16: -
3805 case 24: -
3806 case 32: -
3807 memset(dImage.bits(), 0x00, dImage.byteCount()); -
3808 break;
executed: break;
Execution Count:19
19
3809 } -
3810 -
3811 if (target_format >= QImage::Format_RGB32) {
evaluated: target_format >= QImage::Format_RGB32
TRUEFALSE
yes
Evaluation Count:17
yes
Evaluation Count:2
2-17
3812 QPainter p(&dImage); -
3813 if (mode == Qt::SmoothTransformation) {
evaluated: mode == Qt::SmoothTransformation
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:14
3-14
3814 p.setRenderHint(QPainter::Antialiasing); -
3815 p.setRenderHint(QPainter::SmoothPixmapTransform); -
3816 }
executed: }
Execution Count:3
3
3817 p.setTransform(mat); -
3818 p.drawImage(QPoint(0, 0), *this); -
3819 } else {
executed: }
Execution Count:17
17
3820 bool invertible; -
3821 mat = mat.inverted(&invertible); -
3822 if (!invertible)
partially evaluated: !invertible
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2
0-2
3823 return QImage();
never executed: return QImage();
0
3824 -
3825 -
3826 int type = format() == Format_Mono ? 0 : 1;
partially evaluated: format() == Format_Mono
TRUEFALSE
yes
Evaluation Count:2
no
Evaluation Count:0
0-2
3827 int dbpl = dImage.bytesPerLine(); -
3828 qt_xForm_helper(mat, 0, type, bpp, dImage.bits(), dbpl, 0, hd, sptr, sbpl, ws, hs); -
3829 }
executed: }
Execution Count:2
2
3830 return dImage;
executed: return dImage;
Execution Count:19
19
3831} -
3832QTransform QImage::trueMatrix(const QTransform &matrix, int w, int h) -
3833{ -
3834 const QRectF rect(0, 0, w, h); -
3835 const QRect mapped = matrix.mapRect(rect).toAlignedRect(); -
3836 const QPoint delta = mapped.topLeft(); -
3837 return matrix * QTransform().translate(-delta.x(), -delta.y());
executed: return matrix * QTransform().translate(-delta.x(), -delta.y());
Execution Count:595
595
3838} -
3839 -
3840bool QImageData::convertInPlace(QImage::Format newFormat, Qt::ImageConversionFlags flags) -
3841{ -
3842 if (format == newFormat)
evaluated: format == newFormat
TRUEFALSE
yes
Evaluation Count:10
yes
Evaluation Count:20
10-20
3843 return true;
executed: return true;
Execution Count:10
10
3844 -
3845 -
3846 if (ref.load() > 1)
evaluated: ref.load() > 1
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:17
3-17
3847 return false;
executed: return false;
Execution Count:3
3
3848 -
3849 const InPlace_Image_Converter *const converterPtr = &inplace_converter_map[format][newFormat]; -
3850 InPlace_Image_Converter converter = *converterPtr; -
3851 if (converter)
evaluated: converter
TRUEFALSE
yes
Evaluation Count:15
yes
Evaluation Count:2
2-15
3852 return converter(this, flags);
executed: return converter(this, flags);
Execution Count:15
15
3853 else -
3854 return false;
executed: return false;
Execution Count:2
2
3855} -
3856QDebug operator<<(QDebug dbg, const QImage &i) -
3857{ -
3858 dbg.nospace() << "QImage(" << i.size() << ')'; -
3859 return dbg.space();
executed: return dbg.space();
Execution Count:1
1
3860} -
3861 -
3862 -
Switch to Source codePreprocessed file

Generated by Squish Coco Non-Commercial