OpenCoverage

qimage_conversions.cpp

Absolute File Name:/home/qt/qt5_coco/qt5/qtbase/src/gui/image/qimage_conversions.cpp
Source codeSwitch to Preprocessed file
LineSourceCount
1/****************************************************************************-
2**-
3** Copyright (C) 2016 The Qt Company Ltd.-
4** Contact: https://www.qt.io/licensing/-
5**-
6** This file is part of the QtGui module of the Qt Toolkit.-
7**-
8** $QT_BEGIN_LICENSE:LGPL$-
9** Commercial License Usage-
10** Licensees holding valid commercial Qt licenses may use this file in-
11** accordance with the commercial license agreement provided with the-
12** Software or, alternatively, in accordance with the terms contained in-
13** a written agreement between you and The Qt Company. For licensing terms-
14** and conditions see https://www.qt.io/terms-conditions. For further-
15** information use the contact form at https://www.qt.io/contact-us.-
16**-
17** GNU Lesser General Public License Usage-
18** Alternatively, this file may be used under the terms of the GNU Lesser-
19** General Public License version 3 as published by the Free Software-
20** Foundation and appearing in the file LICENSE.LGPL3 included in the-
21** packaging of this file. Please review the following information to-
22** ensure the GNU Lesser General Public License version 3 requirements-
23** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.-
24**-
25** GNU General Public License Usage-
26** Alternatively, this file may be used under the terms of the GNU-
27** General Public License version 2.0 or (at your option) the GNU General-
28** Public license version 3 or any later version approved by the KDE Free-
29** Qt Foundation. The licenses are as published by the Free Software-
30** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3-
31** included in the packaging of this file. Please review the following-
32** information to ensure the GNU General Public License requirements will-
33** be met: https://www.gnu.org/licenses/gpl-2.0.html and-
34** https://www.gnu.org/licenses/gpl-3.0.html.-
35**-
36** $QT_END_LICENSE$-
37**-
38****************************************************************************/-
39-
40#include <private/qdrawhelper_p.h>-
41#include <private/qguiapplication_p.h>-
42#include <private/qsimd_p.h>-
43#include <private/qimage_p.h>-
44#include <qendian.h>-
45-
46QT_BEGIN_NAMESPACE-
47-
48// table to flip bits-
49static const uchar bitflip[256] = {-
50 /*-
51 open OUT, "| fmt";-
52 for $i (0..255) {-
53 print OUT (($i >> 7) & 0x01) | (($i >> 5) & 0x02) |-
54 (($i >> 3) & 0x04) | (($i >> 1) & 0x08) |-
55 (($i << 7) & 0x80) | (($i << 5) & 0x40) |-
56 (($i << 3) & 0x20) | (($i << 1) & 0x10), ", ";-
57 }-
58 close OUT;-
59 */-
60 0, 128, 64, 192, 32, 160, 96, 224, 16, 144, 80, 208, 48, 176, 112, 240,-
61 8, 136, 72, 200, 40, 168, 104, 232, 24, 152, 88, 216, 56, 184, 120, 248,-
62 4, 132, 68, 196, 36, 164, 100, 228, 20, 148, 84, 212, 52, 180, 116, 244,-
63 12, 140, 76, 204, 44, 172, 108, 236, 28, 156, 92, 220, 60, 188, 124, 252,-
64 2, 130, 66, 194, 34, 162, 98, 226, 18, 146, 82, 210, 50, 178, 114, 242,-
65 10, 138, 74, 202, 42, 170, 106, 234, 26, 154, 90, 218, 58, 186, 122, 250,-
66 6, 134, 70, 198, 38, 166, 102, 230, 22, 150, 86, 214, 54, 182, 118, 246,-
67 14, 142, 78, 206, 46, 174, 110, 238, 30, 158, 94, 222, 62, 190, 126, 254,-
68 1, 129, 65, 193, 33, 161, 97, 225, 17, 145, 81, 209, 49, 177, 113, 241,-
69 9, 137, 73, 201, 41, 169, 105, 233, 25, 153, 89, 217, 57, 185, 121, 249,-
70 5, 133, 69, 197, 37, 165, 101, 229, 21, 149, 85, 213, 53, 181, 117, 245,-
71 13, 141, 77, 205, 45, 173, 109, 237, 29, 157, 93, 221, 61, 189, 125, 253,-
72 3, 131, 67, 195, 35, 163, 99, 227, 19, 147, 83, 211, 51, 179, 115, 243,-
73 11, 139, 75, 203, 43, 171, 107, 235, 27, 155, 91, 219, 59, 187, 123, 251,-
74 7, 135, 71, 199, 39, 167, 103, 231, 23, 151, 87, 215, 55, 183, 119, 247,-
75 15, 143, 79, 207, 47, 175, 111, 239, 31, 159, 95, 223, 63, 191, 127, 255-
76};-
77-
78const uchar *qt_get_bitflip_array()-
79{-
80 return bitflip;
never executed: return bitflip;
0
81}-
82-
83void qGamma_correct_back_to_linear_cs(QImage *image)-
84{-
85 const QDrawHelperGammaTables *tables = QGuiApplicationPrivate::instance()->gammaTables();-
86 if (!tables)
!tablesDescription
TRUEnever evaluated
FALSEnever evaluated
0
87 return;
never executed: return;
0
88 const uchar *gamma = tables->qt_pow_rgb_gamma;-
89 // gamma correct the pixels back to linear color space...-
90 int h = image->height();-
91 int w = image->width();-
92-
93 for (int y=0; y<h; ++y) {
y<hDescription
TRUEnever evaluated
FALSEnever evaluated
0
94 uint *pixels = (uint *) image->scanLine(y);-
95 for (int x=0; x<w; ++x) {
x<wDescription
TRUEnever evaluated
FALSEnever evaluated
0
96 uint p = pixels[x];-
97 uint r = gamma[qRed(p)];-
98 uint g = gamma[qGreen(p)];-
99 uint b = gamma[qBlue(p)];-
100 pixels[x] = (r << 16) | (g << 8) | b | 0xff000000;-
101 }
never executed: end of block
0
102 }
never executed: end of block
0
103}
never executed: end of block
0
104-
105/*****************************************************************************-
106 Internal routines for converting image depth.-
107 *****************************************************************************/-
108-
109// The drawhelper conversions from/to RGB32 are passthroughs which is not always correct for general image conversion.-
110static const uint *QT_FASTCALL convertRGB32FromARGB32PM(uint *buffer, const uint *src, int count,-
111 const QPixelLayout *, const QRgb *)-
112{-
113 for (int i = 0; i < count; ++i)
i < countDescription
TRUEnever evaluated
FALSEnever evaluated
0
114 buffer[i] = 0xff000000 | qUnpremultiply(src[i]);
never executed: buffer[i] = 0xff000000 | qUnpremultiply(src[i]);
0
115 return buffer;
never executed: return buffer;
0
116}-
117-
118static const uint *QT_FASTCALL convertRGB32ToARGB32PM(uint *buffer, const uint *src, int count,-
119 const QPixelLayout *, const QRgb *)-
120{-
121 for (int i = 0; i < count; ++i)
i < countDescription
TRUEnever evaluated
FALSEnever evaluated
0
122 buffer[i] = 0xff000000 |src[i];
never executed: buffer[i] = 0xff000000 |src[i];
0
123 return buffer;
never executed: return buffer;
0
124}-
125-
126#ifdef QT_COMPILER_SUPPORTS_SSE4_1-
127extern const uint *QT_FASTCALL convertRGB32FromARGB32PM_sse4(uint *buffer, const uint *src, int count, const QPixelLayout *, const QRgb *);-
128#endif-
129-
130void convert_generic(QImageData *dest, const QImageData *src, Qt::ImageConversionFlags)-
131{-
132 // Cannot be used with indexed formats.-
133 Q_ASSERT(dest->format > QImage::Format_Indexed8);-
134 Q_ASSERT(src->format > QImage::Format_Indexed8);-
135 const int buffer_size = 2048;-
136 uint buffer[buffer_size];-
137 const QPixelLayout *srcLayout = &qPixelLayouts[src->format];-
138 const QPixelLayout *destLayout = &qPixelLayouts[dest->format];-
139 const uchar *srcData = src->data;-
140 uchar *destData = dest->data;-
141-
142 const FetchPixelsFunc fetch = qFetchPixels[srcLayout->bpp];-
143 const StorePixelsFunc store = qStorePixels[destLayout->bpp];-
144 ConvertFunc convertToARGB32PM = srcLayout->convertToARGB32PM;-
145 ConvertFunc convertFromARGB32PM = destLayout->convertFromARGB32PM;-
146 if (srcLayout->alphaWidth == 0 && destLayout->convertFromRGB32) {
srcLayout->alphaWidth == 0Description
TRUEnever evaluated
FALSEnever evaluated
destLayout->convertFromRGB32Description
TRUEnever evaluated
FALSEnever evaluated
0
147 // If the source doesn't have an alpha channel, we can use the faster convertFromRGB32 method.-
148 convertFromARGB32PM = destLayout->convertFromRGB32;-
149 } else {
never executed: end of block
0
150 if (src->format == QImage::Format_RGB32)
src->format ==...::Format_RGB32Description
TRUEnever evaluated
FALSEnever evaluated
0
151 convertToARGB32PM = convertRGB32ToARGB32PM;
never executed: convertToARGB32PM = convertRGB32ToARGB32PM;
0
152 if (dest->format == QImage::Format_RGB32) {
dest->format =...::Format_RGB32Description
TRUEnever evaluated
FALSEnever evaluated
0
153#ifdef QT_COMPILER_SUPPORTS_SSE4_1-
154 if (qCpuHasFeature(SSE4_1))
(qCompilerCpuF...eatureSSE4_1))Description
TRUEnever evaluated
FALSEnever evaluated
(qCpuFeatures(...eatureSSE4_1))Description
TRUEnever evaluated
FALSEnever evaluated
0
155 convertFromARGB32PM = convertRGB32FromARGB32PM_sse4;
never executed: convertFromARGB32PM = convertRGB32FromARGB32PM_sse4;
0
156 else-
157#endif-
158 convertFromARGB32PM = convertRGB32FromARGB32PM;
never executed: convertFromARGB32PM = convertRGB32FromARGB32PM;
0
159 }-
160 }
never executed: end of block
0
161-
162 for (int y = 0; y < src->height; ++y) {
y < src->heightDescription
TRUEnever evaluated
FALSEnever evaluated
0
163 int x = 0;-
164 while (x < src->width) {
x < src->widthDescription
TRUEnever evaluated
FALSEnever evaluated
0
165 int l = qMin(src->width - x, buffer_size);-
166 const uint *ptr = fetch(buffer, srcData, x, l);-
167 ptr = convertToARGB32PM(buffer, ptr, l, srcLayout, 0);-
168 ptr = convertFromARGB32PM(buffer, ptr, l, destLayout, 0);-
169 store(destData, ptr, x, l);-
170 x += l;-
171 }
never executed: end of block
0
172 srcData += src->bytes_per_line;-
173 destData += dest->bytes_per_line;-
174 }
never executed: end of block
0
175}
never executed: end of block
0
176-
177bool convert_generic_inplace(QImageData *data, QImage::Format dst_format, Qt::ImageConversionFlags)-
178{-
179 // Cannot be used with indexed formats or between formats with different pixel depths.-
180 Q_ASSERT(dst_format > QImage::Format_Indexed8);-
181 Q_ASSERT(data->format > QImage::Format_Indexed8);-
182 if (data->depth != qt_depthForFormat(dst_format))
data->depth !=...at(dst_format)Description
TRUEnever evaluated
FALSEnever evaluated
0
183 return false;
never executed: return false;
0
184-
185 const int buffer_size = 2048;-
186 uint buffer[buffer_size];-
187 const QPixelLayout *srcLayout = &qPixelLayouts[data->format];-
188 const QPixelLayout *destLayout = &qPixelLayouts[dst_format];-
189 uchar *srcData = data->data;-
190-
191 const FetchPixelsFunc fetch = qFetchPixels[srcLayout->bpp];-
192 const StorePixelsFunc store = qStorePixels[destLayout->bpp];-
193 ConvertFunc convertToARGB32PM = srcLayout->convertToARGB32PM;-
194 ConvertFunc convertFromARGB32PM = destLayout->convertFromARGB32PM;-
195 if (srcLayout->alphaWidth == 0 && destLayout->convertFromRGB32) {
srcLayout->alphaWidth == 0Description
TRUEnever evaluated
FALSEnever evaluated
destLayout->convertFromRGB32Description
TRUEnever evaluated
FALSEnever evaluated
0
196 // If the source doesn't have an alpha channel, we can use the faster convertFromRGB32 method.-
197 convertFromARGB32PM = destLayout->convertFromRGB32;-
198 } else {
never executed: end of block
0
199 if (data->format == QImage::Format_RGB32)
data->format =...::Format_RGB32Description
TRUEnever evaluated
FALSEnever evaluated
0
200 convertToARGB32PM = convertRGB32ToARGB32PM;
never executed: convertToARGB32PM = convertRGB32ToARGB32PM;
0
201 if (dst_format == QImage::Format_RGB32) {
dst_format == ...::Format_RGB32Description
TRUEnever evaluated
FALSEnever evaluated
0
202#ifdef QT_COMPILER_SUPPORTS_SSE4_1-
203 if (qCpuHasFeature(SSE4_1))
(qCompilerCpuF...eatureSSE4_1))Description
TRUEnever evaluated
FALSEnever evaluated
(qCpuFeatures(...eatureSSE4_1))Description
TRUEnever evaluated
FALSEnever evaluated
0
204 convertFromARGB32PM = convertRGB32FromARGB32PM_sse4;
never executed: convertFromARGB32PM = convertRGB32FromARGB32PM_sse4;
0
205 else-
206#endif-
207 convertFromARGB32PM = convertRGB32FromARGB32PM;
never executed: convertFromARGB32PM = convertRGB32FromARGB32PM;
0
208 }-
209 }
never executed: end of block
0
210-
211 for (int y = 0; y < data->height; ++y) {
y < data->heightDescription
TRUEnever evaluated
FALSEnever evaluated
0
212 int x = 0;-
213 while (x < data->width) {
x < data->widthDescription
TRUEnever evaluated
FALSEnever evaluated
0
214 int l = qMin(data->width - x, buffer_size);-
215 const uint *ptr = fetch(buffer, srcData, x, l);-
216 ptr = convertToARGB32PM(buffer, ptr, l, srcLayout, 0);-
217 ptr = convertFromARGB32PM(buffer, ptr, l, destLayout, 0);-
218 // The conversions might be passthrough and not use the buffer, in that case we are already done.-
219 if (srcData != (const uchar*)ptr)
srcData != (const uchar*)ptrDescription
TRUEnever evaluated
FALSEnever evaluated
0
220 store(srcData, ptr, x, l);
never executed: store(srcData, ptr, x, l);
0
221 x += l;-
222 }
never executed: end of block
0
223 srcData += data->bytes_per_line;-
224 }
never executed: end of block
0
225 data->format = dst_format;-
226 return true;
never executed: return true;
0
227}-
228-
229static void convert_passthrough(QImageData *dest, const QImageData *src, Qt::ImageConversionFlags)-
230{-
231 Q_ASSERT(src->width == dest->width);-
232 Q_ASSERT(src->height == dest->height);-
233-
234 const int src_pad = (src->bytes_per_line >> 2) - src->width;-
235 const int dest_pad = (dest->bytes_per_line >> 2) - dest->width;-
236 const quint32 *src_data = (quint32 *) src->data;-
237 quint32 *dest_data = (quint32 *) dest->data;-
238-
239 for (int i = 0; i < src->height; ++i) {
i < src->heightDescription
TRUEnever evaluated
FALSEnever evaluated
0
240 const quint32 *end = src_data + src->width;-
241 while (src_data < end) {
src_data < endDescription
TRUEnever evaluated
FALSEnever evaluated
0
242 *dest_data = *src_data;-
243 ++src_data;-
244 ++dest_data;-
245 }
never executed: end of block
0
246 src_data += src_pad;-
247 dest_data += dest_pad;-
248 }
never executed: end of block
0
249}
never executed: end of block
0
250-
251template<QImage::Format Format>-
252static bool convert_passthrough_inplace(QImageData *data, Qt::ImageConversionFlags)-
253{-
254 data->format = Format;-
255 return true;
never executed: return true;
0
256}-
257-
258static void convert_ARGB_to_ARGB_PM(QImageData *dest, const QImageData *src, Qt::ImageConversionFlags)-
259{-
260 Q_ASSERT(src->format == QImage::Format_ARGB32 || src->format == QImage::Format_RGBA8888);-
261 Q_ASSERT(dest->format == QImage::Format_ARGB32_Premultiplied || dest->format == QImage::Format_RGBA8888_Premultiplied);-
262 Q_ASSERT(src->width == dest->width);-
263 Q_ASSERT(src->height == dest->height);-
264-
265 const int src_pad = (src->bytes_per_line >> 2) - src->width;-
266 const int dest_pad = (dest->bytes_per_line >> 2) - dest->width;-
267 const QRgb *src_data = (QRgb *) src->data;-
268 QRgb *dest_data = (QRgb *) dest->data;-
269-
270 for (int i = 0; i < src->height; ++i) {
i < src->heightDescription
TRUEnever evaluated
FALSEnever evaluated
0
271 const QRgb *end = src_data + src->width;-
272 while (src_data < end) {
src_data < endDescription
TRUEnever evaluated
FALSEnever evaluated
0
273 *dest_data = qPremultiply(*src_data);-
274 ++src_data;-
275 ++dest_data;-
276 }
never executed: end of block
0
277 src_data += src_pad;-
278 dest_data += dest_pad;-
279 }
never executed: end of block
0
280}
never executed: end of block
0
281-
282Q_GUI_EXPORT void QT_FASTCALL qt_convert_rgb888_to_rgb32(quint32 *dest_data, const uchar *src_data, int len)-
283{-
284 int pixel = 0;-
285 // prolog: align input to 32bit-
286 while ((quintptr(src_data) & 0x3) && pixel < len) {
(quintptr(src_data) & 0x3)Description
TRUEnever evaluated
FALSEnever evaluated
pixel < lenDescription
TRUEnever evaluated
FALSEnever evaluated
0
287 *dest_data = 0xff000000 | (src_data[0] << 16) | (src_data[1] << 8) | (src_data[2]);-
288 src_data += 3;-
289 ++dest_data;-
290 ++pixel;-
291 }
never executed: end of block
0
292-
293 // Handle 4 pixels at a time 12 bytes input to 16 bytes output.-
294 for (; pixel + 3 < len; pixel += 4) {
pixel + 3 < lenDescription
TRUEnever evaluated
FALSEnever evaluated
0
295 const quint32 *src_packed = (const quint32 *) src_data;-
296 const quint32 src1 = qFromBigEndian(src_packed[0]);-
297 const quint32 src2 = qFromBigEndian(src_packed[1]);-
298 const quint32 src3 = qFromBigEndian(src_packed[2]);-
299-
300 dest_data[0] = 0xff000000 | (src1 >> 8);-
301 dest_data[1] = 0xff000000 | (src1 << 16) | (src2 >> 16);-
302 dest_data[2] = 0xff000000 | (src2 << 8) | (src3 >> 24);-
303 dest_data[3] = 0xff000000 | src3;-
304-
305 src_data += 12;-
306 dest_data += 4;-
307 }
never executed: end of block
0
308-
309 // epilog: handle left over pixels-
310 for (; pixel < len; ++pixel) {
pixel < lenDescription
TRUEnever evaluated
FALSEnever evaluated
0
311 *dest_data = 0xff000000 | (src_data[0] << 16) | (src_data[1] << 8) | (src_data[2]);-
312 src_data += 3;-
313 ++dest_data;-
314 }
never executed: end of block
0
315}
never executed: end of block
0
316-
317Q_GUI_EXPORT void QT_FASTCALL qt_convert_rgb888_to_rgbx8888(quint32 *dest_data, const uchar *src_data, int len)-
318{-
319 int pixel = 0;-
320 // prolog: align input to 32bit-
321 while ((quintptr(src_data) & 0x3) && pixel < len) {
(quintptr(src_data) & 0x3)Description
TRUEnever evaluated
FALSEnever evaluated
pixel < lenDescription
TRUEnever evaluated
FALSEnever evaluated
0
322 *dest_data = ARGB2RGBA(0xff000000 | (src_data[0] << 16) | (src_data[1] << 8) | (src_data[2]));-
323 src_data += 3;-
324 ++dest_data;-
325 ++pixel;-
326 }
never executed: end of block
0
327-
328 // Handle 4 pixels at a time 12 bytes input to 16 bytes output.-
329 for (; pixel + 3 < len; pixel += 4) {
pixel + 3 < lenDescription
TRUEnever evaluated
FALSEnever evaluated
0
330 const quint32 *src_packed = (const quint32 *) src_data;-
331 const quint32 src1 = src_packed[0];-
332 const quint32 src2 = src_packed[1];-
333 const quint32 src3 = src_packed[2];-
334-
335#if Q_BYTE_ORDER == Q_LITTLE_ENDIAN-
336 dest_data[0] = 0xff000000 | src1;-
337 dest_data[1] = 0xff000000 | (src1 >> 24) | (src2 << 8);-
338 dest_data[2] = 0xff000000 | (src2 >> 16) | (src3 << 16);-
339 dest_data[3] = 0xff000000 | (src3 >> 8);-
340#else-
341 dest_data[0] = 0xff | src1;-
342 dest_data[1] = 0xff | (src1 << 24) | (src2 >> 8);-
343 dest_data[2] = 0xff | (src2 << 16) | (src3 >> 16);-
344 dest_data[3] = 0xff | (src3 << 8);-
345#endif-
346-
347 src_data += 12;-
348 dest_data += 4;-
349 }
never executed: end of block
0
350-
351 // epilog: handle left over pixels-
352 for (; pixel < len; ++pixel) {
pixel < lenDescription
TRUEnever evaluated
FALSEnever evaluated
0
353 *dest_data = ARGB2RGBA(0xff000000 | (src_data[0] << 16) | (src_data[1] << 8) | (src_data[2]));-
354 src_data += 3;-
355 ++dest_data;-
356 }
never executed: end of block
0
357}
never executed: end of block
0
358-
359typedef void (QT_FASTCALL *Rgb888ToRgbConverter)(quint32 *dst, const uchar *src, int len);-
360-
361template <bool rgbx>-
362static void convert_RGB888_to_RGB(QImageData *dest, const QImageData *src, Qt::ImageConversionFlags)-
363{-
364 Q_ASSERT(src->format == QImage::Format_RGB888);-
365 if (rgbx)
rgbxDescription
TRUEnever evaluated
FALSEnever evaluated
0
366 Q_ASSERT(dest->format == QImage::Format_RGBX8888 || dest->format == QImage::Format_RGBA8888 || dest->format == QImage::Format_RGBA8888_Premultiplied);
never executed: ((!(dest->format == QImage::Format_RGBX8888 || dest->format == QImage::Format_RGBA8888 || dest->format == QImage::Format_RGBA8888_Premultiplied)) ? qt_assert("dest->format == QImage::Format_RGBX8888 || dest->format == QImage::Format_RGBA8888 || dest->format == QImage::Format_RGBA8888_Premultiplied",__FILE__,366) : qt_noop());
0
367 else-
368 Q_ASSERT(dest->format == QImage::Format_RGB32 || dest->format == QImage::Format_ARGB32 || dest->format == QImage::Format_ARGB32_Premultiplied);
never executed: ((!(dest->format == QImage::Format_RGB32 || dest->format == QImage::Format_ARGB32 || dest->format == QImage::Format_ARGB32_Premultiplied)) ? qt_assert("dest->format == QImage::Format_RGB32 || dest->format == QImage::Format_ARGB32 || dest->format == QImage::Format_ARGB32_Premultiplied",__FILE__,368) : qt_noop());
0
369 Q_ASSERT(src->width == dest->width);-
370 Q_ASSERT(src->height == dest->height);-
371-
372 const uchar *src_data = (uchar *) src->data;-
373 quint32 *dest_data = (quint32 *) dest->data;-
374-
375 Rgb888ToRgbConverter line_converter= rgbx ? qt_convert_rgb888_to_rgbx8888 : qt_convert_rgb888_to_rgb32;
rgbxDescription
TRUEnever evaluated
FALSEnever evaluated
0
376-
377 for (int i = 0; i < src->height; ++i) {
i < src->heightDescription
TRUEnever evaluated
FALSEnever evaluated
0
378 line_converter(dest_data, src_data, src->width);-
379 src_data += src->bytes_per_line;-
380 dest_data = (quint32 *)((uchar*)dest_data + dest->bytes_per_line);-
381 }
never executed: end of block
0
382}
never executed: end of block
0
383-
384#ifdef __SSE2__-
385extern bool convert_ARGB_to_ARGB_PM_inplace_sse2(QImageData *data, Qt::ImageConversionFlags);-
386#else-
387static bool convert_ARGB_to_ARGB_PM_inplace(QImageData *data,Qt::ImageConversionFlags)-
388{-
389 Q_ASSERT(data->format == QImage::Format_ARGB32 || data->format == QImage::Format_RGBA8888);-
390-
391 const int pad = (data->bytes_per_line >> 2) - data->width;-
392 QRgb *rgb_data = (QRgb *) data->data;-
393-
394 for (int i = 0; i < data->height; ++i) {-
395 const QRgb *end = rgb_data + data->width;-
396 while (rgb_data < end) {-
397 *rgb_data = qPremultiply(*rgb_data);-
398 ++rgb_data;-
399 }-
400 rgb_data += pad;-
401 }-
402-
403 if (data->format == QImage::Format_ARGB32)-
404 data->format = QImage::Format_ARGB32_Premultiplied;-
405 else-
406 data->format = QImage::Format_RGBA8888_Premultiplied;-
407 return true;-
408}-
409#endif-
410-
411static void convert_ARGB_to_RGBx(QImageData *dest, const QImageData *src, Qt::ImageConversionFlags)-
412{-
413 Q_ASSERT(src->format == QImage::Format_ARGB32);-
414 Q_ASSERT(dest->format == QImage::Format_RGBX8888);-
415 Q_ASSERT(src->width == dest->width);-
416 Q_ASSERT(src->height == dest->height);-
417-
418 const int src_pad = (src->bytes_per_line >> 2) - src->width;-
419 const int dest_pad = (dest->bytes_per_line >> 2) - dest->width;-
420 const quint32 *src_data = (quint32 *) src->data;-
421 quint32 *dest_data = (quint32 *) dest->data;-
422-
423 for (int i = 0; i < src->height; ++i) {
i < src->heightDescription
TRUEnever evaluated
FALSEnever evaluated
0
424 const quint32 *end = src_data + src->width;-
425 while (src_data < end) {
src_data < endDescription
TRUEnever evaluated
FALSEnever evaluated
0
426 *dest_data = ARGB2RGBA(0xff000000 | *src_data);-
427 ++src_data;-
428 ++dest_data;-
429 }
never executed: end of block
0
430 src_data += src_pad;-
431 dest_data += dest_pad;-
432 }
never executed: end of block
0
433}
never executed: end of block
0
434-
435static void convert_ARGB_to_RGBA(QImageData *dest, const QImageData *src, Qt::ImageConversionFlags)-
436{-
437 Q_ASSERT(src->format == QImage::Format_ARGB32 || src->format == QImage::Format_ARGB32_Premultiplied);-
438 Q_ASSERT(dest->format == QImage::Format_RGBA8888 || dest->format == QImage::Format_RGBA8888_Premultiplied);-
439 Q_ASSERT(src->width == dest->width);-
440 Q_ASSERT(src->height == dest->height);-
441-
442 const int src_pad = (src->bytes_per_line >> 2) - src->width;-
443 const int dest_pad = (dest->bytes_per_line >> 2) - dest->width;-
444 const quint32 *src_data = (quint32 *) src->data;-
445 quint32 *dest_data = (quint32 *) dest->data;-
446-
447 for (int i = 0; i < src->height; ++i) {
i < src->heightDescription
TRUEnever evaluated
FALSEnever evaluated
0
448 const quint32 *end = src_data + src->width;-
449 while (src_data < end) {
src_data < endDescription
TRUEnever evaluated
FALSEnever evaluated
0
450 *dest_data = ARGB2RGBA(*src_data);-
451 ++src_data;-
452 ++dest_data;-
453 }
never executed: end of block
0
454 src_data += src_pad;-
455 dest_data += dest_pad;-
456 }
never executed: end of block
0
457}
never executed: end of block
0
458-
459template<QImage::Format DestFormat>-
460static bool convert_ARGB_to_RGBA_inplace(QImageData *data, Qt::ImageConversionFlags)-
461{-
462 Q_ASSERT(data->format == QImage::Format_ARGB32 || data->format == QImage::Format_ARGB32_Premultiplied);-
463-
464 const int pad = (data->bytes_per_line >> 2) - data->width;-
465 quint32 *rgb_data = (quint32 *) data->data;-
466 Q_CONSTEXPR uint mask = (DestFormat == QImage::Format_RGBX8888) ? 0xff000000 : 0;-
467-
468 for (int i = 0; i < data->height; ++i) {
i < data->heightDescription
TRUEnever evaluated
FALSEnever evaluated
0
469 const quint32 *end = rgb_data + data->width;-
470 while (rgb_data < end) {
rgb_data < endDescription
TRUEnever evaluated
FALSEnever evaluated
0
471 *rgb_data = ARGB2RGBA(*rgb_data | mask);-
472 ++rgb_data;-
473 }
never executed: end of block
0
474 rgb_data += pad;-
475 }
never executed: end of block
0
476-
477 data->format = DestFormat;-
478 return true;
never executed: return true;
0
479}-
480-
481static void convert_RGBA_to_ARGB(QImageData *dest, const QImageData *src, Qt::ImageConversionFlags)-
482{-
483 Q_ASSERT(src->format == QImage::Format_RGBX8888 || src->format == QImage::Format_RGBA8888 || src->format == QImage::Format_RGBA8888_Premultiplied);-
484 Q_ASSERT(dest->format == QImage::Format_ARGB32 || dest->format == QImage::Format_ARGB32_Premultiplied);-
485 Q_ASSERT(src->width == dest->width);-
486 Q_ASSERT(src->height == dest->height);-
487-
488 const int src_pad = (src->bytes_per_line >> 2) - src->width;-
489 const int dest_pad = (dest->bytes_per_line >> 2) - dest->width;-
490 const quint32 *src_data = (quint32 *) src->data;-
491 quint32 *dest_data = (quint32 *) dest->data;-
492-
493 for (int i = 0; i < src->height; ++i) {
i < src->heightDescription
TRUEnever evaluated
FALSEnever evaluated
0
494 const quint32 *end = src_data + src->width;-
495 while (src_data < end) {
src_data < endDescription
TRUEnever evaluated
FALSEnever evaluated
0
496 *dest_data = RGBA2ARGB(*src_data);-
497 ++src_data;-
498 ++dest_data;-
499 }
never executed: end of block
0
500 src_data += src_pad;-
501 dest_data += dest_pad;-
502 }
never executed: end of block
0
503}
never executed: end of block
0
504-
505template<QImage::Format DestFormat>-
506static bool convert_RGBA_to_ARGB_inplace(QImageData *data, Qt::ImageConversionFlags)-
507{-
508 Q_ASSERT(data->format == QImage::Format_RGBX8888 || data->format == QImage::Format_RGBA8888 || data->format == QImage::Format_RGBA8888_Premultiplied);-
509-
510 const int pad = (data->bytes_per_line >> 2) - data->width;-
511 QRgb *rgb_data = (QRgb *) data->data;-
512 Q_CONSTEXPR uint mask = (DestFormat == QImage::Format_RGB32) ? 0xff000000 : 0;-
513-
514 for (int i = 0; i < data->height; ++i) {
i < data->heightDescription
TRUEnever evaluated
FALSEnever evaluated
0
515 const QRgb *end = rgb_data + data->width;-
516 while (rgb_data < end) {
rgb_data < endDescription
TRUEnever evaluated
FALSEnever evaluated
0
517 *rgb_data = mask | RGBA2ARGB(*rgb_data);-
518 ++rgb_data;-
519 }
never executed: end of block
0
520 rgb_data += pad;-
521 }
never executed: end of block
0
522 data->format = DestFormat;-
523 return true;
never executed: return true;
0
524}-
525-
526template<QtPixelOrder PixelOrder>-
527static void convert_RGB_to_RGB30(QImageData *dest, const QImageData *src, Qt::ImageConversionFlags)-
528{-
529-
530 Q_ASSERT(src->format == QImage::Format_RGB32 || src->format == QImage::Format_ARGB32);-
531 Q_ASSERT(dest->format == QImage::Format_BGR30 || dest->format == QImage::Format_RGB30);-
532 Q_ASSERT(src->width == dest->width);-
533 Q_ASSERT(src->height == dest->height);-
534-
535 const int src_pad = (src->bytes_per_line >> 2) - src->width;-
536 const int dest_pad = (dest->bytes_per_line >> 2) - dest->width;-
537 const quint32 *src_data = (quint32 *) src->data;-
538 quint32 *dest_data = (quint32 *) dest->data;-
539-
540 for (int i = 0; i < src->height; ++i) {
i < src->heightDescription
TRUEnever evaluated
FALSEnever evaluated
0
541 const quint32 *end = src_data + src->width;-
542 while (src_data < end) {
src_data < endDescription
TRUEnever evaluated
FALSEnever evaluated
0
543 *dest_data = qConvertRgb32ToRgb30<PixelOrder>(*src_data);-
544 ++src_data;-
545 ++dest_data;-
546 }
never executed: end of block
0
547 src_data += src_pad;-
548 dest_data += dest_pad;-
549 }
never executed: end of block
0
550}
never executed: end of block
0
551-
552template<QtPixelOrder PixelOrder>-
553static bool convert_RGB_to_RGB30_inplace(QImageData *data, Qt::ImageConversionFlags)-
554{-
555 Q_ASSERT(data->format == QImage::Format_RGB32 || data->format == QImage::Format_ARGB32);-
556-
557 const int pad = (data->bytes_per_line >> 2) - data->width;-
558 QRgb *rgb_data = (QRgb *) data->data;-
559-
560 for (int i = 0; i < data->height; ++i) {
i < data->heightDescription
TRUEnever evaluated
FALSEnever evaluated
0
561 const QRgb *end = rgb_data + data->width;-
562 while (rgb_data < end) {
rgb_data < endDescription
TRUEnever evaluated
FALSEnever evaluated
0
563 *rgb_data = qConvertRgb32ToRgb30<PixelOrder>(*rgb_data);-
564 ++rgb_data;-
565 }
never executed: end of block
0
566 rgb_data += pad;-
567 }
never executed: end of block
0
568-
569 data->format = (PixelOrder == PixelOrderRGB) ? QImage::Format_RGB30 : QImage::Format_BGR30;
(PixelOrder == PixelOrderRGB)Description
TRUEnever evaluated
FALSEnever evaluated
0
570 return true;
never executed: return true;
0
571}-
572-
573static inline uint qUnpremultiplyRgb30(uint rgb30)-
574{-
575 const uint a = rgb30 >> 30;-
576 switch (a) {-
577 case 0:
never executed: case 0:
0
578 return 0;
never executed: return 0;
0
579 case 1: {
never executed: case 1:
0
580 uint rgb = rgb30 & 0x3fffffff;-
581 rgb *= 3;-
582 return (a << 30) | rgb;
never executed: return (a << 30) | rgb;
0
583 }-
584 case 2: {
never executed: case 2:
0
585 uint rgb = rgb30 & 0x3fffffff;-
586 rgb += (rgb >> 1) & 0x5ff7fdff;-
587 return (a << 30) | rgb;
never executed: return (a << 30) | rgb;
0
588 }-
589 case 3:
never executed: case 3:
0
590 return rgb30;
never executed: return rgb30;
0
591 }-
592 Q_UNREACHABLE();-
593 return 0;
never executed: return 0;
0
594}-
595-
596template<bool rgbswap>-
597static void convert_A2RGB30_PM_to_RGB30(QImageData *dest, const QImageData *src, Qt::ImageConversionFlags)-
598{-
599 Q_ASSERT(src->format == QImage::Format_A2RGB30_Premultiplied || src->format == QImage::Format_A2BGR30_Premultiplied);-
600 Q_ASSERT(dest->format == QImage::Format_RGB30 || dest->format == QImage::Format_BGR30);-
601 Q_ASSERT(src->width == dest->width);-
602 Q_ASSERT(src->height == dest->height);-
603-
604 const int src_pad = (src->bytes_per_line >> 2) - src->width;-
605 const int dest_pad = (dest->bytes_per_line >> 2) - dest->width;-
606 const quint32 *src_data = (quint32 *) src->data;-
607 quint32 *dest_data = (quint32 *) dest->data;-
608-
609 for (int i = 0; i < src->height; ++i) {
i < src->heightDescription
TRUEnever evaluated
FALSEnever evaluated
0
610 const quint32 *end = src_data + src->width;-
611 while (src_data < end) {
src_data < endDescription
TRUEnever evaluated
FALSEnever evaluated
0
612 const uint p = 0xc0000000 | qUnpremultiplyRgb30(*src_data);-
613 *dest_data = (rgbswap) ? qRgbSwapRgb30(p) : p;
(rgbswap)Description
TRUEnever evaluated
FALSEnever evaluated
0
614 ++src_data;-
615 ++dest_data;-
616 }
never executed: end of block
0
617 src_data += src_pad;-
618 dest_data += dest_pad;-
619 }
never executed: end of block
0
620}
never executed: end of block
0
621-
622template<bool rgbswap>-
623static bool convert_A2RGB30_PM_to_RGB30_inplace(QImageData *data, Qt::ImageConversionFlags)-
624{-
625 Q_ASSERT(data->format == QImage::Format_A2RGB30_Premultiplied || data->format == QImage::Format_A2BGR30_Premultiplied);-
626-
627 const int pad = (data->bytes_per_line >> 2) - data->width;-
628 uint *rgb_data = (uint *) data->data;-
629-
630 for (int i = 0; i < data->height; ++i) {
i < data->heightDescription
TRUEnever evaluated
FALSEnever evaluated
0
631 const uint *end = rgb_data + data->width;-
632 while (rgb_data < end) {
rgb_data < endDescription
TRUEnever evaluated
FALSEnever evaluated
0
633 const uint p = 0xc0000000 | qUnpremultiplyRgb30(*rgb_data);-
634 *rgb_data = (rgbswap) ? qRgbSwapRgb30(p) : p;
(rgbswap)Description
TRUEnever evaluated
FALSEnever evaluated
0
635 ++rgb_data;-
636 }
never executed: end of block
0
637 rgb_data += pad;-
638 }
never executed: end of block
0
639-
640 if (data->format == QImage::Format_A2RGB30_Premultiplied)
data->format =..._PremultipliedDescription
TRUEnever evaluated
FALSEnever evaluated
0
641 data->format = (rgbswap) ? QImage::Format_BGR30 : QImage::Format_RGB30;
never executed: data->format = (rgbswap) ? QImage::Format_BGR30 : QImage::Format_RGB30;
(rgbswap)Description
TRUEnever evaluated
FALSEnever evaluated
0
642 else-
643 data->format = (rgbswap) ? QImage::Format_RGB30 : QImage::Format_BGR30;
never executed: data->format = (rgbswap) ? QImage::Format_RGB30 : QImage::Format_BGR30;
(rgbswap)Description
TRUEnever evaluated
FALSEnever evaluated
0
644 return true;
never executed: return true;
0
645}-
646-
647static void convert_BGR30_to_RGB30(QImageData *dest, const QImageData *src, Qt::ImageConversionFlags)-
648{-
649 Q_ASSERT(src->format == QImage::Format_RGB30 || src->format == QImage::Format_BGR30 ||-
650 src->format == QImage::Format_A2RGB30_Premultiplied || src->format == QImage::Format_A2BGR30_Premultiplied);-
651 Q_ASSERT(dest->format == QImage::Format_RGB30 || dest->format == QImage::Format_BGR30 ||-
652 dest->format == QImage::Format_A2RGB30_Premultiplied || dest->format == QImage::Format_A2BGR30_Premultiplied);-
653 Q_ASSERT(src->width == dest->width);-
654 Q_ASSERT(src->height == dest->height);-
655-
656 const int src_pad = (src->bytes_per_line >> 2) - src->width;-
657 const int dest_pad = (dest->bytes_per_line >> 2) - dest->width;-
658 const quint32 *src_data = (quint32 *) src->data;-
659 quint32 *dest_data = (quint32 *) dest->data;-
660-
661 for (int i = 0; i < src->height; ++i) {
i < src->heightDescription
TRUEnever evaluated
FALSEnever evaluated
0
662 const quint32 *end = src_data + src->width;-
663 while (src_data < end) {
src_data < endDescription
TRUEnever evaluated
FALSEnever evaluated
0
664 *dest_data = qRgbSwapRgb30(*src_data);-
665 ++src_data;-
666 ++dest_data;-
667 }
never executed: end of block
0
668 src_data += src_pad;-
669 dest_data += dest_pad;-
670 }
never executed: end of block
0
671}
never executed: end of block
0
672-
673static bool convert_BGR30_to_RGB30_inplace(QImageData *data, Qt::ImageConversionFlags)-
674{-
675 Q_ASSERT(data->format == QImage::Format_RGB30 || data->format == QImage::Format_BGR30 ||-
676 data->format == QImage::Format_A2RGB30_Premultiplied || data->format == QImage::Format_A2BGR30_Premultiplied);-
677-
678 const int pad = (data->bytes_per_line >> 2) - data->width;-
679 uint *rgb_data = (uint *) data->data;-
680-
681 for (int i = 0; i < data->height; ++i) {
i < data->heightDescription
TRUEnever evaluated
FALSEnever evaluated
0
682 const uint *end = rgb_data + data->width;-
683 while (rgb_data < end) {
rgb_data < endDescription
TRUEnever evaluated
FALSEnever evaluated
0
684 *rgb_data = qRgbSwapRgb30(*rgb_data);-
685 ++rgb_data;-
686 }
never executed: end of block
0
687 rgb_data += pad;-
688 }
never executed: end of block
0
689-
690 switch (data->format) {-
691 case QImage::Format_BGR30:
never executed: case QImage::Format_BGR30:
0
692 data->format = QImage::Format_RGB30;-
693 break;
never executed: break;
0
694 case QImage::Format_A2BGR30_Premultiplied:
never executed: case QImage::Format_A2BGR30_Premultiplied:
0
695 data->format = QImage::Format_A2RGB30_Premultiplied;-
696 break;
never executed: break;
0
697 case QImage::Format_RGB30:
never executed: case QImage::Format_RGB30:
0
698 data->format = QImage::Format_BGR30;-
699 break;
never executed: break;
0
700 case QImage::Format_A2RGB30_Premultiplied:
never executed: case QImage::Format_A2RGB30_Premultiplied:
0
701 data->format = QImage::Format_A2BGR30_Premultiplied;-
702 break;
never executed: break;
0
703 default:
never executed: default:
0
704 Q_UNREACHABLE();-
705 data->format = QImage::Format_Invalid;-
706 return false;
never executed: return false;
0
707 }-
708 return true;
never executed: return true;
0
709}-
710-
711static bool convert_BGR30_to_A2RGB30_inplace(QImageData *data, Qt::ImageConversionFlags flags)-
712{-
713 Q_ASSERT(data->format == QImage::Format_RGB30 || data->format == QImage::Format_BGR30);-
714 if (!convert_BGR30_to_RGB30_inplace(data, flags))
!convert_BGR30...e(data, flags)Description
TRUEnever evaluated
FALSEnever evaluated
0
715 return false;
never executed: return false;
0
716-
717 if (data->format == QImage::Format_RGB30)
data->format =...::Format_RGB30Description
TRUEnever evaluated
FALSEnever evaluated
0
718 data->format = QImage::Format_A2RGB30_Premultiplied;
never executed: data->format = QImage::Format_A2RGB30_Premultiplied;
0
719 else-
720 data->format = QImage::Format_A2BGR30_Premultiplied;
never executed: data->format = QImage::Format_A2BGR30_Premultiplied;
0
721 return true;
never executed: return true;
0
722}-
723-
724template<QtPixelOrder PixelOrder>-
725static void convert_A2RGB30_PM_to_ARGB(QImageData *dest, const QImageData *src, Qt::ImageConversionFlags)-
726{-
727 Q_ASSERT(src->format == QImage::Format_A2RGB30_Premultiplied || src->format == QImage::Format_A2BGR30_Premultiplied);-
728 Q_ASSERT(dest->format == QImage::Format_ARGB32);-
729 Q_ASSERT(src->width == dest->width);-
730 Q_ASSERT(src->height == dest->height);-
731-
732 const int src_pad = (src->bytes_per_line >> 2) - src->width;-
733 const int dest_pad = (dest->bytes_per_line >> 2) - dest->width;-
734 const quint32 *src_data = (quint32 *) src->data;-
735 quint32 *dest_data = (quint32 *) dest->data;-
736-
737 for (int i = 0; i < src->height; ++i) {
i < src->heightDescription
TRUEnever evaluated
FALSEnever evaluated
0
738 const quint32 *end = src_data + src->width;-
739 while (src_data < end) {
src_data < endDescription
TRUEnever evaluated
FALSEnever evaluated
0
740 *dest_data = qConvertA2rgb30ToArgb32<PixelOrder>(qUnpremultiplyRgb30(*src_data));-
741 ++src_data;-
742 ++dest_data;-
743 }
never executed: end of block
0
744 src_data += src_pad;-
745 dest_data += dest_pad;-
746 }
never executed: end of block
0
747}
never executed: end of block
0
748-
749template<QtPixelOrder PixelOrder>-
750static bool convert_A2RGB30_PM_to_ARGB_inplace(QImageData *data, Qt::ImageConversionFlags)-
751{-
752 Q_ASSERT(data->format == QImage::Format_A2RGB30_Premultiplied || data->format == QImage::Format_A2BGR30_Premultiplied);-
753-
754 const int pad = (data->bytes_per_line >> 2) - data->width;-
755 uint *rgb_data = (uint *) data->data;-
756-
757 for (int i = 0; i < data->height; ++i) {
i < data->heightDescription
TRUEnever evaluated
FALSEnever evaluated
0
758 const uint *end = rgb_data + data->width;-
759 while (rgb_data < end) {
rgb_data < endDescription
TRUEnever evaluated
FALSEnever evaluated
0
760 *rgb_data = qConvertA2rgb30ToArgb32<PixelOrder>(qUnpremultiplyRgb30(*rgb_data));-
761 ++rgb_data;-
762 }
never executed: end of block
0
763 rgb_data += pad;-
764 }
never executed: end of block
0
765 data->format = QImage::Format_ARGB32;-
766 return true;
never executed: return true;
0
767}-
768-
769static bool convert_indexed8_to_ARGB_PM_inplace(QImageData *data, Qt::ImageConversionFlags)-
770{-
771 Q_ASSERT(data->format == QImage::Format_Indexed8);-
772 Q_ASSERT(data->own_data);-
773-
774 const int depth = 32;-
775-
776 const int dst_bytes_per_line = ((data->width * depth + 31) >> 5) << 2;-
777 const int nbytes = dst_bytes_per_line * data->height;-
778 uchar *const newData = (uchar *)realloc(data->data, nbytes);-
779 if (!newData)
!newDataDescription
TRUEnever evaluated
FALSEnever evaluated
0
780 return false;
never executed: return false;
0
781-
782 data->data = newData;-
783-
784 // start converting from the end because the end image is bigger than the source-
785 uchar *src_data = newData + data->nbytes; // end of src-
786 quint32 *dest_data = (quint32 *) (newData + nbytes); // end of dest > end of src-
787 const int width = data->width;-
788 const int src_pad = data->bytes_per_line - width;-
789 const int dest_pad = (dst_bytes_per_line >> 2) - width;-
790 if (data->colortable.size() == 0) {
data->colortable.size() == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
791 data->colortable.resize(256);-
792 for (int i = 0; i < 256; ++i)
i < 256Description
TRUEnever evaluated
FALSEnever evaluated
0
793 data->colortable[i] = qRgb(i, i, i);
never executed: data->colortable[i] = qRgb(i, i, i);
0
794 } else {
never executed: end of block
0
795 for (int i = 0; i < data->colortable.size(); ++i)
i < data->colortable.size()Description
TRUEnever evaluated
FALSEnever evaluated
0
796 data->colortable[i] = qPremultiply(data->colortable.at(i));
never executed: data->colortable[i] = qPremultiply(data->colortable.at(i));
0
797-
798 // Fill the rest of the table in case src_data > colortable.size()-
799 const int oldSize = data->colortable.size();-
800 const QRgb lastColor = data->colortable.at(oldSize - 1);-
801 data->colortable.insert(oldSize, 256 - oldSize, lastColor);-
802 }
never executed: end of block
0
803-
804 for (int i = 0; i < data->height; ++i) {
i < data->heightDescription
TRUEnever evaluated
FALSEnever evaluated
0
805 src_data -= src_pad;-
806 dest_data -= dest_pad;-
807 for (int pixI = 0; pixI < width; ++pixI) {
pixI < widthDescription
TRUEnever evaluated
FALSEnever evaluated
0
808 --src_data;-
809 --dest_data;-
810 *dest_data = data->colortable.at(*src_data);-
811 }
never executed: end of block
0
812 }
never executed: end of block
0
813-
814 data->colortable = QVector<QRgb>();-
815 data->format = QImage::Format_ARGB32_Premultiplied;-
816 data->bytes_per_line = dst_bytes_per_line;-
817 data->depth = depth;-
818 data->nbytes = nbytes;-
819-
820 return true;
never executed: return true;
0
821}-
822-
823static bool convert_indexed8_to_ARGB_inplace(QImageData *data, Qt::ImageConversionFlags)-
824{-
825 Q_ASSERT(data->format == QImage::Format_Indexed8);-
826 Q_ASSERT(data->own_data);-
827-
828 const int depth = 32;-
829-
830 const int dst_bytes_per_line = ((data->width * depth + 31) >> 5) << 2;-
831 const int nbytes = dst_bytes_per_line * data->height;-
832 uchar *const newData = (uchar *)realloc(data->data, nbytes);-
833 if (!newData)
!newDataDescription
TRUEnever evaluated
FALSEnever evaluated
0
834 return false;
never executed: return false;
0
835-
836 data->data = newData;-
837-
838 // start converting from the end because the end image is bigger than the source-
839 uchar *src_data = newData + data->nbytes;-
840 quint32 *dest_data = (quint32 *) (newData + nbytes);-
841 const int width = data->width;-
842 const int src_pad = data->bytes_per_line - width;-
843 const int dest_pad = (dst_bytes_per_line >> 2) - width;-
844 if (data->colortable.size() == 0) {
data->colortable.size() == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
845 data->colortable.resize(256);-
846 for (int i = 0; i < 256; ++i)
i < 256Description
TRUEnever evaluated
FALSEnever evaluated
0
847 data->colortable[i] = qRgb(i, i, i);
never executed: data->colortable[i] = qRgb(i, i, i);
0
848 } else {
never executed: end of block
0
849 // Fill the rest of the table in case src_data > colortable.size()-
850 const int oldSize = data->colortable.size();-
851 const QRgb lastColor = data->colortable.at(oldSize - 1);-
852 data->colortable.insert(oldSize, 256 - oldSize, lastColor);-
853 }
never executed: end of block
0
854-
855 for (int i = 0; i < data->height; ++i) {
i < data->heightDescription
TRUEnever evaluated
FALSEnever evaluated
0
856 src_data -= src_pad;-
857 dest_data -= dest_pad;-
858 for (int pixI = 0; pixI < width; ++pixI) {
pixI < widthDescription
TRUEnever evaluated
FALSEnever evaluated
0
859 --src_data;-
860 --dest_data;-
861 *dest_data = (quint32) data->colortable.at(*src_data);-
862 }
never executed: end of block
0
863 }
never executed: end of block
0
864-
865 data->colortable = QVector<QRgb>();-
866 data->format = QImage::Format_ARGB32;-
867 data->bytes_per_line = dst_bytes_per_line;-
868 data->depth = depth;-
869 data->nbytes = nbytes;-
870-
871 return true;
never executed: return true;
0
872}-
873-
874static bool convert_indexed8_to_RGB_inplace(QImageData *data, Qt::ImageConversionFlags flags)-
875{-
876 Q_ASSERT(data->format == QImage::Format_Indexed8);-
877 Q_ASSERT(data->own_data);-
878-
879 if (data->has_alpha_clut) {
data->has_alpha_clutDescription
TRUEnever evaluated
FALSEnever evaluated
0
880 for (int i = 0; i < data->colortable.size(); ++i)
i < data->colortable.size()Description
TRUEnever evaluated
FALSEnever evaluated
0
881 data->colortable[i] |= 0xff000000;
never executed: data->colortable[i] |= 0xff000000;
0
882 }
never executed: end of block
0
883-
884 if (!convert_indexed8_to_ARGB_inplace(data, flags))
!convert_index...e(data, flags)Description
TRUEnever evaluated
FALSEnever evaluated
0
885 return false;
never executed: return false;
0
886-
887 data->format = QImage::Format_RGB32;-
888 return true;
never executed: return true;
0
889}-
890-
891static bool convert_indexed8_to_RGB16_inplace(QImageData *data, Qt::ImageConversionFlags)-
892{-
893 Q_ASSERT(data->format == QImage::Format_Indexed8);-
894 Q_ASSERT(data->own_data);-
895-
896 const int depth = 16;-
897-
898 const int dst_bytes_per_line = ((data->width * depth + 31) >> 5) << 2;-
899 const int nbytes = dst_bytes_per_line * data->height;-
900 uchar *const newData = (uchar *)realloc(data->data, nbytes);-
901 if (!newData)
!newDataDescription
TRUEnever evaluated
FALSEnever evaluated
0
902 return false;
never executed: return false;
0
903-
904 data->data = newData;-
905-
906 // start converting from the end because the end image is bigger than the source-
907 uchar *src_data = newData + data->nbytes;-
908 quint16 *dest_data = (quint16 *) (newData + nbytes);-
909 const int width = data->width;-
910 const int src_pad = data->bytes_per_line - width;-
911 const int dest_pad = (dst_bytes_per_line >> 1) - width;-
912-
913 quint16 colorTableRGB16[256];-
914 const int tableSize = data->colortable.size();-
915 if (tableSize == 0) {
tableSize == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
916 for (int i = 0; i < 256; ++i)
i < 256Description
TRUEnever evaluated
FALSEnever evaluated
0
917 colorTableRGB16[i] = qConvertRgb32To16(qRgb(i, i, i));
never executed: colorTableRGB16[i] = qConvertRgb32To16(qRgb(i, i, i));
0
918 } else {
never executed: end of block
0
919 // 1) convert the existing colors to RGB16-
920 for (int i = 0; i < tableSize; ++i)
i < tableSizeDescription
TRUEnever evaluated
FALSEnever evaluated
0
921 colorTableRGB16[i] = qConvertRgb32To16(data->colortable.at(i));
never executed: colorTableRGB16[i] = qConvertRgb32To16(data->colortable.at(i));
0
922 data->colortable = QVector<QRgb>();-
923-
924 // 2) fill the rest of the table in case src_data > colortable.size()-
925 const quint16 lastColor = colorTableRGB16[tableSize - 1];-
926 for (int i = tableSize; i < 256; ++i)
i < 256Description
TRUEnever evaluated
FALSEnever evaluated
0
927 colorTableRGB16[i] = lastColor;
never executed: colorTableRGB16[i] = lastColor;
0
928 }
never executed: end of block
0
929-
930 for (int i = 0; i < data->height; ++i) {
i < data->heightDescription
TRUEnever evaluated
FALSEnever evaluated
0
931 src_data -= src_pad;-
932 dest_data -= dest_pad;-
933 for (int pixI = 0; pixI < width; ++pixI) {
pixI < widthDescription
TRUEnever evaluated
FALSEnever evaluated
0
934 --src_data;-
935 --dest_data;-
936 *dest_data = colorTableRGB16[*src_data];-
937 }
never executed: end of block
0
938 }
never executed: end of block
0
939-
940 data->format = QImage::Format_RGB16;-
941 data->bytes_per_line = dst_bytes_per_line;-
942 data->depth = depth;-
943 data->nbytes = nbytes;-
944-
945 return true;
never executed: return true;
0
946}-
947-
948static bool convert_RGB_to_RGB16_inplace(QImageData *data, Qt::ImageConversionFlags)-
949{-
950 Q_ASSERT(data->format == QImage::Format_RGB32);-
951 Q_ASSERT(data->own_data);-
952-
953 const int depth = 16;-
954-
955 const int dst_bytes_per_line = ((data->width * depth + 31) >> 5) << 2;-
956 const int src_bytes_per_line = data->bytes_per_line;-
957 quint32 *src_data = (quint32 *) data->data;-
958 quint16 *dst_data = (quint16 *) data->data;-
959-
960 for (int i = 0; i < data->height; ++i) {
i < data->heightDescription
TRUEnever evaluated
FALSEnever evaluated
0
961 for (int j = 0; j < data->width; ++j)
j < data->widthDescription
TRUEnever evaluated
FALSEnever evaluated
0
962 dst_data[j] = qConvertRgb32To16(src_data[j]);
never executed: dst_data[j] = qConvertRgb32To16(src_data[j]);
0
963 src_data = (quint32 *) (((char*)src_data) + src_bytes_per_line);-
964 dst_data = (quint16 *) (((char*)dst_data) + dst_bytes_per_line);-
965 }
never executed: end of block
0
966 data->format = QImage::Format_RGB16;-
967 data->bytes_per_line = dst_bytes_per_line;-
968 data->depth = depth;-
969 data->nbytes = dst_bytes_per_line * data->height;-
970 uchar *const newData = (uchar *)realloc(data->data, data->nbytes);-
971 if (newData) {
newDataDescription
TRUEnever evaluated
FALSEnever evaluated
0
972 data->data = newData;-
973 return true;
never executed: return true;
0
974 } else {-
975 return false;
never executed: return false;
0
976 }-
977}-
978-
979static void convert_ARGB_PM_to_ARGB(QImageData *dest, const QImageData *src)-
980{-
981 Q_ASSERT(src->format == QImage::Format_ARGB32_Premultiplied || src->format == QImage::Format_RGBA8888_Premultiplied);-
982 Q_ASSERT(dest->format == QImage::Format_ARGB32 || dest->format == QImage::Format_RGBA8888);-
983 Q_ASSERT(src->width == dest->width);-
984 Q_ASSERT(src->height == dest->height);-
985-
986 const int src_pad = (src->bytes_per_line >> 2) - src->width;-
987 const int dest_pad = (dest->bytes_per_line >> 2) - dest->width;-
988 const QRgb *src_data = (QRgb *) src->data;-
989 QRgb *dest_data = (QRgb *) dest->data;-
990-
991 for (int i = 0; i < src->height; ++i) {
i < src->heightDescription
TRUEnever evaluated
FALSEnever evaluated
0
992 const QRgb *end = src_data + src->width;-
993 while (src_data < end) {
src_data < endDescription
TRUEnever evaluated
FALSEnever evaluated
0
994 *dest_data = qUnpremultiply(*src_data);-
995 ++src_data;-
996 ++dest_data;-
997 }
never executed: end of block
0
998 src_data += src_pad;-
999 dest_data += dest_pad;-
1000 }
never executed: end of block
0
1001}
never executed: end of block
0
1002-
1003static void convert_RGBA_to_RGB(QImageData *dest, const QImageData *src, Qt::ImageConversionFlags)-
1004{-
1005 Q_ASSERT(src->format == QImage::Format_RGBA8888 || src->format == QImage::Format_RGBX8888);-
1006 Q_ASSERT(dest->format == QImage::Format_RGB32);-
1007 Q_ASSERT(src->width == dest->width);-
1008 Q_ASSERT(src->height == dest->height);-
1009-
1010 const int src_pad = (src->bytes_per_line >> 2) - src->width;-
1011 const int dest_pad = (dest->bytes_per_line >> 2) - dest->width;-
1012 const uint *src_data = (const uint *)src->data;-
1013 uint *dest_data = (uint *)dest->data;-
1014-
1015 for (int i = 0; i < src->height; ++i) {
i < src->heightDescription
TRUEnever evaluated
FALSEnever evaluated
0
1016 const uint *end = src_data + src->width;-
1017 while (src_data < end) {
src_data < endDescription
TRUEnever evaluated
FALSEnever evaluated
0
1018 *dest_data = RGBA2ARGB(*src_data) | 0xff000000;-
1019 ++src_data;-
1020 ++dest_data;-
1021 }
never executed: end of block
0
1022 src_data += src_pad;-
1023 dest_data += dest_pad;-
1024 }
never executed: end of block
0
1025}
never executed: end of block
0
1026-
1027static void swap_bit_order(QImageData *dest, const QImageData *src, Qt::ImageConversionFlags)-
1028{-
1029 Q_ASSERT(src->format == QImage::Format_Mono || src->format == QImage::Format_MonoLSB);-
1030 Q_ASSERT(dest->format == QImage::Format_Mono || dest->format == QImage::Format_MonoLSB);-
1031 Q_ASSERT(src->width == dest->width);-
1032 Q_ASSERT(src->height == dest->height);-
1033 Q_ASSERT(src->nbytes == dest->nbytes);-
1034 Q_ASSERT(src->bytes_per_line == dest->bytes_per_line);-
1035-
1036 dest->colortable = src->colortable;-
1037-
1038 const uchar *src_data = src->data;-
1039 const uchar *end = src->data + src->nbytes;-
1040 uchar *dest_data = dest->data;-
1041 while (src_data < end) {
src_data < endDescription
TRUEnever evaluated
FALSEnever evaluated
0
1042 *dest_data = bitflip[*src_data];-
1043 ++src_data;-
1044 ++dest_data;-
1045 }
never executed: end of block
0
1046}
never executed: end of block
0
1047-
1048static void mask_alpha_converter(QImageData *dest, const QImageData *src, Qt::ImageConversionFlags)-
1049{-
1050 Q_ASSERT(src->width == dest->width);-
1051 Q_ASSERT(src->height == dest->height);-
1052-
1053 const int src_pad = (src->bytes_per_line >> 2) - src->width;-
1054 const int dest_pad = (dest->bytes_per_line >> 2) - dest->width;-
1055 const uint *src_data = (const uint *)src->data;-
1056 uint *dest_data = (uint *)dest->data;-
1057-
1058 for (int i = 0; i < src->height; ++i) {
i < src->heightDescription
TRUEnever evaluated
FALSEnever evaluated
0
1059 const uint *end = src_data + src->width;-
1060 while (src_data < end) {
src_data < endDescription
TRUEnever evaluated
FALSEnever evaluated
0
1061 *dest_data = *src_data | 0xff000000;-
1062 ++src_data;-
1063 ++dest_data;-
1064 }
never executed: end of block
0
1065 src_data += src_pad;-
1066 dest_data += dest_pad;-
1067 }
never executed: end of block
0
1068}
never executed: end of block
0
1069-
1070template<QImage::Format DestFormat>-
1071static bool mask_alpha_converter_inplace(QImageData *data, Qt::ImageConversionFlags)-
1072{-
1073 Q_ASSERT(data->format == QImage::Format_RGB32-
1074 || DestFormat == QImage::Format_RGB32-
1075 || DestFormat == QImage::Format_RGBX8888);-
1076 const int pad = (data->bytes_per_line >> 2) - data->width;-
1077 QRgb *rgb_data = (QRgb *) data->data;-
1078-
1079 for (int i = 0; i < data->height; ++i) {
i < data->heightDescription
TRUEnever evaluated
FALSEnever evaluated
0
1080 const QRgb *end = rgb_data + data->width;-
1081 while (rgb_data < end) {
rgb_data < endDescription
TRUEnever evaluated
FALSEnever evaluated
0
1082 *rgb_data = *rgb_data | 0xff000000;-
1083 ++rgb_data;-
1084 }
never executed: end of block
0
1085 rgb_data += pad;-
1086 }
never executed: end of block
0
1087 data->format = DestFormat;-
1088 return true;
never executed: return true;
0
1089}-
1090-
1091static void mask_alpha_converter_RGBx(QImageData *dest, const QImageData *src, Qt::ImageConversionFlags flags)-
1092{-
1093#if Q_BYTE_ORDER == Q_LITTLE_ENDIAN-
1094 return mask_alpha_converter(dest, src, flags);
never executed: return mask_alpha_converter(dest, src, flags);
0
1095#else-
1096 Q_UNUSED(flags);-
1097 Q_ASSERT(src->width == dest->width);-
1098 Q_ASSERT(src->height == dest->height);-
1099-
1100 const int src_pad = (src->bytes_per_line >> 2) - src->width;-
1101 const int dest_pad = (dest->bytes_per_line >> 2) - dest->width;-
1102 const uint *src_data = (const uint *)src->data;-
1103 uint *dest_data = (uint *)dest->data;-
1104-
1105 for (int i = 0; i < src->height; ++i) {-
1106 const uint *end = src_data + src->width;-
1107 while (src_data < end) {-
1108 *dest_data = *src_data | 0x000000ff;-
1109 ++src_data;-
1110 ++dest_data;-
1111 }-
1112 src_data += src_pad;-
1113 dest_data += dest_pad;-
1114 }-
1115#endif-
1116}-
1117-
1118static bool mask_alpha_converter_rgbx_inplace(QImageData *data, Qt::ImageConversionFlags flags)-
1119{-
1120#if Q_BYTE_ORDER == Q_LITTLE_ENDIAN-
1121 return mask_alpha_converter_inplace<QImage::Format_RGBX8888>(data, flags);
never executed: return mask_alpha_converter_inplace<QImage::Format_RGBX8888>(data, flags);
0
1122#else-
1123 Q_UNUSED(flags);-
1124-
1125 const int pad = (data->bytes_per_line >> 2) - data->width;-
1126 QRgb *rgb_data = (QRgb *) data->data;-
1127-
1128 for (int i = 0; i < data->height; ++i) {-
1129 const QRgb *end = rgb_data + data->width;-
1130 while (rgb_data < end) {-
1131 *rgb_data = *rgb_data | 0x000000fff;-
1132 ++rgb_data;-
1133 }-
1134 rgb_data += pad;-
1135 }-
1136 data->format = QImage::Format_RGBX8888;-
1137 return true;-
1138#endif-
1139}-
1140-
1141static QVector<QRgb> fix_color_table(const QVector<QRgb> &ctbl, QImage::Format format)-
1142{-
1143 QVector<QRgb> colorTable = ctbl;-
1144 if (format == QImage::Format_RGB32) {
format == QImage::Format_RGB32Description
TRUEnever evaluated
FALSEnever evaluated
0
1145 // check if the color table has alpha-
1146 for (int i = 0; i < colorTable.size(); ++i)
i < colorTable.size()Description
TRUEnever evaluated
FALSEnever evaluated
0
1147 if (qAlpha(colorTable.at(i) != 0xff))
qAlpha(colorTa...at(i) != 0xff)Description
TRUEnever evaluated
FALSEnever evaluated
0
1148 colorTable[i] = colorTable.at(i) | 0xff000000;
never executed: colorTable[i] = colorTable.at(i) | 0xff000000;
0
1149 } else if (format == QImage::Format_ARGB32_Premultiplied) {
never executed: end of block
format == QIma..._PremultipliedDescription
TRUEnever evaluated
FALSEnever evaluated
0
1150 // check if the color table has alpha-
1151 for (int i = 0; i < colorTable.size(); ++i)
i < colorTable.size()Description
TRUEnever evaluated
FALSEnever evaluated
0
1152 colorTable[i] = qPremultiply(colorTable.at(i));
never executed: colorTable[i] = qPremultiply(colorTable.at(i));
0
1153 }
never executed: end of block
0
1154 return colorTable;
never executed: return colorTable;
0
1155}-
1156-
1157//-
1158// dither_to_1: Uses selected dithering algorithm.-
1159//-
1160-
1161void dither_to_Mono(QImageData *dst, const QImageData *src,-
1162 Qt::ImageConversionFlags flags, bool fromalpha)-
1163{-
1164 Q_ASSERT(src->width == dst->width);-
1165 Q_ASSERT(src->height == dst->height);-
1166 Q_ASSERT(dst->format == QImage::Format_Mono || dst->format == QImage::Format_MonoLSB);-
1167-
1168 dst->colortable.clear();-
1169 dst->colortable.append(0xffffffff);-
1170 dst->colortable.append(0xff000000);-
1171-
1172 enum { Threshold, Ordered, Diffuse } dithermode;-
1173-
1174 if (fromalpha) {
fromalphaDescription
TRUEnever evaluated
FALSEnever evaluated
0
1175 if ((flags & Qt::AlphaDither_Mask) == Qt::DiffuseAlphaDither)
(flags & Qt::A...useAlphaDitherDescription
TRUEnever evaluated
FALSEnever evaluated
0
1176 dithermode = Diffuse;
never executed: dithermode = Diffuse;
0
1177 else if ((flags & Qt::AlphaDither_Mask) == Qt::OrderedAlphaDither)
(flags & Qt::A...redAlphaDitherDescription
TRUEnever evaluated
FALSEnever evaluated
0
1178 dithermode = Ordered;
never executed: dithermode = Ordered;
0
1179 else-
1180 dithermode = Threshold;
never executed: dithermode = Threshold;
0
1181 } else {-
1182 if ((flags & Qt::Dither_Mask) == Qt::ThresholdDither)
(flags & Qt::D...hresholdDitherDescription
TRUEnever evaluated
FALSEnever evaluated
0
1183 dithermode = Threshold;
never executed: dithermode = Threshold;
0
1184 else if ((flags & Qt::Dither_Mask) == Qt::OrderedDither)
(flags & Qt::D...:OrderedDitherDescription
TRUEnever evaluated
FALSEnever evaluated
0
1185 dithermode = Ordered;
never executed: dithermode = Ordered;
0
1186 else-
1187 dithermode = Diffuse;
never executed: dithermode = Diffuse;
0
1188 }-
1189-
1190 int w = src->width;-
1191 int h = src->height;-
1192 int d = src->depth;-
1193 uchar gray[256]; // gray map for 8 bit images-
1194 bool use_gray = (d == 8);-
1195 if (use_gray) { // make gray map
use_grayDescription
TRUEnever evaluated
FALSEnever evaluated
0
1196 if (fromalpha) {
fromalphaDescription
TRUEnever evaluated
FALSEnever evaluated
0
1197 // Alpha 0x00 -> 0 pixels (white)-
1198 // Alpha 0xFF -> 1 pixels (black)-
1199 for (int i = 0; i < src->colortable.size(); i++)
i < src->colortable.size()Description
TRUEnever evaluated
FALSEnever evaluated
0
1200 gray[i] = (255 - (src->colortable.at(i) >> 24));
never executed: gray[i] = (255 - (src->colortable.at(i) >> 24));
0
1201 } else {
never executed: end of block
0
1202 // Pixel 0x00 -> 1 pixels (black)-
1203 // Pixel 0xFF -> 0 pixels (white)-
1204 for (int i = 0; i < src->colortable.size(); i++)
i < src->colortable.size()Description
TRUEnever evaluated
FALSEnever evaluated
0
1205 gray[i] = qGray(src->colortable.at(i));
never executed: gray[i] = qGray(src->colortable.at(i));
0
1206 }
never executed: end of block
0
1207 }-
1208-
1209 uchar *dst_data = dst->data;-
1210 int dst_bpl = dst->bytes_per_line;-
1211 const uchar *src_data = src->data;-
1212 int src_bpl = src->bytes_per_line;-
1213-
1214 switch (dithermode) {-
1215 case Diffuse: {
never executed: case Diffuse:
0
1216 QScopedArrayPointer<int> lineBuffer(new int[w * 2]);-
1217 int *line1 = lineBuffer.data();-
1218 int *line2 = lineBuffer.data() + w;-
1219 int bmwidth = (w+7)/8;-
1220-
1221 int *b1, *b2;-
1222 int wbytes = w * (d/8);-
1223 const uchar *p = src->data;-
1224 const uchar *end = p + wbytes;-
1225 b2 = line2;-
1226 if (use_gray) { // 8 bit image
use_grayDescription
TRUEnever evaluated
FALSEnever evaluated
0
1227 while (p < end)
p < endDescription
TRUEnever evaluated
FALSEnever evaluated
0
1228 *b2++ = gray[*p++];
never executed: *b2++ = gray[*p++];
0
1229 } else { // 32 bit image
never executed: end of block
0
1230 if (fromalpha) {
fromalphaDescription
TRUEnever evaluated
FALSEnever evaluated
0
1231 while (p < end) {
p < endDescription
TRUEnever evaluated
FALSEnever evaluated
0
1232 *b2++ = 255 - (*(const uint*)p >> 24);-
1233 p += 4;-
1234 }
never executed: end of block
0
1235 } else {
never executed: end of block
0
1236 while (p < end) {
p < endDescription
TRUEnever evaluated
FALSEnever evaluated
0
1237 *b2++ = qGray(*(const uint*)p);-
1238 p += 4;-
1239 }
never executed: end of block
0
1240 }
never executed: end of block
0
1241 }-
1242 for (int y=0; y<h; y++) { // for each scan line...
y<hDescription
TRUEnever evaluated
FALSEnever evaluated
0
1243 int *tmp = line1; line1 = line2; line2 = tmp;-
1244 bool not_last_line = y < h - 1;-
1245 if (not_last_line) { // calc. grayvals for next line
not_last_lineDescription
TRUEnever evaluated
FALSEnever evaluated
0
1246 p = src->data + (y+1)*src->bytes_per_line;-
1247 end = p + wbytes;-
1248 b2 = line2;-
1249 if (use_gray) { // 8 bit image
use_grayDescription
TRUEnever evaluated
FALSEnever evaluated
0
1250 while (p < end)
p < endDescription
TRUEnever evaluated
FALSEnever evaluated
0
1251 *b2++ = gray[*p++];
never executed: *b2++ = gray[*p++];
0
1252 } else { // 24 bit image
never executed: end of block
0
1253 if (fromalpha) {
fromalphaDescription
TRUEnever evaluated
FALSEnever evaluated
0
1254 while (p < end) {
p < endDescription
TRUEnever evaluated
FALSEnever evaluated
0
1255 *b2++ = 255 - (*(const uint*)p >> 24);-
1256 p += 4;-
1257 }
never executed: end of block
0
1258 } else {
never executed: end of block
0
1259 while (p < end) {
p < endDescription
TRUEnever evaluated
FALSEnever evaluated
0
1260 *b2++ = qGray(*(const uint*)p);-
1261 p += 4;-
1262 }
never executed: end of block
0
1263 }
never executed: end of block
0
1264 }-
1265 }-
1266-
1267 int err;-
1268 uchar *p = dst->data + y*dst->bytes_per_line;-
1269 memset(p, 0, bmwidth);-
1270 b1 = line1;-
1271 b2 = line2;-
1272 int bit = 7;-
1273 for (int x=1; x<=w; x++) {
x<=wDescription
TRUEnever evaluated
FALSEnever evaluated
0
1274 if (*b1 < 128) { // black pixel
*b1 < 128Description
TRUEnever evaluated
FALSEnever evaluated
0
1275 err = *b1++;-
1276 *p |= 1 << bit;-
1277 } else { // white pixel
never executed: end of block
0
1278 err = *b1++ - 255;-
1279 }
never executed: end of block
0
1280 if (bit == 0) {
bit == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1281 p++;-
1282 bit = 7;-
1283 } else {
never executed: end of block
0
1284 bit--;-
1285 }
never executed: end of block
0
1286 if (x < w)
x < wDescription
TRUEnever evaluated
FALSEnever evaluated
0
1287 *b1 += (err*7)>>4; // spread error to right pixel
never executed: *b1 += (err*7)>>4;
0
1288 if (not_last_line) {
not_last_lineDescription
TRUEnever evaluated
FALSEnever evaluated
0
1289 b2[0] += (err*5)>>4; // pixel below-
1290 if (x > 1)
x > 1Description
TRUEnever evaluated
FALSEnever evaluated
0
1291 b2[-1] += (err*3)>>4; // pixel below left
never executed: b2[-1] += (err*3)>>4;
0
1292 if (x < w)
x < wDescription
TRUEnever evaluated
FALSEnever evaluated
0
1293 b2[1] += err>>4; // pixel below right
never executed: b2[1] += err>>4;
0
1294 }
never executed: end of block
0
1295 b2++;-
1296 }
never executed: end of block
0
1297 }
never executed: end of block
0
1298 } break;
never executed: break;
0
1299 case Ordered: {
never executed: case Ordered:
0
1300-
1301 memset(dst->data, 0, dst->nbytes);-
1302 if (d == 32) {
d == 32Description
TRUEnever evaluated
FALSEnever evaluated
0
1303 for (int i=0; i<h; i++) {
i<hDescription
TRUEnever evaluated
FALSEnever evaluated
0
1304 const uint *p = (const uint *)src_data;-
1305 const uint *end = p + w;-
1306 uchar *m = dst_data;-
1307 int bit = 7;-
1308 int j = 0;-
1309 if (fromalpha) {
fromalphaDescription
TRUEnever evaluated
FALSEnever evaluated
0
1310 while (p < end) {
p < endDescription
TRUEnever evaluated
FALSEnever evaluated
0
1311 if ((*p++ >> 24) >= qt_bayer_matrix[j++&15][i&15])
(*p++ >> 24) >...[j++&15][i&15]Description
TRUEnever evaluated
FALSEnever evaluated
0
1312 *m |= 1 << bit;
never executed: *m |= 1 << bit;
0
1313 if (bit == 0) {
bit == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1314 m++;-
1315 bit = 7;-
1316 } else {
never executed: end of block
0
1317 bit--;-
1318 }
never executed: end of block
0
1319 }-
1320 } else {
never executed: end of block
0
1321 while (p < end) {
p < endDescription
TRUEnever evaluated
FALSEnever evaluated
0
1322 if ((uint)qGray(*p++) < qt_bayer_matrix[j++&15][i&15])
(uint)qGray(*p...[j++&15][i&15]Description
TRUEnever evaluated
FALSEnever evaluated
0
1323 *m |= 1 << bit;
never executed: *m |= 1 << bit;
0
1324 if (bit == 0) {
bit == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1325 m++;-
1326 bit = 7;-
1327 } else {
never executed: end of block
0
1328 bit--;-
1329 }
never executed: end of block
0
1330 }-
1331 }
never executed: end of block
0
1332 dst_data += dst_bpl;-
1333 src_data += src_bpl;-
1334 }
never executed: end of block
0
1335 } else if (d == 8) {
never executed: end of block
d == 8Description
TRUEnever evaluated
FALSEnever evaluated
0
1336 for (int i=0; i<h; i++) {
i<hDescription
TRUEnever evaluated
FALSEnever evaluated
0
1337 const uchar *p = src_data;-
1338 const uchar *end = p + w;-
1339 uchar *m = dst_data;-
1340 int bit = 7;-
1341 int j = 0;-
1342 while (p < end) {
p < endDescription
TRUEnever evaluated
FALSEnever evaluated
0
1343 if ((uint)gray[*p++] < qt_bayer_matrix[j++&15][i&15])
(uint)gray[*p+...[j++&15][i&15]Description
TRUEnever evaluated
FALSEnever evaluated
0
1344 *m |= 1 << bit;
never executed: *m |= 1 << bit;
0
1345 if (bit == 0) {
bit == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1346 m++;-
1347 bit = 7;-
1348 } else {
never executed: end of block
0
1349 bit--;-
1350 }
never executed: end of block
0
1351 }-
1352 dst_data += dst_bpl;-
1353 src_data += src_bpl;-
1354 }
never executed: end of block
0
1355 }
never executed: end of block
0
1356 } break;
never executed: break;
0
1357 default: { // Threshold:
never executed: default:
0
1358 memset(dst->data, 0, dst->nbytes);-
1359 if (d == 32) {
d == 32Description
TRUEnever evaluated
FALSEnever evaluated
0
1360 for (int i=0; i<h; i++) {
i<hDescription
TRUEnever evaluated
FALSEnever evaluated
0
1361 const uint *p = (const uint *)src_data;-
1362 const uint *end = p + w;-
1363 uchar *m = dst_data;-
1364 int bit = 7;-
1365 if (fromalpha) {
fromalphaDescription
TRUEnever evaluated
FALSEnever evaluated
0
1366 while (p < end) {
p < endDescription
TRUEnever evaluated
FALSEnever evaluated
0
1367 if ((*p++ >> 24) >= 128)
(*p++ >> 24) >= 128Description
TRUEnever evaluated
FALSEnever evaluated
0
1368 *m |= 1 << bit; // Set mask "on"
never executed: *m |= 1 << bit;
0
1369 if (bit == 0) {
bit == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1370 m++;-
1371 bit = 7;-
1372 } else {
never executed: end of block
0
1373 bit--;-
1374 }
never executed: end of block
0
1375 }-
1376 } else {
never executed: end of block
0
1377 while (p < end) {
p < endDescription
TRUEnever evaluated
FALSEnever evaluated
0
1378 if (qGray(*p++) < 128)
qGray(*p++) < 128Description
TRUEnever evaluated
FALSEnever evaluated
0
1379 *m |= 1 << bit; // Set pixel "black"
never executed: *m |= 1 << bit;
0
1380 if (bit == 0) {
bit == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1381 m++;-
1382 bit = 7;-
1383 } else {
never executed: end of block
0
1384 bit--;-
1385 }
never executed: end of block
0
1386 }-
1387 }
never executed: end of block
0
1388 dst_data += dst_bpl;-
1389 src_data += src_bpl;-
1390 }
never executed: end of block
0
1391 } else
never executed: end of block
0
1392 if (d == 8) {
d == 8Description
TRUEnever evaluated
FALSEnever evaluated
0
1393 for (int i=0; i<h; i++) {
i<hDescription
TRUEnever evaluated
FALSEnever evaluated
0
1394 const uchar *p = src_data;-
1395 const uchar *end = p + w;-
1396 uchar *m = dst_data;-
1397 int bit = 7;-
1398 while (p < end) {
p < endDescription
TRUEnever evaluated
FALSEnever evaluated
0
1399 if (gray[*p++] < 128)
gray[*p++] < 128Description
TRUEnever evaluated
FALSEnever evaluated
0
1400 *m |= 1 << bit; // Set mask "on"/ pixel "black"
never executed: *m |= 1 << bit;
0
1401 if (bit == 0) {
bit == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1402 m++;-
1403 bit = 7;-
1404 } else {
never executed: end of block
0
1405 bit--;-
1406 }
never executed: end of block
0
1407 }-
1408 dst_data += dst_bpl;-
1409 src_data += src_bpl;-
1410 }
never executed: end of block
0
1411 }
never executed: end of block
0
1412 }-
1413 }
never executed: end of block
0
1414-
1415 if (dst->format == QImage::Format_MonoLSB) {
dst->format ==...Format_MonoLSBDescription
TRUEnever evaluated
FALSEnever evaluated
0
1416 // need to swap bit order-
1417 uchar *sl = dst->data;-
1418 int bpl = (dst->width + 7) * dst->depth / 8;-
1419 int pad = dst->bytes_per_line - bpl;-
1420 for (int y=0; y<dst->height; ++y) {
y<dst->heightDescription
TRUEnever evaluated
FALSEnever evaluated
0
1421 for (int x=0; x<bpl; ++x) {
x<bplDescription
TRUEnever evaluated
FALSEnever evaluated
0
1422 *sl = bitflip[*sl];-
1423 ++sl;-
1424 }
never executed: end of block
0
1425 sl += pad;-
1426 }
never executed: end of block
0
1427 }
never executed: end of block
0
1428}
never executed: end of block
0
1429-
1430static void convert_X_to_Mono(QImageData *dst, const QImageData *src, Qt::ImageConversionFlags flags)-
1431{-
1432 dither_to_Mono(dst, src, flags, false);-
1433}
never executed: end of block
0
1434-
1435static void convert_ARGB_PM_to_Mono(QImageData *dst, const QImageData *src, Qt::ImageConversionFlags flags)-
1436{-
1437 QScopedPointer<QImageData> tmp(QImageData::create(QSize(src->width, src->height), QImage::Format_ARGB32));-
1438 convert_ARGB_PM_to_ARGB(tmp.data(), src);-
1439 dither_to_Mono(dst, tmp.data(), flags, false);-
1440}
never executed: end of block
0
1441-
1442//-
1443// convert_32_to_8: Converts a 32 bits depth (true color) to an 8 bit-
1444// image with a colormap. If the 32 bit image has more than 256 colors,-
1445// we convert the red,green and blue bytes into a single byte encoded-
1446// as 6 shades of each of red, green and blue.-
1447//-
1448// if dithering is needed, only 1 color at most is available for alpha.-
1449//-
1450struct QRgbMap {-
1451 inline QRgbMap() : used(0) { }
never executed: end of block
0
1452 uchar pix;-
1453 uchar used;-
1454 QRgb rgb;-
1455};-
1456-
1457static void convert_RGB_to_Indexed8(QImageData *dst, const QImageData *src, Qt::ImageConversionFlags flags)-
1458{-
1459 Q_ASSERT(src->format == QImage::Format_RGB32 || src->format == QImage::Format_ARGB32);-
1460 Q_ASSERT(dst->format == QImage::Format_Indexed8);-
1461 Q_ASSERT(src->width == dst->width);-
1462 Q_ASSERT(src->height == dst->height);-
1463-
1464 bool do_quant = (flags & Qt::DitherMode_Mask) == Qt::PreferDither
(flags & Qt::D...::PreferDitherDescription
TRUEnever evaluated
FALSEnever evaluated
0
1465 || src->format == QImage::Format_ARGB32;
src->format ==...:Format_ARGB32Description
TRUEnever evaluated
FALSEnever evaluated
0
1466 uint alpha_mask = src->format == QImage::Format_RGB32 ? 0xff000000 : 0;
src->format ==...::Format_RGB32Description
TRUEnever evaluated
FALSEnever evaluated
0
1467-
1468 const int tablesize = 997; // prime-
1469 QRgbMap table[tablesize];-
1470 int pix=0;-
1471-
1472 if (!dst->colortable.isEmpty()) {
!dst->colortable.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
0
1473 QVector<QRgb> ctbl = dst->colortable;-
1474 dst->colortable.resize(256);-
1475 // Preload palette into table.-
1476 // Almost same code as pixel insertion below-
1477 for (int i = 0; i < dst->colortable.size(); ++i) {
i < dst->colortable.size()Description
TRUEnever evaluated
FALSEnever evaluated
0
1478 // Find in table...-
1479 QRgb p = ctbl.at(i) | alpha_mask;-
1480 int hash = p % tablesize;-
1481 for (;;) {-
1482 if (table[hash].used) {
table[hash].usedDescription
TRUEnever evaluated
FALSEnever evaluated
0
1483 if (table[hash].rgb == p) {
table[hash].rgb == pDescription
TRUEnever evaluated
FALSEnever evaluated
0
1484 // Found previous insertion - use it-
1485 break;
never executed: break;
0
1486 } else {-
1487 // Keep searching...-
1488 if (++hash == tablesize) hash = 0;
never executed: hash = 0;
++hash == tablesizeDescription
TRUEnever evaluated
FALSEnever evaluated
0
1489 }
never executed: end of block
0
1490 } else {-
1491 // Cannot be in table-
1492 Q_ASSERT (pix != 256); // too many colors-
1493 // Insert into table at this unused position-
1494 dst->colortable[pix] = p;-
1495 table[hash].pix = pix++;-
1496 table[hash].rgb = p;-
1497 table[hash].used = 1;-
1498 break;
never executed: break;
0
1499 }-
1500 }-
1501 }
never executed: end of block
0
1502 }
never executed: end of block
0
1503-
1504 if ((flags & Qt::DitherMode_Mask) != Qt::PreferDither) {
(flags & Qt::D...::PreferDitherDescription
TRUEnever evaluated
FALSEnever evaluated
0
1505 dst->colortable.resize(256);-
1506 const uchar *src_data = src->data;-
1507 uchar *dest_data = dst->data;-
1508 for (int y = 0; y < src->height; y++) { // check if <= 256 colors
y < src->heightDescription
TRUEnever evaluated
FALSEnever evaluated
0
1509 const QRgb *s = (const QRgb *)src_data;-
1510 uchar *b = dest_data;-
1511 for (int x = 0; x < src->width; ++x) {
x < src->widthDescription
TRUEnever evaluated
FALSEnever evaluated
0
1512 QRgb p = s[x] | alpha_mask;-
1513 int hash = p % tablesize;-
1514 for (;;) {-
1515 if (table[hash].used) {
table[hash].usedDescription
TRUEnever evaluated
FALSEnever evaluated
0
1516 if (table[hash].rgb == (p)) {
table[hash].rgb == (p)Description
TRUEnever evaluated
FALSEnever evaluated
0
1517 // Found previous insertion - use it-
1518 break;
never executed: break;
0
1519 } else {-
1520 // Keep searching...-
1521 if (++hash == tablesize) hash = 0;
never executed: hash = 0;
++hash == tablesizeDescription
TRUEnever evaluated
FALSEnever evaluated
0
1522 }
never executed: end of block
0
1523 } else {-
1524 // Cannot be in table-
1525 if (pix == 256) { // too many colors
pix == 256Description
TRUEnever evaluated
FALSEnever evaluated
0
1526 do_quant = true;-
1527 // Break right out-
1528 x = src->width;-
1529 y = src->height;-
1530 } else {
never executed: end of block
0
1531 // Insert into table at this unused position-
1532 dst->colortable[pix] = p;-
1533 table[hash].pix = pix++;-
1534 table[hash].rgb = p;-
1535 table[hash].used = 1;-
1536 }
never executed: end of block
0
1537 break;
never executed: break;
0
1538 }-
1539 }-
1540 *b++ = table[hash].pix; // May occur once incorrectly-
1541 }
never executed: end of block
0
1542 src_data += src->bytes_per_line;-
1543 dest_data += dst->bytes_per_line;-
1544 }
never executed: end of block
0
1545 }
never executed: end of block
0
1546 int numColors = do_quant ? 256 : pix;
do_quantDescription
TRUEnever evaluated
FALSEnever evaluated
0
1547-
1548 dst->colortable.resize(numColors);-
1549-
1550 if (do_quant) { // quantization needed
do_quantDescription
TRUEnever evaluated
FALSEnever evaluated
0
1551-
1552#define MAX_R 5-
1553#define MAX_G 5-
1554#define MAX_B 5-
1555#define INDEXOF(r,g,b) (((r)*(MAX_G+1)+(g))*(MAX_B+1)+(b))-
1556-
1557 for (int rc=0; rc<=MAX_R; rc++) // build 6x6x6 color cube
rc<=5Description
TRUEnever evaluated
FALSEnever evaluated
0
1558 for (int gc=0; gc<=MAX_G; gc++)
gc<=5Description
TRUEnever evaluated
FALSEnever evaluated
0
1559 for (int bc=0; bc<=MAX_B; bc++)
bc<=5Description
TRUEnever evaluated
FALSEnever evaluated
0
1560 dst->colortable[INDEXOF(rc,gc,bc)] = 0xff000000 | qRgb(rc*255/MAX_R, gc*255/MAX_G, bc*255/MAX_B);
never executed: dst->colortable[(((rc)*(5 +1)+(gc))*(5 +1)+(bc))] = 0xff000000 | qRgb(rc*255/5, gc*255/5, bc*255/5);
0
1561-
1562 const uchar *src_data = src->data;-
1563 uchar *dest_data = dst->data;-
1564 if ((flags & Qt::Dither_Mask) == Qt::ThresholdDither) {
(flags & Qt::D...hresholdDitherDescription
TRUEnever evaluated
FALSEnever evaluated
0
1565 for (int y = 0; y < src->height; y++) {
y < src->heightDescription
TRUEnever evaluated
FALSEnever evaluated
0
1566 const QRgb *p = (const QRgb *)src_data;-
1567 const QRgb *end = p + src->width;-
1568 uchar *b = dest_data;-
1569-
1570 while (p < end) {
p < endDescription
TRUEnever evaluated
FALSEnever evaluated
0
1571#define DITHER(p,m) ((uchar) ((p * (m) + 127) / 255))-
1572 *b++ =-
1573 INDEXOF(-
1574 DITHER(qRed(*p), MAX_R),-
1575 DITHER(qGreen(*p), MAX_G),-
1576 DITHER(qBlue(*p), MAX_B)-
1577 );-
1578#undef DITHER-
1579 p++;-
1580 }
never executed: end of block
0
1581 src_data += src->bytes_per_line;-
1582 dest_data += dst->bytes_per_line;-
1583 }
never executed: end of block
0
1584 } else if ((flags & Qt::Dither_Mask) == Qt::DiffuseDither) {
never executed: end of block
(flags & Qt::D...:DiffuseDitherDescription
TRUEnever evaluated
FALSEnever evaluated
0
1585 int* line1[3];-
1586 int* line2[3];-
1587 int* pv[3];-
1588 QScopedArrayPointer<int> lineBuffer(new int[src->width * 9]);-
1589 line1[0] = lineBuffer.data();-
1590 line2[0] = lineBuffer.data() + src->width;-
1591 line1[1] = lineBuffer.data() + src->width * 2;-
1592 line2[1] = lineBuffer.data() + src->width * 3;-
1593 line1[2] = lineBuffer.data() + src->width * 4;-
1594 line2[2] = lineBuffer.data() + src->width * 5;-
1595 pv[0] = lineBuffer.data() + src->width * 6;-
1596 pv[1] = lineBuffer.data() + src->width * 7;-
1597 pv[2] = lineBuffer.data() + src->width * 8;-
1598-
1599 int endian = (QSysInfo::ByteOrder == QSysInfo::BigEndian);-
1600 for (int y = 0; y < src->height; y++) {
y < src->heightDescription
TRUEnever evaluated
FALSEnever evaluated
0
1601 const uchar* q = src_data;-
1602 const uchar* q2 = y < src->height - 1 ? q + src->bytes_per_line : src->data;
y < src->height - 1Description
TRUEnever evaluated
FALSEnever evaluated
0
1603 uchar *b = dest_data;-
1604 for (int chan = 0; chan < 3; chan++) {
chan < 3Description
TRUEnever evaluated
FALSEnever evaluated
0
1605 int *l1 = (y&1) ? line2[chan] : line1[chan];
(y&1)Description
TRUEnever evaluated
FALSEnever evaluated
0
1606 int *l2 = (y&1) ? line1[chan] : line2[chan];
(y&1)Description
TRUEnever evaluated
FALSEnever evaluated
0
1607 if (y == 0) {
y == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1608 for (int i = 0; i < src->width; i++)
i < src->widthDescription
TRUEnever evaluated
FALSEnever evaluated
0
1609 l1[i] = q[i*4+chan+endian];
never executed: l1[i] = q[i*4+chan+endian];
0
1610 }
never executed: end of block
0
1611 if (y+1 < src->height) {
y+1 < src->heightDescription
TRUEnever evaluated
FALSEnever evaluated
0
1612 for (int i = 0; i < src->width; i++)
i < src->widthDescription
TRUEnever evaluated
FALSEnever evaluated
0
1613 l2[i] = q2[i*4+chan+endian];
never executed: l2[i] = q2[i*4+chan+endian];
0
1614 }
never executed: end of block
0
1615 // Bi-directional error diffusion-
1616 if (y&1) {
y&1Description
TRUEnever evaluated
FALSEnever evaluated
0
1617 for (int x = 0; x < src->width; x++) {
x < src->widthDescription
TRUEnever evaluated
FALSEnever evaluated
0
1618 int pix = qMax(qMin(5, (l1[x] * 5 + 128)/ 255), 0);-
1619 int err = l1[x] - pix * 255 / 5;-
1620 pv[chan][x] = pix;-
1621-
1622 // Spread the error around...-
1623 if (x + 1< src->width) {
x + 1< src->widthDescription
TRUEnever evaluated
FALSEnever evaluated
0
1624 l1[x+1] += (err*7)>>4;-
1625 l2[x+1] += err>>4;-
1626 }
never executed: end of block
0
1627 l2[x]+=(err*5)>>4;-
1628 if (x>1)
x>1Description
TRUEnever evaluated
FALSEnever evaluated
0
1629 l2[x-1]+=(err*3)>>4;
never executed: l2[x-1]+=(err*3)>>4;
0
1630 }
never executed: end of block
0
1631 } else {
never executed: end of block
0
1632 for (int x = src->width; x-- > 0;) {
x-- > 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1633 int pix = qMax(qMin(5, (l1[x] * 5 + 128)/ 255), 0);-
1634 int err = l1[x] - pix * 255 / 5;-
1635 pv[chan][x] = pix;-
1636-
1637 // Spread the error around...-
1638 if (x > 0) {
x > 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1639 l1[x-1] += (err*7)>>4;-
1640 l2[x-1] += err>>4;-
1641 }
never executed: end of block
0
1642 l2[x]+=(err*5)>>4;-
1643 if (x + 1 < src->width)
x + 1 < src->widthDescription
TRUEnever evaluated
FALSEnever evaluated
0
1644 l2[x+1]+=(err*3)>>4;
never executed: l2[x+1]+=(err*3)>>4;
0
1645 }
never executed: end of block
0
1646 }
never executed: end of block
0
1647 }-
1648 if (endian) {
endianDescription
TRUEnever evaluated
FALSEnever evaluated
0
1649 for (int x = 0; x < src->width; x++) {
x < src->widthDescription
TRUEnever evaluated
FALSEnever evaluated
0
1650 *b++ = INDEXOF(pv[0][x],pv[1][x],pv[2][x]);-
1651 }
never executed: end of block
0
1652 } else {
never executed: end of block
0
1653 for (int x = 0; x < src->width; x++) {
x < src->widthDescription
TRUEnever evaluated
FALSEnever evaluated
0
1654 *b++ = INDEXOF(pv[2][x],pv[1][x],pv[0][x]);-
1655 }
never executed: end of block
0
1656 }
never executed: end of block
0
1657 src_data += src->bytes_per_line;-
1658 dest_data += dst->bytes_per_line;-
1659 }
never executed: end of block
0
1660 } else { // OrderedDither
never executed: end of block
0
1661 for (int y = 0; y < src->height; y++) {
y < src->heightDescription
TRUEnever evaluated
FALSEnever evaluated
0
1662 const QRgb *p = (const QRgb *)src_data;-
1663 const QRgb *end = p + src->width;-
1664 uchar *b = dest_data;-
1665-
1666 int x = 0;-
1667 while (p < end) {
p < endDescription
TRUEnever evaluated
FALSEnever evaluated
0
1668 uint d = qt_bayer_matrix[y & 15][x & 15] << 8;-
1669-
1670#define DITHER(p, d, m) ((uchar) ((((256 * (m) + (m) + 1)) * (p) + (d)) >> 16))-
1671 *b++ =-
1672 INDEXOF(-
1673 DITHER(qRed(*p), d, MAX_R),-
1674 DITHER(qGreen(*p), d, MAX_G),-
1675 DITHER(qBlue(*p), d, MAX_B)-
1676 );-
1677#undef DITHER-
1678-
1679 p++;-
1680 x++;-
1681 }
never executed: end of block
0
1682 src_data += src->bytes_per_line;-
1683 dest_data += dst->bytes_per_line;-
1684 }
never executed: end of block
0
1685 }
never executed: end of block
0
1686-
1687 if (src->format != QImage::Format_RGB32
src->format !=...::Format_RGB32Description
TRUEnever evaluated
FALSEnever evaluated
0
1688 && src->format != QImage::Format_RGB16) {
src->format !=...::Format_RGB16Description
TRUEnever evaluated
FALSEnever evaluated
0
1689 const int trans = 216;-
1690 Q_ASSERT(dst->colortable.size() > trans);-
1691 dst->colortable[trans] = 0;-
1692 QScopedPointer<QImageData> mask(QImageData::create(QSize(src->width, src->height), QImage::Format_Mono));-
1693 dither_to_Mono(mask.data(), src, flags, true);-
1694 uchar *dst_data = dst->data;-
1695 const uchar *mask_data = mask->data;-
1696 for (int y = 0; y < src->height; y++) {
y < src->heightDescription
TRUEnever evaluated
FALSEnever evaluated
0
1697 for (int x = 0; x < src->width ; x++) {
x < src->widthDescription
TRUEnever evaluated
FALSEnever evaluated
0
1698 if (!(mask_data[x>>3] & (0x80 >> (x & 7))))
!(mask_data[x>...0 >> (x & 7)))Description
TRUEnever evaluated
FALSEnever evaluated
0
1699 dst_data[x] = trans;
never executed: dst_data[x] = trans;
0
1700 }
never executed: end of block
0
1701 mask_data += mask->bytes_per_line;-
1702 dst_data += dst->bytes_per_line;-
1703 }
never executed: end of block
0
1704 dst->has_alpha_clut = true;-
1705 }
never executed: end of block
0
1706-
1707#undef MAX_R-
1708#undef MAX_G-
1709#undef MAX_B-
1710#undef INDEXOF-
1711-
1712 }
never executed: end of block
0
1713}
never executed: end of block
0
1714-
1715static void convert_ARGB_PM_to_Indexed8(QImageData *dst, const QImageData *src, Qt::ImageConversionFlags flags)-
1716{-
1717 QScopedPointer<QImageData> tmp(QImageData::create(QSize(src->width, src->height), QImage::Format_ARGB32));-
1718 convert_ARGB_PM_to_ARGB(tmp.data(), src);-
1719 convert_RGB_to_Indexed8(dst, tmp.data(), flags);-
1720}
never executed: end of block
0
1721-
1722static void convert_ARGB_to_Indexed8(QImageData *dst, const QImageData *src, Qt::ImageConversionFlags flags)-
1723{-
1724 convert_RGB_to_Indexed8(dst, src, flags);-
1725}
never executed: end of block
0
1726-
1727static void convert_Indexed8_to_X32(QImageData *dest, const QImageData *src, Qt::ImageConversionFlags)-
1728{-
1729 Q_ASSERT(src->format == QImage::Format_Indexed8);-
1730 Q_ASSERT(dest->format == QImage::Format_RGB32-
1731 || dest->format == QImage::Format_ARGB32-
1732 || dest->format == QImage::Format_ARGB32_Premultiplied);-
1733 Q_ASSERT(src->width == dest->width);-
1734 Q_ASSERT(src->height == dest->height);-
1735-
1736 QVector<QRgb> colorTable = src->has_alpha_clut ? fix_color_table(src->colortable, dest->format) : src->colortable;
src->has_alpha_clutDescription
TRUEnever evaluated
FALSEnever evaluated
0
1737 if (colorTable.size() == 0) {
colorTable.size() == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1738 colorTable.resize(256);-
1739 for (int i=0; i<256; ++i)
i<256Description
TRUEnever evaluated
FALSEnever evaluated
0
1740 colorTable[i] = qRgb(i, i, i);
never executed: colorTable[i] = qRgb(i, i, i);
0
1741 }
never executed: end of block
0
1742 if (colorTable.size() < 256) {
colorTable.size() < 256Description
TRUEnever evaluated
FALSEnever evaluated
0
1743 int tableSize = colorTable.size();-
1744 colorTable.resize(256);-
1745 for (int i=tableSize; i<256; ++i)
i<256Description
TRUEnever evaluated
FALSEnever evaluated
0
1746 colorTable[i] = 0;
never executed: colorTable[i] = 0;
0
1747 }
never executed: end of block
0
1748-
1749 int w = src->width;-
1750 const uchar *src_data = src->data;-
1751 uchar *dest_data = dest->data;-
1752 const QRgb *colorTablePtr = colorTable.constData();-
1753 for (int y = 0; y < src->height; y++) {
y < src->heightDescription
TRUEnever evaluated
FALSEnever evaluated
0
1754 uint *p = reinterpret_cast<uint *>(dest_data);-
1755 const uchar *b = src_data;-
1756 uint *end = p + w;-
1757-
1758 while (p < end)
p < endDescription
TRUEnever evaluated
FALSEnever evaluated
0
1759 *p++ = colorTablePtr[*b++];
never executed: *p++ = colorTablePtr[*b++];
0
1760-
1761 src_data += src->bytes_per_line;-
1762 dest_data += dest->bytes_per_line;-
1763 }
never executed: end of block
0
1764}
never executed: end of block
0
1765-
1766static void convert_Mono_to_X32(QImageData *dest, const QImageData *src, Qt::ImageConversionFlags)-
1767{-
1768 Q_ASSERT(src->format == QImage::Format_Mono || src->format == QImage::Format_MonoLSB);-
1769 Q_ASSERT(dest->format == QImage::Format_RGB32-
1770 || dest->format == QImage::Format_ARGB32-
1771 || dest->format == QImage::Format_ARGB32_Premultiplied);-
1772 Q_ASSERT(src->width == dest->width);-
1773 Q_ASSERT(src->height == dest->height);-
1774-
1775 QVector<QRgb> colorTable = fix_color_table(src->colortable, dest->format);-
1776-
1777 // Default to black / white colors-
1778 if (colorTable.size() < 2) {
colorTable.size() < 2Description
TRUEnever evaluated
FALSEnever evaluated
0
1779 if (colorTable.size() == 0)
colorTable.size() == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1780 colorTable << 0xff000000;
never executed: colorTable << 0xff000000;
0
1781 colorTable << 0xffffffff;-
1782 }
never executed: end of block
0
1783-
1784 const uchar *src_data = src->data;-
1785 uchar *dest_data = dest->data;-
1786 if (src->format == QImage::Format_Mono) {
src->format ==...e::Format_MonoDescription
TRUEnever evaluated
FALSEnever evaluated
0
1787 for (int y = 0; y < dest->height; y++) {
y < dest->heightDescription
TRUEnever evaluated
FALSEnever evaluated
0
1788 uint *p = (uint *)dest_data;-
1789 for (int x = 0; x < dest->width; x++)
x < dest->widthDescription
TRUEnever evaluated
FALSEnever evaluated
0
1790 *p++ = colorTable.at((src_data[x>>3] >> (7 - (x & 7))) & 1);
never executed: *p++ = colorTable.at((src_data[x>>3] >> (7 - (x & 7))) & 1);
0
1791-
1792 src_data += src->bytes_per_line;-
1793 dest_data += dest->bytes_per_line;-
1794 }
never executed: end of block
0
1795 } else {
never executed: end of block
0
1796 for (int y = 0; y < dest->height; y++) {
y < dest->heightDescription
TRUEnever evaluated
FALSEnever evaluated
0
1797 uint *p = (uint *)dest_data;-
1798 for (int x = 0; x < dest->width; x++)
x < dest->widthDescription
TRUEnever evaluated
FALSEnever evaluated
0
1799 *p++ = colorTable.at((src_data[x>>3] >> (x & 7)) & 1);
never executed: *p++ = colorTable.at((src_data[x>>3] >> (x & 7)) & 1);
0
1800-
1801 src_data += src->bytes_per_line;-
1802 dest_data += dest->bytes_per_line;-
1803 }
never executed: end of block
0
1804 }
never executed: end of block
0
1805}-
1806-
1807-
1808static void convert_Mono_to_Indexed8(QImageData *dest, const QImageData *src, Qt::ImageConversionFlags)-
1809{-
1810 Q_ASSERT(src->format == QImage::Format_Mono || src->format == QImage::Format_MonoLSB);-
1811 Q_ASSERT(dest->format == QImage::Format_Indexed8);-
1812 Q_ASSERT(src->width == dest->width);-
1813 Q_ASSERT(src->height == dest->height);-
1814-
1815 QVector<QRgb> ctbl = src->colortable;-
1816 if (ctbl.size() > 2) {
ctbl.size() > 2Description
TRUEnever evaluated
FALSEnever evaluated
0
1817 ctbl.resize(2);-
1818 } else if (ctbl.size() < 2) {
never executed: end of block
ctbl.size() < 2Description
TRUEnever evaluated
FALSEnever evaluated
0
1819 if (ctbl.size() == 0)
ctbl.size() == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1820 ctbl << 0xff000000;
never executed: ctbl << 0xff000000;
0
1821 ctbl << 0xffffffff;-
1822 }
never executed: end of block
0
1823 dest->colortable = ctbl;-
1824 dest->has_alpha_clut = src->has_alpha_clut;-
1825-
1826-
1827 const uchar *src_data = src->data;-
1828 uchar *dest_data = dest->data;-
1829 if (src->format == QImage::Format_Mono) {
src->format ==...e::Format_MonoDescription
TRUEnever evaluated
FALSEnever evaluated
0
1830 for (int y = 0; y < dest->height; y++) {
y < dest->heightDescription
TRUEnever evaluated
FALSEnever evaluated
0
1831 uchar *p = dest_data;-
1832 for (int x = 0; x < dest->width; x++)
x < dest->widthDescription
TRUEnever evaluated
FALSEnever evaluated
0
1833 *p++ = (src_data[x>>3] >> (7 - (x & 7))) & 1;
never executed: *p++ = (src_data[x>>3] >> (7 - (x & 7))) & 1;
0
1834 src_data += src->bytes_per_line;-
1835 dest_data += dest->bytes_per_line;-
1836 }
never executed: end of block
0
1837 } else {
never executed: end of block
0
1838 for (int y = 0; y < dest->height; y++) {
y < dest->heightDescription
TRUEnever evaluated
FALSEnever evaluated
0
1839 uchar *p = dest_data;-
1840 for (int x = 0; x < dest->width; x++)
x < dest->widthDescription
TRUEnever evaluated
FALSEnever evaluated
0
1841 *p++ = (src_data[x>>3] >> (x & 7)) & 1;
never executed: *p++ = (src_data[x>>3] >> (x & 7)) & 1;
0
1842 src_data += src->bytes_per_line;-
1843 dest_data += dest->bytes_per_line;-
1844 }
never executed: end of block
0
1845 }
never executed: end of block
0
1846}-
1847-
1848static void convert_Indexed8_to_Alpha8(QImageData *dest, const QImageData *src, Qt::ImageConversionFlags)-
1849{-
1850 Q_ASSERT(src->format == QImage::Format_Indexed8);-
1851 Q_ASSERT(dest->format == QImage::Format_Alpha8);-
1852-
1853 uchar translate[256];-
1854 const QVector<QRgb> &colors = src->colortable;-
1855 bool simpleCase = (colors.size() == 256);-
1856 for (int i = 0; i < colors.size(); ++i) {
i < colors.size()Description
TRUEnever evaluated
FALSEnever evaluated
0
1857 uchar alpha = qAlpha(colors[i]);-
1858 translate[i] = alpha;-
1859 simpleCase = simpleCase && (alpha == i);
simpleCaseDescription
TRUEnever evaluated
FALSEnever evaluated
(alpha == i)Description
TRUEnever evaluated
FALSEnever evaluated
0
1860 }
never executed: end of block
0
1861-
1862 if (simpleCase)
simpleCaseDescription
TRUEnever evaluated
FALSEnever evaluated
0
1863 memcpy(dest->data, src->data, src->bytes_per_line * src->height);
never executed: memcpy(dest->data, src->data, src->bytes_per_line * src->height);
0
1864 else {-
1865 int size = src->bytes_per_line * src->height;-
1866 for (int i = 0; i < size; ++i) {
i < sizeDescription
TRUEnever evaluated
FALSEnever evaluated
0
1867 dest->data[i] = translate[src->data[i]];-
1868 }
never executed: end of block
0
1869 }
never executed: end of block
0
1870}-
1871-
1872static void convert_Indexed8_to_Grayscale8(QImageData *dest, const QImageData *src, Qt::ImageConversionFlags)-
1873{-
1874 Q_ASSERT(src->format == QImage::Format_Indexed8);-
1875 Q_ASSERT(dest->format == QImage::Format_Grayscale8);-
1876-
1877 uchar translate[256];-
1878 const QVector<QRgb> &colors = src->colortable;-
1879 bool simpleCase = (colors.size() == 256);-
1880 for (int i = 0; i < colors.size(); ++i) {
i < colors.size()Description
TRUEnever evaluated
FALSEnever evaluated
0
1881 uchar gray = qGray(colors[i]);-
1882 translate[i] = gray;-
1883 simpleCase = simpleCase && (gray == i);
simpleCaseDescription
TRUEnever evaluated
FALSEnever evaluated
(gray == i)Description
TRUEnever evaluated
FALSEnever evaluated
0
1884 }
never executed: end of block
0
1885-
1886 if (simpleCase)
simpleCaseDescription
TRUEnever evaluated
FALSEnever evaluated
0
1887 memcpy(dest->data, src->data, src->bytes_per_line * src->height);
never executed: memcpy(dest->data, src->data, src->bytes_per_line * src->height);
0
1888 else {-
1889 int size = src->bytes_per_line * src->height;-
1890 for (int i = 0; i < size; ++i) {
i < sizeDescription
TRUEnever evaluated
FALSEnever evaluated
0
1891 dest->data[i] = translate[src->data[i]];-
1892 }
never executed: end of block
0
1893 }
never executed: end of block
0
1894}-
1895-
1896static bool convert_Indexed8_to_Alpha8_inplace(QImageData *data, Qt::ImageConversionFlags)-
1897{-
1898 Q_ASSERT(data->format == QImage::Format_Indexed8);-
1899-
1900 // Just check if this is an Alpha8 in Indexed8 disguise.-
1901 const QVector<QRgb> &colors = data->colortable;-
1902 if (colors.size() != 256)
colors.size() != 256Description
TRUEnever evaluated
FALSEnever evaluated
0
1903 return false;
never executed: return false;
0
1904 for (int i = 0; i < colors.size(); ++i) {
i < colors.size()Description
TRUEnever evaluated
FALSEnever evaluated
0
1905 if (i != qAlpha(colors[i]))
i != qAlpha(colors[i])Description
TRUEnever evaluated
FALSEnever evaluated
0
1906 return false;
never executed: return false;
0
1907 }
never executed: end of block
0
1908-
1909 data->colortable.clear();-
1910 data->format = QImage::Format_Alpha8;-
1911-
1912 return true;
never executed: return true;
0
1913}-
1914-
1915static bool convert_Indexed8_to_Grayscale8_inplace(QImageData *data, Qt::ImageConversionFlags)-
1916{-
1917 Q_ASSERT(data->format == QImage::Format_Indexed8);-
1918-
1919 // Just check if this is a Grayscale8 in Indexed8 disguise.-
1920 const QVector<QRgb> &colors = data->colortable;-
1921 if (colors.size() != 256)
colors.size() != 256Description
TRUEnever evaluated
FALSEnever evaluated
0
1922 return false;
never executed: return false;
0
1923 for (int i = 0; i < colors.size(); ++i) {
i < colors.size()Description
TRUEnever evaluated
FALSEnever evaluated
0
1924 if (i != qGray(colors[i]))
i != qGray(colors[i])Description
TRUEnever evaluated
FALSEnever evaluated
0
1925 return false;
never executed: return false;
0
1926 }
never executed: end of block
0
1927-
1928 data->colortable.clear();-
1929 data->format = QImage::Format_Grayscale8;-
1930-
1931 return true;
never executed: return true;
0
1932}-
1933-
1934static void convert_Alpha8_to_Indexed8(QImageData *dest, const QImageData *src, Qt::ImageConversionFlags)-
1935{-
1936 Q_ASSERT(src->format == QImage::Format_Alpha8);-
1937 Q_ASSERT(dest->format == QImage::Format_Indexed8);-
1938-
1939 memcpy(dest->data, src->data, src->bytes_per_line * src->height);-
1940-
1941 QVector<QRgb> colors(256);-
1942 for (int i=0; i<256; ++i)
i<256Description
TRUEnever evaluated
FALSEnever evaluated
0
1943 colors[i] = qRgba(0, 0, 0, i);
never executed: colors[i] = qRgba(0, 0, 0, i);
0
1944-
1945 dest->colortable = colors;-
1946}
never executed: end of block
0
1947-
1948static void convert_Grayscale8_to_Indexed8(QImageData *dest, const QImageData *src, Qt::ImageConversionFlags)-
1949{-
1950 Q_ASSERT(src->format == QImage::Format_Grayscale8);-
1951 Q_ASSERT(dest->format == QImage::Format_Indexed8);-
1952-
1953 memcpy(dest->data, src->data, src->bytes_per_line * src->height);-
1954-
1955 QVector<QRgb> colors(256);-
1956 for (int i=0; i<256; ++i)
i<256Description
TRUEnever evaluated
FALSEnever evaluated
0
1957 colors[i] = qRgb(i, i, i);
never executed: colors[i] = qRgb(i, i, i);
0
1958-
1959 dest->colortable = colors;-
1960}
never executed: end of block
0
1961-
1962static bool convert_Alpha8_to_Indexed8_inplace(QImageData *data, Qt::ImageConversionFlags)-
1963{-
1964 Q_ASSERT(data->format == QImage::Format_Alpha8);-
1965-
1966 QVector<QRgb> colors(256);-
1967 for (int i=0; i<256; ++i)
i<256Description
TRUEnever evaluated
FALSEnever evaluated
0
1968 colors[i] = qRgba(0, 0, 0, i);
never executed: colors[i] = qRgba(0, 0, 0, i);
0
1969-
1970 data->colortable = colors;-
1971 data->format = QImage::Format_Indexed8;-
1972-
1973 return true;
never executed: return true;
0
1974}-
1975-
1976static bool convert_Grayscale8_to_Indexed8_inplace(QImageData *data, Qt::ImageConversionFlags)-
1977{-
1978 Q_ASSERT(data->format == QImage::Format_Grayscale8);-
1979-
1980 QVector<QRgb> colors(256);-
1981 for (int i=0; i<256; ++i)
i<256Description
TRUEnever evaluated
FALSEnever evaluated
0
1982 colors[i] = qRgb(i, i, i);
never executed: colors[i] = qRgb(i, i, i);
0
1983-
1984 data->colortable = colors;-
1985 data->format = QImage::Format_Indexed8;-
1986-
1987 return true;
never executed: return true;
0
1988}-
1989-
1990-
1991// first index source, second dest-
1992Image_Converter qimage_converter_map[QImage::NImageFormats][QImage::NImageFormats] =-
1993{-
1994 {-
1995 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0-
1996 },-
1997 {-
1998 0,-
1999 0,-
2000 swap_bit_order,-
2001 convert_Mono_to_Indexed8,-
2002 convert_Mono_to_X32,-
2003 convert_Mono_to_X32,-
2004 convert_Mono_to_X32,-
2005 0,-
2006 0,-
2007 0,-
2008 0,-
2009 0,-
2010 0,-
2011 0,-
2012 0,-
2013 0,-
2014 0,-
2015 0,-
2016 0, 0, 0, 0, 0, 0, 0-
2017 }, // Format_Mono-
2018-
2019 {-
2020 0,-
2021 swap_bit_order,-
2022 0,-
2023 convert_Mono_to_Indexed8,-
2024 convert_Mono_to_X32,-
2025 convert_Mono_to_X32,-
2026 convert_Mono_to_X32,-
2027 0,-
2028 0,-
2029 0,-
2030 0,-
2031 0,-
2032 0,-
2033 0,-
2034 0,-
2035 0,-
2036 0,-
2037 0,-
2038 0, 0, 0, 0, 0, 0, 0-
2039 }, // Format_MonoLSB-
2040-
2041 {-
2042 0,-
2043 convert_X_to_Mono,-
2044 convert_X_to_Mono,-
2045 0,-
2046 convert_Indexed8_to_X32,-
2047 convert_Indexed8_to_X32,-
2048 convert_Indexed8_to_X32,-
2049 0,-
2050 0,-
2051 0,-
2052 0,-
2053 0,-
2054 0,-
2055 0,-
2056 0,-
2057 0,-
2058 0,-
2059 0,-
2060 0, 0, 0, 0, 0,-
2061 convert_Indexed8_to_Alpha8,-
2062 convert_Indexed8_to_Grayscale8,-
2063 }, // Format_Indexed8-
2064-
2065 {-
2066 0,-
2067 convert_X_to_Mono,-
2068 convert_X_to_Mono,-
2069 convert_RGB_to_Indexed8,-
2070 0,-
2071 mask_alpha_converter,-
2072 mask_alpha_converter,-
2073 0,-
2074 0,-
2075 0,-
2076 0,-
2077 0,-
2078 0,-
2079 0,-
2080 0,-
2081 0,-
2082 0,-
2083 0,-
2084 0,-
2085 convert_RGB_to_RGB30<PixelOrderBGR>,-
2086 0,-
2087 convert_RGB_to_RGB30<PixelOrderRGB>,-
2088 0,-
2089 0, 0-
2090 }, // Format_RGB32-
2091-
2092 {-
2093 0,-
2094 convert_X_to_Mono,-
2095 convert_X_to_Mono,-
2096 convert_ARGB_to_Indexed8,-
2097 mask_alpha_converter,-
2098 0,-
2099 convert_ARGB_to_ARGB_PM,-
2100 0,-
2101 0,-
2102 0,-
2103 0,-
2104 0,-
2105 0,-
2106 0,-
2107 0,-
2108 0,-
2109 convert_ARGB_to_RGBx,-
2110 convert_ARGB_to_RGBA,-
2111 0,-
2112 convert_RGB_to_RGB30<PixelOrderBGR>,-
2113 0,-
2114 convert_RGB_to_RGB30<PixelOrderRGB>,-
2115 0,-
2116 0, 0-
2117 }, // Format_ARGB32-
2118-
2119 {-
2120 0,-
2121 convert_ARGB_PM_to_Mono,-
2122 convert_ARGB_PM_to_Mono,-
2123 convert_ARGB_PM_to_Indexed8,-
2124 0,-
2125 0,-
2126 0,-
2127 0,-
2128 0,-
2129 0,-
2130 0,-
2131 0,-
2132 0,-
2133 0,-
2134 0,-
2135 0,-
2136 0,-
2137 0,-
2138 convert_ARGB_to_RGBA,-
2139 0,-
2140 0,-
2141 0,-
2142 0,-
2143 0, 0-
2144 }, // Format_ARGB32_Premultiplied-
2145-
2146 {-
2147 0,-
2148 0,-
2149 0,-
2150 0,-
2151 0,-
2152 0,-
2153 0,-
2154 0,-
2155 0,-
2156 0,-
2157 0,-
2158 0,-
2159 0,-
2160 0,-
2161 0,-
2162 0,-
2163 0,-
2164 0,-
2165 0, 0, 0, 0, 0, 0, 0-
2166 }, // Format_RGB16-
2167-
2168 {-
2169 0,-
2170 0,-
2171 0,-
2172 0,-
2173 0,-
2174 0,-
2175 0,-
2176 0,-
2177 0,-
2178 0,-
2179 0,-
2180 0,-
2181 0,-
2182 0,-
2183 0,-
2184 0,-
2185 0,-
2186 0,-
2187 0, 0, 0, 0, 0, 0, 0-
2188 }, // Format_ARGB8565_Premultiplied-
2189-
2190 {-
2191 0,-
2192 0,-
2193 0,-
2194 0,-
2195 0,-
2196 0,-
2197 0,-
2198 0,-
2199 0,-
2200 0,-
2201 0,-
2202 0,-
2203 0,-
2204 0,-
2205 0,-
2206 0,-
2207 0,-
2208 0,-
2209 0, 0, 0, 0, 0, 0, 0-
2210 }, // Format_RGB666-
2211-
2212 {-
2213 0,-
2214 0,-
2215 0,-
2216 0,-
2217 0,-
2218 0,-
2219 0,-
2220 0,-
2221 0,-
2222 0,-
2223 0,-
2224 0,-
2225 0,-
2226 0,-
2227 0,-
2228 0,-
2229 0,-
2230 0,-
2231 0, 0, 0, 0, 0, 0, 0-
2232 }, // Format_ARGB6666_Premultiplied-
2233-
2234 {-
2235 0,-
2236 0,-
2237 0,-
2238 0,-
2239 0,-
2240 0,-
2241 0,-
2242 0,-
2243 0,-
2244 0,-
2245 0,-
2246 0,-
2247 0,-
2248 0,-
2249 0,-
2250 0,-
2251 0,-
2252 0,-
2253 0, 0, 0, 0, 0, 0, 0-
2254 }, // Format_RGB555-
2255-
2256 {-
2257 0,-
2258 0,-
2259 0,-
2260 0,-
2261 0,-
2262 0,-
2263 0,-
2264 0,-
2265 0,-
2266 0,-
2267 0,-
2268 0,-
2269 0,-
2270 0,-
2271 0,-
2272 0,-
2273 0,-
2274 0,-
2275 0, 0, 0, 0, 0, 0, 0-
2276 }, // Format_ARGB8555_Premultiplied-
2277-
2278 {-
2279 0,-
2280 0,-
2281 0,-
2282 0,-
2283 convert_RGB888_to_RGB<false>,-
2284 convert_RGB888_to_RGB<false>,-
2285 convert_RGB888_to_RGB<false>,-
2286 0,-
2287 0,-
2288 0,-
2289 0,-
2290 0,-
2291 0,-
2292 0,-
2293 0,-
2294 0,-
2295 convert_RGB888_to_RGB<true>,-
2296 convert_RGB888_to_RGB<true>,-
2297 convert_RGB888_to_RGB<true>,-
2298 0, 0, 0, 0, 0, 0-
2299 }, // Format_RGB888-
2300-
2301 {-
2302 0,-
2303 0,-
2304 0,-
2305 0,-
2306 0,-
2307 0,-
2308 0,-
2309 0,-
2310 0,-
2311 0,-
2312 0,-
2313 0,-
2314 0,-
2315 0,-
2316 0,-
2317 0,-
2318 0,-
2319 0,-
2320 0, 0, 0, 0, 0, 0, 0-
2321 }, // Format_RGB444-
2322-
2323 {-
2324 0,-
2325 0,-
2326 0,-
2327 0,-
2328 0,-
2329 0,-
2330 0,-
2331 0,-
2332 0,-
2333 0,-
2334 0,-
2335 0,-
2336 0,-
2337 0,-
2338 0,-
2339 0,-
2340 0,-
2341 0, 0, 0, 0, 0, 0, 0-
2342 }, // Format_ARGB4444_Premultiplied-
2343 {-
2344 0,-
2345 0,-
2346 0,-
2347 0,-
2348 convert_RGBA_to_RGB,-
2349 convert_RGBA_to_ARGB,-
2350 convert_RGBA_to_ARGB,-
2351 0,-
2352 0,-
2353 0,-
2354 0,-
2355 0,-
2356 0,-
2357 0,-
2358 0,-
2359 0,-
2360 0,-
2361 mask_alpha_converter_RGBx,-
2362 mask_alpha_converter_RGBx,-
2363 0, 0, 0, 0, 0, 0-
2364 }, // Format_RGBX8888-
2365 {-
2366 0,-
2367 0,-
2368 0,-
2369 0,-
2370 convert_RGBA_to_RGB,-
2371 convert_RGBA_to_ARGB,-
2372 0,-
2373 0,-
2374 0,-
2375 0,-
2376 0,-
2377 0,-
2378 0,-
2379 0,-
2380 0,-
2381 0,-
2382 mask_alpha_converter_RGBx,-
2383#if Q_BYTE_ORDER == Q_LITTLE_ENDIAN-
2384 0,-
2385 convert_ARGB_to_ARGB_PM,-
2386#else-
2387 0,-
2388 0,-
2389#endif-
2390 0, 0, 0, 0, 0, 0-
2391 }, // Format_RGBA8888-
2392-
2393 {-
2394 0,-
2395 0,-
2396 0,-
2397 0,-
2398 0,-
2399 0,-
2400 convert_RGBA_to_ARGB,-
2401 0,-
2402 0,-
2403 0,-
2404 0,-
2405 0,-
2406 0,-
2407 0,-
2408 0,-
2409 0,-
2410 0,-
2411 0,-
2412 0, 0, 0, 0, 0, 0-
2413 }, // Format_RGBA8888_Premultiplied-
2414-
2415 {-
2416 0,-
2417 0,-
2418 0,-
2419 0,-
2420 0,-
2421 0,-
2422 0,-
2423 0,-
2424 0,-
2425 0,-
2426 0,-
2427 0,-
2428 0,-
2429 0,-
2430 0,-
2431 0,-
2432 0,-
2433 0,-
2434 0,-
2435 0,-
2436 convert_passthrough,-
2437 convert_BGR30_to_RGB30,-
2438 convert_BGR30_to_RGB30,-
2439 0, 0-
2440 }, // Format_BGR30-
2441 {-
2442 0,-
2443 0,-
2444 0,-
2445 0,-
2446 0,-
2447 convert_A2RGB30_PM_to_ARGB<PixelOrderBGR>,-
2448 0,-
2449 0,-
2450 0,-
2451 0,-
2452 0,-
2453 0,-
2454 0,-
2455 0,-
2456 0,-
2457 0,-
2458 0,-
2459 0,-
2460 0,-
2461 convert_A2RGB30_PM_to_RGB30<false>,-
2462 0,-
2463 convert_A2RGB30_PM_to_RGB30<true>,-
2464 convert_BGR30_to_RGB30,-
2465 0, 0-
2466 }, // Format_BGR30A2_Premultiplied-
2467 {-
2468 0,-
2469 0,-
2470 0,-
2471 0,-
2472 0,-
2473 0,-
2474 0,-
2475 0,-
2476 0,-
2477 0,-
2478 0,-
2479 0,-
2480 0,-
2481 0,-
2482 0,-
2483 0,-
2484 0,-
2485 0,-
2486 0,-
2487 convert_BGR30_to_RGB30,-
2488 convert_BGR30_to_RGB30,-
2489 0,-
2490 convert_passthrough,-
2491 0, 0-
2492 }, // Format_RGB30-
2493 {-
2494 0,-
2495 0,-
2496 0,-
2497 0,-
2498 0,-
2499 convert_A2RGB30_PM_to_ARGB<PixelOrderRGB>,-
2500 0,-
2501 0,-
2502 0,-
2503 0,-
2504 0,-
2505 0,-
2506 0,-
2507 0,-
2508 0,-
2509 0,-
2510 0,-
2511 0,-
2512 0,-
2513 convert_A2RGB30_PM_to_RGB30<true>,-
2514 convert_BGR30_to_RGB30,-
2515 convert_A2RGB30_PM_to_RGB30<false>,-
2516 0,-
2517 0, 0-
2518 }, // Format_RGB30A2_Premultiplied-
2519 {-
2520 0,-
2521 0,-
2522 0,-
2523 convert_Alpha8_to_Indexed8,-
2524 0,-
2525 0,-
2526 0,-
2527 0,-
2528 0,-
2529 0,-
2530 0,-
2531 0,-
2532 0,-
2533 0,-
2534 0,-
2535 0,-
2536 0,-
2537 0, 0, 0, 0, 0, 0, 0-
2538 }, // Format_Alpha8-
2539 {-
2540 0,-
2541 0,-
2542 0,-
2543 convert_Grayscale8_to_Indexed8,-
2544 0,-
2545 0,-
2546 0,-
2547 0,-
2548 0,-
2549 0,-
2550 0,-
2551 0,-
2552 0,-
2553 0,-
2554 0,-
2555 0,-
2556 0,-
2557 0, 0, 0, 0, 0, 0, 0-
2558 } // Format_Grayscale8-
2559};-
2560-
2561InPlace_Image_Converter qimage_inplace_converter_map[QImage::NImageFormats][QImage::NImageFormats] =-
2562{-
2563 {-
2564 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0-
2565 },-
2566 {-
2567 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0-
2568 }, // Format_Mono-
2569 {-
2570 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0-
2571 }, // Format_MonoLSB-
2572 {-
2573 0,-
2574 0,-
2575 0,-
2576 0,-
2577 convert_indexed8_to_RGB_inplace,-
2578 convert_indexed8_to_ARGB_inplace,-
2579 convert_indexed8_to_ARGB_PM_inplace,-
2580 convert_indexed8_to_RGB16_inplace,-
2581 0,-
2582 0,-
2583 0,-
2584 0,-
2585 0,-
2586 0,-
2587 0,-
2588 0,-
2589 0,-
2590 0,-
2591 0, 0, 0, 0, 0,-
2592 convert_Indexed8_to_Alpha8_inplace,-
2593 convert_Indexed8_to_Grayscale8_inplace,-
2594 }, // Format_Indexed8-
2595 {-
2596 0,-
2597 0,-
2598 0,-
2599 0,-
2600 0,-
2601 mask_alpha_converter_inplace<QImage::Format_ARGB32>,-
2602 mask_alpha_converter_inplace<QImage::Format_ARGB32_Premultiplied>,-
2603 convert_RGB_to_RGB16_inplace,-
2604 0,-
2605 0,-
2606 0,-
2607 0,-
2608 0,-
2609 0,-
2610 0,-
2611 0,-
2612 0,-
2613 0,-
2614 0,-
2615 convert_RGB_to_RGB30_inplace<PixelOrderBGR>,-
2616 0,-
2617 convert_RGB_to_RGB30_inplace<PixelOrderRGB>,-
2618 0,-
2619 0, 0-
2620 }, // Format_RGB32-
2621 {-
2622 0,-
2623 0,-
2624 0,-
2625 0,-
2626 mask_alpha_converter_inplace<QImage::Format_RGB32>,-
2627 0,-
2628#ifdef __SSE2__-
2629 convert_ARGB_to_ARGB_PM_inplace_sse2,-
2630#else-
2631 convert_ARGB_to_ARGB_PM_inplace,-
2632#endif-
2633 0,-
2634 0,-
2635 0,-
2636 0,-
2637 0,-
2638 0,-
2639 0,-
2640 0,-
2641 0,-
2642 convert_ARGB_to_RGBA_inplace<QImage::Format_RGBX8888>,-
2643 convert_ARGB_to_RGBA_inplace<QImage::Format_RGBA8888>,-
2644 0,-
2645 convert_RGB_to_RGB30_inplace<PixelOrderBGR>,-
2646 0,-
2647 convert_RGB_to_RGB30_inplace<PixelOrderRGB>,-
2648 0,-
2649 0, 0-
2650 }, // Format_ARGB32-
2651 {-
2652 0,-
2653 0,-
2654 0,-
2655 0,-
2656 0,-
2657 0,-
2658 0,-
2659 0,-
2660 0,-
2661 0,-
2662 0,-
2663 0,-
2664 0,-
2665 0,-
2666 0,-
2667 0,-
2668 0,-
2669 0,-
2670 convert_ARGB_to_RGBA_inplace<QImage::Format_RGBA8888_Premultiplied>,-
2671 0,-
2672 0,-
2673 0,-
2674 0,-
2675 0, 0-
2676 }, // Format_ARGB32_Premultiplied-
2677 {-
2678 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0-
2679 }, // Format_RGB16-
2680 {-
2681 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0-
2682 }, // Format_ARGB8565_Premultiplied-
2683 {-
2684 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0-
2685 }, // Format_RGB666-
2686 {-
2687 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0-
2688 }, // Format_ARGB6666_Premultiplied-
2689 {-
2690 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0-
2691 }, // Format_RGB555-
2692 {-
2693 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0-
2694 }, // Format_ARGB8555_Premultiplied-
2695 {-
2696 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0-
2697 }, // Format_RGB888-
2698 {-
2699 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0-
2700 }, // Format_RGB444-
2701 {-
2702 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0-
2703 }, // Format_ARGB4444_Premultiplied-
2704 {-
2705 0,-
2706 0,-
2707 0,-
2708 0,-
2709 convert_RGBA_to_ARGB_inplace<QImage::Format_RGB32>,-
2710 convert_RGBA_to_ARGB_inplace<QImage::Format_ARGB32>,-
2711 convert_RGBA_to_ARGB_inplace<QImage::Format_ARGB32_Premultiplied>,-
2712 0,-
2713 0,-
2714 0,-
2715 0,-
2716 0,-
2717 0,-
2718 0,-
2719 0,-
2720 0,-
2721 0,-
2722 convert_passthrough_inplace<QImage::Format_RGBA8888>,-
2723 convert_passthrough_inplace<QImage::Format_RGBA8888_Premultiplied>,-
2724 0, 0, 0, 0, 0, 0-
2725 }, // Format_RGBX8888-
2726 {-
2727 0,-
2728 0,-
2729 0,-
2730 0,-
2731 convert_RGBA_to_ARGB_inplace<QImage::Format_RGB32>,-
2732 convert_RGBA_to_ARGB_inplace<QImage::Format_ARGB32>,-
2733 0,-
2734 0,-
2735 0,-
2736 0,-
2737 0,-
2738 0,-
2739 0,-
2740 0,-
2741 0,-
2742 0,-
2743 mask_alpha_converter_rgbx_inplace,-
2744 0,-
2745#ifdef __SSE2__-
2746 convert_ARGB_to_ARGB_PM_inplace_sse2,-
2747#elif Q_BYTE_ORDER == Q_LITTLE_ENDIAN-
2748 convert_ARGB_to_ARGB_PM_inplace,-
2749#else-
2750 0,-
2751#endif-
2752 0, 0, 0, 0, 0, 0-
2753 }, // Format_RGBA8888-
2754 {-
2755 0,-
2756 0,-
2757 0,-
2758 0,-
2759 0,-
2760 0,-
2761 convert_RGBA_to_ARGB_inplace<QImage::Format_ARGB32_Premultiplied>,-
2762 0,-
2763 0,-
2764 0,-
2765 0,-
2766 0,-
2767 0,-
2768 0,-
2769 0,-
2770 0,-
2771 0,-
2772 0,-
2773 0,-
2774 0, 0, 0, 0, 0, 0-
2775 }, // Format_RGBA8888_Premultiplied-
2776 {-
2777 0,-
2778 0,-
2779 0,-
2780 0,-
2781 0,-
2782 0,-
2783 0,-
2784 0,-
2785 0,-
2786 0,-
2787 0,-
2788 0,-
2789 0,-
2790 0,-
2791 0,-
2792 0,-
2793 0,-
2794 0,-
2795 0,-
2796 0, // self-
2797 convert_passthrough_inplace<QImage::Format_A2BGR30_Premultiplied>,-
2798 convert_BGR30_to_RGB30_inplace,-
2799 convert_BGR30_to_A2RGB30_inplace,-
2800 0, 0-
2801 }, // Format_BGR30-
2802 {-
2803 0,-
2804 0,-
2805 0,-
2806 0,-
2807 0,-
2808 convert_A2RGB30_PM_to_ARGB_inplace<PixelOrderBGR>,-
2809 0,-
2810 0,-
2811 0,-
2812 0,-
2813 0,-
2814 0,-
2815 0,-
2816 0,-
2817 0,-
2818 0,-
2819 0,-
2820 0,-
2821 0,-
2822 convert_A2RGB30_PM_to_RGB30_inplace<false>,-
2823 0, // self-
2824 convert_A2RGB30_PM_to_RGB30_inplace<true>,-
2825 convert_BGR30_to_RGB30_inplace,-
2826 0, 0-
2827 }, // Format_BGR30A2_Premultiplied-
2828 {-
2829 0,-
2830 0,-
2831 0,-
2832 0,-
2833 0,-
2834 0,-
2835 0,-
2836 0,-
2837 0,-
2838 0,-
2839 0,-
2840 0,-
2841 0,-
2842 0,-
2843 0,-
2844 0,-
2845 0,-
2846 0,-
2847 0,-
2848 convert_BGR30_to_RGB30_inplace,-
2849 convert_BGR30_to_A2RGB30_inplace,-
2850 0, // self-
2851 convert_passthrough_inplace<QImage::Format_A2RGB30_Premultiplied>,-
2852 0, 0-
2853 }, // Format_RGB30-
2854 {-
2855 0,-
2856 0,-
2857 0,-
2858 0,-
2859 0,-
2860 convert_A2RGB30_PM_to_ARGB_inplace<PixelOrderRGB>,-
2861 0,-
2862 0,-
2863 0,-
2864 0,-
2865 0,-
2866 0,-
2867 0,-
2868 0,-
2869 0,-
2870 0,-
2871 0,-
2872 0,-
2873 0,-
2874 convert_A2RGB30_PM_to_RGB30_inplace<true>,-
2875 convert_BGR30_to_RGB30_inplace,-
2876 convert_A2RGB30_PM_to_RGB30_inplace<false>,-
2877 0, // self-
2878 0, 0-
2879 }, // Format_RGB30A2_Premultiplied-
2880 {-
2881 0,-
2882 0,-
2883 0,-
2884 convert_Alpha8_to_Indexed8_inplace,-
2885 0,-
2886 0,-
2887 0,-
2888 0,-
2889 0,-
2890 0,-
2891 0,-
2892 0,-
2893 0,-
2894 0,-
2895 0,-
2896 0,-
2897 0,-
2898 0,-
2899 0,-
2900 0,-
2901 0,-
2902 0,-
2903 0,-
2904 0, 0-
2905 }, // Format_Alpha8-
2906 {-
2907 0,-
2908 0,-
2909 0,-
2910 convert_Grayscale8_to_Indexed8_inplace,-
2911 0,-
2912 0,-
2913 0,-
2914 0,-
2915 0,-
2916 0,-
2917 0,-
2918 0,-
2919 0,-
2920 0,-
2921 0,-
2922 0,-
2923 0,-
2924 0,-
2925 0,-
2926 0,-
2927 0,-
2928 0,-
2929 0,-
2930 0, 0-
2931 } // Format_Grayscale8-
2932};-
2933-
2934static void qInitImageConversions()-
2935{-
2936#if defined(__SSE2__) && defined(QT_COMPILER_SUPPORTS_SSSE3)-
2937 if (qCpuHasFeature(SSSE3)) {
(qCompilerCpuF...FeatureSSSE3))Description
TRUEnever evaluated
FALSEnever evaluated
(qCpuFeatures(...FeatureSSSE3))Description
TRUEnever evaluated
FALSEnever evaluated
0
2938 extern void convert_RGB888_to_RGB32_ssse3(QImageData *dest, const QImageData *src, Qt::ImageConversionFlags);-
2939 qimage_converter_map[QImage::Format_RGB888][QImage::Format_RGB32] = convert_RGB888_to_RGB32_ssse3;-
2940 qimage_converter_map[QImage::Format_RGB888][QImage::Format_ARGB32] = convert_RGB888_to_RGB32_ssse3;-
2941 qimage_converter_map[QImage::Format_RGB888][QImage::Format_ARGB32_Premultiplied] = convert_RGB888_to_RGB32_ssse3;-
2942 }
never executed: end of block
0
2943#endif-
2944-
2945#if defined(QT_COMPILER_SUPPORTS_SSE4_1) && !defined(__SSE4_1__)-
2946 if (qCpuHasFeature(SSE4_1)) {
(qCompilerCpuF...eatureSSE4_1))Description
TRUEnever evaluated
FALSEnever evaluated
(qCpuFeatures(...eatureSSE4_1))Description
TRUEnever evaluated
FALSEnever evaluated
0
2947 extern void convert_ARGB_to_ARGB_PM_sse4(QImageData *dest, const QImageData *src, Qt::ImageConversionFlags);-
2948 qimage_converter_map[QImage::Format_ARGB32][QImage::Format_ARGB32_Premultiplied] = convert_ARGB_to_ARGB_PM_sse4;-
2949 qimage_converter_map[QImage::Format_RGBA8888][QImage::Format_RGBA8888_Premultiplied] = convert_ARGB_to_ARGB_PM_sse4;-
2950 }
never executed: end of block
0
2951#endif-
2952-
2953#if defined(QT_COMPILER_SUPPORTS_AVX2) && !defined(__AVX2__)-
2954 if (qCpuHasFeature(AVX2)) {
(qCompilerCpuF...uFeatureAVX2))Description
TRUEnever evaluated
FALSEnever evaluated
(qCpuFeatures(...uFeatureAVX2))Description
TRUEnever evaluated
FALSEnever evaluated
0
2955 extern void convert_ARGB_to_ARGB_PM_avx2(QImageData *dest, const QImageData *src, Qt::ImageConversionFlags);-
2956 qimage_converter_map[QImage::Format_ARGB32][QImage::Format_ARGB32_Premultiplied] = convert_ARGB_to_ARGB_PM_avx2;-
2957 qimage_converter_map[QImage::Format_RGBA8888][QImage::Format_RGBA8888_Premultiplied] = convert_ARGB_to_ARGB_PM_avx2;-
2958 }
never executed: end of block
0
2959#endif-
2960-
2961#if defined(__ARM_NEON__)-
2962 extern void convert_RGB888_to_RGB32_neon(QImageData *dest, const QImageData *src, Qt::ImageConversionFlags);-
2963 qimage_converter_map[QImage::Format_RGB888][QImage::Format_RGB32] = convert_RGB888_to_RGB32_neon;-
2964 qimage_converter_map[QImage::Format_RGB888][QImage::Format_ARGB32] = convert_RGB888_to_RGB32_neon;-
2965 qimage_converter_map[QImage::Format_RGB888][QImage::Format_ARGB32_Premultiplied] = convert_RGB888_to_RGB32_neon;-
2966#endif-
2967-
2968#ifdef QT_COMPILER_SUPPORTS_MIPS_DSPR2-
2969 if (qCpuHasFeature(DSPR2)) {-
2970 extern bool convert_ARGB_to_ARGB_PM_inplace_mips_dspr2(QImageData *data, Qt::ImageConversionFlags);-
2971 qimage_inplace_converter_map[QImage::Format_ARGB32][QImage::Format_ARGB32_Premultiplied] = convert_ARGB_to_ARGB_PM_inplace_mips_dspr2;-
2972-
2973 extern void convert_RGB888_to_RGB32_mips_dspr2(QImageData *dest, const QImageData *src, Qt::ImageConversionFlags);-
2974 qimage_converter_map[QImage::Format_RGB888][QImage::Format_RGB32] = convert_RGB888_to_RGB32_mips_dspr2;-
2975 qimage_converter_map[QImage::Format_RGB888][QImage::Format_ARGB32] = convert_RGB888_to_RGB32_mips_dspr2;-
2976 qimage_converter_map[QImage::Format_RGB888][QImage::Format_ARGB32_Premultiplied] = convert_RGB888_to_RGB32_mips_dspr2;-
2977 }-
2978#endif-
2979}
never executed: end of block
0
2980-
2981Q_CONSTRUCTOR_FUNCTION(qInitImageConversions);
never executed: end of block
0
2982-
2983QT_END_NAMESPACE-
Source codeSwitch to Preprocessed file

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