1// Copyright (C) 2016 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4#include <qmath.h>
5#include "qblendfunctions_p.h"
6
7QT_BEGIN_NAMESPACE
8
9struct SourceOnlyAlpha
10{
11 inline uchar alpha(uchar src) const { return src; }
12 inline quint16 bytemul(quint16 spix) const { return spix; }
13};
14
15
16struct SourceAndConstAlpha
17{
18 SourceAndConstAlpha(int a) : m_alpha256(a) {
19 m_alpha255 = (m_alpha256 * 255) >> 8;
20 };
21 inline uchar alpha(uchar src) const { return (src * m_alpha256) >> 8; }
22 inline quint16 bytemul(quint16 x) const {
23 uint t = (((x & 0x07e0)*m_alpha255) >> 8) & 0x07e0;
24 t |= (((x & 0xf81f)*(m_alpha255>>2)) >> 6) & 0xf81f;
25 return t;
26 }
27 int m_alpha255;
28 int m_alpha256;
29};
30
31
32/************************************************************************
33 RGB16 (565) format target format
34 ************************************************************************/
35
36struct Blend_RGB16_on_RGB16_NoAlpha {
37 inline void write(quint16 *dst, quint16 src) { *dst = src; }
38
39 inline void flush(void *) {}
40};
41
42struct Blend_RGB16_on_RGB16_ConstAlpha {
43 inline Blend_RGB16_on_RGB16_ConstAlpha(quint32 alpha) {
44 m_alpha = (alpha * 255) >> 8;
45 m_ialpha = 255 - m_alpha;
46 }
47
48 inline void write(quint16 *dst, quint16 src) {
49 *dst = BYTE_MUL_RGB16(x: src, a: m_alpha) + BYTE_MUL_RGB16(x: *dst, a: m_ialpha);
50 }
51
52 inline void flush(void *) {}
53
54 quint32 m_alpha;
55 quint32 m_ialpha;
56};
57
58struct Blend_ARGB32_on_RGB16_SourceAlpha {
59 inline void write(quint16 *dst, quint32 src) {
60 const quint8 alpha = qAlpha(rgb: src);
61 if (alpha) {
62 quint16 s = qConvertRgb32To16(c: src);
63 if (alpha < 255)
64 s += BYTE_MUL_RGB16(x: *dst, a: 255 - alpha);
65 *dst = s;
66 }
67 }
68
69 inline void flush(void *) {}
70};
71
72struct Blend_ARGB32_on_RGB16_SourceAndConstAlpha {
73 inline Blend_ARGB32_on_RGB16_SourceAndConstAlpha(quint32 alpha) {
74 m_alpha = (alpha * 255) >> 8;
75 }
76
77 inline void write(quint16 *dst, quint32 src) {
78 src = BYTE_MUL(x: src, a: m_alpha);
79 const quint8 alpha = qAlpha(rgb: src);
80 if (alpha) {
81 quint16 s = qConvertRgb32To16(c: src);
82 if (alpha < 255)
83 s += BYTE_MUL_RGB16(x: *dst, a: 255 - alpha);
84 *dst = s;
85 }
86 }
87
88 inline void flush(void *) {}
89
90 quint32 m_alpha;
91};
92
93void qt_scale_image_rgb16_on_rgb16(uchar *destPixels, int dbpl,
94 const uchar *srcPixels, int sbpl, int srch,
95 const QRectF &targetRect,
96 const QRectF &sourceRect,
97 const QRect &clip,
98 int const_alpha)
99{
100#ifdef QT_DEBUG_DRAW
101 printf("qt_scale_rgb16_on_rgb16: dst=(%p, %d), src=(%p, %d), target=(%d, %d), [%d x %d], src=(%d, %d) [%d x %d] alpha=%d\n",
102 destPixels, dbpl, srcPixels, sbpl,
103 targetRect.x(), targetRect.y(), targetRect.width(), targetRect.height(),
104 sourceRect.x(), sourceRect.y(), sourceRect.width(), sourceRect.height(),
105 const_alpha);
106#endif
107 if (const_alpha == 256) {
108 Blend_RGB16_on_RGB16_NoAlpha noAlpha;
109 qt_scale_image_16bit<quint16>(destPixels, dbpl, srcPixels, sbpl, srch,
110 targetRect, srcRect: sourceRect, clip, blender: noAlpha);
111 } else {
112 Blend_RGB16_on_RGB16_ConstAlpha constAlpha(const_alpha);
113 qt_scale_image_16bit<quint16>(destPixels, dbpl, srcPixels, sbpl, srch,
114 targetRect, srcRect: sourceRect, clip, blender: constAlpha);
115 }
116}
117
118void qt_scale_image_argb32_on_rgb16(uchar *destPixels, int dbpl,
119 const uchar *srcPixels, int sbpl, int srch,
120 const QRectF &targetRect,
121 const QRectF &sourceRect,
122 const QRect &clip,
123 int const_alpha)
124{
125#ifdef QT_DEBUG_DRAW
126 printf("qt_scale_argb32_on_rgb16: dst=(%p, %d), src=(%p, %d), target=(%d, %d), [%d x %d], src=(%d, %d) [%d x %d] alpha=%d\n",
127 destPixels, dbpl, srcPixels, sbpl,
128 targetRect.x(), targetRect.y(), targetRect.width(), targetRect.height(),
129 sourceRect.x(), sourceRect.y(), sourceRect.width(), sourceRect.height(),
130 const_alpha);
131#endif
132 if (const_alpha == 256) {
133 Blend_ARGB32_on_RGB16_SourceAlpha noAlpha;
134 qt_scale_image_16bit<quint32>(destPixels, dbpl, srcPixels, sbpl, srch,
135 targetRect, srcRect: sourceRect, clip, blender: noAlpha);
136 } else {
137 Blend_ARGB32_on_RGB16_SourceAndConstAlpha constAlpha(const_alpha);
138 qt_scale_image_16bit<quint32>(destPixels, dbpl, srcPixels, sbpl, srch,
139 targetRect, srcRect: sourceRect, clip, blender: constAlpha);
140 }
141}
142
143void qt_blend_rgb16_on_rgb16(uchar *dst, int dbpl,
144 const uchar *src, int sbpl,
145 int w, int h,
146 int const_alpha)
147{
148#ifdef QT_DEBUG_DRAW
149 printf("qt_blend_rgb16_on_rgb16: dst=(%p, %d), src=(%p, %d), dim=(%d, %d) alpha=%d\n",
150 dst, dbpl, src, sbpl, w, h, const_alpha);
151#endif
152
153 if (const_alpha == 256) {
154 int length = w << 1;
155 while (--h >= 0) {
156 memcpy(dest: dst, src: src, n: length);
157 dst += dbpl;
158 src += sbpl;
159 }
160 } else if (const_alpha != 0) {
161 quint16 *d = (quint16 *) dst;
162 const quint16 *s = (const quint16 *) src;
163 quint8 a = (255 * const_alpha) >> 8;
164 quint8 ia = 255 - a;
165 while (--h >= 0) {
166 for (int x=0; x<w; ++x) {
167 d[x] = BYTE_MUL_RGB16(x: s[x], a) + BYTE_MUL_RGB16(x: d[x], a: ia);
168 }
169 d = (quint16 *)(((uchar *) d) + dbpl);
170 s = (const quint16 *)(((const uchar *) s) + sbpl);
171 }
172 }
173}
174
175
176void qt_blend_argb32_on_rgb16_const_alpha(uchar *destPixels, int dbpl,
177 const uchar *srcPixels, int sbpl,
178 int w, int h,
179 int const_alpha)
180{
181 quint16 *dst = (quint16 *) destPixels;
182 const quint32 *src = (const quint32 *) srcPixels;
183
184 const_alpha = (const_alpha * 255) >> 8;
185 for (int y=0; y<h; ++y) {
186 for (int i = 0; i < w; ++i) {
187 uint s = src[i];
188 s = BYTE_MUL(x: s, a: const_alpha);
189 int alpha = qAlpha(rgb: s);
190 s = qConvertRgb32To16(c: s);
191 s += BYTE_MUL_RGB16(x: dst[i], a: 255 - alpha);
192 dst[i] = s;
193 }
194 dst = (quint16 *)(((uchar *) dst) + dbpl);
195 src = (const quint32 *)(((const uchar *) src) + sbpl);
196 }
197}
198
199static void qt_blend_argb32_on_rgb16(uchar *destPixels, int dbpl,
200 const uchar *srcPixels, int sbpl,
201 int w, int h,
202 int const_alpha)
203{
204 if (const_alpha != 256) {
205 qt_blend_argb32_on_rgb16_const_alpha(destPixels, dbpl, srcPixels, sbpl, w, h, const_alpha);
206 return;
207 }
208
209 quint16 *dst = (quint16 *) destPixels;
210 const quint32 *src = (const quint32 *) srcPixels;
211
212 for (int y=0; y<h; ++y) {
213 for (int x=0; x<w; ++x) {
214
215 quint32 spix = src[x];
216 quint32 alpha = spix >> 24;
217
218 if (alpha == 255) {
219 dst[x] = qConvertRgb32To16(c: spix);
220 } else if (alpha != 0) {
221 quint32 dpix = dst[x];
222
223 quint32 sia = 255 - alpha;
224
225 quint32 sr = (spix >> 8) & 0xf800;
226 quint32 sg = (spix >> 5) & 0x07e0;
227 quint32 sb = (spix >> 3) & 0x001f;
228
229 quint32 dr = (dpix & 0x0000f800);
230 quint32 dg = (dpix & 0x000007e0);
231 quint32 db = (dpix & 0x0000001f);
232
233 quint32 siar = dr * sia;
234 quint32 siag = dg * sia;
235 quint32 siab = db * sia;
236
237 quint32 rr = sr + ((siar + (siar>>8) + (0x80 << 8)) >> 8);
238 quint32 rg = sg + ((siag + (siag>>8) + (0x80 << 3)) >> 8);
239 quint32 rb = sb + ((siab + (siab>>8) + (0x80 >> 3)) >> 8);
240
241 dst[x] = (rr & 0xf800)
242 | (rg & 0x07e0)
243 | (rb);
244 }
245 }
246 dst = (quint16 *) (((uchar *) dst) + dbpl);
247 src = (const quint32 *) (((const uchar *) src) + sbpl);
248 }
249}
250
251
252static void qt_blend_rgb32_on_rgb16(uchar *destPixels, int dbpl,
253 const uchar *srcPixels, int sbpl,
254 int w, int h,
255 int const_alpha)
256{
257#ifdef QT_DEBUG_DRAW
258 printf("qt_blend_rgb32_on_rgb16: dst=(%p, %d), src=(%p, %d), dim=(%d, %d) alpha=%d\n",
259 destPixels, dbpl, srcPixels, sbpl, w, h, const_alpha);
260#endif
261
262 if (const_alpha != 256) {
263 qt_blend_argb32_on_rgb16(destPixels, dbpl, srcPixels, sbpl, w, h, const_alpha);
264 return;
265 }
266
267 const quint32 *src = (const quint32 *) srcPixels;
268 int srcExtraStride = (sbpl >> 2) - w;
269
270 int dstJPL = dbpl / 2;
271
272 quint16 *dst = (quint16 *) destPixels;
273 quint16 *dstEnd = dst + dstJPL * h;
274
275 int dstExtraStride = dstJPL - w;
276
277 while (dst < dstEnd) {
278 const quint32 *srcEnd = src + w;
279 while (src < srcEnd) {
280 *dst = qConvertRgb32To16(c: *src);
281 ++dst;
282 ++src;
283 }
284 dst += dstExtraStride;
285 src += srcExtraStride;
286 }
287}
288
289
290
291/************************************************************************
292 RGB32 (-888) format target format
293 ************************************************************************/
294
295static void qt_blend_argb32_on_argb32(uchar *destPixels, int dbpl,
296 const uchar *srcPixels, int sbpl,
297 int w, int h,
298 int const_alpha)
299{
300#ifdef QT_DEBUG_DRAW
301 fprintf(stdout, "qt_blend_argb32_on_argb32: dst=(%p, %d), src=(%p, %d), dim=(%d, %d) alpha=%d\n",
302 destPixels, dbpl, srcPixels, sbpl, w, h, const_alpha);
303 fflush(stdout);
304#endif
305
306 const uint *src = (const uint *) srcPixels;
307 uint *dst = (uint *) destPixels;
308 if (const_alpha == 256) {
309 for (int y=0; y<h; ++y) {
310 for (int x=0; x<w; ++x) {
311 uint s = src[x];
312 if (s >= 0xff000000)
313 dst[x] = s;
314 else if (s != 0)
315 dst[x] = s + BYTE_MUL(x: dst[x], a: qAlpha(rgb: ~s));
316 }
317 dst = (quint32 *)(((uchar *) dst) + dbpl);
318 src = (const quint32 *)(((const uchar *) src) + sbpl);
319 }
320 } else if (const_alpha != 0) {
321 const_alpha = (const_alpha * 255) >> 8;
322 for (int y=0; y<h; ++y) {
323 for (int x=0; x<w; ++x) {
324 uint s = BYTE_MUL(x: src[x], a: const_alpha);
325 dst[x] = s + BYTE_MUL(x: dst[x], a: qAlpha(rgb: ~s));
326 }
327 dst = (quint32 *)(((uchar *) dst) + dbpl);
328 src = (const quint32 *)(((const uchar *) src) + sbpl);
329 }
330 }
331}
332
333
334void qt_blend_rgb32_on_rgb32(uchar *destPixels, int dbpl,
335 const uchar *srcPixels, int sbpl,
336 int w, int h,
337 int const_alpha)
338{
339#ifdef QT_DEBUG_DRAW
340 fprintf(stdout, "qt_blend_rgb32_on_rgb32: dst=(%p, %d), src=(%p, %d), dim=(%d, %d) alpha=%d\n",
341 destPixels, dbpl, srcPixels, sbpl, w, h, const_alpha);
342 fflush(stdout);
343#endif
344 const uint *src = (const uint *) srcPixels;
345 uint *dst = (uint *) destPixels;
346 if (const_alpha == 256) {
347 const int len = w * 4;
348 for (int y = 0; y < h; ++y) {
349 memcpy(dest: dst, src: src, n: len);
350 dst = (quint32 *)(((uchar *) dst) + dbpl);
351 src = (const quint32 *)(((const uchar *) src) + sbpl);
352 }
353 return;
354 } else if (const_alpha != 0) {
355 const_alpha = (const_alpha * 255) >> 8;
356 int ialpha = 255 - const_alpha;
357 for (int y=0; y<h; ++y) {
358 for (int x=0; x<w; ++x)
359 dst[x] = INTERPOLATE_PIXEL_255(x: dst[x], a: ialpha, y: src[x], b: const_alpha);
360 dst = (quint32 *)(((uchar *) dst) + dbpl);
361 src = (const quint32 *)(((const uchar *) src) + sbpl);
362 }
363 }
364}
365
366struct Blend_RGB32_on_RGB32_NoAlpha {
367 inline void write(quint32 *dst, quint32 src) { *dst = src; }
368
369 inline void flush(void *) {}
370};
371
372struct Blend_RGB32_on_RGB32_ConstAlpha {
373 inline Blend_RGB32_on_RGB32_ConstAlpha(quint32 alpha) {
374 m_alpha = (alpha * 255) >> 8;
375 m_ialpha = 255 - m_alpha;
376 }
377
378 inline void write(quint32 *dst, quint32 src) {
379 *dst = INTERPOLATE_PIXEL_255(x: src, a: m_alpha, y: *dst, b: m_ialpha);
380 }
381
382 inline void flush(void *) {}
383
384 quint32 m_alpha;
385 quint32 m_ialpha;
386};
387
388struct Blend_ARGB32_on_ARGB32_SourceAlpha {
389 inline void write(quint32 *dst, quint32 src)
390 {
391 blend_pixel(dst&: *dst, src);
392 }
393
394 inline void flush(void *) {}
395};
396
397struct Blend_ARGB32_on_ARGB32_SourceAndConstAlpha {
398 inline Blend_ARGB32_on_ARGB32_SourceAndConstAlpha(quint32 alpha)
399 {
400 m_alpha = (alpha * 255) >> 8;
401 }
402
403 inline void write(quint32 *dst, quint32 src)
404 {
405 blend_pixel(dst&: *dst, src, const_alpha: m_alpha);
406 }
407
408 inline void flush(void *) {}
409
410 quint32 m_alpha;
411};
412
413void qt_scale_image_rgb32_on_rgb32(uchar *destPixels, int dbpl,
414 const uchar *srcPixels, int sbpl, int srch,
415 const QRectF &targetRect,
416 const QRectF &sourceRect,
417 const QRect &clip,
418 int const_alpha)
419{
420#ifdef QT_DEBUG_DRAW
421 printf("qt_scale_rgb32_on_rgb32: dst=(%p, %d), src=(%p, %d), target=(%d, %d), [%d x %d], src=(%d, %d) [%d x %d] alpha=%d\n",
422 destPixels, dbpl, srcPixels, sbpl,
423 targetRect.x(), targetRect.y(), targetRect.width(), targetRect.height(),
424 sourceRect.x(), sourceRect.y(), sourceRect.width(), sourceRect.height(),
425 const_alpha);
426#endif
427 if (const_alpha == 256) {
428 Blend_RGB32_on_RGB32_NoAlpha noAlpha;
429 qt_scale_image_32bit(destPixels, dbpl, srcPixels, sbpl, srch,
430 targetRect, srcRect: sourceRect, clip, blender: noAlpha);
431 } else {
432 Blend_RGB32_on_RGB32_ConstAlpha constAlpha(const_alpha);
433 qt_scale_image_32bit(destPixels, dbpl, srcPixels, sbpl, srch,
434 targetRect, srcRect: sourceRect, clip, blender: constAlpha);
435 }
436}
437
438void qt_scale_image_argb32_on_argb32(uchar *destPixels, int dbpl,
439 const uchar *srcPixels, int sbpl, int srch,
440 const QRectF &targetRect,
441 const QRectF &sourceRect,
442 const QRect &clip,
443 int const_alpha)
444{
445#ifdef QT_DEBUG_DRAW
446 printf("qt_scale_argb32_on_argb32: dst=(%p, %d), src=(%p, %d), target=(%d, %d), [%d x %d], src=(%d, %d) [%d x %d] alpha=%d\n",
447 destPixels, dbpl, srcPixels, sbpl,
448 targetRect.x(), targetRect.y(), targetRect.width(), targetRect.height(),
449 sourceRect.x(), sourceRect.y(), sourceRect.width(), sourceRect.height(),
450 const_alpha);
451#endif
452 if (const_alpha == 256) {
453 Blend_ARGB32_on_ARGB32_SourceAlpha sourceAlpha;
454 qt_scale_image_32bit(destPixels, dbpl, srcPixels, sbpl, srch,
455 targetRect, srcRect: sourceRect, clip, blender: sourceAlpha);
456 } else {
457 Blend_ARGB32_on_ARGB32_SourceAndConstAlpha constAlpha(const_alpha);
458 qt_scale_image_32bit(destPixels, dbpl, srcPixels, sbpl, srch,
459 targetRect, srcRect: sourceRect, clip, blender: constAlpha);
460 }
461}
462
463void qt_transform_image_rgb16_on_rgb16(uchar *destPixels, int dbpl,
464 const uchar *srcPixels, int sbpl,
465 const QRectF &targetRect,
466 const QRectF &sourceRect,
467 const QRect &clip,
468 const QTransform &targetRectTransform,
469 int const_alpha)
470{
471 if (const_alpha == 256) {
472 Blend_RGB16_on_RGB16_NoAlpha noAlpha;
473 qt_transform_image(destPixels: reinterpret_cast<quint16 *>(destPixels), dbpl,
474 srcPixels: reinterpret_cast<const quint16 *>(srcPixels), sbpl,
475 targetRect, sourceRect, clip, targetRectTransform, blender: noAlpha);
476 } else {
477 Blend_RGB16_on_RGB16_ConstAlpha constAlpha(const_alpha);
478 qt_transform_image(destPixels: reinterpret_cast<quint16 *>(destPixels), dbpl,
479 srcPixels: reinterpret_cast<const quint16 *>(srcPixels), sbpl,
480 targetRect, sourceRect, clip, targetRectTransform, blender: constAlpha);
481 }
482}
483
484void qt_transform_image_argb32_on_rgb16(uchar *destPixels, int dbpl,
485 const uchar *srcPixels, int sbpl,
486 const QRectF &targetRect,
487 const QRectF &sourceRect,
488 const QRect &clip,
489 const QTransform &targetRectTransform,
490 int const_alpha)
491{
492 if (const_alpha == 256) {
493 Blend_ARGB32_on_RGB16_SourceAlpha noAlpha;
494 qt_transform_image(destPixels: reinterpret_cast<quint16 *>(destPixels), dbpl,
495 srcPixels: reinterpret_cast<const quint32 *>(srcPixels), sbpl,
496 targetRect, sourceRect, clip, targetRectTransform, blender: noAlpha);
497 } else {
498 Blend_ARGB32_on_RGB16_SourceAndConstAlpha constAlpha(const_alpha);
499 qt_transform_image(destPixels: reinterpret_cast<quint16 *>(destPixels), dbpl,
500 srcPixels: reinterpret_cast<const quint32 *>(srcPixels), sbpl,
501 targetRect, sourceRect, clip, targetRectTransform, blender: constAlpha);
502 }
503}
504
505
506void qt_transform_image_rgb32_on_rgb32(uchar *destPixels, int dbpl,
507 const uchar *srcPixels, int sbpl,
508 const QRectF &targetRect,
509 const QRectF &sourceRect,
510 const QRect &clip,
511 const QTransform &targetRectTransform,
512 int const_alpha)
513{
514 if (const_alpha == 256) {
515 Blend_RGB32_on_RGB32_NoAlpha noAlpha;
516 qt_transform_image(destPixels: reinterpret_cast<quint32 *>(destPixels), dbpl,
517 srcPixels: reinterpret_cast<const quint32 *>(srcPixels), sbpl,
518 targetRect, sourceRect, clip, targetRectTransform, blender: noAlpha);
519 } else {
520 Blend_RGB32_on_RGB32_ConstAlpha constAlpha(const_alpha);
521 qt_transform_image(destPixels: reinterpret_cast<quint32 *>(destPixels), dbpl,
522 srcPixels: reinterpret_cast<const quint32 *>(srcPixels), sbpl,
523 targetRect, sourceRect, clip, targetRectTransform, blender: constAlpha);
524 }
525}
526
527void qt_transform_image_argb32_on_argb32(uchar *destPixels, int dbpl,
528 const uchar *srcPixels, int sbpl,
529 const QRectF &targetRect,
530 const QRectF &sourceRect,
531 const QRect &clip,
532 const QTransform &targetRectTransform,
533 int const_alpha)
534{
535 if (const_alpha == 256) {
536 Blend_ARGB32_on_ARGB32_SourceAlpha sourceAlpha;
537 qt_transform_image(destPixels: reinterpret_cast<quint32 *>(destPixels), dbpl,
538 srcPixels: reinterpret_cast<const quint32 *>(srcPixels), sbpl,
539 targetRect, sourceRect, clip, targetRectTransform, blender: sourceAlpha);
540 } else {
541 Blend_ARGB32_on_ARGB32_SourceAndConstAlpha constAlpha(const_alpha);
542 qt_transform_image(destPixels: reinterpret_cast<quint32 *>(destPixels), dbpl,
543 srcPixels: reinterpret_cast<const quint32 *>(srcPixels), sbpl,
544 targetRect, sourceRect, clip, targetRectTransform, blender: constAlpha);
545 }
546}
547
548SrcOverScaleFunc qScaleFunctions[QImage::NImageFormats][QImage::NImageFormats];
549SrcOverBlendFunc qBlendFunctions[QImage::NImageFormats][QImage::NImageFormats];
550SrcOverTransformFunc qTransformFunctions[QImage::NImageFormats][QImage::NImageFormats];
551
552void qInitBlendFunctions()
553{
554 qScaleFunctions[QImage::Format_RGB32][QImage::Format_RGB32] = qt_scale_image_rgb32_on_rgb32;
555 qScaleFunctions[QImage::Format_RGB32][QImage::Format_ARGB32_Premultiplied] = qt_scale_image_argb32_on_argb32;
556 qScaleFunctions[QImage::Format_ARGB32_Premultiplied][QImage::Format_RGB32] = qt_scale_image_rgb32_on_rgb32;
557 qScaleFunctions[QImage::Format_ARGB32_Premultiplied][QImage::Format_ARGB32_Premultiplied] = qt_scale_image_argb32_on_argb32;
558 qScaleFunctions[QImage::Format_RGB16][QImage::Format_ARGB32_Premultiplied] = qt_scale_image_argb32_on_rgb16;
559 qScaleFunctions[QImage::Format_RGB16][QImage::Format_RGB16] = qt_scale_image_rgb16_on_rgb16;
560#if Q_BYTE_ORDER == Q_LITTLE_ENDIAN
561 qScaleFunctions[QImage::Format_RGBX8888][QImage::Format_RGBX8888] = qt_scale_image_rgb32_on_rgb32;
562 qScaleFunctions[QImage::Format_RGBX8888][QImage::Format_RGBA8888_Premultiplied] = qt_scale_image_argb32_on_argb32;
563 qScaleFunctions[QImage::Format_RGBA8888_Premultiplied][QImage::Format_RGBX8888] = qt_scale_image_rgb32_on_rgb32;
564 qScaleFunctions[QImage::Format_RGBA8888_Premultiplied][QImage::Format_RGBA8888_Premultiplied] = qt_scale_image_argb32_on_argb32;
565#endif
566
567 qBlendFunctions[QImage::Format_RGB32][QImage::Format_RGB32] = qt_blend_rgb32_on_rgb32;
568 qBlendFunctions[QImage::Format_RGB32][QImage::Format_ARGB32_Premultiplied] = qt_blend_argb32_on_argb32;
569 qBlendFunctions[QImage::Format_ARGB32_Premultiplied][QImage::Format_RGB32] = qt_blend_rgb32_on_rgb32;
570 qBlendFunctions[QImage::Format_ARGB32_Premultiplied][QImage::Format_ARGB32_Premultiplied] = qt_blend_argb32_on_argb32;
571 qBlendFunctions[QImage::Format_RGB16][QImage::Format_RGB32] = qt_blend_rgb32_on_rgb16;
572 qBlendFunctions[QImage::Format_RGB16][QImage::Format_ARGB32_Premultiplied] = qt_blend_argb32_on_rgb16;
573 qBlendFunctions[QImage::Format_RGB16][QImage::Format_RGB16] = qt_blend_rgb16_on_rgb16;
574#if Q_BYTE_ORDER == Q_LITTLE_ENDIAN
575 qBlendFunctions[QImage::Format_RGBX8888][QImage::Format_RGBX8888] = qt_blend_rgb32_on_rgb32;
576 qBlendFunctions[QImage::Format_RGBX8888][QImage::Format_RGBA8888_Premultiplied] = qt_blend_argb32_on_argb32;
577 qBlendFunctions[QImage::Format_RGBA8888_Premultiplied][QImage::Format_RGBX8888] = qt_blend_rgb32_on_rgb32;
578 qBlendFunctions[QImage::Format_RGBA8888_Premultiplied][QImage::Format_RGBA8888_Premultiplied] = qt_blend_argb32_on_argb32;
579#endif
580
581 qTransformFunctions[QImage::Format_RGB32][QImage::Format_RGB32] = qt_transform_image_rgb32_on_rgb32;
582 qTransformFunctions[QImage::Format_RGB32][QImage::Format_ARGB32_Premultiplied] = qt_transform_image_argb32_on_argb32;
583 qTransformFunctions[QImage::Format_ARGB32_Premultiplied][QImage::Format_RGB32] = qt_transform_image_rgb32_on_rgb32;
584 qTransformFunctions[QImage::Format_ARGB32_Premultiplied][QImage::Format_ARGB32_Premultiplied] = qt_transform_image_argb32_on_argb32;
585 qTransformFunctions[QImage::Format_RGB16][QImage::Format_ARGB32_Premultiplied] = qt_transform_image_argb32_on_rgb16;
586 qTransformFunctions[QImage::Format_RGB16][QImage::Format_RGB16] = qt_transform_image_rgb16_on_rgb16;
587#if Q_BYTE_ORDER == Q_LITTLE_ENDIAN
588 qTransformFunctions[QImage::Format_RGBX8888][QImage::Format_RGBX8888] = qt_transform_image_rgb32_on_rgb32;
589 qTransformFunctions[QImage::Format_RGBX8888][QImage::Format_RGBA8888_Premultiplied] = qt_transform_image_argb32_on_argb32;
590 qTransformFunctions[QImage::Format_RGBA8888_Premultiplied][QImage::Format_RGBX8888] = qt_transform_image_rgb32_on_rgb32;
591 qTransformFunctions[QImage::Format_RGBA8888_Premultiplied][QImage::Format_RGBA8888_Premultiplied] = qt_transform_image_argb32_on_argb32;
592#endif
593}
594
595QT_END_NAMESPACE
596

source code of qtbase/src/gui/painting/qblendfunctions.cpp