qimage.cpp

Absolute File Name:/home/qt/qt5_coco/qt5/qtbase/src/gui/image/qimage.cpp
Switch to Source codePreprocessed file
LineSourceCount
1-
2-
3-
4-
5-
6-
7-
8-
9static inline bool isLocked(QImageData *data)-
10{-
11 return
never executed: return data != 0 && data->is_locked;
data != 0 && data->is_locked;
never executed: return data != 0 && data->is_locked;
0
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}
never executed: end of block
0
31QImageData * QImageData::create(const QSize &size, QImage::Format format)-
32{-
33 if (!size.isValid()
!size.isValid()Description
TRUEnever evaluated
FALSEnever evaluated
|| format == QImage::Format_Invalid
format == QIma...Format_InvalidDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
34 return
never executed: return 0;
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 const int bytes_per_line = ((width * depth + 31) >> 5) << 2;-
41-
42-
43 if (2147483647/depth < width
2147483647/depth < widthDescription
TRUEnever evaluated
FALSEnever evaluated
0
44 || bytes_per_line <= 0
bytes_per_line <= 0Description
TRUEnever evaluated
FALSEnever evaluated
0
45 || height <= 0
height <= 0Description
TRUEnever evaluated
FALSEnever evaluated
0
46 || 2147483647/uint(bytes_per_line) < height
2147483647/uin...line) < heightDescription
TRUEnever evaluated
FALSEnever evaluated
0
47 || 2147483647/sizeof(uchar *) < uint(height)
2147483647/siz...< uint(height)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
48 return
never executed: return 0;
0;
never executed: return 0;
0
49-
50 QScopedPointer<QImageData> d(new QImageData);-
51-
52 switch (format) {-
53 case
never executed: case QImage::Format_Mono:
QImage::Format_Mono:
never executed: case QImage::Format_Mono:
0
54 case
never executed: case QImage::Format_MonoLSB:
QImage::Format_MonoLSB:
never executed: case QImage::Format_MonoLSB:
0
55 d->colortable.resize(2);-
56 d->colortable[0] = QColor(Qt::black).rgba();-
57 d->colortable[1] = QColor(Qt::white).rgba();-
58 break;
never executed: break;
0
59 default
never executed: default:
:
never executed: default:
0
60 break;
never executed: break;
0
61 }-
62-
63 d->width = width;-
64 d->height = height;-
65 d->depth = depth;-
66 d->format = format;-
67 d->has_alpha_clut = false;-
68 d->is_cached = false;-
69-
70 d->bytes_per_line = bytes_per_line;-
71-
72 d->nbytes = d->bytes_per_line*height;-
73 d->data = (uchar *)malloc(d->nbytes);-
74-
75 if (!d->data
!d->dataDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
76 return
never executed: return 0;
0;
never executed: return 0;
0
77 }-
78-
79 d->ref.ref();-
80 return
never executed: return d.take();
d.take();
never executed: return d.take();
0
81-
82}-
83-
84QImageData::~QImageData()-
85{-
86 if (cleanupFunction
cleanupFunctionDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
87 cleanupFunction(cleanupInfo);
never executed: cleanupFunction(cleanupInfo);
0
88 if (is_cached
is_cachedDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
89 QImagePixmapCleanupHooks::executeImageHooks((((qint64) ser_no) << 32) | ((qint64) detach_no));
never executed: QImagePixmapCleanupHooks::executeImageHooks((((qint64) ser_no) << 32) | ((qint64) detach_no));
0
90 delete paintEngine;-
91 if (data
dataDescription
TRUEnever evaluated
FALSEnever evaluated
&& own_data
own_dataDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
92 free(data);
never executed: free(data);
0
93 data = 0;-
94}
never executed: end of block
0
95-
96-
97-
98-
99-
100bool QImageData::checkForAlphaPixels() const-
101{-
102 bool has_alpha_pixels = false;-
103-
104 switch (format) {-
105-
106 case
never executed: case QImage::Format_Mono:
QImage::Format_Mono:
never executed: case QImage::Format_Mono:
0
107 case
never executed: case QImage::Format_MonoLSB:
QImage::Format_MonoLSB:
never executed: case QImage::Format_MonoLSB:
0
108 case
never executed: case QImage::Format_Indexed8:
QImage::Format_Indexed8:
never executed: case QImage::Format_Indexed8:
0
109 has_alpha_pixels = has_alpha_clut;-
110 break;
never executed: break;
0
111 case
never executed: case QImage::Format_Alpha8:
QImage::Format_Alpha8:
never executed: case QImage::Format_Alpha8:
0
112 has_alpha_pixels = true;-
113 break;
never executed: break;
0
114 case
never executed: case QImage::Format_ARGB32:
QImage::Format_ARGB32:
never executed: case QImage::Format_ARGB32:
0
115 case
never executed: case QImage::Format_ARGB32_Premultiplied:
QImage::Format_ARGB32_Premultiplied:
never executed: case QImage::Format_ARGB32_Premultiplied:
{
0
116 const uchar *bits = data;-
117 for (int y=0; y<height
y<heightDescription
TRUEnever evaluated
FALSEnever evaluated
&& !has_alpha_pixels
!has_alpha_pixelsDescription
TRUEnever evaluated
FALSEnever evaluated
; ++y) {
0
118 uint alphaAnd = 0xff000000;-
119 for (int x=0; x<width
x<widthDescription
TRUEnever evaluated
FALSEnever evaluated
; ++x)
0
120 alphaAnd &= reinterpret_cast<const uint*>(bits)[x];
never executed: alphaAnd &= reinterpret_cast<const uint*>(bits)[x];
0
121 has_alpha_pixels = (alphaAnd != 0xff000000);-
122 bits += bytes_per_line;-
123 }
never executed: end of block
0
124 } break;
never executed: break;
0
125-
126 case
never executed: case QImage::Format_RGBA8888:
QImage::Format_RGBA8888:
never executed: case QImage::Format_RGBA8888:
0
127 case
never executed: case QImage::Format_RGBA8888_Premultiplied:
QImage::Format_RGBA8888_Premultiplied:
never executed: case QImage::Format_RGBA8888_Premultiplied:
{
0
128 const uchar *bits = data;-
129 for (int y=0; y<height
y<heightDescription
TRUEnever evaluated
FALSEnever evaluated
&& !has_alpha_pixels
!has_alpha_pixelsDescription
TRUEnever evaluated
FALSEnever evaluated
; ++y) {
0
130 uchar alphaAnd = 0xff;-
131 for (int x=0; x<width
x<widthDescription
TRUEnever evaluated
FALSEnever evaluated
; ++x)
0
132 alphaAnd &= bits[x * 4+ 3];
never executed: alphaAnd &= bits[x * 4+ 3];
0
133 has_alpha_pixels = (alphaAnd != 0xff);-
134 bits += bytes_per_line;-
135 }
never executed: end of block
0
136 } break;
never executed: break;
0
137-
138 case
never executed: case QImage::Format_A2BGR30_Premultiplied:
QImage::Format_A2BGR30_Premultiplied:
never executed: case QImage::Format_A2BGR30_Premultiplied:
0
139 case
never executed: case QImage::Format_A2RGB30_Premultiplied:
QImage::Format_A2RGB30_Premultiplied:
never executed: case QImage::Format_A2RGB30_Premultiplied:
{
0
140 const uchar *bits = data;-
141 for (int y=0; y<height
y<heightDescription
TRUEnever evaluated
FALSEnever evaluated
&& !has_alpha_pixels
!has_alpha_pixelsDescription
TRUEnever evaluated
FALSEnever evaluated
; ++y) {
0
142 uint alphaAnd = 0xc0000000;-
143 for (int x=0; x<width
x<widthDescription
TRUEnever evaluated
FALSEnever evaluated
; ++x)
0
144 alphaAnd &= reinterpret_cast<const uint*>(bits)[x];
never executed: alphaAnd &= reinterpret_cast<const uint*>(bits)[x];
0
145 has_alpha_pixels = (alphaAnd != 0xc0000000);-
146 bits += bytes_per_line;-
147 }
never executed: end of block
0
148 } break;
never executed: break;
0
149-
150 case
never executed: case QImage::Format_ARGB8555_Premultiplied:
QImage::Format_ARGB8555_Premultiplied:
never executed: case QImage::Format_ARGB8555_Premultiplied:
0
151 case
never executed: case QImage::Format_ARGB8565_Premultiplied:
QImage::Format_ARGB8565_Premultiplied:
never executed: case QImage::Format_ARGB8565_Premultiplied:
{
0
152 const uchar *bits = data;-
153 const uchar *end_bits = data + bytes_per_line;-
154-
155 for (int y=0; y<height
y<heightDescription
TRUEnever evaluated
FALSEnever evaluated
&& !has_alpha_pixels
!has_alpha_pixelsDescription
TRUEnever evaluated
FALSEnever evaluated
; ++y) {
0
156 uchar alphaAnd = 0xff;-
157 while (bits < end_bits
bits < end_bitsDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
158 alphaAnd &= bits[0];-
159 bits += 3;-
160 }
never executed: end of block
0
161 has_alpha_pixels = (alphaAnd != 0xff);-
162 bits = end_bits;-
163 end_bits += bytes_per_line;-
164 }
never executed: end of block
0
165 } break;
never executed: break;
0
166-
167 case
never executed: case QImage::Format_ARGB6666_Premultiplied:
QImage::Format_ARGB6666_Premultiplied:
never executed: case QImage::Format_ARGB6666_Premultiplied:
{
0
168 const uchar *bits = data;-
169 const uchar *end_bits = data + bytes_per_line;-
170-
171 for (int y=0; y<height
y<heightDescription
TRUEnever evaluated
FALSEnever evaluated
&& !has_alpha_pixels
!has_alpha_pixelsDescription
TRUEnever evaluated
FALSEnever evaluated
; ++y) {
0
172 uchar alphaAnd = 0xfc;-
173 while (bits < end_bits
bits < end_bitsDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
174 alphaAnd &= bits[0];-
175 bits += 3;-
176 }
never executed: end of block
0
177 has_alpha_pixels = (alphaAnd != 0xfc);-
178 bits = end_bits;-
179 end_bits += bytes_per_line;-
180 }
never executed: end of block
0
181 } break;
never executed: break;
0
182-
183 case
never executed: case QImage::Format_ARGB4444_Premultiplied:
QImage::Format_ARGB4444_Premultiplied:
never executed: case QImage::Format_ARGB4444_Premultiplied:
{
0
184 const uchar *bits = data;-
185 for (int y=0; y<height
y<heightDescription
TRUEnever evaluated
FALSEnever evaluated
&& !has_alpha_pixels
!has_alpha_pixelsDescription
TRUEnever evaluated
FALSEnever evaluated
; ++y) {
0
186 ushort alphaAnd = 0xf000;-
187 for (int x=0; x<width
x<widthDescription
TRUEnever evaluated
FALSEnever evaluated
; ++x)
0
188 alphaAnd &= reinterpret_cast<const ushort*>(bits)[x];
never executed: alphaAnd &= reinterpret_cast<const ushort*>(bits)[x];
0
189 has_alpha_pixels = (alphaAnd != 0xf000);-
190 bits += bytes_per_line;-
191 }
never executed: end of block
0
192 } break;
never executed: break;
0
193-
194 case
never executed: case QImage::Format_RGB32:
QImage::Format_RGB32:
never executed: case QImage::Format_RGB32:
0
195 case
never executed: case QImage::Format_RGB16:
QImage::Format_RGB16:
never executed: case QImage::Format_RGB16:
0
196 case
never executed: case QImage::Format_RGB444:
QImage::Format_RGB444:
never executed: case QImage::Format_RGB444:
0
197 case
never executed: case QImage::Format_RGB555:
QImage::Format_RGB555:
never executed: case QImage::Format_RGB555:
0
198 case
never executed: case QImage::Format_RGB666:
QImage::Format_RGB666:
never executed: case QImage::Format_RGB666:
0
199 case
never executed: case QImage::Format_RGB888:
QImage::Format_RGB888:
never executed: case QImage::Format_RGB888:
0
200 case
never executed: case QImage::Format_RGBX8888:
QImage::Format_RGBX8888:
never executed: case QImage::Format_RGBX8888:
0
201 case
never executed: case QImage::Format_BGR30:
QImage::Format_BGR30:
never executed: case QImage::Format_BGR30:
0
202 case
never executed: case QImage::Format_RGB30:
QImage::Format_RGB30:
never executed: case QImage::Format_RGB30:
0
203 case
never executed: case QImage::Format_Grayscale8:
QImage::Format_Grayscale8:
never executed: case QImage::Format_Grayscale8:
0
204 break;
never executed: break;
0
205 case
never executed: case QImage::Format_Invalid:
QImage::Format_Invalid:
never executed: case QImage::Format_Invalid:
0
206 case
never executed: case QImage::NImageFormats:
QImage::NImageFormats:
never executed: case QImage::NImageFormats:
0
207 do { ((!(false)) ? qt_assert_x("Q_UNREACHABLE()", "Q_UNREACHABLE was reached",__FILE__,290) : qt_noop()); __builtin_unreachable(); } while (0);-
208 break;
never executed: break;
0
209 }-
210-
211 return
never executed: return has_alpha_pixels;
has_alpha_pixels;
never executed: return has_alpha_pixels;
0
212}-
213QImage::QImage() noexcept-
214 : QPaintDevice()-
215{-
216 d = 0;-
217}
never executed: end of block
0
218QImage::QImage(int width, int height, Format format)-
219 : QPaintDevice()-
220{-
221 d = QImageData::create(QSize(width, height), format);-
222}
never executed: end of block
0
223QImage::QImage(const QSize &size, Format format)-
224 : QPaintDevice()-
225{-
226 d = QImageData::create(size, format);-
227}
never executed: end of block
0
228-
229-
230-
231QImageData *QImageData::create(uchar *data, int width, int height, int bpl, QImage::Format format, bool readOnly, QImageCleanupFunction cleanupFunction, void *cleanupInfo)-
232{-
233 QImageData *d = 0;-
234-
235 if (format == QImage::Format_Invalid
format == QIma...Format_InvalidDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
236 return
never executed: return d;
d;
never executed: return d;
0
237-
238 const int depth = qt_depthForFormat(format);-
239 const int calc_bytes_per_line = ((width * depth + 31)/32) * 4;-
240 const int min_bytes_per_line = (width * depth + 7)/8;-
241-
242 if (bpl <= 0
bpl <= 0Description
TRUEnever evaluated
FALSEnever evaluated
)
0
243 bpl = calc_bytes_per_line;
never executed: bpl = calc_bytes_per_line;
0
244-
245 if (width <= 0
width <= 0Description
TRUEnever evaluated
FALSEnever evaluated
|| height <= 0
height <= 0Description
TRUEnever evaluated
FALSEnever evaluated
|| !data
!dataDescription
TRUEnever evaluated
FALSEnever evaluated
0
246 || 2147483647/sizeof(uchar *) < uint(height)
2147483647/siz...< uint(height)Description
TRUEnever evaluated
FALSEnever evaluated
0
247 || 2147483647/uint(depth) < uint(width)
2147483647/uin... < uint(width)Description
TRUEnever evaluated
FALSEnever evaluated
0
248 || bpl <= 0
bpl <= 0Description
TRUEnever evaluated
FALSEnever evaluated
0
249 || bpl < min_bytes_per_line
bpl < min_bytes_per_lineDescription
TRUEnever evaluated
FALSEnever evaluated
0
250 || 2147483647/uint(bpl) < uint(height)
2147483647/uin...< uint(height)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
251 return
never executed: return d;
d;
never executed: return d;
0
252-
253 d = new QImageData;-
254 d->ref.ref();-
255-
256 d->own_data = false;-
257 d->ro_data = readOnly;-
258 d->data = data;-
259 d->width = width;-
260 d->height = height;-
261 d->depth = depth;-
262 d->format = format;-
263-
264 d->bytes_per_line = bpl;-
265 d->nbytes = d->bytes_per_line * height;-
266-
267 d->cleanupFunction = cleanupFunction;-
268 d->cleanupInfo = cleanupInfo;-
269-
270 return
never executed: return d;
d;
never executed: return d;
0
271}-
272QImage::QImage(uchar* data, int width, int height, Format format, QImageCleanupFunction cleanupFunction, void *cleanupInfo)-
273 : QPaintDevice()-
274{-
275 d = QImageData::create(data, width, height, 0, format, false, cleanupFunction, cleanupInfo);-
276}
never executed: end of block
0
277QImage::QImage(const uchar* data, int width, int height, Format format, QImageCleanupFunction cleanupFunction, void *cleanupInfo)-
278 : QPaintDevice()-
279{-
280 d = QImageData::create(const_cast<uchar*>(data), width, height, 0, format, true, cleanupFunction, cleanupInfo);-
281}
never executed: end of block
0
282QImage::QImage(uchar *data, int width, int height, int bytesPerLine, Format format, QImageCleanupFunction cleanupFunction, void *cleanupInfo)-
283 :QPaintDevice()-
284{-
285 d = QImageData::create(data, width, height, bytesPerLine, format, false, cleanupFunction, cleanupInfo);-
286}
never executed: end of block
0
287QImage::QImage(const uchar *data, int width, int height, int bytesPerLine, Format format, QImageCleanupFunction cleanupFunction, void *cleanupInfo)-
288 :QPaintDevice()-
289{-
290 d = QImageData::create(const_cast<uchar*>(data), width, height, bytesPerLine, format, true, cleanupFunction, cleanupInfo);-
291}
never executed: end of block
0
292QImage::QImage(const QString &fileName, const char *format)-
293 : QPaintDevice()-
294{-
295 d = 0;-
296 load(fileName, format);-
297}
never executed: end of block
0
298-
299-
300extern bool qt_read_xpm_image_or_array(QIODevice *device, const char * const *source, QImage &image);-
301QImage::QImage(const char * const xpm[])-
302 : QPaintDevice()-
303{-
304 d = 0;-
305 if (!xpm
!xpmDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
306 return;
never executed: return;
0
307 if (!qt_read_xpm_image_or_array(0, xpm, *this)
!qt_read_xpm_i...0, xpm, *this)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
308-
309 QMessageLogger(__FILE__, 1009, __PRETTY_FUNCTION__).warning("QImage::QImage(), XPM is not supported");
never executed: QMessageLogger(__FILE__, 1009, __PRETTY_FUNCTION__).warning("QImage::QImage(), XPM is not supported");
0
310}
never executed: end of block
0
311QImage::QImage(const QImage &image)-
312 : QPaintDevice()-
313{-
314 if (image.paintingActive()
image.paintingActive()Description
TRUEnever evaluated
FALSEnever evaluated
|| isLocked(image.d)
isLocked(image.d)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
315 d = 0;-
316 image.copy().swap(*this);-
317 }
never executed: end of block
else {
0
318 d = image.d;-
319 if (d
dDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
320 d->ref.ref();
never executed: d->ref.ref();
0
321 }
never executed: end of block
0
322}-
323-
324-
325-
326-
327-
328QImage::~QImage()-
329{-
330 if (d
dDescription
TRUEnever evaluated
FALSEnever evaluated
&& !d->ref.deref()
!d->ref.deref()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
331 delete d;
never executed: delete d;
0
332}
never executed: end of block
0
333QImage &QImage::operator=(const QImage &image)-
334{-
335 if (image.paintingActive()
image.paintingActive()Description
TRUEnever evaluated
FALSEnever evaluated
|| isLocked(image.d)
isLocked(image.d)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
336 operator=(image.copy());-
337 }
never executed: end of block
else {
0
338 if (image.d
image.dDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
339 image.d->ref.ref();
never executed: image.d->ref.ref();
0
340 if (d
dDescription
TRUEnever evaluated
FALSEnever evaluated
&& !d->ref.deref()
!d->ref.deref()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
341 delete d;
never executed: delete d;
0
342 d = image.d;-
343 }
never executed: end of block
0
344 return
never executed: return *this;
*this;
never executed: return *this;
0
345}-
346int QImage::devType() const-
347{-
348 return
never executed: return QInternal::Image;
QInternal::Image;
never executed: return QInternal::Image;
0
349}-
350-
351-
352-
353-
354QImage::operator QVariant() const-
355{-
356 return
never executed: return QVariant(QVariant::Image, this);
QVariant(QVariant::Image, this);
never executed: return QVariant(QVariant::Image, this);
0
357}-
358void QImage::detach()-
359{-
360 if (d
dDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
361 if (d->is_cached
d->is_cachedDescription
TRUEnever evaluated
FALSEnever evaluated
&& d->ref.load() == 1
d->ref.load() == 1Description
TRUEnever evaluated
FALSEnever evaluated
)
0
362 QImagePixmapCleanupHooks::executeImageHooks(cacheKey());
never executed: QImagePixmapCleanupHooks::executeImageHooks(cacheKey());
0
363-
364 if (d->ref.load() != 1
d->ref.load() != 1Description
TRUEnever evaluated
FALSEnever evaluated
|| d->ro_data
d->ro_dataDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
365 *
never executed: *this = copy();
this = copy();
never executed: *this = copy();
0
366-
367 if (d
dDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
368 ++
never executed: ++d->detach_no;
d->detach_no;
never executed: ++d->detach_no;
0
369 }
never executed: end of block
0
370}
never executed: end of block
0
371-
372-
373static void copyMetadata(QImageData *dst, const QImageData *src)-
374{-
375-
376 dst->dpmx = src->dpmx;-
377 dst->dpmy = src->dpmy;-
378 dst->devicePixelRatio = src->devicePixelRatio;-
379 dst->text = src->text;-
380}
never executed: end of block
0
381QImage QImage::copy(const QRect& r) const-
382{-
383 if (!d
!dDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
384 return
never executed: return QImage();
QImage();
never executed: return QImage();
0
385-
386 if (r.isNull()
r.isNull()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
387 QImage image(d->width, d->height, d->format);-
388 if (image.isNull()
image.isNull()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
389 return
never executed: return image;
image;
never executed: return image;
0
390-
391-
392-
393 if (image.d->nbytes != d->nbytes
image.d->nbytes != d->nbytesDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
394 int bpl = qMin(bytesPerLine(), image.bytesPerLine());-
395 for (int i = 0; i < height()
i < height()Description
TRUEnever evaluated
FALSEnever evaluated
; i++)
0
396 memcpy(image.scanLine(i), scanLine(i), bpl);
never executed: memcpy(image.scanLine(i), scanLine(i), bpl);
0
397 }
never executed: end of block
else
0
398 memcpy(image.bits(), bits(), d->nbytes);
never executed: memcpy(image.bits(), bits(), d->nbytes);
0
399 image.d->colortable = d->colortable;-
400 image.d->offset = d->offset;-
401 image.d->has_alpha_clut = d->has_alpha_clut;-
402 copyMetadata(image.d, d);-
403 return
never executed: return image;
image;
never executed: return image;
0
404 }-
405-
406 int x = r.x();-
407 int y = r.y();-
408 int w = r.width();-
409 int h = r.height();-
410-
411 int dx = 0;-
412 int dy = 0;-
413 if (w <= 0
w <= 0Description
TRUEnever evaluated
FALSEnever evaluated
|| h <= 0
h <= 0Description
TRUEnever evaluated
FALSEnever evaluated
)
0
414 return
never executed: return QImage();
QImage();
never executed: return QImage();
0
415-
416 QImage image(w, h, d->format);-
417 if (image.isNull()
image.isNull()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
418 return
never executed: return image;
image;
never executed: return image;
0
419-
420 if (x < 0
x < 0Description
TRUEnever evaluated
FALSEnever evaluated
|| y < 0
y < 0Description
TRUEnever evaluated
FALSEnever evaluated
|| x + w > d->width
x + w > d->widthDescription
TRUEnever evaluated
FALSEnever evaluated
|| y + h > d->height
y + h > d->heightDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
421-
422 image.fill(0);-
423 if (x < 0
x < 0Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
424 dx = -x;-
425 x = 0;-
426 }
never executed: end of block
0
427 if (y < 0
y < 0Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
428 dy = -y;-
429 y = 0;-
430 }
never executed: end of block
0
431 }
never executed: end of block
0
432-
433 image.d->colortable = d->colortable;-
434-
435 int pixels_to_copy = qMax(w - dx, 0);-
436 if (x > d->width
x > d->widthDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
437 pixels_to_copy = 0;
never executed: pixels_to_copy = 0;
0
438 else if (pixels_to_copy > d->width - x
pixels_to_copy > d->width - xDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
439 pixels_to_copy = d->width - x;
never executed: pixels_to_copy = d->width - x;
0
440 int lines_to_copy = qMax(h - dy, 0);-
441 if (y > d->height
y > d->heightDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
442 lines_to_copy = 0;
never executed: lines_to_copy = 0;
0
443 else if (lines_to_copy > d->height - y
lines_to_copy > d->height - yDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
444 lines_to_copy = d->height - y;
never executed: lines_to_copy = d->height - y;
0
445-
446 bool byteAligned = true;-
447 if (d->format == Format_Mono
d->format == Format_MonoDescription
TRUEnever evaluated
FALSEnever evaluated
|| d->format == Format_MonoLSB
d->format == Format_MonoLSBDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
448 byteAligned = !(dx & 7)
!(dx & 7)Description
TRUEnever evaluated
FALSEnever evaluated
&& !(x & 7)
!(x & 7)Description
TRUEnever evaluated
FALSEnever evaluated
&& !(pixels_to_copy & 7)
!(pixels_to_copy & 7)Description
TRUEnever evaluated
FALSEnever evaluated
;
never executed: byteAligned = !(dx & 7) && !(x & 7) && !(pixels_to_copy & 7);
0
449-
450 if (byteAligned
byteAlignedDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
451 const uchar *src = d->data + ((x * d->depth) >> 3) + y * d->bytes_per_line;-
452 uchar *dest = image.d->data + ((dx * d->depth) >> 3) + dy * image.d->bytes_per_line;-
453 const int bytes_to_copy = (pixels_to_copy * d->depth) >> 3;-
454 for (int i = 0; i < lines_to_copy
i < lines_to_copyDescription
TRUEnever evaluated
FALSEnever evaluated
; ++i) {
0
455 memcpy(dest, src, bytes_to_copy);-
456 src += d->bytes_per_line;-
457 dest += image.d->bytes_per_line;-
458 }
never executed: end of block
0
459 }
never executed: end of block
else if (d->format == Format_Mono
d->format == Format_MonoDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
460 const uchar *src = d->data + y * d->bytes_per_line;-
461 uchar *dest = image.d->data + dy * image.d->bytes_per_line;-
462 for (int i = 0; i < lines_to_copy
i < lines_to_copyDescription
TRUEnever evaluated
FALSEnever evaluated
; ++i) {
0
463 for (int j = 0; j < pixels_to_copy
j < pixels_to_copyDescription
TRUEnever evaluated
FALSEnever evaluated
; ++j) {
0
464 if (src[(x + j) >> 3] & (0x80 >> ((x + j) & 7))
src[(x + j) >>...((x + j) & 7))Description
TRUEnever evaluated
FALSEnever evaluated
)
0
465 dest[(dx + j) >> 3] |= (0x80 >> ((dx + j) & 7));
never executed: dest[(dx + j) >> 3] |= (0x80 >> ((dx + j) & 7));
0
466 else-
467 dest[(dx + j) >> 3] &= ~(0x80 >> ((dx + j) & 7));
never executed: dest[(dx + j) >> 3] &= ~(0x80 >> ((dx + j) & 7));
0
468 }-
469 src += d->bytes_per_line;-
470 dest += image.d->bytes_per_line;-
471 }
never executed: end of block
0
472 }
never executed: end of block
else {
0
473 ((!(d->format == Format_MonoLSB)) ? qt_assert("d->format == Format_MonoLSB",__FILE__,1250) : qt_noop());-
474 const uchar *src = d->data + y * d->bytes_per_line;-
475 uchar *dest = image.d->data + dy * image.d->bytes_per_line;-
476 for (int i = 0; i < lines_to_copy
i < lines_to_copyDescription
TRUEnever evaluated
FALSEnever evaluated
; ++i) {
0
477 for (int j = 0; j < pixels_to_copy
j < pixels_to_copyDescription
TRUEnever evaluated
FALSEnever evaluated
; ++j) {
0
478 if (src[(x + j) >> 3] & (0x1 << ((x + j) & 7))
src[(x + j) >>...((x + j) & 7))Description
TRUEnever evaluated
FALSEnever evaluated
)
0
479 dest[(dx + j) >> 3] |= (0x1 << ((dx + j) & 7));
never executed: dest[(dx + j) >> 3] |= (0x1 << ((dx + j) & 7));
0
480 else-
481 dest[(dx + j) >> 3] &= ~(0x1 << ((dx + j) & 7));
never executed: dest[(dx + j) >> 3] &= ~(0x1 << ((dx + j) & 7));
0
482 }-
483 src += d->bytes_per_line;-
484 dest += image.d->bytes_per_line;-
485 }
never executed: end of block
0
486 }
never executed: end of block
0
487-
488 copyMetadata(image.d, d);-
489 image.d->offset = offset();-
490 image.d->has_alpha_clut = d->has_alpha_clut;-
491 return
never executed: return image;
image;
never executed: return image;
0
492}-
493bool QImage::isNull() const-
494{-
495 return
never executed: return !d;
!d;
never executed: return !d;
0
496}-
497int QImage::width() const-
498{-
499 return
never executed: return d ? d->width : 0;
d ? d->width : 0;
never executed: return d ? d->width : 0;
0
500}-
501int QImage::height() const-
502{-
503 return
never executed: return d ? d->height : 0;
d ? d->height : 0;
never executed: return d ? d->height : 0;
0
504}-
505QSize QImage::size() const-
506{-
507 return
never executed: return d ? QSize(d->width, d->height) : QSize(0, 0);
d ? QSize(d->width, d->height) : QSize(0, 0);
never executed: return d ? QSize(d->width, d->height) : QSize(0, 0);
0
508}-
509QRect QImage::rect() const-
510{-
511 return
never executed: return d ? QRect(0, 0, d->width, d->height) : QRect();
d ? QRect(0, 0, d->width, d->height) : QRect();
never executed: return d ? QRect(0, 0, d->width, d->height) : QRect();
0
512}-
513int QImage::depth() const-
514{-
515 return
never executed: return d ? d->depth : 0;
d ? d->depth : 0;
never executed: return d ? d->depth : 0;
0
516}-
517int QImage::colorCount() const-
518{-
519 return
never executed: return d ? d->colortable.size() : 0;
d ? d->colortable.size() : 0;
never executed: return d ? d->colortable.size() : 0;
0
520}-
521void QImage::setColorTable(const QVector<QRgb> colors)-
522-
523{-
524 if (!d
!dDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
525 return;
never executed: return;
0
526 detach();-
527-
528-
529 if (!d
!dDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
530 return;
never executed: return;
0
531-
532-
533-
534-
535 d->colortable = std::move(const_cast<QVector<QRgb>&>(colors));-
536-
537 d->has_alpha_clut = false;-
538 for (int i = 0; i < d->colortable.size()
i < d->colortable.size()Description
TRUEnever evaluated
FALSEnever evaluated
; ++i) {
0
539 if (qAlpha(d->colortable.at(i)) != 255
qAlpha(d->colo....at(i)) != 255Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
540 d->has_alpha_clut = true;-
541 break;
never executed: break;
0
542 }-
543 }
never executed: end of block
0
544}
never executed: end of block
0
545-
546-
547-
548-
549-
550-
551-
552QVector<QRgb> QImage::colorTable() const-
553{-
554 return
never executed: return d ? d->colortable : QVector<QRgb>();
d ? d->colortable : QVector<QRgb>();
never executed: return d ? d->colortable : QVector<QRgb>();
0
555}-
556qreal QImage::devicePixelRatio() const-
557{-
558 if (!d
!dDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
559 return
never executed: return 1.0;
1.0;
never executed: return 1.0;
0
560 return
never executed: return d->devicePixelRatio;
d->devicePixelRatio;
never executed: return d->devicePixelRatio;
0
561}-
562void QImage::setDevicePixelRatio(qreal scaleFactor)-
563{-
564 if (!d
!dDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
565 return;
never executed: return;
0
566-
567 if (scaleFactor == d->devicePixelRatio
scaleFactor ==...vicePixelRatioDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
568 return;
never executed: return;
0
569-
570 detach();-
571 d->devicePixelRatio = scaleFactor;-
572}
never executed: end of block
0
573int QImage::byteCount() const-
574{-
575 return
never executed: return d ? d->nbytes : 0;
d ? d->nbytes : 0;
never executed: return d ? d->nbytes : 0;
0
576}-
577int QImage::bytesPerLine() const-
578{-
579 return
never executed: return (d && d->height) ? d->nbytes / d->height : 0;
(d && d->height) ? d->nbytes / d->height : 0;
never executed: return (d && d->height) ? d->nbytes / d->height : 0;
0
580}-
581QRgb QImage::color(int i) const-
582{-
583 ((!(i < colorCount())) ? qt_assert("i < colorCount()",__FILE__,1515) : qt_noop());-
584 return
never executed: return d ? d->colortable.at(i) : QRgb(uint(-1));
d ? d->colortable.at(i) : QRgb(uint(-1));
never executed: return d ? d->colortable.at(i) : QRgb(uint(-1));
0
585}-
586void QImage::setColor(int i, QRgb c)-
587{-
588 if (!d
!dDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
589 return;
never executed: return;
0
590 if (i < 0
i < 0Description
TRUEnever evaluated
FALSEnever evaluated
|| d->depth > 8
d->depth > 8Description
TRUEnever evaluated
FALSEnever evaluated
|| i >= 1<<d->depth
i >= 1<<d->depthDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
591 QMessageLogger(__FILE__, 1536, __PRETTY_FUNCTION__).warning("QImage::setColor: Index out of bound %d", i);-
592 return;
never executed: return;
0
593 }-
594 detach();-
595-
596-
597 if (!d
!dDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
598 return;
never executed: return;
0
599-
600 if (i >= d->colortable.size()
i >= d->colortable.size()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
601 setColorCount(i+1);
never executed: setColorCount(i+1);
0
602 d->colortable[i] = c;-
603 d->has_alpha_clut |= (qAlpha(c) != 255);-
604}
never executed: end of block
0
605uchar *QImage::scanLine(int i)-
606{-
607 if (!d
!dDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
608 return
never executed: return 0;
0;
never executed: return 0;
0
609-
610 detach();-
611-
612-
613 if (!d
!dDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
614 return
never executed: return 0;
0;
never executed: return 0;
0
615-
616 return
never executed: return d->data + i * d->bytes_per_line;
d->data + i * d->bytes_per_line;
never executed: return d->data + i * d->bytes_per_line;
0
617}-
618-
619-
620-
621-
622const uchar *QImage::scanLine(int i) const-
623{-
624 if (!d
!dDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
625 return
never executed: return 0;
0;
never executed: return 0;
0
626-
627 ((!(i >= 0 && i < height())) ? qt_assert("i >= 0 && i < height()",__FILE__,1589) : qt_noop());-
628 return
never executed: return d->data + i * d->bytes_per_line;
d->data + i * d->bytes_per_line;
never executed: return d->data + i * d->bytes_per_line;
0
629}-
630const uchar *QImage::constScanLine(int i) const-
631{-
632 if (!d
!dDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
633 return
never executed: return 0;
0;
never executed: return 0;
0
634-
635 ((!(i >= 0 && i < height())) ? qt_assert("i >= 0 && i < height()",__FILE__,1612) : qt_noop());-
636 return
never executed: return d->data + i * d->bytes_per_line;
d->data + i * d->bytes_per_line;
never executed: return d->data + i * d->bytes_per_line;
0
637}-
638uchar *QImage::bits()-
639{-
640 if (!d
!dDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
641 return
never executed: return 0;
0;
never executed: return 0;
0
642 detach();-
643-
644-
645 if (!d
!dDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
646 return
never executed: return 0;
0;
never executed: return 0;
0
647-
648 return
never executed: return d->data;
d->data;
never executed: return d->data;
0
649}-
650const uchar *QImage::bits() const-
651{-
652 return
never executed: return d ? d->data : 0;
d ? d->data : 0;
never executed: return d ? d->data : 0;
0
653}-
654const uchar *QImage::constBits() const-
655{-
656 return
never executed: return d ? d->data : 0;
d ? d->data : 0;
never executed: return d ? d->data : 0;
0
657}-
658void QImage::fill(uint pixel)-
659{-
660 if (!d
!dDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
661 return;
never executed: return;
0
662-
663 detach();-
664-
665-
666 if (!d
!dDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
667 return;
never executed: return;
0
668-
669 if (d->depth == 1
d->depth == 1Description
TRUEnever evaluated
FALSEnever evaluated
|| d->depth == 8
d->depth == 8Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
670 int w = d->width;-
671 if (d->depth == 1
d->depth == 1Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
672 if (pixel & 1
pixel & 1Description
TRUEnever evaluated
FALSEnever evaluated
)
0
673 pixel = 0xffffffff;
never executed: pixel = 0xffffffff;
0
674 else-
675 pixel = 0;
never executed: pixel = 0;
0
676 w = (w + 7) / 8;-
677 }
never executed: end of block
else {
0
678 pixel &= 0xff;-
679 }
never executed: end of block
0
680 qt_rectfill<quint8>(d->data, pixel, 0, 0,-
681 w, d->height, d->bytes_per_line);-
682 return;
never executed: return;
0
683 } else if (d->depth == 16
d->depth == 16Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
684 qt_rectfill<quint16>(reinterpret_cast<quint16*>(d->data), pixel,-
685 0, 0, d->width, d->height, d->bytes_per_line);-
686 return;
never executed: return;
0
687 } else if (d->depth == 24
d->depth == 24Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
688 qt_rectfill<quint24>(reinterpret_cast<quint24*>(d->data), pixel,-
689 0, 0, d->width, d->height, d->bytes_per_line);-
690 return;
never executed: return;
0
691 }-
692-
693 if (d->format == Format_RGB32
d->format == Format_RGB32Description
TRUEnever evaluated
FALSEnever evaluated
)
0
694 pixel |= 0xff000000;
never executed: pixel |= 0xff000000;
0
695 if (d->format == Format_RGBX8888
d->format == Format_RGBX8888Description
TRUEnever evaluated
FALSEnever evaluated
)
0
696-
697 pixel |= 0xff000000;
never executed: pixel |= 0xff000000;
0
698-
699-
700-
701 if (d->format == Format_BGR30
d->format == Format_BGR30Description
TRUEnever evaluated
FALSEnever evaluated
|| d->format == Format_RGB30
d->format == Format_RGB30Description
TRUEnever evaluated
FALSEnever evaluated
)
0
702 pixel |= 0xc0000000;
never executed: pixel |= 0xc0000000;
0
703-
704 qt_rectfill<uint>(reinterpret_cast<uint*>(d->data), pixel,-
705 0, 0, d->width, d->height, d->bytes_per_line);-
706}
never executed: end of block
0
707void QImage::fill(Qt::GlobalColor color)-
708{-
709 fill(QColor(color));-
710}
never executed: end of block
0
711void QImage::fill(const QColor &color)-
712{-
713 if (!d
!dDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
714 return;
never executed: return;
0
715 detach();-
716-
717-
718 if (!d
!dDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
719 return;
never executed: return;
0
720-
721 switch (d->format) {-
722 case
never executed: case QImage::Format_RGB32:
QImage::Format_RGB32:
never executed: case QImage::Format_RGB32:
0
723 case
never executed: case QImage::Format_ARGB32:
QImage::Format_ARGB32:
never executed: case QImage::Format_ARGB32:
0
724 fill(color.rgba());-
725 break;
never executed: break;
0
726 case
never executed: case QImage::Format_ARGB32_Premultiplied:
QImage::Format_ARGB32_Premultiplied:
never executed: case QImage::Format_ARGB32_Premultiplied:
0
727 fill(qPremultiply(color.rgba()));-
728 break;
never executed: break;
0
729 case
never executed: case QImage::Format_RGBX8888:
QImage::Format_RGBX8888:
never executed: case QImage::Format_RGBX8888:
0
730 fill(ARGB2RGBA(color.rgba() | 0xff000000));-
731 break;
never executed: break;
0
732 case
never executed: case QImage::Format_RGBA8888:
QImage::Format_RGBA8888:
never executed: case QImage::Format_RGBA8888:
0
733 fill(ARGB2RGBA(color.rgba()));-
734 break;
never executed: break;
0
735 case
never executed: case QImage::Format_RGBA8888_Premultiplied:
QImage::Format_RGBA8888_Premultiplied:
never executed: case QImage::Format_RGBA8888_Premultiplied:
0
736 fill(ARGB2RGBA(qPremultiply(color.rgba())));-
737 break;
never executed: break;
0
738 case
never executed: case QImage::Format_BGR30:
QImage::Format_BGR30:
never executed: case QImage::Format_BGR30:
0
739 case
never executed: case QImage::Format_A2BGR30_Premultiplied:
QImage::Format_A2BGR30_Premultiplied:
never executed: case QImage::Format_A2BGR30_Premultiplied:
0
740 fill(qConvertRgb64ToRgb30<PixelOrderBGR>(color.rgba64()));-
741 break;
never executed: break;
0
742 case
never executed: case QImage::Format_RGB30:
QImage::Format_RGB30:
never executed: case QImage::Format_RGB30:
0
743 case
never executed: case QImage::Format_A2RGB30_Premultiplied:
QImage::Format_A2RGB30_Premultiplied:
never executed: case QImage::Format_A2RGB30_Premultiplied:
0
744 fill(qConvertRgb64ToRgb30<PixelOrderRGB>(color.rgba64()));-
745 break;
never executed: break;
0
746 case
never executed: case QImage::Format_RGB16:
QImage::Format_RGB16:
never executed: case QImage::Format_RGB16:
0
747 fill((uint) qConvertRgb32To16(color.rgba()));-
748 break;
never executed: break;
0
749 case
never executed: case QImage::Format_Indexed8:
QImage::Format_Indexed8:
never executed: case QImage::Format_Indexed8:
{
0
750 uint pixel = 0;-
751 for (int i=0; i<d->colortable.size()
i<d->colortable.size()Description
TRUEnever evaluated
FALSEnever evaluated
; ++i) {
0
752 if (color.rgba() == d->colortable.at(i)
color.rgba() =...lortable.at(i)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
753 pixel = i;-
754 break;
never executed: break;
0
755 }-
756 }
never executed: end of block
0
757 fill(pixel);-
758 break;
never executed: break;
0
759 }-
760 case
never executed: case QImage::Format_Mono:
QImage::Format_Mono:
never executed: case QImage::Format_Mono:
0
761 case
never executed: case QImage::Format_MonoLSB:
QImage::Format_MonoLSB:
never executed: case QImage::Format_MonoLSB:
0
762 if (color == Qt::color1
color == Qt::color1Description
TRUEnever evaluated
FALSEnever evaluated
)
0
763 fill((uint) 1);
never executed: fill((uint) 1);
0
764 else-
765 fill((uint) 0);
never executed: fill((uint) 0);
0
766 break;
never executed: break;
0
767 default
never executed: default:
:
never executed: default:
{
0
768 QPainter p(this);-
769 p.setCompositionMode(QPainter::CompositionMode_Source);-
770 p.fillRect(rect(), color);-
771 }}
never executed: end of block
0
772}-
773void QImage::invertPixels(InvertMode mode)-
774{-
775 if (!d
!dDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
776 return;
never executed: return;
0
777-
778 detach();-
779-
780-
781 if (!d
!dDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
782 return;
never executed: return;
0
783-
784 QImage::Format originalFormat = d->format;-
785-
786 if (hasAlphaChannel()
hasAlphaChannel()Description
TRUEnever evaluated
FALSEnever evaluated
&& qPixelLayouts[d->format].premultiplied
qPixelLayouts[....premultipliedDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
787 if (!d->convertInPlace(QImage::Format_ARGB32, 0)
!d->convertInP...mat_ARGB32, 0)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
788 *
never executed: *this = convertToFormat(QImage::Format_ARGB32);
this = convertToFormat(QImage::Format_ARGB32);
never executed: *this = convertToFormat(QImage::Format_ARGB32);
0
789 }
never executed: end of block
0
790-
791 if (depth() < 32
depth() < 32Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
792-
793 int bpl = (d->width * d->depth + 7) / 8;-
794 int pad = d->bytes_per_line - bpl;-
795 uchar *sl = d->data;-
796 for (int y=0; y<d->height
y<d->heightDescription
TRUEnever evaluated
FALSEnever evaluated
; ++y) {
0
797 for (int x=0; x<bpl
x<bplDescription
TRUEnever evaluated
FALSEnever evaluated
; ++x)
0
798 *
never executed: *sl++ ^= 0xff;
sl++ ^= 0xff;
never executed: *sl++ ^= 0xff;
0
799 sl += pad;-
800 }
never executed: end of block
0
801 }
never executed: end of block
else {
0
802 quint32 *p = (quint32*)d->data;-
803 quint32 *end = (quint32*)(d->data + d->nbytes);-
804 quint32 xorbits = 0xffffffff;-
805 switch (d->format) {-
806 case
never executed: case QImage::Format_RGBA8888:
QImage::Format_RGBA8888:
never executed: case QImage::Format_RGBA8888:
0
807 if (mode == InvertRgba
mode == InvertRgbaDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
808 break;
never executed: break;
0
809-
810 case
never executed: case QImage::Format_RGBX8888:
QImage::Format_RGBX8888:
never executed: case QImage::Format_RGBX8888:
code before this statement never executed: case QImage::Format_RGBX8888:
0
811-
812-
813-
814-
815 xorbits = 0x00ffffff;-
816 break;
never executed: break;
0
817-
818 case
never executed: case QImage::Format_ARGB32:
QImage::Format_ARGB32:
never executed: case QImage::Format_ARGB32:
0
819 if (mode == InvertRgba
mode == InvertRgbaDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
820 break;
never executed: break;
0
821-
822 case
never executed: case QImage::Format_RGB32:
QImage::Format_RGB32:
never executed: case QImage::Format_RGB32:
code before this statement never executed: case QImage::Format_RGB32:
0
823 xorbits = 0x00ffffff;-
824 break;
never executed: break;
0
825 case
never executed: case QImage::Format_BGR30:
QImage::Format_BGR30:
never executed: case QImage::Format_BGR30:
0
826 case
never executed: case QImage::Format_RGB30:
QImage::Format_RGB30:
never executed: case QImage::Format_RGB30:
0
827 xorbits = 0x3fffffff;-
828 break;
never executed: break;
0
829 default
never executed: default:
:
never executed: default:
0
830 do { ((!(false)) ? qt_assert_x("Q_UNREACHABLE()", "Q_UNREACHABLE was reached",__FILE__,1913) : qt_noop()); __builtin_unreachable(); } while (0);-
831 xorbits = 0;-
832 break;
never executed: break;
0
833 }-
834 while (p < end
p < endDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
835 *
never executed: *p++ ^= xorbits;
p++ ^= xorbits;
never executed: *p++ ^= xorbits;
0
836 }
never executed: end of block
0
837-
838 if (originalFormat != d->format
originalFormat != d->formatDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
839 if (!d->convertInPlace(originalFormat, 0)
!d->convertInP...inalFormat, 0)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
840 *
never executed: *this = convertToFormat(originalFormat);
this = convertToFormat(originalFormat);
never executed: *this = convertToFormat(originalFormat);
0
841 }
never executed: end of block
0
842}
never executed: end of block
0
843void QImage::setColorCount(int colorCount)-
844{-
845 if (!d
!dDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
846 QMessageLogger(__FILE__, 1956, __PRETTY_FUNCTION__).warning("QImage::setColorCount: null image");-
847 return;
never executed: return;
0
848 }-
849-
850 detach();-
851-
852-
853 if (!d
!dDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
854 return;
never executed: return;
0
855-
856 if (colorCount == d->colortable.size()
colorCount == ...ortable.size()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
857 return;
never executed: return;
0
858 if (colorCount <= 0
colorCount <= 0Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
859 d->colortable = QVector<QRgb>();-
860 return;
never executed: return;
0
861 }-
862 int nc = d->colortable.size();-
863 d->colortable.resize(colorCount);-
864 for (int i = nc; i < colorCount
i < colorCountDescription
TRUEnever evaluated
FALSEnever evaluated
; ++i)
0
865 d->colortable[i] = 0;
never executed: d->colortable[i] = 0;
0
866}
never executed: end of block
0
867-
868-
869-
870-
871-
872-
873QImage::Format QImage::format() const-
874{-
875 return
never executed: return d ? d->format : Format_Invalid;
d ? d->format : Format_Invalid;
never executed: return d ? d->format : Format_Invalid;
0
876}-
877QImage QImage::convertToFormat_helper(Format format, Qt::ImageConversionFlags flags) const-
878{-
879 if (!d
!dDescription
TRUEnever evaluated
FALSEnever evaluated
|| d->format == format
d->format == formatDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
880 return
never executed: return *this;
*this;
never executed: return *this;
0
881-
882 if (format == Format_Invalid
format == Format_InvalidDescription
TRUEnever evaluated
FALSEnever evaluated
|| d->format == Format_Invalid
d->format == Format_InvalidDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
883 return
never executed: return QImage();
QImage();
never executed: return QImage();
0
884-
885 Image_Converter converter = qimage_converter_map[d->format][format];-
886 if (!converter
!converterDescription
TRUEnever evaluated
FALSEnever evaluated
&& format > QImage::Format_Indexed8
format > QImag...ormat_Indexed8Description
TRUEnever evaluated
FALSEnever evaluated
&& d->format > QImage::Format_Indexed8
d->format > QI...ormat_Indexed8Description
TRUEnever evaluated
FALSEnever evaluated
)
0
887 converter = convert_generic;
never executed: converter = convert_generic;
0
888 if (converter
converterDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
889 QImage image(d->width, d->height, format);-
890-
891 if ((
(image).isNull()Description
TRUEnever evaluated
FALSEnever evaluated
image).isNull()
(image).isNull()Description
TRUEnever evaluated
FALSEnever evaluated
) { QMessageLogger(__FILE__, 2016, __PRETTY_FUNCTION__).warning("QImage: out of memory, returning null image"); return
never executed: return QImage();
QImage();
never executed: return QImage();
};
0
892-
893 image.d->offset = offset();-
894 copyMetadata(image.d, d);-
895-
896 converter(image.d, d, flags);-
897 return
never executed: return image;
image;
never executed: return image;
0
898 }-
899-
900-
901 ((!(format != QImage::Format_ARGB32 && format != QImage::Format_RGB32)) ? qt_assert("format != QImage::Format_ARGB32 && format != QImage::Format_RGB32",__FILE__,2026) : qt_noop());-
902 ((!(d->format != QImage::Format_ARGB32 && d->format != QImage::Format_RGB32)) ? qt_assert("d->format != QImage::Format_ARGB32 && d->format != QImage::Format_RGB32",__FILE__,2027) : qt_noop());-
903-
904 if (!hasAlphaChannel()
!hasAlphaChannel()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
905 return
never executed: return convertToFormat(Format_RGB32, flags).convertToFormat(format, flags);
convertToFormat(Format_RGB32, flags).convertToFormat(format, flags);
never executed: return convertToFormat(Format_RGB32, flags).convertToFormat(format, flags);
0
906-
907 return
never executed: return convertToFormat(Format_ARGB32, flags).convertToFormat(format, flags);
convertToFormat(Format_ARGB32, flags).convertToFormat(format, flags);
never executed: return convertToFormat(Format_ARGB32, flags).convertToFormat(format, flags);
0
908}-
909-
910-
911-
912-
913bool QImage::convertToFormat_inplace(Format format, Qt::ImageConversionFlags flags)-
914{-
915 return
never executed: return d && d->convertInPlace(format, flags);
d && d->convertInPlace(format, flags);
never executed: return d && d->convertInPlace(format, flags);
0
916}-
917-
918static inline int pixel_distance(QRgb p1, QRgb p2) {-
919 int r1 = qRed(p1);-
920 int g1 = qGreen(p1);-
921 int b1 = qBlue(p1);-
922 int a1 = qAlpha(p1);-
923-
924 int r2 = qRed(p2);-
925 int g2 = qGreen(p2);-
926 int b2 = qBlue(p2);-
927 int a2 = qAlpha(p2);-
928-
929 return
never executed: return abs(r1 - r2) + abs(g1 - g2) + abs(b1 - b2) + abs(a1 - a2);
abs(r1 - r2) + abs(g1 - g2) + abs(b1 - b2) + abs(a1 - a2);
never executed: return abs(r1 - r2) + abs(g1 - g2) + abs(b1 - b2) + abs(a1 - a2);
0
930}-
931-
932static inline int closestMatch(QRgb pixel, const QVector<QRgb> &clut) {-
933 int idx = 0;-
934 int current_distance = 2147483647;-
935 for (int i=0; i<clut.size()
i<clut.size()Description
TRUEnever evaluated
FALSEnever evaluated
; ++i) {
0
936 int dist = pixel_distance(pixel, clut.at(i));-
937 if (dist < current_distance
dist < current_distanceDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
938 current_distance = dist;-
939 idx = i;-
940 }
never executed: end of block
0
941 }
never executed: end of block
0
942 return
never executed: return idx;
idx;
never executed: return idx;
0
943}-
944-
945static QImage convertWithPalette(const QImage &src, QImage::Format format,-
946 const QVector<QRgb> &clut) {-
947 QImage dest(src.size(), format);-
948 dest.setColorTable(clut);-
949-
950 QString textsKeys = src.text();-
951 const auto textKeyList = textsKeys.splitRef(QLatin1Char('\n'), QString::SkipEmptyParts);-
952 for (const auto &textKey : textKeyList) {-
953 const auto textKeySplitted = textKey.split(QLatin1String(": "));-
954 dest.setText(textKeySplitted[0].toString(), textKeySplitted[1].toString());-
955 }
never executed: end of block
0
956-
957 int h = src.height();-
958 int w = src.width();-
959-
960 QHash<QRgb, int> cache;-
961-
962 if (format == QImage::Format_Indexed8
format == QIma...ormat_Indexed8Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
963 for (int y=0; y<h
y<hDescription
TRUEnever evaluated
FALSEnever evaluated
; ++y) {
0
964 const QRgb *src_pixels = (const QRgb *) src.scanLine(y);-
965 uchar *dest_pixels = (uchar *) dest.scanLine(y);-
966 for (int x=0; x<w
x<wDescription
TRUEnever evaluated
FALSEnever evaluated
; ++x) {
0
967 int src_pixel = src_pixels[x];-
968 int value = cache.value(src_pixel, -1);-
969 if (value == -1
value == -1Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
970 value = closestMatch(src_pixel, clut);-
971 cache.insert(src_pixel, value);-
972 }
never executed: end of block
0
973 dest_pixels[x] = (uchar) value;-
974 }
never executed: end of block
0
975 }
never executed: end of block
0
976 }
never executed: end of block
else {
0
977 QVector<QRgb> table = clut;-
978 table.resize(2);-
979 for (int y=0; y<h
y<hDescription
TRUEnever evaluated
FALSEnever evaluated
; ++y) {
0
980 const QRgb *src_pixels = (const QRgb *) src.scanLine(y);-
981 for (int x=0; x<w
x<wDescription
TRUEnever evaluated
FALSEnever evaluated
; ++x) {
0
982 int src_pixel = src_pixels[x];-
983 int value = cache.value(src_pixel, -1);-
984 if (value == -1
value == -1Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
985 value = closestMatch(src_pixel, table);-
986 cache.insert(src_pixel, value);-
987 }
never executed: end of block
0
988 dest.setPixel(x, y, value);-
989 }
never executed: end of block
0
990 }
never executed: end of block
0
991 }
never executed: end of block
0
992-
993 return
never executed: return dest;
dest;
never executed: return dest;
0
994}-
995QImage QImage::convertToFormat(Format format, const QVector<QRgb> &colorTable, Qt::ImageConversionFlags flags) const-
996{-
997 if (!d
!dDescription
TRUEnever evaluated
FALSEnever evaluated
|| d->format == format
d->format == formatDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
998 return
never executed: return *this;
*this;
never executed: return *this;
0
999-
1000 if (format <= QImage::Format_Indexed8
format <= QIma...ormat_Indexed8Description
TRUEnever evaluated
FALSEnever evaluated
&& depth() == 32
depth() == 32Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
1001 return
never executed: return convertWithPalette(*this, format, colorTable);
convertWithPalette(*this, format, colorTable);
never executed: return convertWithPalette(*this, format, colorTable);
0
1002 }-
1003-
1004 const Image_Converter *converterPtr = &qimage_converter_map[d->format][format];-
1005 Image_Converter converter = *converterPtr;-
1006 if (!converter
!converterDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
1007 return
never executed: return QImage();
QImage();
never executed: return QImage();
0
1008-
1009 QImage image(d->width, d->height, format);-
1010 if ((
(image).isNull()Description
TRUEnever evaluated
FALSEnever evaluated
image).isNull()
(image).isNull()Description
TRUEnever evaluated
FALSEnever evaluated
) { QMessageLogger(__FILE__, 2146, __PRETTY_FUNCTION__).warning("QImage: out of memory, returning null image"); return
never executed: return QImage();
QImage();
never executed: return QImage();
};
0
1011-
1012 image.d->offset = offset();-
1013 copyMetadata(image.d, d);-
1014-
1015 converter(image.d, d, flags);-
1016 return
never executed: return image;
image;
never executed: return image;
0
1017}-
1018bool QImage::valid(int x, int y) const-
1019{-
1020 return
never executed: return d && x >= 0 && x < d->width && y >= 0 && y < d->height;
d
never executed: return d && x >= 0 && x < d->width && y >= 0 && y < d->height;
0
1021 && x >= 0 && x < d->width
never executed: return d && x >= 0 && x < d->width && y >= 0 && y < d->height;
0
1022 && y >= 0 && y < d->height;
never executed: return d && x >= 0 && x < d->width && y >= 0 && y < d->height;
0
1023}-
1024int QImage::pixelIndex(int x, int y) const-
1025{-
1026 if (!d
!dDescription
TRUEnever evaluated
FALSEnever evaluated
|| x < 0
x < 0Description
TRUEnever evaluated
FALSEnever evaluated
|| x >= d->width
x >= d->widthDescription
TRUEnever evaluated
FALSEnever evaluated
|| y < 0
y < 0Description
TRUEnever evaluated
FALSEnever evaluated
|| y >= height()
y >= height()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
1027 QMessageLogger(__FILE__, 2196, __PRETTY_FUNCTION__).warning("QImage::pixelIndex: coordinate (%d,%d) out of range", x, y);-
1028 return
never executed: return -12345;
-12345;
never executed: return -12345;
0
1029 }-
1030 const uchar * s = scanLine(y);-
1031 switch(d->format) {-
1032 case
never executed: case Format_Mono:
Format_Mono:
never executed: case Format_Mono:
0
1033 return
never executed: return (*(s + (x >> 3)) >> (7- (x & 7))) & 1;
(*(s + (x >> 3)) >> (7- (x & 7))) & 1;
never executed: return (*(s + (x >> 3)) >> (7- (x & 7))) & 1;
0
1034 case
never executed: case Format_MonoLSB:
Format_MonoLSB:
never executed: case Format_MonoLSB:
0
1035 return
never executed: return (*(s + (x >> 3)) >> (x & 7)) & 1;
(*(s + (x >> 3)) >> (x & 7)) & 1;
never executed: return (*(s + (x >> 3)) >> (x & 7)) & 1;
0
1036 case
never executed: case Format_Indexed8:
Format_Indexed8:
never executed: case Format_Indexed8:
0
1037 return
never executed: return (int)s[x];
(int)s[x];
never executed: return (int)s[x];
0
1038 default
never executed: default:
:
never executed: default:
0
1039 QMessageLogger(__FILE__, 2208, __PRETTY_FUNCTION__).warning("QImage::pixelIndex: Not applicable for %d-bpp images (no palette)", d->depth);-
1040 }
never executed: end of block
0
1041 return
never executed: return 0;
0;
never executed: return 0;
0
1042}-
1043QRgb QImage::pixel(int x, int y) const-
1044{-
1045 if (!d
!dDescription
TRUEnever evaluated
FALSEnever evaluated
|| x < 0
x < 0Description
TRUEnever evaluated
FALSEnever evaluated
|| x >= d->width
x >= d->widthDescription
TRUEnever evaluated
FALSEnever evaluated
|| y < 0
y < 0Description
TRUEnever evaluated
FALSEnever evaluated
|| y >= d->height
y >= d->heightDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
1046 QMessageLogger(__FILE__, 2237, __PRETTY_FUNCTION__).warning("QImage::pixel: coordinate (%d,%d) out of range", x, y);-
1047 return
never executed: return 12345;
12345;
never executed: return 12345;
0
1048 }-
1049-
1050 const uchar *s = d->data + y * d->bytes_per_line;-
1051-
1052 int index = -1;-
1053 switch (d->format) {-
1054 case
never executed: case Format_Mono:
Format_Mono:
never executed: case Format_Mono:
0
1055 index = (*(s + (x >> 3)) >> (~x & 7)) & 1;-
1056 break;
never executed: break;
0
1057 case
never executed: case Format_MonoLSB:
Format_MonoLSB:
never executed: case Format_MonoLSB:
0
1058 index = (*(s + (x >> 3)) >> (x & 7)) & 1;-
1059 break;
never executed: break;
0
1060 case
never executed: case Format_Indexed8:
Format_Indexed8:
never executed: case Format_Indexed8:
0
1061 index = s[x];-
1062 break;
never executed: break;
0
1063 default
never executed: default:
:
never executed: default:
0
1064 break;
never executed: break;
0
1065 }-
1066 if (index >= 0
index >= 0Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
1067 if (index >= d->colortable.size()
index >= d->colortable.size()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
1068 QMessageLogger(__FILE__, 2259, __PRETTY_FUNCTION__).warning("QImage::pixel: color table index %d out of range.", index);-
1069 return
never executed: return 0;
0;
never executed: return 0;
0
1070 }-
1071 return
never executed: return d->colortable.at(index);
d->colortable.at(index);
never executed: return d->colortable.at(index);
0
1072 }-
1073-
1074 switch (d->format) {-
1075 case
never executed: case Format_RGB32:
Format_RGB32:
never executed: case Format_RGB32:
0
1076 return
never executed: return 0xff000000 | reinterpret_cast<const QRgb *>(s)[x];
0xff000000 | reinterpret_cast<const QRgb *>(s)[x];
never executed: return 0xff000000 | reinterpret_cast<const QRgb *>(s)[x];
0
1077 case
never executed: case Format_ARGB32:
Format_ARGB32:
never executed: case Format_ARGB32:
0
1078 case
never executed: case Format_ARGB32_Premultiplied:
Format_ARGB32_Premultiplied:
never executed: case Format_ARGB32_Premultiplied:
0
1079 return
never executed: return reinterpret_cast<const QRgb *>(s)[x];
reinterpret_cast<const QRgb *>(s)[x];
never executed: return reinterpret_cast<const QRgb *>(s)[x];
0
1080 case
never executed: case Format_RGBX8888:
Format_RGBX8888:
never executed: case Format_RGBX8888:
0
1081 case
never executed: case Format_RGBA8888:
Format_RGBA8888:
never executed: case Format_RGBA8888:
0
1082 case
never executed: case Format_RGBA8888_Premultiplied:
Format_RGBA8888_Premultiplied:
never executed: case Format_RGBA8888_Premultiplied:
0
1083 return
never executed: return RGBA2ARGB(reinterpret_cast<const quint32 *>(s)[x]);
RGBA2ARGB(reinterpret_cast<const quint32 *>(s)[x]);
never executed: return RGBA2ARGB(reinterpret_cast<const quint32 *>(s)[x]);
0
1084 case
never executed: case Format_BGR30:
Format_BGR30:
never executed: case Format_BGR30:
0
1085 case
never executed: case Format_A2BGR30_Premultiplied:
Format_A2BGR30_Premultiplied:
never executed: case Format_A2BGR30_Premultiplied:
0
1086 return
never executed: return qConvertA2rgb30ToArgb32<PixelOrderBGR>(reinterpret_cast<const quint32 *>(s)[x]);
qConvertA2rgb30ToArgb32<PixelOrderBGR>(reinterpret_cast<const quint32 *>(s)[x]);
never executed: return qConvertA2rgb30ToArgb32<PixelOrderBGR>(reinterpret_cast<const quint32 *>(s)[x]);
0
1087 case
never executed: case Format_RGB30:
Format_RGB30:
never executed: case Format_RGB30:
0
1088 case
never executed: case Format_A2RGB30_Premultiplied:
Format_A2RGB30_Premultiplied:
never executed: case Format_A2RGB30_Premultiplied:
0
1089 return
never executed: return qConvertA2rgb30ToArgb32<PixelOrderRGB>(reinterpret_cast<const quint32 *>(s)[x]);
qConvertA2rgb30ToArgb32<PixelOrderRGB>(reinterpret_cast<const quint32 *>(s)[x]);
never executed: return qConvertA2rgb30ToArgb32<PixelOrderRGB>(reinterpret_cast<const quint32 *>(s)[x]);
0
1090 case
never executed: case Format_RGB16:
Format_RGB16:
never executed: case Format_RGB16:
0
1091 return
never executed: return qConvertRgb16To32(reinterpret_cast<const quint16 *>(s)[x]);
qConvertRgb16To32(reinterpret_cast<const quint16 *>(s)[x]);
never executed: return qConvertRgb16To32(reinterpret_cast<const quint16 *>(s)[x]);
0
1092 default
never executed: default:
:
never executed: default:
0
1093 break;
never executed: break;
0
1094 }-
1095 const QPixelLayout *layout = &qPixelLayouts[d->format];-
1096 uint result;-
1097 const uint *ptr = qFetchPixels[layout->bpp](&result, s, x, 1);-
1098 return
never executed: return *layout->convertToARGB32PM(&result, ptr, 1, layout, 0);
*layout->convertToARGB32PM(&result, ptr, 1, layout, 0);
never executed: return *layout->convertToARGB32PM(&result, ptr, 1, layout, 0);
0
1099}-
1100void QImage::setPixel(int x, int y, uint index_or_rgb)-
1101{-
1102 if (!d
!dDescription
TRUEnever evaluated
FALSEnever evaluated
|| x < 0
x < 0Description
TRUEnever evaluated
FALSEnever evaluated
|| x >= width()
x >= width()Description
TRUEnever evaluated
FALSEnever evaluated
|| y < 0
y < 0Description
TRUEnever evaluated
FALSEnever evaluated
|| y >= height()
y >= height()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
1103 QMessageLogger(__FILE__, 2321, __PRETTY_FUNCTION__).warning("QImage::setPixel: coordinate (%d,%d) out of range", x, y);-
1104 return;
never executed: return;
0
1105 }-
1106-
1107 uchar * s = scanLine(y);-
1108 switch(d->format) {-
1109 case
never executed: case Format_Mono:
Format_Mono:
never executed: case Format_Mono:
0
1110 case
never executed: case Format_MonoLSB:
Format_MonoLSB:
never executed: case Format_MonoLSB:
0
1111 if (index_or_rgb > 1
index_or_rgb > 1Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
1112 QMessageLogger(__FILE__, 2330, __PRETTY_FUNCTION__).warning("QImage::setPixel: Index %d out of range", index_or_rgb);-
1113 }
never executed: end of block
else if (format() == Format_MonoLSB
format() == Format_MonoLSBDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
1114 if (index_or_rgb==0
index_or_rgb==0Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1115 *(
never executed: *(s + (x >> 3)) &= ~(1 << (x & 7));
s + (x >> 3)) &= ~(1 << (x & 7));
never executed: *(s + (x >> 3)) &= ~(1 << (x & 7));
0
1116 else-
1117 *(
never executed: *(s + (x >> 3)) |= (1 << (x & 7));
s + (x >> 3)) |= (1 << (x & 7));
never executed: *(s + (x >> 3)) |= (1 << (x & 7));
0
1118 } else {-
1119 if (index_or_rgb==0
index_or_rgb==0Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1120 *(
never executed: *(s + (x >> 3)) &= ~(1 << (7-(x & 7)));
s + (x >> 3)) &= ~(1 << (7-(x & 7)));
never executed: *(s + (x >> 3)) &= ~(1 << (7-(x & 7)));
0
1121 else-
1122 *(
never executed: *(s + (x >> 3)) |= (1 << (7-(x & 7)));
s + (x >> 3)) |= (1 << (7-(x & 7)));
never executed: *(s + (x >> 3)) |= (1 << (7-(x & 7)));
0
1123 }-
1124 return;
never executed: return;
0
1125 case
never executed: case Format_Indexed8:
Format_Indexed8:
never executed: case Format_Indexed8:
0
1126 if (index_or_rgb >= (uint)d->colortable.size()
index_or_rgb >...ortable.size()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
1127 QMessageLogger(__FILE__, 2345, __PRETTY_FUNCTION__).warning("QImage::setPixel: Index %d out of range", index_or_rgb);-
1128 return;
never executed: return;
0
1129 }-
1130 s[x] = index_or_rgb;-
1131 return;
never executed: return;
0
1132 case
never executed: case Format_RGB32:
Format_RGB32:
never executed: case Format_RGB32:
0
1133-
1134-
1135 ((uint *)s)[x] = 0xff000000 | index_or_rgb;-
1136 return;
never executed: return;
0
1137 case
never executed: case Format_ARGB32:
Format_ARGB32:
never executed: case Format_ARGB32:
0
1138 case
never executed: case Format_ARGB32_Premultiplied:
Format_ARGB32_Premultiplied:
never executed: case Format_ARGB32_Premultiplied:
0
1139 ((uint *)s)[x] = index_or_rgb;-
1140 return;
never executed: return;
0
1141 case
never executed: case Format_RGB16:
Format_RGB16:
never executed: case Format_RGB16:
0
1142 ((quint16 *)s)[x] = qConvertRgb32To16(qUnpremultiply(index_or_rgb));-
1143 return;
never executed: return;
0
1144 case
never executed: case Format_RGBX8888:
Format_RGBX8888:
never executed: case Format_RGBX8888:
0
1145 ((uint *)s)[x] = ARGB2RGBA(0xff000000 | index_or_rgb);-
1146 return;
never executed: return;
0
1147 case
never executed: case Format_RGBA8888:
Format_RGBA8888:
never executed: case Format_RGBA8888:
0
1148 case
never executed: case Format_RGBA8888_Premultiplied:
Format_RGBA8888_Premultiplied:
never executed: case Format_RGBA8888_Premultiplied:
0
1149 ((uint *)s)[x] = ARGB2RGBA(index_or_rgb);-
1150 return;
never executed: return;
0
1151 case
never executed: case Format_BGR30:
Format_BGR30:
never executed: case Format_BGR30:
0
1152 ((uint *)s)[x] = qConvertRgb32ToRgb30<PixelOrderBGR>(index_or_rgb);-
1153 return;
never executed: return;
0
1154 case
never executed: case Format_A2BGR30_Premultiplied:
Format_A2BGR30_Premultiplied:
never executed: case Format_A2BGR30_Premultiplied:
0
1155 ((uint *)s)[x] = qConvertArgb32ToA2rgb30<PixelOrderBGR>(index_or_rgb);-
1156 return;
never executed: return;
0
1157 case
never executed: case Format_RGB30:
Format_RGB30:
never executed: case Format_RGB30:
0
1158 ((uint *)s)[x] = qConvertRgb32ToRgb30<PixelOrderRGB>(index_or_rgb);-
1159 return;
never executed: return;
0
1160 case
never executed: case Format_A2RGB30_Premultiplied:
Format_A2RGB30_Premultiplied:
never executed: case Format_A2RGB30_Premultiplied:
0
1161 ((uint *)s)[x] = qConvertArgb32ToA2rgb30<PixelOrderRGB>(index_or_rgb);-
1162 return;
never executed: return;
0
1163 case
never executed: case Format_Invalid:
Format_Invalid:
never executed: case Format_Invalid:
0
1164 case
never executed: case NImageFormats:
NImageFormats:
never executed: case NImageFormats:
0
1165 ((!(false)) ? qt_assert("false",__FILE__,2383) : qt_noop());-
1166 return;
never executed: return;
0
1167 default
never executed: default:
:
never executed: default:
0
1168 break;
never executed: break;
0
1169 }-
1170-
1171 const QPixelLayout *layout = &qPixelLayouts[d->format];-
1172 uint result;-
1173 const uint *ptr = layout->convertFromARGB32PM(&result, &index_or_rgb, 1, layout, 0);-
1174 qStorePixels[layout->bpp](s, ptr, x, 1);-
1175}
never executed: end of block
0
1176QColor QImage::pixelColor(int x, int y) const-
1177{-
1178 if (!d
!dDescription
TRUEnever evaluated
FALSEnever evaluated
|| x < 0
x < 0Description
TRUEnever evaluated
FALSEnever evaluated
|| x >= d->width
x >= d->widthDescription
TRUEnever evaluated
FALSEnever evaluated
|| y < 0
y < 0Description
TRUEnever evaluated
FALSEnever evaluated
|| y >= height()
y >= height()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
1179 QMessageLogger(__FILE__, 2420, __PRETTY_FUNCTION__).warning("QImage::pixelColor: coordinate (%d,%d) out of range", x, y);-
1180 return
never executed: return QColor();
QColor();
never executed: return QColor();
0
1181 }-
1182-
1183 QRgba64 c;-
1184 const uchar * s = constScanLine(y);-
1185 switch (d->format) {-
1186 case
never executed: case Format_BGR30:
Format_BGR30:
never executed: case Format_BGR30:
0
1187 case
never executed: case Format_A2BGR30_Premultiplied:
Format_A2BGR30_Premultiplied:
never executed: case Format_A2BGR30_Premultiplied:
0
1188 c = qConvertA2rgb30ToRgb64<PixelOrderBGR>(reinterpret_cast<const quint32 *>(s)[x]);-
1189 break;
never executed: break;
0
1190 case
never executed: case Format_RGB30:
Format_RGB30:
never executed: case Format_RGB30:
0
1191 case
never executed: case Format_A2RGB30_Premultiplied:
Format_A2RGB30_Premultiplied:
never executed: case Format_A2RGB30_Premultiplied:
0
1192 c = qConvertA2rgb30ToRgb64<PixelOrderRGB>(reinterpret_cast<const quint32 *>(s)[x]);-
1193 break;
never executed: break;
0
1194 default
never executed: default:
:
never executed: default:
0
1195 c = QRgba64::fromArgb32(pixel(x, y));-
1196 break;
never executed: break;
0
1197 }-
1198-
1199 if (hasAlphaChannel()
hasAlphaChannel()Description
TRUEnever evaluated
FALSEnever evaluated
&& qPixelLayouts[d->format].premultiplied
qPixelLayouts[....premultipliedDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
1200 c = c.unpremultiplied();
never executed: c = c.unpremultiplied();
0
1201 return
never executed: return QColor(c);
QColor(c);
never executed: return QColor(c);
0
1202}-
1203void QImage::setPixelColor(int x, int y, const QColor &color)-
1204{-
1205 if (!d
!dDescription
TRUEnever evaluated
FALSEnever evaluated
|| x < 0
x < 0Description
TRUEnever evaluated
FALSEnever evaluated
|| x >= width()
x >= width()Description
TRUEnever evaluated
FALSEnever evaluated
|| y < 0
y < 0Description
TRUEnever evaluated
FALSEnever evaluated
|| y >= height()
y >= height()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
1206 QMessageLogger(__FILE__, 2470, __PRETTY_FUNCTION__).warning("QImage::setPixelColor: coordinate (%d,%d) out of range", x, y);-
1207 return;
never executed: return;
0
1208 }-
1209-
1210 if (!color.isValid()
!color.isValid()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
1211 QMessageLogger(__FILE__, 2475, __PRETTY_FUNCTION__).warning("QImage::setPixelColor: color is invalid");-
1212 return;
never executed: return;
0
1213 }-
1214-
1215-
1216 QRgba64 c = color.rgba64();-
1217 if (!hasAlphaChannel()
!hasAlphaChannel()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1218 c.setAlpha(65535);
never executed: c.setAlpha(65535);
0
1219 else if (qPixelLayouts[d->format].premultiplied
qPixelLayouts[....premultipliedDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
1220 c = c.premultiplied();
never executed: c = c.premultiplied();
0
1221-
1222 uchar * s = scanLine(y);-
1223 switch (d->format) {-
1224 case
never executed: case Format_Mono:
Format_Mono:
never executed: case Format_Mono:
0
1225 case
never executed: case Format_MonoLSB:
Format_MonoLSB:
never executed: case Format_MonoLSB:
0
1226 case
never executed: case Format_Indexed8:
Format_Indexed8:
never executed: case Format_Indexed8:
0
1227 QMessageLogger(__FILE__, 2491, __PRETTY_FUNCTION__).warning("QImage::setPixelColor: called on monochrome or indexed format");-
1228 return;
never executed: return;
0
1229 case
never executed: case Format_BGR30:
Format_BGR30:
never executed: case Format_BGR30:
0
1230 ((uint *)s)[x] = qConvertRgb64ToRgb30<PixelOrderBGR>(c) | 0xc0000000;-
1231 return;
never executed: return;
0
1232 case
never executed: case Format_A2BGR30_Premultiplied:
Format_A2BGR30_Premultiplied:
never executed: case Format_A2BGR30_Premultiplied:
0
1233 ((uint *)s)[x] = qConvertRgb64ToRgb30<PixelOrderBGR>(c);-
1234 return;
never executed: return;
0
1235 case
never executed: case Format_RGB30:
Format_RGB30:
never executed: case Format_RGB30:
0
1236 ((uint *)s)[x] = qConvertRgb64ToRgb30<PixelOrderRGB>(c) | 0xc0000000;-
1237 return;
never executed: return;
0
1238 case
never executed: case Format_A2RGB30_Premultiplied:
Format_A2RGB30_Premultiplied:
never executed: case Format_A2RGB30_Premultiplied:
0
1239 ((uint *)s)[x] = qConvertRgb64ToRgb30<PixelOrderRGB>(c);-
1240 return;
never executed: return;
0
1241 default
never executed: default:
:
never executed: default:
0
1242 setPixel(x, y, c.toArgb32());-
1243 return;
never executed: return;
0
1244 }-
1245}-
1246bool QImage::allGray() const-
1247{-
1248 if (!d
!dDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
1249 return
never executed: return true;
true;
never executed: return true;
0
1250-
1251 switch (d->format) {-
1252 case
never executed: case Format_Mono:
Format_Mono:
never executed: case Format_Mono:
0
1253 case
never executed: case Format_MonoLSB:
Format_MonoLSB:
never executed: case Format_MonoLSB:
0
1254 case
never executed: case Format_Indexed8:
Format_Indexed8:
never executed: case Format_Indexed8:
0
1255 for (int i = 0; i < d->colortable.size()
i < d->colortable.size()Description
TRUEnever evaluated
FALSEnever evaluated
; ++i) {
0
1256 if (!qIsGray(d->colortable.at(i))
!qIsGray(d->colortable.at(i))Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1257 return
never executed: return false;
false;
never executed: return false;
0
1258 }
never executed: end of block
0
1259 return
never executed: return true;
true;
never executed: return true;
0
1260 case
never executed: case Format_Alpha8:
Format_Alpha8:
never executed: case Format_Alpha8:
0
1261 return
never executed: return false;
false;
never executed: return false;
0
1262 case
never executed: case Format_Grayscale8:
Format_Grayscale8:
never executed: case Format_Grayscale8:
0
1263 return
never executed: return true;
true;
never executed: return true;
0
1264 case
never executed: case Format_RGB32:
Format_RGB32:
never executed: case Format_RGB32:
0
1265 case
never executed: case Format_ARGB32:
Format_ARGB32:
never executed: case Format_ARGB32:
0
1266 case
never executed: case Format_ARGB32_Premultiplied:
Format_ARGB32_Premultiplied:
never executed: case Format_ARGB32_Premultiplied:
0
1267-
1268 case
never executed: case Format_RGBX8888:
Format_RGBX8888:
never executed: case Format_RGBX8888:
0
1269 case
never executed: case Format_RGBA8888:
Format_RGBA8888:
never executed: case Format_RGBA8888:
0
1270 case
never executed: case Format_RGBA8888_Premultiplied:
Format_RGBA8888_Premultiplied:
never executed: case Format_RGBA8888_Premultiplied:
0
1271-
1272 for (int j = 0; j < d->height
j < d->heightDescription
TRUEnever evaluated
FALSEnever evaluated
; ++j) {
0
1273 const QRgb *b = (const QRgb *)constScanLine(j);-
1274 for (int i = 0; i < d->width
i < d->widthDescription
TRUEnever evaluated
FALSEnever evaluated
; ++i) {
0
1275 if (!qIsGray(b[i])
!qIsGray(b[i])Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1276 return
never executed: return false;
false;
never executed: return false;
0
1277 }
never executed: end of block
0
1278 }
never executed: end of block
0
1279 return
never executed: return true;
true;
never executed: return true;
0
1280 case
never executed: case Format_RGB16:
Format_RGB16:
never executed: case Format_RGB16:
0
1281 for (int j = 0; j < d->height
j < d->heightDescription
TRUEnever evaluated
FALSEnever evaluated
; ++j) {
0
1282 const quint16 *b = (const quint16 *)constScanLine(j);-
1283 for (int i = 0; i < d->width
i < d->widthDescription
TRUEnever evaluated
FALSEnever evaluated
; ++i) {
0
1284 if (!qIsGray(qConvertRgb16To32(b[i]))
!qIsGray(qConv...b16To32(b[i]))Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1285 return
never executed: return false;
false;
never executed: return false;
0
1286 }
never executed: end of block
0
1287 }
never executed: end of block
0
1288 return
never executed: return true;
true;
never executed: return true;
0
1289 default
never executed: default:
:
never executed: default:
0
1290 break;
never executed: break;
0
1291 }-
1292-
1293 const int buffer_size = 2048;-
1294 uint buffer[buffer_size];-
1295 const QPixelLayout *layout = &qPixelLayouts[d->format];-
1296 FetchPixelsFunc fetch = qFetchPixels[layout->bpp];-
1297 for (int j = 0; j < d->height
j < d->heightDescription
TRUEnever evaluated
FALSEnever evaluated
; ++j) {
0
1298 const uchar *b = constScanLine(j);-
1299 int x = 0;-
1300 while (x < d->width
x < d->widthDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
1301 int l = qMin(d->width - x, buffer_size);-
1302 const uint *ptr = fetch(buffer, b, x, l);-
1303 ptr = layout->convertToARGB32PM(buffer, ptr, l, layout, 0);-
1304 for (int i = 0; i < l
i < lDescription
TRUEnever evaluated
FALSEnever evaluated
; ++i) {
0
1305 if (!qIsGray(ptr[i])
!qIsGray(ptr[i])Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1306 return
never executed: return false;
false;
never executed: return false;
0
1307 }
never executed: end of block
0
1308 x += l;-
1309 }
never executed: end of block
0
1310 }
never executed: end of block
0
1311 return
never executed: return true;
true;
never executed: return true;
0
1312}-
1313bool QImage::isGrayscale() const-
1314{-
1315 if (!d
!dDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
1316 return
never executed: return false;
false;
never executed: return false;
0
1317-
1318 if (d->format == QImage::Format_Alpha8
d->format == Q...:Format_Alpha8Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1319 return
never executed: return false;
false;
never executed: return false;
0
1320-
1321 if (d->format == QImage::Format_Grayscale8
d->format == Q...mat_Grayscale8Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1322 return
never executed: return true;
true;
never executed: return true;
0
1323-
1324 switch (depth()) {-
1325 case
never executed: case 32:
32:
never executed: case 32:
0
1326 case
never executed: case 24:
24:
never executed: case 24:
0
1327 case
never executed: case 16:
16:
never executed: case 16:
0
1328 return
never executed: return allGray();
allGray();
never executed: return allGray();
0
1329 case
never executed: case 8:
8:
never executed: case 8:
{
0
1330 ((!(d->format == QImage::Format_Indexed8)) ? qt_assert("d->format == QImage::Format_Indexed8",__FILE__,2614) : qt_noop());-
1331 for (int i = 0; i < colorCount()
i < colorCount()Description
TRUEnever evaluated
FALSEnever evaluated
; i++)
0
1332 if (d->colortable.at(i) != qRgb(i,i,i)
d->colortable....!= qRgb(i,i,i)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1333 return
never executed: return false;
false;
never executed: return false;
0
1334 return
never executed: return true;
true;
never executed: return true;
0
1335 }-
1336 }-
1337 return
never executed: return false;
false;
never executed: return false;
0
1338}-
1339QImage QImage::scaled(const QSize& s, Qt::AspectRatioMode aspectMode, Qt::TransformationMode mode) const-
1340{-
1341 if (!d
!dDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
1342 QMessageLogger(__FILE__, 2665, __PRETTY_FUNCTION__).warning("QImage::scaled: Image is a null image");-
1343 return
never executed: return QImage();
QImage();
never executed: return QImage();
0
1344 }-
1345 if (s.isEmpty()
s.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1346 return
never executed: return QImage();
QImage();
never executed: return QImage();
0
1347-
1348 QSize newSize = size();-
1349 newSize.scale(s, aspectMode);-
1350 newSize.rwidth() = qMax(newSize.width(), 1);-
1351 newSize.rheight() = qMax(newSize.height(), 1);-
1352 if (newSize == size()
newSize == size()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1353 return
never executed: return *this;
*this;
never executed: return *this;
0
1354-
1355 QTransform wm = QTransform::fromScale((qreal)newSize.width() / width(), (qreal)newSize.height() / height());-
1356 QImage img = transformed(wm, mode);-
1357 return
never executed: return img;
img;
never executed: return img;
0
1358}-
1359QImage QImage::scaledToWidth(int w, Qt::TransformationMode mode) const-
1360{-
1361 if (!d
!dDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
1362 QMessageLogger(__FILE__, 2700, __PRETTY_FUNCTION__).warning("QImage::scaleWidth: Image is a null image");-
1363 return
never executed: return QImage();
QImage();
never executed: return QImage();
0
1364 }-
1365 if (w <= 0
w <= 0Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1366 return
never executed: return QImage();
QImage();
never executed: return QImage();
0
1367-
1368 qreal factor = (qreal) w / width();-
1369 QTransform wm = QTransform::fromScale(factor, factor);-
1370 return
never executed: return transformed(wm, mode);
transformed(wm, mode);
never executed: return transformed(wm, mode);
0
1371}-
1372QImage QImage::scaledToHeight(int h, Qt::TransformationMode mode) const-
1373{-
1374 if (!d
!dDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
1375 QMessageLogger(__FILE__, 2728, __PRETTY_FUNCTION__).warning("QImage::scaleHeight: Image is a null image");-
1376 return
never executed: return QImage();
QImage();
never executed: return QImage();
0
1377 }-
1378 if (h <= 0
h <= 0Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1379 return
never executed: return QImage();
QImage();
never executed: return QImage();
0
1380-
1381 qreal factor = (qreal) h / height();-
1382 QTransform wm = QTransform::fromScale(factor, factor);-
1383 return
never executed: return transformed(wm, mode);
transformed(wm, mode);
never executed: return transformed(wm, mode);
0
1384}-
1385QMatrix QImage::trueMatrix(const QMatrix &matrix, int w, int h)-
1386{-
1387 return
never executed: return trueMatrix(QTransform(matrix), w, h).toAffine();
trueMatrix(QTransform(matrix), w, h).toAffine();
never executed: return trueMatrix(QTransform(matrix), w, h).toAffine();
0
1388}-
1389QImage QImage::transformed(const QMatrix &matrix, Qt::TransformationMode mode) const-
1390{-
1391 return
never executed: return transformed(QTransform(matrix), mode);
transformed(QTransform(matrix), mode);
never executed: return transformed(QTransform(matrix), mode);
0
1392}-
1393QImage QImage::createAlphaMask(Qt::ImageConversionFlags flags) const-
1394{-
1395 if (!d
!dDescription
TRUEnever evaluated
FALSEnever evaluated
|| d->format == QImage::Format_RGB32
d->format == Q...::Format_RGB32Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1396 return
never executed: return QImage();
QImage();
never executed: return QImage();
0
1397-
1398 if (d->depth == 1
d->depth == 1Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
1399-
1400-
1401 return
never executed: return convertToFormat(Format_Indexed8, flags).createAlphaMask(flags);
convertToFormat(Format_Indexed8, flags).createAlphaMask(flags);
never executed: return convertToFormat(Format_Indexed8, flags).createAlphaMask(flags);
0
1402 }-
1403-
1404 QImage mask(d->width, d->height, Format_MonoLSB);-
1405 if (!mask.isNull()
!mask.isNull()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1406 dither_to_Mono(mask.d, d, flags, true);
never executed: dither_to_Mono(mask.d, d, flags, true);
0
1407 return
never executed: return mask;
mask;
never executed: return mask;
0
1408}-
1409QImage QImage::createHeuristicMask(bool clipTight) const-
1410{-
1411 if (!d
!dDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
1412 return
never executed: return QImage();
QImage();
never executed: return QImage();
0
1413-
1414 if (d->depth != 32
d->depth != 32Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
1415 QImage img32 = convertToFormat(Format_RGB32);-
1416 return
never executed: return img32.createHeuristicMask(clipTight);
img32.createHeuristicMask(clipTight);
never executed: return img32.createHeuristicMask(clipTight);
0
1417 }-
1418-
1419-
1420-
1421 int w = width();-
1422 int h = height();-
1423 QImage m(w, h, Format_MonoLSB);-
1424 if ((
(m).isNull()Description
TRUEnever evaluated
FALSEnever evaluated
m).isNull()
(m).isNull()Description
TRUEnever evaluated
FALSEnever evaluated
) { QMessageLogger(__FILE__, 2853, __PRETTY_FUNCTION__).warning("QImage: out of memory, returning null image"); return
never executed: return QImage();
QImage();
never executed: return QImage();
};
0
1425 m.setColorCount(2);-
1426 m.setColor(0, QColor(Qt::color0).rgba());-
1427 m.setColor(1, QColor(Qt::color1).rgba());-
1428 m.fill(0xff);-
1429-
1430 QRgb background = (*((const QRgb*)scanLine(0)+0) & 0x00ffffff);-
1431 if (background != (*((const QRgb*)scanLine(0)+w-1) & 0x00ffffff)
background != ... & 0x00ffffff)Description
TRUEnever evaluated
FALSEnever evaluated
&&
0
1432 background != (*((const QRgb*)scanLine(h-1)+0) & 0x00ffffff)
background != ... & 0x00ffffff)Description
TRUEnever evaluated
FALSEnever evaluated
&&
0
1433 background != (*((const QRgb*)scanLine(h-1)+w-1) & 0x00ffffff)
background != ... & 0x00ffffff)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
1434 background = (*((const QRgb*)scanLine(0)+w-1) & 0x00ffffff);-
1435 if (background != (*((const QRgb*)scanLine(h-1)+w-1) & 0x00ffffff)
background != ... & 0x00ffffff)Description
TRUEnever evaluated
FALSEnever evaluated
&&
0
1436 background != (*((const QRgb*)scanLine(h-1)+0) & 0x00ffffff)
background != ... & 0x00ffffff)Description
TRUEnever evaluated
FALSEnever evaluated
&&
0
1437 (*((const
(*((const QRgb... & 0x00ffffff)Description
TRUEnever evaluated
FALSEnever evaluated
QRgb*)scanLine(h-1)+0) & 0x00ffffff) == (*((const QRgb*)scanLine(h-1)+w-1) & 0x00ffffff)
(*((const QRgb... & 0x00ffffff)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
1438 background = (*((const QRgb*)scanLine(h-1)+w-1) & 0x00ffffff);-
1439 }
never executed: end of block
0
1440 }
never executed: end of block
0
1441-
1442 int x,y;-
1443 bool done = false;-
1444 uchar *ypp, *ypc, *ypn;-
1445 while(!done
!doneDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
1446 done = true;-
1447 ypn = m.scanLine(0);-
1448 ypc = 0;-
1449 for (y = 0; y < h
y < hDescription
TRUEnever evaluated
FALSEnever evaluated
; y++) {
0
1450 ypp = ypc;-
1451 ypc = ypn;-
1452 ypn = (
(y == h-1)Description
TRUEnever evaluated
FALSEnever evaluated
y == h-1)
(y == h-1)Description
TRUEnever evaluated
FALSEnever evaluated
? 0 : m.scanLine(y+1);
0
1453 const QRgb *p = (const QRgb *)scanLine(y);-
1454 for (x = 0; x < w
x < wDescription
TRUEnever evaluated
FALSEnever evaluated
; x++) {
0
1455-
1456-
1457 if ((x == 0
x == 0Description
TRUEnever evaluated
FALSEnever evaluated
|| y == 0
y == 0Description
TRUEnever evaluated
FALSEnever evaluated
|| x == w-1
x == w-1Description
TRUEnever evaluated
FALSEnever evaluated
|| y == h-1
y == h-1Description
TRUEnever evaluated
FALSEnever evaluated
||
0
1458 !(*(ypc + ((x-1) >> 3)) & (1 << ((x-1) & 7)))
!(*(ypc + ((x-... ((x-1) & 7)))Description
TRUEnever evaluated
FALSEnever evaluated
||
0
1459 !(*(ypc + ((x+1) >> 3)) & (1 << ((x+1) & 7)))
!(*(ypc + ((x+... ((x+1) & 7)))Description
TRUEnever evaluated
FALSEnever evaluated
||
0
1460 !(*(ypp + (x >> 3)) & (1 << (x & 7)))
!(*(ypp + (x >...1 << (x & 7)))Description
TRUEnever evaluated
FALSEnever evaluated
||
0
1461 !(*(ypn + (x >> 3)) & (1 << (x & 7)))
!(*(ypn + (x >...1 << (x & 7)))Description
TRUEnever evaluated
FALSEnever evaluated
) &&
0
1462 (
( (*(ypc + (x ... << (x & 7))))Description
TRUEnever evaluated
FALSEnever evaluated
(*(ypc + (x >> 3)) & (1 << (x & 7))))
( (*(ypc + (x ... << (x & 7))))Description
TRUEnever evaluated
FALSEnever evaluated
&&
0
1463 ((*
((*p & 0x00fff...== background)Description
TRUEnever evaluated
FALSEnever evaluated
p & 0x00ffffff) == background)
((*p & 0x00fff...== background)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
1464 done = false;-
1465 *(ypc + (x >> 3)) &= ~(1 << (x & 7));-
1466 }
never executed: end of block
0
1467 p++;-
1468 }
never executed: end of block
0
1469 }
never executed: end of block
0
1470 }
never executed: end of block
0
1471-
1472 if (!clipTight
!clipTightDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
1473 ypn = m.scanLine(0);-
1474 ypc = 0;-
1475 for (y = 0; y < h
y < hDescription
TRUEnever evaluated
FALSEnever evaluated
; y++) {
0
1476 ypp = ypc;-
1477 ypc = ypn;-
1478 ypn = (
(y == h-1)Description
TRUEnever evaluated
FALSEnever evaluated
y == h-1)
(y == h-1)Description
TRUEnever evaluated
FALSEnever evaluated
? 0 : m.scanLine(y+1);
0
1479 const QRgb *p = (const QRgb *)scanLine(y);-
1480 for (x = 0; x < w
x < wDescription
TRUEnever evaluated
FALSEnever evaluated
; x++) {
0
1481 if ((*
(*p & 0x00ffff... != backgroundDescription
TRUEnever evaluated
FALSEnever evaluated
p & 0x00ffffff) != background
(*p & 0x00ffff... != backgroundDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
1482 if (x > 0
x > 0Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1483 *(
never executed: *(ypc + ((x-1) >> 3)) |= (1 << ((x-1) & 7));
ypc + ((x-1) >> 3)) |= (1 << ((x-1) & 7));
never executed: *(ypc + ((x-1) >> 3)) |= (1 << ((x-1) & 7));
0
1484 if (x < w-1
x < w-1Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1485 *(
never executed: *(ypc + ((x+1) >> 3)) |= (1 << ((x+1) & 7));
ypc + ((x+1) >> 3)) |= (1 << ((x+1) & 7));
never executed: *(ypc + ((x+1) >> 3)) |= (1 << ((x+1) & 7));
0
1486 if (y > 0
y > 0Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1487 *(
never executed: *(ypp + (x >> 3)) |= (1 << (x & 7));
ypp + (x >> 3)) |= (1 << (x & 7));
never executed: *(ypp + (x >> 3)) |= (1 << (x & 7));
0
1488 if (y < h-1
y < h-1Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1489 *(
never executed: *(ypn + (x >> 3)) |= (1 << (x & 7));
ypn + (x >> 3)) |= (1 << (x & 7));
never executed: *(ypn + (x >> 3)) |= (1 << (x & 7));
0
1490 }
never executed: end of block
0
1491 p++;-
1492 }
never executed: end of block
0
1493 }
never executed: end of block
0
1494 }
never executed: end of block
0
1495-
1496-
1497-
1498 return
never executed: return m;
m;
never executed: return m;
0
1499}-
1500QImage QImage::createMaskFromColor(QRgb color, Qt::MaskMode mode) const-
1501{-
1502 if (!d
!dDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
1503 return
never executed: return QImage();
QImage();
never executed: return QImage();
0
1504 QImage maskImage(size(), QImage::Format_MonoLSB);-
1505 if ((
(maskImage).isNull()Description
TRUEnever evaluated
FALSEnever evaluated
maskImage).isNull()
(maskImage).isNull()Description
TRUEnever evaluated
FALSEnever evaluated
) { QMessageLogger(__FILE__, 2946, __PRETTY_FUNCTION__).warning("QImage: out of memory, returning null image"); return
never executed: return QImage();
QImage();
never executed: return QImage();
};
0
1506 maskImage.fill(0);-
1507 uchar *s = maskImage.bits();-
1508-
1509 if (depth() == 32
depth() == 32Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
1510 for (int h = 0; h < d->height
h < d->heightDescription
TRUEnever evaluated
FALSEnever evaluated
; h++) {
0
1511 const uint *sl = (const uint *) scanLine(h);-
1512 for (int w = 0; w < d->width
w < d->widthDescription
TRUEnever evaluated
FALSEnever evaluated
; w++) {
0
1513 if (sl[w] == color
sl[w] == colorDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
1514 *(
never executed: *(s + (w >> 3)) |= (1 << (w & 7));
s + (w >> 3)) |= (1 << (w & 7));
never executed: *(s + (w >> 3)) |= (1 << (w & 7));
0
1515 }
never executed: end of block
0
1516 s += maskImage.bytesPerLine();-
1517 }
never executed: end of block
0
1518 }
never executed: end of block
else {
0
1519 for (int h = 0; h < d->height
h < d->heightDescription
TRUEnever evaluated
FALSEnever evaluated
; h++) {
0
1520 for (int w = 0; w < d->width
w < d->widthDescription
TRUEnever evaluated
FALSEnever evaluated
; w++) {
0
1521 if ((
(uint) pixel(w, h) == colorDescription
TRUEnever evaluated
FALSEnever evaluated
uint) pixel(w, h) == color
(uint) pixel(w, h) == colorDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
1522 *(
never executed: *(s + (w >> 3)) |= (1 << (w & 7));
s + (w >> 3)) |= (1 << (w & 7));
never executed: *(s + (w >> 3)) |= (1 << (w & 7));
0
1523 }
never executed: end of block
0
1524 s += maskImage.bytesPerLine();-
1525 }
never executed: end of block
0
1526 }
never executed: end of block
0
1527 if (mode == Qt::MaskOutColor
mode == Qt::MaskOutColorDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
1528 maskImage.invertPixels();
never executed: maskImage.invertPixels();
0
1529 return
never executed: return maskImage;
maskImage;
never executed: return maskImage;
0
1530}-
1531template<class T> inline void do_mirror_data(QImageData *dst, QImageData *src,-
1532 int dstX0, int dstY0,-
1533 int dstXIncr, int dstYIncr,-
1534 int w, int h)-
1535{-
1536 if (dst == src
dst == srcDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
1537-
1538-
1539 const int srcXEnd = (dstX0 && !dstY0) ? w / 2 : w;-
1540 const int srcYEnd = dstY0 ? h / 2 : h;-
1541 for (int srcY = 0, dstY = dstY0; srcY < srcYEnd
srcY < srcYEndDescription
TRUEnever evaluated
FALSEnever evaluated
; ++srcY, dstY += dstYIncr) {
0
1542 T *srcPtr = (T *) (src->data + srcY * src->bytes_per_line);-
1543 T *dstPtr = (T *) (dst->data + dstY * dst->bytes_per_line);-
1544 for (int srcX = 0, dstX = dstX0; srcX < srcXEnd
srcX < srcXEndDescription
TRUEnever evaluated
FALSEnever evaluated
; ++srcX, dstX += dstXIncr)
0
1545 std::swap(srcPtr[srcX], dstPtr[dstX]);
never executed: std::swap(srcPtr[srcX], dstPtr[dstX]);
0
1546 }
never executed: end of block
0
1547-
1548 if (dstX0
dstX0Description
TRUEnever evaluated
FALSEnever evaluated
&& dstY0
dstY0Description
TRUEnever evaluated
FALSEnever evaluated
&& (
(h & 1)Description
TRUEnever evaluated
FALSEnever evaluated
h & 1)
(h & 1)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
1549 int srcY = h / 2;-
1550 int srcXEnd2 = w / 2;-
1551 T *srcPtr = (T *) (src->data + srcY * src->bytes_per_line);-
1552 for (int srcX = 0, dstX = dstX0; srcX < srcXEnd2
srcX < srcXEnd2Description
TRUEnever evaluated
FALSEnever evaluated
; ++srcX, dstX += dstXIncr)
0
1553 std::swap(srcPtr[srcX], srcPtr[dstX]);
never executed: std::swap(srcPtr[srcX], srcPtr[dstX]);
0
1554 }
never executed: end of block
0
1555 }
never executed: end of block
else {
0
1556 for (int srcY = 0, dstY = dstY0; srcY < h
srcY < hDescription
TRUEnever evaluated
FALSEnever evaluated
; ++srcY, dstY += dstYIncr) {
0
1557 T *srcPtr = (T *) (src->data + srcY * src->bytes_per_line);-
1558 T *dstPtr = (T *) (dst->data + dstY * dst->bytes_per_line);-
1559 for (int srcX = 0, dstX = dstX0; srcX < w
srcX < wDescription
TRUEnever evaluated
FALSEnever evaluated
; ++srcX, dstX += dstXIncr)
0
1560 dstPtr[dstX] = srcPtr[srcX];
never executed: dstPtr[dstX] = srcPtr[srcX];
0
1561 }
never executed: end of block
0
1562 }
never executed: end of block
0
1563}-
1564-
1565inline void do_mirror(QImageData *dst, QImageData *src, bool horizontal, bool vertical)-
1566{-
1567 ((!(src->width == dst->width && src->height == dst->height && src->depth == dst->depth)) ? qt_assert("src->width == dst->width && src->height == dst->height && src->depth == dst->depth",__FILE__,3020) : qt_noop());-
1568 int w = src->width;-
1569 int h = src->height;-
1570 int depth = src->depth;-
1571-
1572 if (src->depth == 1
src->depth == 1Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
1573 w = (w + 7) / 8;-
1574 depth = 8;-
1575 }
never executed: end of block
0
1576-
1577 int dstX0 = 0, dstXIncr = 1;-
1578 int dstY0 = 0, dstYIncr = 1;-
1579 if (horizontal
horizontalDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
1580-
1581 dstX0 = w - 1;-
1582 dstXIncr = -1;-
1583 }
never executed: end of block
0
1584 if (vertical
verticalDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
1585-
1586 dstY0 = h - 1;-
1587 dstYIncr = -1;-
1588 }
never executed: end of block
0
1589-
1590 switch (depth) {-
1591 case
never executed: case 32:
32:
never executed: case 32:
0
1592 do_mirror_data<quint32>(dst, src, dstX0, dstY0, dstXIncr, dstYIncr, w, h);-
1593 break;
never executed: break;
0
1594 case
never executed: case 24:
24:
never executed: case 24:
0
1595 do_mirror_data<quint24>(dst, src, dstX0, dstY0, dstXIncr, dstYIncr, w, h);-
1596 break;
never executed: break;
0
1597 case
never executed: case 16:
16:
never executed: case 16:
0
1598 do_mirror_data<quint16>(dst, src, dstX0, dstY0, dstXIncr, dstYIncr, w, h);-
1599 break;
never executed: break;
0
1600 case
never executed: case 8:
8:
never executed: case 8:
0
1601 do_mirror_data<quint8>(dst, src, dstX0, dstY0, dstXIncr, dstYIncr, w, h);-
1602 break;
never executed: break;
0
1603 default
never executed: default:
:
never executed: default:
0
1604 ((!(false)) ? qt_assert("false",__FILE__,3057) : qt_noop());-
1605 break;
never executed: break;
0
1606 }-
1607-
1608-
1609-
1610 if (horizontal
horizontalDescription
TRUEnever evaluated
FALSEnever evaluated
&& dst->depth == 1
dst->depth == 1Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
1611 ((!(dst->format == QImage::Format_Mono || dst->format == QImage::Format_MonoLSB)) ? qt_assert("dst->format == QImage::Format_Mono || dst->format == QImage::Format_MonoLSB",__FILE__,3064) : qt_noop());-
1612 const int shift = 8 - (dst->width % 8);-
1613 const uchar *bitflip = qt_get_bitflip_array();-
1614 for (int y = 0; y < h
y < hDescription
TRUEnever evaluated
FALSEnever evaluated
; ++y) {
0
1615 uchar *begin = dst->data + y * dst->bytes_per_line;-
1616 uchar *end = begin + dst->bytes_per_line;-
1617 for (uchar *p = begin; p < end
p < endDescription
TRUEnever evaluated
FALSEnever evaluated
; ++p) {
0
1618 *p = bitflip[*p];-
1619-
1620-
1621 if (shift != 8
shift != 8Description
TRUEnever evaluated
FALSEnever evaluated
&& p != begin
p != beginDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
1622 if (dst->format == QImage::Format_Mono
dst->format ==...e::Format_MonoDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
1623 for (int i = 0; i < shift
i < shiftDescription
TRUEnever evaluated
FALSEnever evaluated
; ++i) {
0
1624 p[-1] <<= 1;-
1625 p[-1] |= (*p & (128 >> i)) >> (7 - i);-
1626 }
never executed: end of block
0
1627 }
never executed: end of block
else {
0
1628 for (int i = 0; i < shift
i < shiftDescription
TRUEnever evaluated
FALSEnever evaluated
; ++i) {
0
1629 p[-1] >>= 1;-
1630 p[-1] |= (*p & (1 << i)) << (7 - i);-
1631 }
never executed: end of block
0
1632 }
never executed: end of block
0
1633 }-
1634 }
never executed: end of block
0
1635 if (shift != 8
shift != 8Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
1636 if (dst->format == QImage::Format_Mono
dst->format ==...e::Format_MonoDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
1637 end[-1] <<= shift;
never executed: end[-1] <<= shift;
0
1638 else-
1639 end[-1] >>= shift;
never executed: end[-1] >>= shift;
0
1640 }-
1641 }
never executed: end of block
0
1642 }
never executed: end of block
0
1643}
never executed: end of block
0
1644-
1645-
1646-
1647-
1648QImage QImage::mirrored_helper(bool horizontal, bool vertical) const-
1649{-
1650 if (!d
!dDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
1651 return
never executed: return QImage();
QImage();
never executed: return QImage();
0
1652-
1653 if ((d->width <= 1
d->width <= 1Description
TRUEnever evaluated
FALSEnever evaluated
&& d->height <= 1
d->height <= 1Description
TRUEnever evaluated
FALSEnever evaluated
) || (!horizontal
!horizontalDescription
TRUEnever evaluated
FALSEnever evaluated
&& !vertical
!verticalDescription
TRUEnever evaluated
FALSEnever evaluated
))
0
1654 return
never executed: return *this;
*this;
never executed: return *this;
0
1655-
1656-
1657 QImage result(d->width, d->height, d->format);-
1658 if ((
(result).isNull()Description
TRUEnever evaluated
FALSEnever evaluated
result).isNull()
(result).isNull()Description
TRUEnever evaluated
FALSEnever evaluated
) { QMessageLogger(__FILE__, 3111, __PRETTY_FUNCTION__).warning("QImage: out of memory, returning null image"); return
never executed: return QImage();
QImage();
never executed: return QImage();
};
0
1659-
1660-
1661 if (!result.d
!result.dDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
1662 return
never executed: return QImage();
QImage();
never executed: return QImage();
0
1663-
1664 result.d->colortable = d->colortable;-
1665 result.d->has_alpha_clut = d->has_alpha_clut;-
1666 copyMetadata(result.d, d);-
1667-
1668 do_mirror(result.d, d, horizontal, vertical);-
1669-
1670 return
never executed: return result;
result;
never executed: return result;
0
1671}-
1672-
1673-
1674-
1675-
1676void QImage::mirrored_inplace(bool horizontal, bool vertical)-
1677{-
1678 if (!d
!dDescription
TRUEnever evaluated
FALSEnever evaluated
|| (d->width <= 1
d->width <= 1Description
TRUEnever evaluated
FALSEnever evaluated
&& d->height <= 1
d->height <= 1Description
TRUEnever evaluated
FALSEnever evaluated
) || (!horizontal
!horizontalDescription
TRUEnever evaluated
FALSEnever evaluated
&& !vertical
!verticalDescription
TRUEnever evaluated
FALSEnever evaluated
))
0
1679 return;
never executed: return;
0
1680-
1681 detach();-
1682 if (!d->own_data
!d->own_dataDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
1683 *
never executed: *this = copy();
this = copy();
never executed: *this = copy();
0
1684-
1685 do_mirror(d, d, horizontal, vertical);-
1686}
never executed: end of block
0
1687inline void rgbSwapped_generic(int width, int height, const QImage *src, QImage *dst, const QPixelLayout* layout)-
1688{-
1689 ((!(layout->redWidth == layout->blueWidth)) ? qt_assert("layout->redWidth == layout->blueWidth",__FILE__,3154) : qt_noop());-
1690 FetchPixelsFunc fetch = qFetchPixels[layout->bpp];-
1691 StorePixelsFunc store = qStorePixels[layout->bpp];-
1692-
1693 const uint redBlueMask = (1 << layout->redWidth) - 1;-
1694 const uint alphaGreenMask = (((1 << layout->alphaWidth) - 1) << layout->alphaShift)-
1695 | (((1 << layout->greenWidth) - 1) << layout->greenShift);-
1696-
1697 const int buffer_size = 2048;-
1698 uint buffer[buffer_size];-
1699 for (int i = 0; i < height
i < heightDescription
TRUEnever evaluated
FALSEnever evaluated
; ++i) {
0
1700 uchar *q = dst->scanLine(i);-
1701 const uchar *p = src->constScanLine(i);-
1702 int x = 0;-
1703 while (x < width
x < widthDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
1704 int l = qMin(width - x, buffer_size);-
1705 const uint *ptr = fetch(buffer, p, x, l);-
1706 for (int j = 0; j < l
j < lDescription
TRUEnever evaluated
FALSEnever evaluated
; ++j) {
0
1707 uint red = (ptr[j] >> layout->redShift) & redBlueMask;-
1708 uint blue = (ptr[j] >> layout->blueShift) & redBlueMask;-
1709 buffer[j] = (ptr[j] & alphaGreenMask)-
1710 | (red << layout->blueShift)-
1711 | (blue << layout->redShift);-
1712 }
never executed: end of block
0
1713 store(q, buffer, x, l);-
1714 x += l;-
1715 }
never executed: end of block
0
1716 }
never executed: end of block
0
1717}
never executed: end of block
0
1718-
1719-
1720-
1721-
1722QImage QImage::rgbSwapped_helper() const-
1723{-
1724 if (isNull()
isNull()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1725 return
never executed: return *this;
*this;
never executed: return *this;
0
1726-
1727 QImage res;-
1728-
1729 switch (d->format) {-
1730 case
never executed: case Format_Invalid:
Format_Invalid:
never executed: case Format_Invalid:
0
1731 case
never executed: case NImageFormats:
NImageFormats:
never executed: case NImageFormats:
0
1732 ((!(false)) ? qt_assert("false",__FILE__,3197) : qt_noop());-
1733 break;
never executed: break;
0
1734 case
never executed: case Format_Alpha8:
Format_Alpha8:
never executed: case Format_Alpha8:
0
1735 case
never executed: case Format_Grayscale8:
Format_Grayscale8:
never executed: case Format_Grayscale8:
0
1736 return
never executed: return *this;
*this;
never executed: return *this;
0
1737 case
never executed: case Format_Mono:
Format_Mono:
never executed: case Format_Mono:
0
1738 case
never executed: case Format_MonoLSB:
Format_MonoLSB:
never executed: case Format_MonoLSB:
0
1739 case
never executed: case Format_Indexed8:
Format_Indexed8:
never executed: case Format_Indexed8:
0
1740 res = copy();-
1741 for (int i = 0; i < res.d->colortable.size()
i < res.d->colortable.size()Description
TRUEnever evaluated
FALSEnever evaluated
; i++) {
0
1742 QRgb c = res.d->colortable.at(i);-
1743 res.d->colortable[i] = QRgb(((c << 16) & 0xff0000) | ((c >> 16) & 0xff) | (c & 0xff00ff00));-
1744 }
never executed: end of block
0
1745 break;
never executed: break;
0
1746 case
never executed: case Format_RGB32:
Format_RGB32:
never executed: case Format_RGB32:
0
1747 case
never executed: case Format_ARGB32:
Format_ARGB32:
never executed: case Format_ARGB32:
0
1748 case
never executed: case Format_ARGB32_Premultiplied:
Format_ARGB32_Premultiplied:
never executed: case Format_ARGB32_Premultiplied:
0
1749-
1750 case
never executed: case Format_RGBX8888:
Format_RGBX8888:
never executed: case Format_RGBX8888:
0
1751 case
never executed: case Format_RGBA8888:
Format_RGBA8888:
never executed: case Format_RGBA8888:
0
1752 case
never executed: case Format_RGBA8888_Premultiplied:
Format_RGBA8888_Premultiplied:
never executed: case Format_RGBA8888_Premultiplied:
0
1753-
1754 res = QImage(d->width, d->height, d->format);-
1755 if ((
(res).isNull()Description
TRUEnever evaluated
FALSEnever evaluated
res).isNull()
(res).isNull()Description
TRUEnever evaluated
FALSEnever evaluated
) { QMessageLogger(__FILE__, 3220, __PRETTY_FUNCTION__).warning("QImage: out of memory, returning null image"); return
never executed: return QImage();
QImage();
never executed: return QImage();
};
0
1756 for (int i = 0; i < d->height
i < d->heightDescription
TRUEnever evaluated
FALSEnever evaluated
; i++) {
0
1757 uint *q = (uint*)res.scanLine(i);-
1758 const uint *p = (const uint*)constScanLine(i);-
1759 const uint *end = p + d->width;-
1760 while (p < end
p < endDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
1761 uint c = *p;-
1762 *q = ((c << 16) & 0xff0000) | ((c >> 16) & 0xff) | (c & 0xff00ff00);-
1763 p++;-
1764 q++;-
1765 }
never executed: end of block
0
1766 }
never executed: end of block
0
1767 break;
never executed: break;
0
1768 case
never executed: case Format_RGB16:
Format_RGB16:
never executed: case Format_RGB16:
0
1769 res = QImage(d->width, d->height, d->format);-
1770 if ((
(res).isNull()Description
TRUEnever evaluated
FALSEnever evaluated
res).isNull()
(res).isNull()Description
TRUEnever evaluated
FALSEnever evaluated
) { QMessageLogger(__FILE__, 3235, __PRETTY_FUNCTION__).warning("QImage: out of memory, returning null image"); return
never executed: return QImage();
QImage();
never executed: return QImage();
};
0
1771 for (int i = 0; i < d->height
i < d->heightDescription
TRUEnever evaluated
FALSEnever evaluated
; i++) {
0
1772 ushort *q = (ushort*)res.scanLine(i);-
1773 const ushort *p = (const ushort*)constScanLine(i);-
1774 const ushort *end = p + d->width;-
1775 while (p < end
p < endDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
1776 ushort c = *p;-
1777 *q = ((c << 11) & 0xf800) | ((c >> 11) & 0x1f) | (c & 0x07e0);-
1778 p++;-
1779 q++;-
1780 }
never executed: end of block
0
1781 }
never executed: end of block
0
1782 break;
never executed: break;
0
1783 case
never executed: case Format_BGR30:
Format_BGR30:
never executed: case Format_BGR30:
0
1784 case
never executed: case Format_A2BGR30_Premultiplied:
Format_A2BGR30_Premultiplied:
never executed: case Format_A2BGR30_Premultiplied:
0
1785 case
never executed: case Format_RGB30:
Format_RGB30:
never executed: case Format_RGB30:
0
1786 case
never executed: case Format_A2RGB30_Premultiplied:
Format_A2RGB30_Premultiplied:
never executed: case Format_A2RGB30_Premultiplied:
0
1787 res = QImage(d->width, d->height, d->format);-
1788 if ((
(res).isNull()Description
TRUEnever evaluated
FALSEnever evaluated
res).isNull()
(res).isNull()Description
TRUEnever evaluated
FALSEnever evaluated
) { QMessageLogger(__FILE__, 3253, __PRETTY_FUNCTION__).warning("QImage: out of memory, returning null image"); return
never executed: return QImage();
QImage();
never executed: return QImage();
};
0
1789 for (int i = 0; i < d->height
i < d->heightDescription
TRUEnever evaluated
FALSEnever evaluated
; i++) {
0
1790 uint *q = (uint*)res.scanLine(i);-
1791 const uint *p = (const uint*)constScanLine(i);-
1792 const uint *end = p + d->width;-
1793 while (p < end
p < endDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
1794 *q = qRgbSwapRgb30(*p);-
1795 p++;-
1796 q++;-
1797 }
never executed: end of block
0
1798 }
never executed: end of block
0
1799 break;
never executed: break;
0
1800 default
never executed: default:
:
never executed: default:
0
1801 res = QImage(d->width, d->height, d->format);-
1802 rgbSwapped_generic(d->width, d->height, this, &res, &qPixelLayouts[d->format]);-
1803 break;
never executed: break;
0
1804 }-
1805 copyMetadata(res.d, d);-
1806 return
never executed: return res;
res;
never executed: return res;
0
1807}-
1808-
1809-
1810-
1811-
1812void QImage::rgbSwapped_inplace()-
1813{-
1814 if (isNull()
isNull()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1815 return;
never executed: return;
0
1816-
1817 detach();-
1818 if (!d->own_data
!d->own_dataDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
1819 *
never executed: *this = copy();
this = copy();
never executed: *this = copy();
0
1820-
1821 switch (d->format) {-
1822 case
never executed: case Format_Invalid:
Format_Invalid:
never executed: case Format_Invalid:
0
1823 case
never executed: case NImageFormats:
NImageFormats:
never executed: case NImageFormats:
0
1824 ((!(false)) ? qt_assert("false",__FILE__,3289) : qt_noop());-
1825 break;
never executed: break;
0
1826 case
never executed: case Format_Alpha8:
Format_Alpha8:
never executed: case Format_Alpha8:
0
1827 case
never executed: case Format_Grayscale8:
Format_Grayscale8:
never executed: case Format_Grayscale8:
0
1828 return;
never executed: return;
0
1829 case
never executed: case Format_Mono:
Format_Mono:
never executed: case Format_Mono:
0
1830 case
never executed: case Format_MonoLSB:
Format_MonoLSB:
never executed: case Format_MonoLSB:
0
1831 case
never executed: case Format_Indexed8:
Format_Indexed8:
never executed: case Format_Indexed8:
0
1832 for (int i = 0; i < d->colortable.size()
i < d->colortable.size()Description
TRUEnever evaluated
FALSEnever evaluated
; i++) {
0
1833 QRgb c = d->colortable.at(i);-
1834 d->colortable[i] = QRgb(((c << 16) & 0xff0000) | ((c >> 16) & 0xff) | (c & 0xff00ff00));-
1835 }
never executed: end of block
0
1836 break;
never executed: break;
0
1837 case
never executed: case Format_RGB32:
Format_RGB32:
never executed: case Format_RGB32:
0
1838 case
never executed: case Format_ARGB32:
Format_ARGB32:
never executed: case Format_ARGB32:
0
1839 case
never executed: case Format_ARGB32_Premultiplied:
Format_ARGB32_Premultiplied:
never executed: case Format_ARGB32_Premultiplied:
0
1840-
1841 case
never executed: case Format_RGBX8888:
Format_RGBX8888:
never executed: case Format_RGBX8888:
0
1842 case
never executed: case Format_RGBA8888:
Format_RGBA8888:
never executed: case Format_RGBA8888:
0
1843 case
never executed: case Format_RGBA8888_Premultiplied:
Format_RGBA8888_Premultiplied:
never executed: case Format_RGBA8888_Premultiplied:
0
1844-
1845 for (int i = 0; i < d->height
i < d->heightDescription
TRUEnever evaluated
FALSEnever evaluated
; i++) {
0
1846 uint *p = (uint*)scanLine(i);-
1847 uint *end = p + d->width;-
1848 while (p < end
p < endDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
1849 uint c = *p;-
1850 *p = ((c << 16) & 0xff0000) | ((c >> 16) & 0xff) | (c & 0xff00ff00);-
1851 p++;-
1852 }
never executed: end of block
0
1853 }
never executed: end of block
0
1854 break;
never executed: break;
0
1855 case
never executed: case Format_RGB16:
Format_RGB16:
never executed: case Format_RGB16:
0
1856 for (int i = 0; i < d->height
i < d->heightDescription
TRUEnever evaluated
FALSEnever evaluated
; i++) {
0
1857 ushort *p = (ushort*)scanLine(i);-
1858 ushort *end = p + d->width;-
1859 while (p < end
p < endDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
1860 ushort c = *p;-
1861 *p = ((c << 11) & 0xf800) | ((c >> 11) & 0x1f) | (c & 0x07e0);-
1862 p++;-
1863 }
never executed: end of block
0
1864 }
never executed: end of block
0
1865 break;
never executed: break;
0
1866 case
never executed: case Format_BGR30:
Format_BGR30:
never executed: case Format_BGR30:
0
1867 case
never executed: case Format_A2BGR30_Premultiplied:
Format_A2BGR30_Premultiplied:
never executed: case Format_A2BGR30_Premultiplied:
0
1868 case
never executed: case Format_RGB30:
Format_RGB30:
never executed: case Format_RGB30:
0
1869 case
never executed: case Format_A2RGB30_Premultiplied:
Format_A2RGB30_Premultiplied:
never executed: case Format_A2RGB30_Premultiplied:
0
1870 for (int i = 0; i < d->height
i < d->heightDescription
TRUEnever evaluated
FALSEnever evaluated
; i++) {
0
1871 uint *p = (uint*)scanLine(i);-
1872 uint *end = p + d->width;-
1873 while (p < end
p < endDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
1874 *p = qRgbSwapRgb30(*p);-
1875 p++;-
1876 }
never executed: end of block
0
1877 }
never executed: end of block
0
1878 break;
never executed: break;
0
1879 default
never executed: default:
:
never executed: default:
0
1880 rgbSwapped_generic(d->width, d->height, this, this, &qPixelLayouts[d->format]);-
1881 break;
never executed: break;
0
1882 }-
1883}-
1884bool QImage::load(const QString &fileName, const char* format)-
1885{-
1886 QImage image = QImageReader(fileName, format).read();-
1887 operator=(image);-
1888 return
never executed: return !isNull();
!isNull();
never executed: return !isNull();
0
1889}-
1890bool QImage::load(QIODevice* device, const char* format)-
1891{-
1892 QImage image = QImageReader(device, format).read();-
1893 operator=(image);-
1894 return
never executed: return !isNull();
!isNull();
never executed: return !isNull();
0
1895}-
1896bool QImage::loadFromData(const uchar *data, int len, const char *format)-
1897{-
1898 QImage image = fromData(data, len, format);-
1899 operator=(image);-
1900 return
never executed: return !isNull();
!isNull();
never executed: return !isNull();
0
1901}-
1902QImage QImage::fromData(const uchar *data, int size, const char *format)-
1903{-
1904 QByteArray a = QByteArray::fromRawData(reinterpret_cast<const char *>(data), size);-
1905 QBuffer b;-
1906 b.setData(a);-
1907 b.open(QIODevice::ReadOnly);-
1908 return
never executed: return QImageReader(&b, format).read();
QImageReader(&b, format).read();
never executed: return QImageReader(&b, format).read();
0
1909}-
1910bool QImage::save(const QString &fileName, const char *format, int quality) const-
1911{-
1912 if (isNull()
isNull()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1913 return
never executed: return false;
false;
never executed: return false;
0
1914 QImageWriter writer(fileName, format);-
1915 return
never executed: return d->doImageIO(this, &writer, quality);
d->doImageIO(this, &writer, quality);
never executed: return d->doImageIO(this, &writer, quality);
0
1916}-
1917bool QImage::save(QIODevice* device, const char* format, int quality) const-
1918{-
1919 if (isNull()
isNull()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1920 return
never executed: return false;
false;
never executed: return false;
0
1921 QImageWriter writer(device, format);-
1922 return
never executed: return d->doImageIO(this, &writer, quality);
d->doImageIO(this, &writer, quality);
never executed: return d->doImageIO(this, &writer, quality);
0
1923}-
1924-
1925-
1926-
1927-
1928bool QImageData::doImageIO(const QImage *image, QImageWriter *writer, int quality) const-
1929{-
1930 if (quality > 100
quality > 100Description
TRUEnever evaluated
FALSEnever evaluated
|| quality < -1
quality < -1Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1931 QMessageLogger(__FILE__, 3504, __PRETTY_FUNCTION__).warning("QPixmap::save: Quality out of range [-1, 100]");
never executed: QMessageLogger(__FILE__, 3504, __PRETTY_FUNCTION__).warning("QPixmap::save: Quality out of range [-1, 100]");
0
1932 if (quality >= 0
quality >= 0Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1933 writer->setQuality(qMin(quality,100));
never executed: writer->setQuality(qMin(quality,100));
0
1934 return
never executed: return writer->write(*image);
writer->write(*image);
never executed: return writer->write(*image);
0
1935}-
1936QDataStream &operator<<(QDataStream &s, const QImage &image)-
1937{-
1938 if (s.version() >= 5
s.version() >= 5Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
1939 if (image.isNull()
image.isNull()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
1940 s << (qint32) 0;-
1941 return
never executed: return s;
s;
never executed: return s;
0
1942 } else {-
1943 s << (qint32) 1;-
1944-
1945 }
never executed: end of block
0
1946 }-
1947 QImageWriter writer(s.device(), s.version() == 1 ? "bmp" : "png");-
1948 writer.write(image);-
1949 return
never executed: return s;
s;
never executed: return s;
0
1950}-
1951QDataStream &operator>>(QDataStream &s, QImage &image)-
1952{-
1953 if (s.version() >= 5
s.version() >= 5Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
1954 qint32 nullMarker;-
1955 s >> nullMarker;-
1956 if (!nullMarker
!nullMarkerDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
1957 image = QImage();-
1958 return
never executed: return s;
s;
never executed: return s;
0
1959 }-
1960 }
never executed: end of block
0
1961 image = QImageReader(s.device(), 0).read();-
1962 return
never executed: return s;
s;
never executed: return s;
0
1963}-
1964bool QImage::operator==(const QImage & i) const-
1965{-
1966-
1967 if (i.d == d
i.d == dDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
1968 return
never executed: return true;
true;
never executed: return true;
0
1969 if (!i.d
!i.dDescription
TRUEnever evaluated
FALSEnever evaluated
|| !d
!dDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
1970 return
never executed: return false;
false;
never executed: return false;
0
1971-
1972-
1973 if (i.d->height != d->height
i.d->height != d->heightDescription
TRUEnever evaluated
FALSEnever evaluated
|| i.d->width != d->width
i.d->width != d->widthDescription
TRUEnever evaluated
FALSEnever evaluated
|| i.d->format != d->format
i.d->format != d->formatDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
1974 return
never executed: return false;
false;
never executed: return false;
0
1975-
1976 if (d->format != Format_RGB32
d->format != Format_RGB32Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
1977 if (d->format >= Format_ARGB32
d->format >= Format_ARGB32Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
1978 const int n = d->width * d->depth / 8;-
1979 if (n == d->bytes_per_line
n == d->bytes_per_lineDescription
TRUEnever evaluated
FALSEnever evaluated
&& n == i.d->bytes_per_line
n == i.d->bytes_per_lineDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
1980 if (memcmp(bits(), i.bits(), d->nbytes)
memcmp(bits(),...(), d->nbytes)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1981 return
never executed: return false;
false;
never executed: return false;
0
1982 }
never executed: end of block
else {
0
1983 for (int y = 0; y < d->height
y < d->heightDescription
TRUEnever evaluated
FALSEnever evaluated
; ++y) {
0
1984 if (memcmp(scanLine(y), i.scanLine(y), n)
memcmp(scanLin...canLine(y), n)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1985 return
never executed: return false;
false;
never executed: return false;
0
1986 }
never executed: end of block
0
1987 }
never executed: end of block
0
1988 } else {-
1989 const int w = width();-
1990 const int h = height();-
1991 const QVector<QRgb> &colortable = d->colortable;-
1992 const QVector<QRgb> &icolortable = i.d->colortable;-
1993 for (int y=0; y<h
y<hDescription
TRUEnever evaluated
FALSEnever evaluated
; ++y) {
0
1994 for (int x=0; x<w
x<wDescription
TRUEnever evaluated
FALSEnever evaluated
; ++x) {
0
1995 if (colortable[pixelIndex(x, y)] != icolortable[i.pixelIndex(x, y)]
colortable[pix...elIndex(x, y)]Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1996 return
never executed: return false;
false;
never executed: return false;
0
1997 }
never executed: end of block
0
1998 }
never executed: end of block
0
1999 }
never executed: end of block
0
2000 } else {-
2001-
2002 for(int l = 0; l < d->height
l < d->heightDescription
TRUEnever evaluated
FALSEnever evaluated
; l++) {
0
2003 int w = d->width;-
2004 const uint *p1 = reinterpret_cast<const uint*>(scanLine(l));-
2005 const uint *p2 = reinterpret_cast<const uint*>(i.scanLine(l));-
2006 while (w--
w--Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
2007 if ((*
(*p1++ & 0x00f... & 0x00ffffff)Description
TRUEnever evaluated
FALSEnever evaluated
p1++ & 0x00ffffff) != (*p2++ & 0x00ffffff)
(*p1++ & 0x00f... & 0x00ffffff)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
2008 return
never executed: return false;
false;
never executed: return false;
0
2009 }
never executed: end of block
0
2010 }
never executed: end of block
0
2011 }
never executed: end of block
0
2012 return
never executed: return true;
true;
never executed: return true;
0
2013}-
2014bool QImage::operator!=(const QImage & i) const-
2015{-
2016 return
never executed: return !(*this == i);
!(*this == i);
never executed: return !(*this == i);
0
2017}-
2018int QImage::dotsPerMeterX() const-
2019{-
2020 return
never executed: return d ? qRound(d->dpmx) : 0;
d ? qRound(d->dpmx) : 0;
never executed: return d ? qRound(d->dpmx) : 0;
0
2021}-
2022int QImage::dotsPerMeterY() const-
2023{-
2024 return
never executed: return d ? qRound(d->dpmy) : 0;
d ? qRound(d->dpmy) : 0;
never executed: return d ? qRound(d->dpmy) : 0;
0
2025}-
2026void QImage::setDotsPerMeterX(int x)-
2027{-
2028 if (!d
!dDescription
TRUEnever evaluated
FALSEnever evaluated
|| !x
!xDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
2029 return;
never executed: return;
0
2030 detach();-
2031-
2032 if (d
dDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
2033 d->dpmx = x;
never executed: d->dpmx = x;
0
2034}
never executed: end of block
0
2035void QImage::setDotsPerMeterY(int y)-
2036{-
2037 if (!d
!dDescription
TRUEnever evaluated
FALSEnever evaluated
|| !y
!yDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
2038 return;
never executed: return;
0
2039 detach();-
2040-
2041 if (d
dDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
2042 d->dpmy = y;
never executed: d->dpmy = y;
0
2043}
never executed: end of block
0
2044QPoint QImage::offset() const-
2045{-
2046 return
never executed: return d ? d->offset : QPoint();
d ? d->offset : QPoint();
never executed: return d ? d->offset : QPoint();
0
2047}-
2048void QImage::setOffset(const QPoint& p)-
2049{-
2050 if (!d
!dDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
2051 return;
never executed: return;
0
2052 detach();-
2053-
2054 if (d
dDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
2055 d->offset = p;
never executed: d->offset = p;
0
2056}
never executed: end of block
0
2057QStringList QImage::textKeys() const-
2058{-
2059 return
never executed: return d ? QStringList(d->text.keys()) : QStringList();
d ? QStringList(d->text.keys()) : QStringList();
never executed: return d ? QStringList(d->text.keys()) : QStringList();
0
2060}-
2061QString QImage::text(const QString &key) const-
2062{-
2063 if (!d
!dDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
2064 return
never executed: return QString();
QString();
never executed: return QString();
0
2065-
2066 if (!key.isEmpty()
!key.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
2067 return
never executed: return d->text.value(key);
d->text.value(key);
never executed: return d->text.value(key);
0
2068-
2069 QString tmp;-
2070 for (auto it = d->text.begin(), end = d->text.end(); it != end
it != endDescription
TRUEnever evaluated
FALSEnever evaluated
; ++it)
0
2071 tmp += it.key() + QLatin1String(": ") + it.value().simplified() + QLatin1String("\n\n");
never executed: tmp += it.key() + QLatin1String(": ") + it.value().simplified() + QLatin1String("\n\n");
0
2072 if (!tmp.isEmpty()
!tmp.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
2073 tmp.chop(2);
never executed: tmp.chop(2);
0
2074 return
never executed: return tmp;
tmp;
never executed: return tmp;
0
2075}-
2076void QImage::setText(const QString &key, const QString &value)-
2077{-
2078 if (!d
!dDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
2079 return;
never executed: return;
0
2080 detach();-
2081-
2082 if (d
dDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
2083 d->text.insert(key, value);
never executed: d->text.insert(key, value);
0
2084}
never executed: end of block
0
2085QPaintEngine *QImage::paintEngine() const-
2086{-
2087 if (!d
!dDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
2088 return
never executed: return 0;
0;
never executed: return 0;
0
2089-
2090 if (!d->paintEngine
!d->paintEngineDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
2091 QPaintDevice *paintDevice = const_cast<QImage *>(this);-
2092 QPaintEngine *paintEngine = 0;-
2093 QPlatformIntegration *platformIntegration = QGuiApplicationPrivate::platformIntegration();-
2094 if (platformIntegration
platformIntegrationDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
2095 paintEngine = platformIntegration->createImagePaintEngine(paintDevice);
never executed: paintEngine = platformIntegration->createImagePaintEngine(paintDevice);
0
2096 d->paintEngine = paintEngine
paintEngineDescription
TRUEnever evaluated
FALSEnever evaluated
? paintEngine : new QRasterPaintEngine(paintDevice);
0
2097 }
never executed: end of block
0
2098-
2099 return
never executed: return d->paintEngine;
d->paintEngine;
never executed: return d->paintEngine;
0
2100}-
2101-
2102-
2103-
2104-
2105-
2106-
2107-
2108int QImage::metric(PaintDeviceMetric metric) const-
2109{-
2110 if (!d
!dDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
2111 return
never executed: return 0;
0;
never executed: return 0;
0
2112-
2113 switch (metric) {-
2114 case
never executed: case PdmWidth:
PdmWidth:
never executed: case PdmWidth:
0
2115 return
never executed: return d->width;
d->width;
never executed: return d->width;
0
2116-
2117 case
never executed: case PdmHeight:
PdmHeight:
never executed: case PdmHeight:
0
2118 return
never executed: return d->height;
d->height;
never executed: return d->height;
0
2119-
2120 case
never executed: case PdmWidthMM:
PdmWidthMM:
never executed: case PdmWidthMM:
0
2121 return
never executed: return qRound(d->width * 1000 / d->dpmx);
qRound(d->width * 1000 / d->dpmx);
never executed: return qRound(d->width * 1000 / d->dpmx);
0
2122-
2123 case
never executed: case PdmHeightMM:
PdmHeightMM:
never executed: case PdmHeightMM:
0
2124 return
never executed: return qRound(d->height * 1000 / d->dpmy);
qRound(d->height * 1000 / d->dpmy);
never executed: return qRound(d->height * 1000 / d->dpmy);
0
2125-
2126 case
never executed: case PdmNumColors:
PdmNumColors:
never executed: case PdmNumColors:
0
2127 return
never executed: return d->colortable.size();
d->colortable.size();
never executed: return d->colortable.size();
0
2128-
2129 case
never executed: case PdmDepth:
PdmDepth:
never executed: case PdmDepth:
0
2130 return
never executed: return d->depth;
d->depth;
never executed: return d->depth;
0
2131-
2132 case
never executed: case PdmDpiX:
PdmDpiX:
never executed: case PdmDpiX:
0
2133 return
never executed: return qRound(d->dpmx * 0.0254);
qRound(d->dpmx * 0.0254);
never executed: return qRound(d->dpmx * 0.0254);
0
2134 break;
dead code: break;
-
2135-
2136 case
never executed: case PdmDpiY:
PdmDpiY:
never executed: case PdmDpiY:
0
2137 return
never executed: return qRound(d->dpmy * 0.0254);
qRound(d->dpmy * 0.0254);
never executed: return qRound(d->dpmy * 0.0254);
0
2138 break;
dead code: break;
-
2139-
2140 case
never executed: case PdmPhysicalDpiX:
PdmPhysicalDpiX:
never executed: case PdmPhysicalDpiX:
0
2141 return
never executed: return qRound(d->dpmx * 0.0254);
qRound(d->dpmx * 0.0254);
never executed: return qRound(d->dpmx * 0.0254);
0
2142 break;
dead code: break;
-
2143-
2144 case
never executed: case PdmPhysicalDpiY:
PdmPhysicalDpiY:
never executed: case PdmPhysicalDpiY:
0
2145 return
never executed: return qRound(d->dpmy * 0.0254);
qRound(d->dpmy * 0.0254);
never executed: return qRound(d->dpmy * 0.0254);
0
2146 break;
dead code: break;
-
2147-
2148 case
never executed: case PdmDevicePixelRatio:
PdmDevicePixelRatio:
never executed: case PdmDevicePixelRatio:
0
2149 return
never executed: return d->devicePixelRatio;
d->devicePixelRatio;
never executed: return d->devicePixelRatio;
0
2150 break;
dead code: break;
-
2151-
2152 case
never executed: case PdmDevicePixelRatioScaled:
PdmDevicePixelRatioScaled:
never executed: case PdmDevicePixelRatioScaled:
0
2153 return
never executed: return d->devicePixelRatio * QPaintDevice::devicePixelRatioFScale();
d->devicePixelRatio * QPaintDevice::devicePixelRatioFScale();
never executed: return d->devicePixelRatio * QPaintDevice::devicePixelRatioFScale();
0
2154 break;
dead code: break;
-
2155-
2156 default
never executed: default:
:
never executed: default:
0
2157 QMessageLogger(__FILE__, 3964, __PRETTY_FUNCTION__).warning("QImage::metric(): Unhandled metric type %d", metric);-
2158 break;
never executed: break;
0
2159 }-
2160 return
never executed: return 0;
0;
never executed: return 0;
0
2161}-
2162bool qt_xForm_helper(const QTransform &trueMat, int xoffset, int type, int depth,-
2163 uchar *dptr, int dbpl, int p_inc, int dHeight,-
2164 const uchar *sptr, int sbpl, int sWidth, int sHeight)-
2165{-
2166 int m11 = int(trueMat.m11()*4096.0);-
2167 int m12 = int(trueMat.m12()*4096.0);-
2168 int m21 = int(trueMat.m21()*4096.0);-
2169 int m22 = int(trueMat.m22()*4096.0);-
2170 int dx = qRound(trueMat.dx()*4096.0);-
2171 int dy = qRound(trueMat.dy()*4096.0);-
2172-
2173 int m21ydx = dx + (xoffset<<16) + (m11 + m21) / 2;-
2174 int m22ydy = dy + (m12 + m22) / 2;-
2175 uint trigx;-
2176 uint trigy;-
2177 uint maxws = sWidth<<12;-
2178 uint maxhs = sHeight<<12;-
2179-
2180 for (int y=0; y<dHeight
y<dHeightDescription
TRUEnever evaluated
FALSEnever evaluated
; y++) {
0
2181 trigx = m21ydx;-
2182 trigy = m22ydy;-
2183 uchar *maxp = dptr + dbpl;-
2184 if (depth != 1
depth != 1Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
2185 switch (depth) {-
2186 case
never executed: case 8:
8:
never executed: case 8:
0
2187 while (dptr < maxp
dptr < maxpDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
2188 if (trigx < maxws
trigx < maxwsDescription
TRUEnever evaluated
FALSEnever evaluated
&& trigy < maxhs
trigy < maxhsDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
2189 *
never executed: *dptr = *(sptr+sbpl*(trigy>>12)+(trigx>>12));
dptr = *(sptr+sbpl*(trigy>>12)+(trigx>>12));
never executed: *dptr = *(sptr+sbpl*(trigy>>12)+(trigx>>12));
0
2190 trigx += m11;-
2191 trigy += m12;-
2192 dptr++;-
2193 }
never executed: end of block
0
2194 break;
never executed: break;
0
2195-
2196 case
never executed: case 16:
16:
never executed: case 16:
0
2197 while (dptr < maxp
dptr < maxpDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
2198 if (trigx < maxws
trigx < maxwsDescription
TRUEnever evaluated
FALSEnever evaluated
&& trigy < maxhs
trigy < maxhsDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
2199 *((
never executed: *((ushort*)dptr) = *((const ushort *)(sptr+sbpl*(trigy>>12) + ((trigx>>12)<<1)));
ushort*)dptr) = *((const ushort *)(sptr+sbpl*(trigy>>12) +
never executed: *((ushort*)dptr) = *((const ushort *)(sptr+sbpl*(trigy>>12) + ((trigx>>12)<<1)));
0
2200 ((trigx>>12)<<1)));
never executed: *((ushort*)dptr) = *((const ushort *)(sptr+sbpl*(trigy>>12) + ((trigx>>12)<<1)));
0
2201 trigx += m11;-
2202 trigy += m12;-
2203 dptr++;-
2204 dptr++;-
2205 }
never executed: end of block
0
2206 break;
never executed: break;
0
2207-
2208 case
never executed: case 24:
24:
never executed: case 24:
0
2209 while (dptr < maxp
dptr < maxpDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
2210 if (trigx < maxws
trigx < maxwsDescription
TRUEnever evaluated
FALSEnever evaluated
&& trigy < maxhs
trigy < maxhsDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
2211 const uchar *p2 = sptr+sbpl*(trigy>>12) + ((trigx>>12)*3);-
2212 dptr[0] = p2[0];-
2213 dptr[1] = p2[1];-
2214 dptr[2] = p2[2];-
2215 }
never executed: end of block
0
2216 trigx += m11;-
2217 trigy += m12;-
2218 dptr += 3;-
2219 }
never executed: end of block
0
2220 break;
never executed: break;
0
2221-
2222 case
never executed: case 32:
32:
never executed: case 32:
0
2223 while (dptr < maxp
dptr < maxpDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
2224 if (trigx < maxws
trigx < maxwsDescription
TRUEnever evaluated
FALSEnever evaluated
&& trigy < maxhs
trigy < maxhsDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
2225 *((
never executed: *((uint*)dptr) = *((const uint *)(sptr+sbpl*(trigy>>12) + ((trigx>>12)<<2)));
uint*)dptr) = *((const uint *)(sptr+sbpl*(trigy>>12) +
never executed: *((uint*)dptr) = *((const uint *)(sptr+sbpl*(trigy>>12) + ((trigx>>12)<<2)));
0
2226 ((trigx>>12)<<2)));
never executed: *((uint*)dptr) = *((const uint *)(sptr+sbpl*(trigy>>12) + ((trigx>>12)<<2)));
0
2227 trigx += m11;-
2228 trigy += m12;-
2229 dptr += 4;-
2230 }
never executed: end of block
0
2231 break;
never executed: break;
0
2232-
2233 default
never executed: default:
:
never executed: default:
{
0
2234 return
never executed: return false;
false;
never executed: return false;
0
2235 }-
2236 }-
2237 } else {-
2238 switch (type) {-
2239 case
never executed: case 0:
0:
never executed: case 0:
0
2240 while (dptr < maxp
dptr < maxpDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
2241 if (trigx < maxws
trigx < maxwsDescription
TRUEnever evaluated
FALSEnever evaluated
&& trigy < maxhs
trigy < maxhsDescription
TRUEnever evaluated
FALSEnever evaluated
) { if (*(
*(sptr+sbpl*(t...rigx>>12)&7)))Description
TRUEnever evaluated
FALSEnever evaluated
sptr+sbpl*(trigy>>12)+(trigx>>15)) & (1 << (7-((trigx>>12)&7)))
*(sptr+sbpl*(t...rigx>>12)&7)))Description
TRUEnever evaluated
FALSEnever evaluated
) *
never executed: *dptr |= 128;
dptr |= 128;
never executed: *dptr |= 128;
}
never executed: end of block
trigx += m11; trigy += m12;;
0
2242 if (trigx < maxws
trigx < maxwsDescription
TRUEnever evaluated
FALSEnever evaluated
&& trigy < maxhs
trigy < maxhsDescription
TRUEnever evaluated
FALSEnever evaluated
) { if (*(
*(sptr+sbpl*(t...rigx>>12)&7)))Description
TRUEnever evaluated
FALSEnever evaluated
sptr+sbpl*(trigy>>12)+(trigx>>15)) & (1 << (7-((trigx>>12)&7)))
*(sptr+sbpl*(t...rigx>>12)&7)))Description
TRUEnever evaluated
FALSEnever evaluated
) *
never executed: *dptr |= 64;
dptr |= 64;
never executed: *dptr |= 64;
}
never executed: end of block
trigx += m11; trigy += m12;;
0
2243 if (trigx < maxws
trigx < maxwsDescription
TRUEnever evaluated
FALSEnever evaluated
&& trigy < maxhs
trigy < maxhsDescription
TRUEnever evaluated
FALSEnever evaluated
) { if (*(
*(sptr+sbpl*(t...rigx>>12)&7)))Description
TRUEnever evaluated
FALSEnever evaluated
sptr+sbpl*(trigy>>12)+(trigx>>15)) & (1 << (7-((trigx>>12)&7)))
*(sptr+sbpl*(t...rigx>>12)&7)))Description
TRUEnever evaluated
FALSEnever evaluated
) *
never executed: *dptr |= 32;
dptr |= 32;
never executed: *dptr |= 32;
}
never executed: end of block
trigx += m11; trigy += m12;;
0
2244 if (trigx < maxws
trigx < maxwsDescription
TRUEnever evaluated
FALSEnever evaluated
&& trigy < maxhs
trigy < maxhsDescription
TRUEnever evaluated
FALSEnever evaluated
) { if (*(
*(sptr+sbpl*(t...rigx>>12)&7)))Description
TRUEnever evaluated
FALSEnever evaluated
sptr+sbpl*(trigy>>12)+(trigx>>15)) & (1 << (7-((trigx>>12)&7)))
*(sptr+sbpl*(t...rigx>>12)&7)))Description
TRUEnever evaluated
FALSEnever evaluated
) *
never executed: *dptr |= 16;
dptr |= 16;
never executed: *dptr |= 16;
}
never executed: end of block
trigx += m11; trigy += m12;;
0
2245 if (trigx < maxws
trigx < maxwsDescription
TRUEnever evaluated
FALSEnever evaluated
&& trigy < maxhs
trigy < maxhsDescription
TRUEnever evaluated
FALSEnever evaluated
) { if (*(
*(sptr+sbpl*(t...rigx>>12)&7)))Description
TRUEnever evaluated
FALSEnever evaluated
sptr+sbpl*(trigy>>12)+(trigx>>15)) & (1 << (7-((trigx>>12)&7)))
*(sptr+sbpl*(t...rigx>>12)&7)))Description
TRUEnever evaluated
FALSEnever evaluated
) *
never executed: *dptr |= 8;
dptr |= 8;
never executed: *dptr |= 8;
}
never executed: end of block
trigx += m11; trigy += m12;;
0
2246 if (trigx < maxws
trigx < maxwsDescription
TRUEnever evaluated
FALSEnever evaluated
&& trigy < maxhs
trigy < maxhsDescription
TRUEnever evaluated
FALSEnever evaluated
) { if (*(
*(sptr+sbpl*(t...rigx>>12)&7)))Description
TRUEnever evaluated
FALSEnever evaluated
sptr+sbpl*(trigy>>12)+(trigx>>15)) & (1 << (7-((trigx>>12)&7)))
*(sptr+sbpl*(t...rigx>>12)&7)))Description
TRUEnever evaluated
FALSEnever evaluated
) *
never executed: *dptr |= 4;
dptr |= 4;
never executed: *dptr |= 4;
}
never executed: end of block
trigx += m11; trigy += m12;;
0
2247 if (trigx < maxws
trigx < maxwsDescription
TRUEnever evaluated
FALSEnever evaluated
&& trigy < maxhs
trigy < maxhsDescription
TRUEnever evaluated
FALSEnever evaluated
) { if (*(
*(sptr+sbpl*(t...rigx>>12)&7)))Description
TRUEnever evaluated
FALSEnever evaluated
sptr+sbpl*(trigy>>12)+(trigx>>15)) & (1 << (7-((trigx>>12)&7)))
*(sptr+sbpl*(t...rigx>>12)&7)))Description
TRUEnever evaluated
FALSEnever evaluated
) *
never executed: *dptr |= 2;
dptr |= 2;
never executed: *dptr |= 2;
}
never executed: end of block
trigx += m11; trigy += m12;;
0
2248 if (trigx < maxws
trigx < maxwsDescription
TRUEnever evaluated
FALSEnever evaluated
&& trigy < maxhs
trigy < maxhsDescription
TRUEnever evaluated
FALSEnever evaluated
) { if (*(
*(sptr+sbpl*(t...rigx>>12)&7)))Description
TRUEnever evaluated
FALSEnever evaluated
sptr+sbpl*(trigy>>12)+(trigx>>15)) & (1 << (7-((trigx>>12)&7)))
*(sptr+sbpl*(t...rigx>>12)&7)))Description
TRUEnever evaluated
FALSEnever evaluated
) *
never executed: *dptr |= 1;
dptr |= 1;
never executed: *dptr |= 1;
}
never executed: end of block
trigx += m11; trigy += m12;;
0
2249 dptr++;-
2250 }
never executed: end of block
0
2251 break;
never executed: break;
0
2252 case
never executed: case 1:
1:
never executed: case 1:
0
2253 while (dptr < maxp
dptr < maxpDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
2254 if (trigx < maxws
trigx < maxwsDescription
TRUEnever evaluated
FALSEnever evaluated
&& trigy < maxhs
trigy < maxhsDescription
TRUEnever evaluated
FALSEnever evaluated
) { if (*(
*(sptr+sbpl*(t...trigx>>12)&7))Description
TRUEnever evaluated
FALSEnever evaluated
sptr+sbpl*(trigy>>12)+(trigx>>15)) & (1 << ((trigx>>12)&7))
*(sptr+sbpl*(t...trigx>>12)&7))Description
TRUEnever evaluated
FALSEnever evaluated
) *
never executed: *dptr |= 1;
dptr |= 1;
never executed: *dptr |= 1;
}
never executed: end of block
trigx += m11; trigy += m12;;
0
2255 if (trigx < maxws
trigx < maxwsDescription
TRUEnever evaluated
FALSEnever evaluated
&& trigy < maxhs
trigy < maxhsDescription
TRUEnever evaluated
FALSEnever evaluated
) { if (*(
*(sptr+sbpl*(t...trigx>>12)&7))Description
TRUEnever evaluated
FALSEnever evaluated
sptr+sbpl*(trigy>>12)+(trigx>>15)) & (1 << ((trigx>>12)&7))
*(sptr+sbpl*(t...trigx>>12)&7))Description
TRUEnever evaluated
FALSEnever evaluated
) *
never executed: *dptr |= 2;
dptr |= 2;
never executed: *dptr |= 2;
}
never executed: end of block
trigx += m11; trigy += m12;;
0
2256 if (trigx < maxws
trigx < maxwsDescription
TRUEnever evaluated
FALSEnever evaluated
&& trigy < maxhs
trigy < maxhsDescription
TRUEnever evaluated
FALSEnever evaluated
) { if (*(
*(sptr+sbpl*(t...trigx>>12)&7))Description
TRUEnever evaluated
FALSEnever evaluated
sptr+sbpl*(trigy>>12)+(trigx>>15)) & (1 << ((trigx>>12)&7))
*(sptr+sbpl*(t...trigx>>12)&7))Description
TRUEnever evaluated
FALSEnever evaluated
) *
never executed: *dptr |= 4;
dptr |= 4;
never executed: *dptr |= 4;
}
never executed: end of block
trigx += m11; trigy += m12;;
0
2257 if (trigx < maxws
trigx < maxwsDescription
TRUEnever evaluated
FALSEnever evaluated
&& trigy < maxhs
trigy < maxhsDescription
TRUEnever evaluated
FALSEnever evaluated
) { if (*(
*(sptr+sbpl*(t...trigx>>12)&7))Description
TRUEnever evaluated
FALSEnever evaluated
sptr+sbpl*(trigy>>12)+(trigx>>15)) & (1 << ((trigx>>12)&7))
*(sptr+sbpl*(t...trigx>>12)&7))Description
TRUEnever evaluated
FALSEnever evaluated
) *
never executed: *dptr |= 8;
dptr |= 8;
never executed: *dptr |= 8;
}
never executed: end of block
trigx += m11; trigy += m12;;
0
2258 if (trigx < maxws
trigx < maxwsDescription
TRUEnever evaluated
FALSEnever evaluated
&& trigy < maxhs
trigy < maxhsDescription
TRUEnever evaluated
FALSEnever evaluated
) { if (*(
*(sptr+sbpl*(t...trigx>>12)&7))Description
TRUEnever evaluated
FALSEnever evaluated
sptr+sbpl*(trigy>>12)+(trigx>>15)) & (1 << ((trigx>>12)&7))
*(sptr+sbpl*(t...trigx>>12)&7))Description
TRUEnever evaluated
FALSEnever evaluated
) *
never executed: *dptr |= 16;
dptr |= 16;
never executed: *dptr |= 16;
}
never executed: end of block
trigx += m11; trigy += m12;;
0
2259 if (trigx < maxws
trigx < maxwsDescription
TRUEnever evaluated
FALSEnever evaluated
&& trigy < maxhs
trigy < maxhsDescription
TRUEnever evaluated
FALSEnever evaluated
) { if (*(
*(sptr+sbpl*(t...trigx>>12)&7))Description
TRUEnever evaluated
FALSEnever evaluated
sptr+sbpl*(trigy>>12)+(trigx>>15)) & (1 << ((trigx>>12)&7))
*(sptr+sbpl*(t...trigx>>12)&7))Description
TRUEnever evaluated
FALSEnever evaluated
) *
never executed: *dptr |= 32;
dptr |= 32;
never executed: *dptr |= 32;
}
never executed: end of block
trigx += m11; trigy += m12;;
0
2260 if (trigx < maxws
trigx < maxwsDescription
TRUEnever evaluated
FALSEnever evaluated
&& trigy < maxhs
trigy < maxhsDescription
TRUEnever evaluated
FALSEnever evaluated
) { if (*(
*(sptr+sbpl*(t...trigx>>12)&7))Description
TRUEnever evaluated
FALSEnever evaluated
sptr+sbpl*(trigy>>12)+(trigx>>15)) & (1 << ((trigx>>12)&7))
*(sptr+sbpl*(t...trigx>>12)&7))Description
TRUEnever evaluated
FALSEnever evaluated
) *
never executed: *dptr |= 64;
dptr |= 64;
never executed: *dptr |= 64;
}
never executed: end of block
trigx += m11; trigy += m12;;
0
2261 if (trigx < maxws
trigx < maxwsDescription
TRUEnever evaluated
FALSEnever evaluated
&& trigy < maxhs
trigy < maxhsDescription
TRUEnever evaluated
FALSEnever evaluated
) { if (*(
*(sptr+sbpl*(t...trigx>>12)&7))Description
TRUEnever evaluated
FALSEnever evaluated
sptr+sbpl*(trigy>>12)+(trigx>>15)) & (1 << ((trigx>>12)&7))
*(sptr+sbpl*(t...trigx>>12)&7))Description
TRUEnever evaluated
FALSEnever evaluated
) *
never executed: *dptr |= 128;
dptr |= 128;
never executed: *dptr |= 128;
}
never executed: end of block
trigx += m11; trigy += m12;;
0
2262 dptr++;-
2263 }
never executed: end of block
0
2264 break;
never executed: break;
0
2265 }-
2266 }
never executed: end of block
0
2267 m21ydx += m21;-
2268 m22ydy += m22;-
2269 dptr += p_inc;-
2270 }
never executed: end of block
0
2271 return
never executed: return true;
true;
never executed: return true;
0
2272}-
2273qint64 QImage::cacheKey() const-
2274{-
2275 if (!d
!dDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
2276 return
never executed: return 0;
0;
never executed: return 0;
0
2277 else-
2278 return
never executed: return (((qint64) d->ser_no) << 32) | ((qint64) d->detach_no);
(((qint64) d->ser_no) << 32) | ((qint64) d->detach_no);
never executed: return (((qint64) d->ser_no) << 32) | ((qint64) d->detach_no);
0
2279}-
2280bool QImage::isDetached() const-
2281{-
2282 return
never executed: return d && d->ref.load() == 1;
d && d->ref.load() == 1;
never executed: return d && d->ref.load() == 1;
0
2283}-
2284void QImage::setAlphaChannel(const QImage &alphaChannel)-
2285{-
2286 if (!d
!dDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
2287 return;
never executed: return;
0
2288-
2289 int w = d->width;-
2290 int h = d->height;-
2291-
2292 if (w != alphaChannel.d->width
w != alphaChannel.d->widthDescription
TRUEnever evaluated
FALSEnever evaluated
|| h != alphaChannel.d->height
h != alphaChannel.d->heightDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
2293 QMessageLogger(__FILE__, 4210, __PRETTY_FUNCTION__).warning("QImage::setAlphaChannel: "-
2294 "Alpha channel must have same dimensions as the target image");-
2295 return;
never executed: return;
0
2296 }-
2297-
2298 if (d->paintEngine
d->paintEngineDescription
TRUEnever evaluated
FALSEnever evaluated
&& d->paintEngine->isActive()
d->paintEngine->isActive()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
2299 QMessageLogger(__FILE__, 4216, __PRETTY_FUNCTION__).warning("QImage::setAlphaChannel: "-
2300 "Unable to set alpha channel while image is being painted on");-
2301 return;
never executed: return;
0
2302 }-
2303-
2304 if (d->format == QImage::Format_ARGB32_Premultiplied
d->format == Q..._PremultipliedDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
2305 detach();
never executed: detach();
0
2306 else-
2307 *
never executed: *this = convertToFormat(QImage::Format_ARGB32_Premultiplied);
this = convertToFormat(QImage::Format_ARGB32_Premultiplied);
never executed: *this = convertToFormat(QImage::Format_ARGB32_Premultiplied);
0
2308-
2309 if (isNull()
isNull()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
2310 return;
never executed: return;
0
2311-
2312-
2313 if (alphaChannel.format() == QImage::Format_Alpha8
alphaChannel.f...:Format_Alpha8Description
TRUEnever evaluated
FALSEnever evaluated
||( alphaChannel.d->depth == 8
alphaChannel.d->depth == 8Description
TRUEnever evaluated
FALSEnever evaluated
&& alphaChannel.isGrayscale()
alphaChannel.isGrayscale()Description
TRUEnever evaluated
FALSEnever evaluated
)) {
0
2314 const uchar *src_data = alphaChannel.d->data;-
2315 uchar *dest_data = d->data;-
2316 for (int y=0; y<h
y<hDescription
TRUEnever evaluated
FALSEnever evaluated
; ++y) {
0
2317 const uchar *src = src_data;-
2318 QRgb *dest = (QRgb *)dest_data;-
2319 for (int x=0; x<w
x<wDescription
TRUEnever evaluated
FALSEnever evaluated
; ++x) {
0
2320 int alpha = *src;-
2321 int destAlpha = qt_div_255(alpha * qAlpha(*dest));-
2322 *dest = ((destAlpha << 24)-
2323 | (qt_div_255(qRed(*dest) * alpha) << 16)-
2324 | (qt_div_255(qGreen(*dest) * alpha) << 8)-
2325 | (qt_div_255(qBlue(*dest) * alpha)));-
2326 ++dest;-
2327 ++src;-
2328 }
never executed: end of block
0
2329 src_data += alphaChannel.d->bytes_per_line;-
2330 dest_data += d->bytes_per_line;-
2331 }
never executed: end of block
0
2332-
2333 }
never executed: end of block
else {
0
2334 const QImage sourceImage = alphaChannel.convertToFormat(QImage::Format_RGB32);-
2335 if (sourceImage.isNull()
sourceImage.isNull()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
2336 return;
never executed: return;
0
2337 const uchar *src_data = sourceImage.d->data;-
2338 uchar *dest_data = d->data;-
2339 for (int y=0; y<h
y<hDescription
TRUEnever evaluated
FALSEnever evaluated
; ++y) {
0
2340 const QRgb *src = (const QRgb *) src_data;-
2341 QRgb *dest = (QRgb *) dest_data;-
2342 for (int x=0; x<w
x<wDescription
TRUEnever evaluated
FALSEnever evaluated
; ++x) {
0
2343 int alpha = qGray(*src);-
2344 int destAlpha = qt_div_255(alpha * qAlpha(*dest));-
2345 *dest = ((destAlpha << 24)-
2346 | (qt_div_255(qRed(*dest) * alpha) << 16)-
2347 | (qt_div_255(qGreen(*dest) * alpha) << 8)-
2348 | (qt_div_255(qBlue(*dest) * alpha)));-
2349 ++dest;-
2350 ++src;-
2351 }
never executed: end of block
0
2352 src_data += sourceImage.d->bytes_per_line;-
2353 dest_data += d->bytes_per_line;-
2354 }
never executed: end of block
0
2355 }
never executed: end of block
0
2356}-
2357QImage QImage::alphaChannel() const-
2358{-
2359 if (!d
!dDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
2360 return
never executed: return QImage();
QImage();
never executed: return QImage();
0
2361-
2362 int w = d->width;-
2363 int h = d->height;-
2364-
2365 QImage image(w, h, Format_Indexed8);-
2366 image.setColorCount(256);-
2367-
2368-
2369 for (int i=0; i<256
i<256Description
TRUEnever evaluated
FALSEnever evaluated
; ++i)
0
2370 image.setColor(i, qRgb(i, i, i));
never executed: image.setColor(i, qRgb(i, i, i));
0
2371-
2372 if (!hasAlphaChannel()
!hasAlphaChannel()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
2373 image.fill(255);-
2374 return
never executed: return image;
image;
never executed: return image;
0
2375 }-
2376-
2377 if (d->format == Format_Indexed8
d->format == Format_Indexed8Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
2378 const uchar *src_data = d->data;-
2379 uchar *dest_data = image.d->data;-
2380 for (int y=0; y<h
y<hDescription
TRUEnever evaluated
FALSEnever evaluated
; ++y) {
0
2381 const uchar *src = src_data;-
2382 uchar *dest = dest_data;-
2383 for (int x=0; x<w
x<wDescription
TRUEnever evaluated
FALSEnever evaluated
; ++x) {
0
2384 *dest = qAlpha(d->colortable.at(*src));-
2385 ++dest;-
2386 ++src;-
2387 }
never executed: end of block
0
2388 src_data += d->bytes_per_line;-
2389 dest_data += image.d->bytes_per_line;-
2390 }
never executed: end of block
0
2391 }
never executed: end of block
else if (d->format == Format_Alpha8
d->format == Format_Alpha8Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
2392 const uchar *src_data = d->data;-
2393 uchar *dest_data = image.d->data;-
2394 memcpy(dest_data, src_data, d->bytes_per_line * h);-
2395 }
never executed: end of block
else {
0
2396 QImage alpha32 = *this;-
2397 bool canSkipConversion = (d->format == Format_ARGB32
d->format == Format_ARGB32Description
TRUEnever evaluated
FALSEnever evaluated
|| d->format == Format_ARGB32_Premultiplied
d->format == F..._PremultipliedDescription
TRUEnever evaluated
FALSEnever evaluated
);
0
2398-
2399 canSkipConversion = canSkipConversion
canSkipConversionDescription
TRUEnever evaluated
FALSEnever evaluated
|| (d->format == Format_RGBA8888
d->format == Format_RGBA8888Description
TRUEnever evaluated
FALSEnever evaluated
|| d->format == Format_RGBA8888_Premultiplied
d->format == F..._PremultipliedDescription
TRUEnever evaluated
FALSEnever evaluated
);
0
2400-
2401 if (!canSkipConversion
!canSkipConversionDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
2402 alpha32 = convertToFormat(Format_ARGB32);
never executed: alpha32 = convertToFormat(Format_ARGB32);
0
2403-
2404 const uchar *src_data = alpha32.d->data;-
2405 uchar *dest_data = image.d->data;-
2406 for (int y=0; y<h
y<hDescription
TRUEnever evaluated
FALSEnever evaluated
; ++y) {
0
2407 const QRgb *src = (const QRgb *) src_data;-
2408 uchar *dest = dest_data;-
2409 for (int x=0; x<w
x<wDescription
TRUEnever evaluated
FALSEnever evaluated
; ++x) {
0
2410 *dest = qAlpha(*src);-
2411 ++dest;-
2412 ++src;-
2413 }
never executed: end of block
0
2414 src_data += alpha32.d->bytes_per_line;-
2415 dest_data += image.d->bytes_per_line;-
2416 }
never executed: end of block
0
2417 }
never executed: end of block
0
2418-
2419 return
never executed: return image;
image;
never executed: return image;
0
2420}-
2421-
2422-
2423-
2424-
2425-
2426-
2427-
2428bool QImage::hasAlphaChannel() const-
2429{-
2430 if (!d
!dDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
2431 return
never executed: return false;
false;
never executed: return false;
0
2432 const QPixelFormat format = pixelFormat();-
2433 if (format.alphaUsage() == QPixelFormat::UsesAlpha
format.alphaUs...mat::UsesAlphaDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
2434 return
never executed: return true;
true;
never executed: return true;
0
2435 if (format.colorModel() == QPixelFormat::Indexed
format.colorMo...ormat::IndexedDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
2436 return
never executed: return d->has_alpha_clut;
d->has_alpha_clut;
never executed: return d->has_alpha_clut;
0
2437 return
never executed: return false;
false;
never executed: return false;
0
2438}-
2439int QImage::bitPlaneCount() const-
2440{-
2441 if (!d
!dDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
2442 return
never executed: return 0;
0;
never executed: return 0;
0
2443 int bpc = 0;-
2444 switch (d->format) {-
2445 case
never executed: case QImage::Format_Invalid:
QImage::Format_Invalid:
never executed: case QImage::Format_Invalid:
0
2446 break;
never executed: break;
0
2447 case
never executed: case QImage::Format_BGR30:
QImage::Format_BGR30:
never executed: case QImage::Format_BGR30:
0
2448 case
never executed: case QImage::Format_RGB30:
QImage::Format_RGB30:
never executed: case QImage::Format_RGB30:
0
2449 bpc = 30;-
2450 break;
never executed: break;
0
2451 case
never executed: case QImage::Format_RGB32:
QImage::Format_RGB32:
never executed: case QImage::Format_RGB32:
0
2452 case
never executed: case QImage::Format_RGBX8888:
QImage::Format_RGBX8888:
never executed: case QImage::Format_RGBX8888:
0
2453 bpc = 24;-
2454 break;
never executed: break;
0
2455 case
never executed: case QImage::Format_RGB666:
QImage::Format_RGB666:
never executed: case QImage::Format_RGB666:
0
2456 bpc = 18;-
2457 break;
never executed: break;
0
2458 case
never executed: case QImage::Format_RGB555:
QImage::Format_RGB555:
never executed: case QImage::Format_RGB555:
0
2459 bpc = 15;-
2460 break;
never executed: break;
0
2461 case
never executed: case QImage::Format_ARGB8555_Premultiplied:
QImage::Format_ARGB8555_Premultiplied:
never executed: case QImage::Format_ARGB8555_Premultiplied:
0
2462 bpc = 23;-
2463 break;
never executed: break;
0
2464 case
never executed: case QImage::Format_RGB444:
QImage::Format_RGB444:
never executed: case QImage::Format_RGB444:
0
2465 bpc = 12;-
2466 break;
never executed: break;
0
2467 default
never executed: default:
:
never executed: default:
0
2468 bpc = qt_depthForFormat(d->format);-
2469 break;
never executed: break;
0
2470 }-
2471 return
never executed: return bpc;
bpc;
never executed: return bpc;
0
2472}-
2473-
2474-
2475-
2476-
2477-
2478QImage QImage::smoothScaled(int w, int h) const {-
2479 QImage src = *this;-
2480 switch (src.format()) {-
2481 case
never executed: case QImage::Format_RGB32:
QImage::Format_RGB32:
never executed: case QImage::Format_RGB32:
0
2482 case
never executed: case QImage::Format_ARGB32_Premultiplied:
QImage::Format_ARGB32_Premultiplied:
never executed: case QImage::Format_ARGB32_Premultiplied:
0
2483-
2484 case
never executed: case QImage::Format_RGBX8888:
QImage::Format_RGBX8888:
never executed: case QImage::Format_RGBX8888:
0
2485-
2486 case
never executed: case QImage::Format_RGBA8888_Premultiplied:
QImage::Format_RGBA8888_Premultiplied:
never executed: case QImage::Format_RGBA8888_Premultiplied:
0
2487 break;
never executed: break;
0
2488 default
never executed: default:
:
never executed: default:
0
2489 if (src.hasAlphaChannel()
src.hasAlphaChannel()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
2490 src = src.convertToFormat(QImage::Format_ARGB32_Premultiplied);
never executed: src = src.convertToFormat(QImage::Format_ARGB32_Premultiplied);
0
2491 else-
2492 src = src.convertToFormat(QImage::Format_RGB32);
never executed: src = src.convertToFormat(QImage::Format_RGB32);
0
2493 }-
2494 src = qSmoothScaleImage(src, w, h);-
2495 if (!src.isNull()
!src.isNull()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
2496 copyMetadata(src.d, d);
never executed: copyMetadata(src.d, d);
0
2497 return
never executed: return src;
src;
never executed: return src;
0
2498}-
2499-
2500static QImage rotated90(const QImage &image) {-
2501 QImage out(image.height(), image.width(), image.format());-
2502 out.setDotsPerMeterX(image.dotsPerMeterY());-
2503 out.setDotsPerMeterY(image.dotsPerMeterX());-
2504 if (image.colorCount() > 0
image.colorCount() > 0Description
TRUEnever evaluated
FALSEnever evaluated
)
0
2505 out.setColorTable(image.colorTable());
never executed: out.setColorTable(image.colorTable());
0
2506 int w = image.width();-
2507 int h = image.height();-
2508 switch (image.format()) {-
2509 case
never executed: case QImage::Format_RGB32:
QImage::Format_RGB32:
never executed: case QImage::Format_RGB32:
0
2510 case
never executed: case QImage::Format_ARGB32:
QImage::Format_ARGB32:
never executed: case QImage::Format_ARGB32:
0
2511 case
never executed: case QImage::Format_ARGB32_Premultiplied:
QImage::Format_ARGB32_Premultiplied:
never executed: case QImage::Format_ARGB32_Premultiplied:
0
2512 case
never executed: case QImage::Format_RGBX8888:
QImage::Format_RGBX8888:
never executed: case QImage::Format_RGBX8888:
0
2513 case
never executed: case QImage::Format_RGBA8888:
QImage::Format_RGBA8888:
never executed: case QImage::Format_RGBA8888:
0
2514 case
never executed: case QImage::Format_RGBA8888_Premultiplied:
QImage::Format_RGBA8888_Premultiplied:
never executed: case QImage::Format_RGBA8888_Premultiplied:
0
2515 case
never executed: case QImage::Format_BGR30:
QImage::Format_BGR30:
never executed: case QImage::Format_BGR30:
0
2516 case
never executed: case QImage::Format_A2BGR30_Premultiplied:
QImage::Format_A2BGR30_Premultiplied:
never executed: case QImage::Format_A2BGR30_Premultiplied:
0
2517 case
never executed: case QImage::Format_RGB30:
QImage::Format_RGB30:
never executed: case QImage::Format_RGB30:
0
2518 case
never executed: case QImage::Format_A2RGB30_Premultiplied:
QImage::Format_A2RGB30_Premultiplied:
never executed: case QImage::Format_A2RGB30_Premultiplied:
0
2519 qt_memrotate270(reinterpret_cast<const quint32*>(image.bits()),-
2520 w, h, image.bytesPerLine(),-
2521 reinterpret_cast<quint32*>(out.bits()),-
2522 out.bytesPerLine());-
2523 break;
never executed: break;
0
2524 case
never executed: case QImage::Format_RGB666:
QImage::Format_RGB666:
never executed: case QImage::Format_RGB666:
0
2525 case
never executed: case QImage::Format_ARGB6666_Premultiplied:
QImage::Format_ARGB6666_Premultiplied:
never executed: case QImage::Format_ARGB6666_Premultiplied:
0
2526 case
never executed: case QImage::Format_ARGB8565_Premultiplied:
QImage::Format_ARGB8565_Premultiplied:
never executed: case QImage::Format_ARGB8565_Premultiplied:
0
2527 case
never executed: case QImage::Format_ARGB8555_Premultiplied:
QImage::Format_ARGB8555_Premultiplied:
never executed: case QImage::Format_ARGB8555_Premultiplied:
0
2528 case
never executed: case QImage::Format_RGB888:
QImage::Format_RGB888:
never executed: case QImage::Format_RGB888:
0
2529 qt_memrotate270(reinterpret_cast<const quint24*>(image.bits()),-
2530 w, h, image.bytesPerLine(),-
2531 reinterpret_cast<quint24*>(out.bits()),-
2532 out.bytesPerLine());-
2533 break;
never executed: break;
0
2534 case
never executed: case QImage::Format_RGB555:
QImage::Format_RGB555:
never executed: case QImage::Format_RGB555:
0
2535 case
never executed: case QImage::Format_RGB16:
QImage::Format_RGB16:
never executed: case QImage::Format_RGB16:
0
2536 case
never executed: case QImage::Format_ARGB4444_Premultiplied:
QImage::Format_ARGB4444_Premultiplied:
never executed: case QImage::Format_ARGB4444_Premultiplied:
0
2537 qt_memrotate270(reinterpret_cast<const quint16*>(image.bits()),-
2538 w, h, image.bytesPerLine(),-
2539 reinterpret_cast<quint16*>(out.bits()),-
2540 out.bytesPerLine());-
2541 break;
never executed: break;
0
2542 case
never executed: case QImage::Format_Alpha8:
QImage::Format_Alpha8:
never executed: case QImage::Format_Alpha8:
0
2543 case
never executed: case QImage::Format_Grayscale8:
QImage::Format_Grayscale8:
never executed: case QImage::Format_Grayscale8:
0
2544 case
never executed: case QImage::Format_Indexed8:
QImage::Format_Indexed8:
never executed: case QImage::Format_Indexed8:
0
2545 qt_memrotate270(reinterpret_cast<const quint8*>(image.bits()),-
2546 w, h, image.bytesPerLine(),-
2547 reinterpret_cast<quint8*>(out.bits()),-
2548 out.bytesPerLine());-
2549 break;
never executed: break;
0
2550 default
never executed: default:
:
never executed: default:
0
2551 for (int y=0; y<h
y<hDescription
TRUEnever evaluated
FALSEnever evaluated
; ++y) {
0
2552 if (image.colorCount()
image.colorCount()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
2553 for (int x=0; x<w
x<wDescription
TRUEnever evaluated
FALSEnever evaluated
; ++x)
0
2554 out.setPixel(h-y-1, x, image.pixelIndex(x, y));
never executed: out.setPixel(h-y-1, x, image.pixelIndex(x, y));
0
2555 else-
2556 for (int x=0; x<w
x<wDescription
TRUEnever evaluated
FALSEnever evaluated
; ++x)
0
2557 out.setPixel(h-y-1, x, image.pixel(x, y));
never executed: out.setPixel(h-y-1, x, image.pixel(x, y));
0
2558 }
never executed: end of block
0
2559 break;
never executed: break;
0
2560 }-
2561 return
never executed: return out;
out;
never executed: return out;
0
2562}-
2563-
2564-
2565static QImage rotated180(const QImage &image) {-
2566 return
never executed: return image.mirrored(true, true);
image.mirrored(true, true);
never executed: return image.mirrored(true, true);
0
2567}-
2568-
2569-
2570static QImage rotated270(const QImage &image) {-
2571 QImage out(image.height(), image.width(), image.format());-
2572 out.setDotsPerMeterX(image.dotsPerMeterY());-
2573 out.setDotsPerMeterY(image.dotsPerMeterX());-
2574 if (image.colorCount() > 0
image.colorCount() > 0Description
TRUEnever evaluated
FALSEnever evaluated
)
0
2575 out.setColorTable(image.colorTable());
never executed: out.setColorTable(image.colorTable());
0
2576 int w = image.width();-
2577 int h = image.height();-
2578 switch (image.format()) {-
2579 case
never executed: case QImage::Format_RGB32:
QImage::Format_RGB32:
never executed: case QImage::Format_RGB32:
0
2580 case
never executed: case QImage::Format_ARGB32:
QImage::Format_ARGB32:
never executed: case QImage::Format_ARGB32:
0
2581 case
never executed: case QImage::Format_ARGB32_Premultiplied:
QImage::Format_ARGB32_Premultiplied:
never executed: case QImage::Format_ARGB32_Premultiplied:
0
2582 case
never executed: case QImage::Format_RGBX8888:
QImage::Format_RGBX8888:
never executed: case QImage::Format_RGBX8888:
0
2583 case
never executed: case QImage::Format_RGBA8888:
QImage::Format_RGBA8888:
never executed: case QImage::Format_RGBA8888:
0
2584 case
never executed: case QImage::Format_RGBA8888_Premultiplied:
QImage::Format_RGBA8888_Premultiplied:
never executed: case QImage::Format_RGBA8888_Premultiplied:
0
2585 case
never executed: case QImage::Format_BGR30:
QImage::Format_BGR30:
never executed: case QImage::Format_BGR30:
0
2586 case
never executed: case QImage::Format_A2BGR30_Premultiplied:
QImage::Format_A2BGR30_Premultiplied:
never executed: case QImage::Format_A2BGR30_Premultiplied:
0
2587 case
never executed: case QImage::Format_RGB30:
QImage::Format_RGB30:
never executed: case QImage::Format_RGB30:
0
2588 case
never executed: case QImage::Format_A2RGB30_Premultiplied:
QImage::Format_A2RGB30_Premultiplied:
never executed: case QImage::Format_A2RGB30_Premultiplied:
0
2589 qt_memrotate90(reinterpret_cast<const quint32*>(image.bits()),-
2590 w, h, image.bytesPerLine(),-
2591 reinterpret_cast<quint32*>(out.bits()),-
2592 out.bytesPerLine());-
2593 break;
never executed: break;
0
2594 case
never executed: case QImage::Format_RGB666:
QImage::Format_RGB666:
never executed: case QImage::Format_RGB666:
0
2595 case
never executed: case QImage::Format_ARGB6666_Premultiplied:
QImage::Format_ARGB6666_Premultiplied:
never executed: case QImage::Format_ARGB6666_Premultiplied:
0
2596 case
never executed: case QImage::Format_ARGB8565_Premultiplied:
QImage::Format_ARGB8565_Premultiplied:
never executed: case QImage::Format_ARGB8565_Premultiplied:
0
2597 case
never executed: case QImage::Format_ARGB8555_Premultiplied:
QImage::Format_ARGB8555_Premultiplied:
never executed: case QImage::Format_ARGB8555_Premultiplied:
0
2598 case
never executed: case QImage::Format_RGB888:
QImage::Format_RGB888:
never executed: case QImage::Format_RGB888:
0
2599 qt_memrotate90(reinterpret_cast<const quint24*>(image.bits()),-
2600 w, h, image.bytesPerLine(),-
2601 reinterpret_cast<quint24*>(out.bits()),-
2602 out.bytesPerLine());-
2603 break;
never executed: break;
0
2604 case
never executed: case QImage::Format_RGB555:
QImage::Format_RGB555:
never executed: case QImage::Format_RGB555:
0
2605 case
never executed: case QImage::Format_RGB16:
QImage::Format_RGB16:
never executed: case QImage::Format_RGB16:
0
2606 case
never executed: case QImage::Format_ARGB4444_Premultiplied:
QImage::Format_ARGB4444_Premultiplied:
never executed: case QImage::Format_ARGB4444_Premultiplied:
0
2607 qt_memrotate90(reinterpret_cast<const quint16*>(image.bits()),-
2608 w, h, image.bytesPerLine(),-
2609 reinterpret_cast<quint16*>(out.bits()),-
2610 out.bytesPerLine());-
2611 break;
never executed: break;
0
2612 case
never executed: case QImage::Format_Alpha8:
QImage::Format_Alpha8:
never executed: case QImage::Format_Alpha8:
0
2613 case
never executed: case QImage::Format_Grayscale8:
QImage::Format_Grayscale8:
never executed: case QImage::Format_Grayscale8:
0
2614 case
never executed: case QImage::Format_Indexed8:
QImage::Format_Indexed8:
never executed: case QImage::Format_Indexed8:
0
2615 qt_memrotate90(reinterpret_cast<const quint8*>(image.bits()),-
2616 w, h, image.bytesPerLine(),-
2617 reinterpret_cast<quint8*>(out.bits()),-
2618 out.bytesPerLine());-
2619 break;
never executed: break;
0
2620 default
never executed: default:
:
never executed: default:
0
2621 for (int y=0; y<h
y<hDescription
TRUEnever evaluated
FALSEnever evaluated
; ++y) {
0
2622 if (image.colorCount()
image.colorCount()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
2623 for (int x=0; x<w
x<wDescription
TRUEnever evaluated
FALSEnever evaluated
; ++x)
0
2624 out.setPixel(y, w-x-1, image.pixelIndex(x, y));
never executed: out.setPixel(y, w-x-1, image.pixelIndex(x, y));
0
2625 else-
2626 for (int x=0; x<w
x<wDescription
TRUEnever evaluated
FALSEnever evaluated
; ++x)
0
2627 out.setPixel(y, w-x-1, image.pixel(x, y));
never executed: out.setPixel(y, w-x-1, image.pixel(x, y));
0
2628 }
never executed: end of block
0
2629 break;
never executed: break;
0
2630 }-
2631 return
never executed: return out;
out;
never executed: return out;
0
2632}-
2633QImage QImage::transformed(const QTransform &matrix, Qt::TransformationMode mode ) const-
2634{-
2635 if (!d
!dDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
2636 return
never executed: return QImage();
QImage();
never executed: return QImage();
0
2637-
2638-
2639 int ws = width();-
2640 int hs = height();-
2641-
2642-
2643 int wd;-
2644 int hd;-
2645-
2646-
2647 QTransform mat = trueMatrix(matrix, ws, hs);-
2648 bool complex_xform = false;-
2649 bool scale_xform = false;-
2650 if (mat.type() <= QTransform::TxScale
mat.type() <= ...sform::TxScaleDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
2651 if (mat.type() == QTransform::TxNone
mat.type() == ...nsform::TxNoneDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
2652 return
never executed: return *this;
*this;
never executed: return *this;
0
2653 else if (mat.m11() == -1.
mat.m11() == -1.Description
TRUEnever evaluated
FALSEnever evaluated
&& mat.m22() == -1.
mat.m22() == -1.Description
TRUEnever evaluated
FALSEnever evaluated
)
0
2654 return
never executed: return rotated180(*this);
rotated180(*this);
never executed: return rotated180(*this);
0
2655-
2656 if (mode == Qt::FastTransformation
mode == Qt::FastTransformationDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
2657 hd = qRound(qAbs(mat.m22()) * hs);-
2658 wd = qRound(qAbs(mat.m11()) * ws);-
2659 }
never executed: end of block
else {
0
2660 hd = int(qAbs(mat.m22()) * hs + 0.9999);-
2661 wd = int(qAbs(mat.m11()) * ws + 0.9999);-
2662 }
never executed: end of block
0
2663 scale_xform = true;-
2664 }
never executed: end of block
else {
0
2665 if (mat.type() <= QTransform::TxRotate
mat.type() <= ...form::TxRotateDescription
TRUEnever evaluated
FALSEnever evaluated
&& mat.m11() == 0
mat.m11() == 0Description
TRUEnever evaluated
FALSEnever evaluated
&& mat.m22() == 0
mat.m22() == 0Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
2666 if (mat.m12() == 1.
mat.m12() == 1.Description
TRUEnever evaluated
FALSEnever evaluated
&& mat.m21() == -1.
mat.m21() == -1.Description
TRUEnever evaluated
FALSEnever evaluated
)
0
2667 return
never executed: return rotated90(*this);
rotated90(*this);
never executed: return rotated90(*this);
0
2668 else if (mat.m12() == -1.
mat.m12() == -1.Description
TRUEnever evaluated
FALSEnever evaluated
&& mat.m21() == 1.
mat.m21() == 1.Description
TRUEnever evaluated
FALSEnever evaluated
)
0
2669 return
never executed: return rotated270(*this);
rotated270(*this);
never executed: return rotated270(*this);
0
2670 }
never executed: end of block
0
2671-
2672 QPolygonF a(QRectF(0, 0, ws, hs));-
2673 a = mat.map(a);-
2674 QRect r = a.boundingRect().toAlignedRect();-
2675 wd = r.width();-
2676 hd = r.height();-
2677 complex_xform = true;-
2678 }
never executed: end of block
0
2679-
2680 if (wd == 0
wd == 0Description
TRUEnever evaluated
FALSEnever evaluated
|| hd == 0
hd == 0Description
TRUEnever evaluated
FALSEnever evaluated
)
0
2681 return
never executed: return QImage();
QImage();
never executed: return QImage();
0
2682-
2683-
2684 if (scale_xform
scale_xformDescription
TRUEnever evaluated
FALSEnever evaluated
&& mode == Qt::SmoothTransformation
mode == Qt::Sm...TransformationDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
2685 if (mat.m11() < 0.0F
mat.m11() < 0.0FDescription
TRUEnever evaluated
FALSEnever evaluated
&& mat.m22() < 0.0F
mat.m22() < 0.0FDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
2686 return
never executed: return smoothScaled(wd, hd).mirrored(true, true);
smoothScaled(wd, hd).mirrored(true, true);
never executed: return smoothScaled(wd, hd).mirrored(true, true);
0
2687 } else if (mat.m11() < 0.0F
mat.m11() < 0.0FDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
2688 return
never executed: return smoothScaled(wd, hd).mirrored(true, false);
smoothScaled(wd, hd).mirrored(true, false);
never executed: return smoothScaled(wd, hd).mirrored(true, false);
0
2689 } else if (mat.m22() < 0.0F
mat.m22() < 0.0FDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
2690 return
never executed: return smoothScaled(wd, hd).mirrored(false, true);
smoothScaled(wd, hd).mirrored(false, true);
never executed: return smoothScaled(wd, hd).mirrored(false, true);
0
2691 } else {-
2692 return
never executed: return smoothScaled(wd, hd);
smoothScaled(wd, hd);
never executed: return smoothScaled(wd, hd);
0
2693 }-
2694 }-
2695-
2696 int bpp = depth();-
2697-
2698 int sbpl = bytesPerLine();-
2699 const uchar *sptr = bits();-
2700-
2701 QImage::Format target_format = d->format;-
2702-
2703 if (complex_xform
complex_xformDescription
TRUEnever evaluated
FALSEnever evaluated
|| mode == Qt::SmoothTransformation
mode == Qt::Sm...TransformationDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
2704 if (d->format < QImage::Format_RGB32
d->format < QI...::Format_RGB32Description
TRUEnever evaluated
FALSEnever evaluated
|| !hasAlphaChannel()
!hasAlphaChannel()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
2705 target_format = qt_alphaVersion(d->format);-
2706 }
never executed: end of block
0
2707 }
never executed: end of block
0
2708-
2709 QImage dImage(wd, hd, target_format);-
2710 if ((
(dImage).isNull()Description
TRUEnever evaluated
FALSEnever evaluated
dImage).isNull()
(dImage).isNull()Description
TRUEnever evaluated
FALSEnever evaluated
) { QMessageLogger(__FILE__, 4684, __PRETTY_FUNCTION__).warning("QImage: out of memory, returning null image"); return
never executed: return QImage();
QImage();
never executed: return QImage();
};
0
2711-
2712 if (target_format == QImage::Format_MonoLSB
target_format ...Format_MonoLSBDescription
TRUEnever evaluated
FALSEnever evaluated
0
2713 || target_format == QImage::Format_Mono
target_format ...e::Format_MonoDescription
TRUEnever evaluated
FALSEnever evaluated
0
2714 || target_format == QImage::Format_Indexed8
target_format ...ormat_Indexed8Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
2715 dImage.d->colortable = d->colortable;-
2716 dImage.d->has_alpha_clut = d->has_alpha_clut | complex_xform;-
2717 }
never executed: end of block
0
2718-
2719-
2720 if (d->format == QImage::Format_Indexed8
d->format == Q...ormat_Indexed8Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
2721 if (dImage.d->colortable.size() < 256
dImage.d->colo...e.size() < 256Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
2722-
2723 dImage.d->colortable.append(0x0);-
2724 memset(dImage.bits(), dImage.d->colortable.size() - 1, dImage.byteCount());-
2725 }
never executed: end of block
else {
0
2726 memset(dImage.bits(), 0, dImage.byteCount());-
2727 }
never executed: end of block
0
2728 } else-
2729 memset(dImage.bits(), 0x00, dImage.byteCount());
never executed: memset(dImage.bits(), 0x00, dImage.byteCount());
0
2730-
2731 if (target_format >= QImage::Format_RGB32
target_format ...::Format_RGB32Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
2732-
2733 const QImage sImage = (
(devicePixelRatio() != 1)Description
TRUEnever evaluated
FALSEnever evaluated
devicePixelRatio() != 1)
(devicePixelRatio() != 1)Description
TRUEnever evaluated
FALSEnever evaluated
? QImage(constBits(), width(), height(), format()) : *this;
0
2734-
2735 ((!(sImage.devicePixelRatio() == 1)) ? qt_assert("sImage.devicePixelRatio() == 1",__FILE__,4709) : qt_noop());-
2736 ((!(sImage.devicePixelRatio() == dImage.devicePixelRatio())) ? qt_assert("sImage.devicePixelRatio() == dImage.devicePixelRatio()",__FILE__,4710) : qt_noop());-
2737-
2738 QPainter p(&dImage);-
2739 if (mode == Qt::SmoothTransformation
mode == Qt::Sm...TransformationDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
2740 p.setRenderHint(QPainter::Antialiasing);-
2741 p.setRenderHint(QPainter::SmoothPixmapTransform);-
2742 }
never executed: end of block
0
2743 p.setTransform(mat);-
2744 p.drawImage(QPoint(0, 0), sImage);-
2745 }
never executed: end of block
else {
0
2746 bool invertible;-
2747 mat = mat.inverted(&invertible);-
2748 if (!invertible
!invertibleDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
2749 return
never executed: return QImage();
QImage();
never executed: return QImage();
0
2750-
2751-
2752 int type = format() == Format_Mono
format() == Format_MonoDescription
TRUEnever evaluated
FALSEnever evaluated
? 0 : 1;
0
2753 int dbpl = dImage.bytesPerLine();-
2754 qt_xForm_helper(mat, 0, type, bpp, dImage.bits(), dbpl, 0, hd, sptr, sbpl, ws, hs);-
2755 }
never executed: end of block
0
2756 copyMetadata(dImage.d, d);-
2757-
2758 return
never executed: return dImage;
dImage;
never executed: return dImage;
0
2759}-
2760QTransform QImage::trueMatrix(const QTransform &matrix, int w, int h)-
2761{-
2762 const QRectF rect(0, 0, w, h);-
2763 const QRect mapped = matrix.mapRect(rect).toAlignedRect();-
2764 const QPoint delta = mapped.topLeft();-
2765 return
never executed: return matrix * QTransform().translate(-delta.x(), -delta.y());
matrix * QTransform().translate(-delta.x(), -delta.y());
never executed: return matrix * QTransform().translate(-delta.x(), -delta.y());
0
2766}-
2767-
2768bool QImageData::convertInPlace(QImage::Format newFormat, Qt::ImageConversionFlags flags)-
2769{-
2770 if (format == newFormat
format == newFormatDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
2771 return
never executed: return true;
true;
never executed: return true;
0
2772-
2773-
2774 if (ref.load() > 1
ref.load() > 1Description
TRUEnever evaluated
FALSEnever evaluated
|| !own_data
!own_dataDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
2775 return
never executed: return false;
false;
never executed: return false;
0
2776-
2777 InPlace_Image_Converter converter = qimage_inplace_converter_map[format][newFormat];-
2778 if (converter
converterDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
2779 return
never executed: return converter(this, flags);
converter(this, flags);
never executed: return converter(this, flags);
0
2780 else if (format > QImage::Format_Indexed8
format > QImag...ormat_Indexed8Description
TRUEnever evaluated
FALSEnever evaluated
&& newFormat > QImage::Format_Indexed8
newFormat > QI...ormat_Indexed8Description
TRUEnever evaluated
FALSEnever evaluated
&& !qimage_converter_map[format][newFormat]
!qimage_conver...at][newFormat]Description
TRUEnever evaluated
FALSEnever evaluated
)
0
2781-
2782-
2783 return
never executed: return convert_generic_inplace(this, newFormat, flags);
convert_generic_inplace(this, newFormat, flags);
never executed: return convert_generic_inplace(this, newFormat, flags);
0
2784 else-
2785 return
never executed: return false;
false;
never executed: return false;
0
2786}-
2787QDebug operator<<(QDebug dbg, const QImage &i)-
2788{-
2789 QDebugStateSaver saver(dbg);-
2790 dbg.resetFormat();-
2791 dbg.nospace();-
2792 dbg << "QImage(";-
2793 if (i.isNull()
i.isNull()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
2794 dbg << "null";-
2795 }
never executed: end of block
else {
0
2796 dbg << i.size() << ",format=" << i.format() << ",depth=" << i.depth();-
2797 if (i.colorCount()
i.colorCount()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
2798 dbg << ",colorCount=" << i.colorCount();
never executed: dbg << ",colorCount=" << i.colorCount();
0
2799 dbg << ",devicePixelRatio=" << i.devicePixelRatio()-
2800 << ",bytesPerLine=" << i.bytesPerLine() << ",byteCount=" << i.byteCount();-
2801 }
never executed: end of block
0
2802 dbg << ')';-
2803 return
never executed: return dbg;
dbg;
never executed: return dbg;
0
2804}-
2805static constexpr QPixelFormat pixelformats[] = {-
2806-
2807 QPixelFormat(),-
2808-
2809 QPixelFormat(QPixelFormat::Indexed,-
2810 1,-
2811 0,-
2812 0,-
2813 0,-
2814 0,-
2815 0,-
2816 QPixelFormat::IgnoresAlpha,-
2817 QPixelFormat::AtBeginning,-
2818 QPixelFormat::NotPremultiplied,-
2819 QPixelFormat::UnsignedByte,-
2820 QPixelFormat::CurrentSystemEndian),-
2821-
2822 QPixelFormat(QPixelFormat::Indexed,-
2823 1,-
2824 0,-
2825 0,-
2826 0,-
2827 0,-
2828 0,-
2829 QPixelFormat::IgnoresAlpha,-
2830 QPixelFormat::AtBeginning,-
2831 QPixelFormat::NotPremultiplied,-
2832 QPixelFormat::UnsignedByte,-
2833 QPixelFormat::CurrentSystemEndian),-
2834-
2835 QPixelFormat(QPixelFormat::Indexed,-
2836 8,-
2837 0,-
2838 0,-
2839 0,-
2840 0,-
2841 0,-
2842 QPixelFormat::IgnoresAlpha,-
2843 QPixelFormat::AtBeginning,-
2844 QPixelFormat::NotPremultiplied,-
2845 QPixelFormat::UnsignedByte,-
2846 QPixelFormat::CurrentSystemEndian),-
2847-
2848 QPixelFormat(QPixelFormat::RGB,-
2849 8,-
2850 8,-
2851 8,-
2852 0,-
2853 0,-
2854 8,-
2855 QPixelFormat::IgnoresAlpha,-
2856 QPixelFormat::AtBeginning,-
2857 QPixelFormat::NotPremultiplied,-
2858 QPixelFormat::UnsignedInteger,-
2859 QPixelFormat::CurrentSystemEndian),-
2860-
2861 QPixelFormat(QPixelFormat::RGB,-
2862 8,-
2863 8,-
2864 8,-
2865 0,-
2866 0,-
2867 8,-
2868 QPixelFormat::UsesAlpha,-
2869 QPixelFormat::AtBeginning,-
2870 QPixelFormat::NotPremultiplied,-
2871 QPixelFormat::UnsignedInteger,-
2872 QPixelFormat::CurrentSystemEndian),-
2873-
2874 QPixelFormat(QPixelFormat::RGB,-
2875 8,-
2876 8,-
2877 8,-
2878 0,-
2879 0,-
2880 8,-
2881 QPixelFormat::UsesAlpha,-
2882 QPixelFormat::AtBeginning,-
2883 QPixelFormat::Premultiplied,-
2884 QPixelFormat::UnsignedInteger,-
2885 QPixelFormat::CurrentSystemEndian),-
2886-
2887 QPixelFormat(QPixelFormat::RGB,-
2888 5,-
2889 6,-
2890 5,-
2891 0,-
2892 0,-
2893 0,-
2894 QPixelFormat::IgnoresAlpha,-
2895 QPixelFormat::AtBeginning,-
2896 QPixelFormat::NotPremultiplied,-
2897 QPixelFormat::UnsignedShort,-
2898 QPixelFormat::CurrentSystemEndian),-
2899-
2900 QPixelFormat(QPixelFormat::RGB,-
2901 5,-
2902 6,-
2903 5,-
2904 0,-
2905 0,-
2906 8,-
2907 QPixelFormat::UsesAlpha,-
2908 QPixelFormat::AtBeginning,-
2909 QPixelFormat::Premultiplied,-
2910 QPixelFormat::UnsignedInteger,-
2911 QPixelFormat::CurrentSystemEndian),-
2912-
2913 QPixelFormat(QPixelFormat::RGB,-
2914 6,-
2915 6,-
2916 6,-
2917 0,-
2918 0,-
2919 0,-
2920 QPixelFormat::IgnoresAlpha,-
2921 QPixelFormat::AtBeginning,-
2922 QPixelFormat::NotPremultiplied,-
2923 QPixelFormat::UnsignedInteger,-
2924 QPixelFormat::CurrentSystemEndian),-
2925-
2926 QPixelFormat(QPixelFormat::RGB,-
2927 6,-
2928 6,-
2929 6,-
2930 0,-
2931 0,-
2932 6,-
2933 QPixelFormat::UsesAlpha,-
2934 QPixelFormat::AtEnd,-
2935 QPixelFormat::Premultiplied,-
2936 QPixelFormat::UnsignedInteger,-
2937 QPixelFormat::CurrentSystemEndian),-
2938-
2939 QPixelFormat(QPixelFormat::RGB,-
2940 5,-
2941 5,-
2942 5,-
2943 0,-
2944 0,-
2945 0,-
2946 QPixelFormat::IgnoresAlpha,-
2947 QPixelFormat::AtBeginning,-
2948 QPixelFormat::NotPremultiplied,-
2949 QPixelFormat::UnsignedShort,-
2950 QPixelFormat::CurrentSystemEndian),-
2951-
2952 QPixelFormat(QPixelFormat::RGB,-
2953 5,-
2954 5,-
2955 5,-
2956 0,-
2957 0,-
2958 8,-
2959 QPixelFormat::UsesAlpha,-
2960 QPixelFormat::AtBeginning,-
2961 QPixelFormat::Premultiplied,-
2962 QPixelFormat::UnsignedInteger,-
2963 QPixelFormat::CurrentSystemEndian),-
2964-
2965 QPixelFormat(QPixelFormat::RGB,-
2966 8,-
2967 8,-
2968 8,-
2969 0,-
2970 0,-
2971 0,-
2972 QPixelFormat::IgnoresAlpha,-
2973 QPixelFormat::AtBeginning,-
2974 QPixelFormat::NotPremultiplied,-
2975 QPixelFormat::UnsignedByte,-
2976 QPixelFormat::CurrentSystemEndian),-
2977-
2978 QPixelFormat(QPixelFormat::RGB,-
2979 4,-
2980 4,-
2981 4,-
2982 0,-
2983 0,-
2984 0,-
2985 QPixelFormat::IgnoresAlpha,-
2986 QPixelFormat::AtBeginning,-
2987 QPixelFormat::NotPremultiplied,-
2988 QPixelFormat::UnsignedShort,-
2989 QPixelFormat::CurrentSystemEndian),-
2990-
2991 QPixelFormat(QPixelFormat::RGB,-
2992 4,-
2993 4,-
2994 4,-
2995 0,-
2996 0,-
2997 4,-
2998 QPixelFormat::UsesAlpha,-
2999 QPixelFormat::AtEnd,-
3000 QPixelFormat::Premultiplied,-
3001 QPixelFormat::UnsignedShort,-
3002 QPixelFormat::CurrentSystemEndian),-
3003-
3004 QPixelFormat(QPixelFormat::RGB,-
3005 8,-
3006 8,-
3007 8,-
3008 0,-
3009 0,-
3010 8,-
3011 QPixelFormat::IgnoresAlpha,-
3012 QPixelFormat::AtEnd,-
3013 QPixelFormat::NotPremultiplied,-
3014 QPixelFormat::UnsignedByte,-
3015 QPixelFormat::CurrentSystemEndian),-
3016-
3017 QPixelFormat(QPixelFormat::RGB,-
3018 8,-
3019 8,-
3020 8,-
3021 0,-
3022 0,-
3023 8,-
3024 QPixelFormat::UsesAlpha,-
3025 QPixelFormat::AtEnd,-
3026 QPixelFormat::NotPremultiplied,-
3027 QPixelFormat::UnsignedByte,-
3028 QPixelFormat::CurrentSystemEndian),-
3029-
3030 QPixelFormat(QPixelFormat::RGB,-
3031 8,-
3032 8,-
3033 8,-
3034 0,-
3035 0,-
3036 8,-
3037 QPixelFormat::UsesAlpha,-
3038 QPixelFormat::AtEnd,-
3039 QPixelFormat::Premultiplied,-
3040 QPixelFormat::UnsignedByte,-
3041 QPixelFormat::CurrentSystemEndian),-
3042-
3043 QPixelFormat(QPixelFormat::BGR,-
3044 10,-
3045 10,-
3046 10,-
3047 0,-
3048 0,-
3049 2,-
3050 QPixelFormat::IgnoresAlpha,-
3051 QPixelFormat::AtBeginning,-
3052 QPixelFormat::NotPremultiplied,-
3053 QPixelFormat::UnsignedInteger,-
3054 QPixelFormat::CurrentSystemEndian),-
3055-
3056 QPixelFormat(QPixelFormat::BGR,-
3057 10,-
3058 10,-
3059 10,-
3060 0,-
3061 0,-
3062 2,-
3063 QPixelFormat::UsesAlpha,-
3064 QPixelFormat::AtBeginning,-
3065 QPixelFormat::Premultiplied,-
3066 QPixelFormat::UnsignedInteger,-
3067 QPixelFormat::CurrentSystemEndian),-
3068-
3069 QPixelFormat(QPixelFormat::RGB,-
3070 10,-
3071 10,-
3072 10,-
3073 0,-
3074 0,-
3075 2,-
3076 QPixelFormat::IgnoresAlpha,-
3077 QPixelFormat::AtBeginning,-
3078 QPixelFormat::NotPremultiplied,-
3079 QPixelFormat::UnsignedInteger,-
3080 QPixelFormat::CurrentSystemEndian),-
3081-
3082 QPixelFormat(QPixelFormat::RGB,-
3083 10,-
3084 10,-
3085 10,-
3086 0,-
3087 0,-
3088 2,-
3089 QPixelFormat::UsesAlpha,-
3090 QPixelFormat::AtBeginning,-
3091 QPixelFormat::Premultiplied,-
3092 QPixelFormat::UnsignedInteger,-
3093 QPixelFormat::CurrentSystemEndian),-
3094-
3095 QPixelFormat(QPixelFormat::Alpha,-
3096 0,-
3097 0,-
3098 0,-
3099 0,-
3100 0,-
3101 8,-
3102 QPixelFormat::UsesAlpha,-
3103 QPixelFormat::AtBeginning,-
3104 QPixelFormat::Premultiplied,-
3105 QPixelFormat::UnsignedByte,-
3106 QPixelFormat::CurrentSystemEndian),-
3107-
3108 QPixelFormat(QPixelFormat::Grayscale,-
3109 8,-
3110 0,-
3111 0,-
3112 0,-
3113 0,-
3114 0,-
3115 QPixelFormat::IgnoresAlpha,-
3116 QPixelFormat::AtBeginning,-
3117 QPixelFormat::NotPremultiplied,-
3118 QPixelFormat::UnsignedByte,-
3119 QPixelFormat::CurrentSystemEndian),-
3120};-
3121static_assert(bool(sizeof(pixelformats) / sizeof(*pixelformats) == QImage::NImageFormats), "sizeof(pixelformats) / sizeof(*pixelformats) == QImage::NImageFormats");-
3122-
3123-
3124-
3125-
3126QPixelFormat QImage::pixelFormat() const noexcept-
3127{-
3128 return
never executed: return toPixelFormat(format());
toPixelFormat(format());
never executed: return toPixelFormat(format());
0
3129}-
3130-
3131-
3132-
3133-
3134QPixelFormat QImage::toPixelFormat(QImage::Format format) noexcept-
3135{-
3136 ((!(static_cast<int>(format) < NImageFormats)) ? qt_assert("static_cast<int>(format) < NImageFormats",__FILE__,5190) : qt_noop());-
3137 return
never executed: return pixelformats[format];
pixelformats[format];
never executed: return pixelformats[format];
0
3138}-
3139-
3140-
3141-
3142-
3143QImage::Format QImage::toImageFormat(QPixelFormat format) noexcept-
3144{-
3145 for (int i = 0; i < NImageFormats
i < NImageFormatsDescription
TRUEnever evaluated
FALSEnever evaluated
; i++) {
0
3146 if (format == pixelformats[i]
format == pixelformats[i]Description
TRUEnever evaluated
FALSEnever evaluated
)
0
3147 return
never executed: return Format(i);
Format(i);
never executed: return Format(i);
0
3148 }
never executed: end of block
0
3149 return
never executed: return Format_Invalid;
Format_Invalid;
never executed: return Format_Invalid;
0
3150}-
3151-
3152__attribute__((visibility("default"))) void qt_imageTransform(QImage &src, QImageIOHandler::Transformations orient)-
3153{-
3154 if (orient == QImageIOHandler::TransformationNone
orient == QIma...sformationNoneDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
3155 return;
never executed: return;
0
3156 if (orient == QImageIOHandler::TransformationRotate270
orient == QIma...ationRotate270Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
3157 src = rotated270(src);-
3158 }
never executed: end of block
else {
0
3159 src = std::move(src).mirrored(orient & QImageIOHandler::TransformationMirror,-
3160 orient & QImageIOHandler::TransformationFlip);-
3161 if (orient & QImageIOHandler::TransformationRotate90
orient & QImag...mationRotate90Description
TRUEnever evaluated
FALSEnever evaluated
)
0
3162 src = rotated90(src);
never executed: src = rotated90(src);
0
3163 }
never executed: end of block
0
3164}-
3165-
3166-
Switch to Source codePreprocessed file

Generated by Squish Coco Non-Commercial 4.3.0-BETA-master-30-08-2018-4cb69e9