source: trunk/src/gui/painting/qblendfunctions.cpp@ 5

Last change on this file since 5 was 2, checked in by Dmitry A. Kuminov, 16 years ago

Initially imported qt-all-opensource-src-4.5.1 from Trolltech.

File size: 49.0 KB
Line 
1/****************************************************************************
2**
3** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
4** Contact: Qt Software Information (qt-info@nokia.com)
5**
6** This file is part of the QtGui module of the Qt Toolkit.
7**
8** $QT_BEGIN_LICENSE:LGPL$
9** Commercial Usage
10** Licensees holding valid Qt Commercial licenses may use this file in
11** accordance with the Qt Commercial License Agreement provided with the
12** Software or, alternatively, in accordance with the terms contained in
13** a written agreement between you and Nokia.
14**
15** GNU Lesser General Public License Usage
16** Alternatively, this file may be used under the terms of the GNU Lesser
17** General Public License version 2.1 as published by the Free Software
18** Foundation and appearing in the file LICENSE.LGPL included in the
19** packaging of this file. Please review the following information to
20** ensure the GNU Lesser General Public License version 2.1 requirements
21** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
22**
23** In addition, as a special exception, Nokia gives you certain
24** additional rights. These rights are described in the Nokia Qt LGPL
25** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
26** package.
27**
28** GNU General Public License Usage
29** Alternatively, this file may be used under the terms of the GNU
30** General Public License version 3.0 as published by the Free Software
31** Foundation and appearing in the file LICENSE.GPL included in the
32** packaging of this file. Please review the following information to
33** ensure the GNU General Public License version 3.0 requirements will be
34** met: http://www.gnu.org/copyleft/gpl.html.
35**
36** If you are unsure which license is appropriate for your use, please
37** contact the sales department at qt-sales@nokia.com.
38** $QT_END_LICENSE$
39**
40****************************************************************************/
41
42#include <qmath.h>
43#include "qdrawhelper_p.h"
44
45QT_BEGIN_NAMESPACE
46
47
48// This ifdef is made with the best of intention. GCC fails to
49// optimzie the code properly so the bytemul approach is the fastest
50// it gets. Both on ARM and on MSVC the code is optimized to be better
51// than the bytemul approach... On the other hand... This code is
52// almost never run on i386 so it may be downright silly to have this
53// piece of code here...
54#if defined (Q_CC_GNU) && (defined (QT_ARCH_I386) || defined (QT_ARCH_X86_64))
55# define QT_BLEND_USE_BYTEMUL
56#endif
57
58// #define QT_DEBUG_DRAW
59
60static const qreal aliasedCoordinateDelta = 0.5 - 0.015625;
61
62struct SourceOnlyAlpha
63{
64 inline uchar alpha(uchar src) const { return src; }
65 inline quint16 bytemul(quint16 spix) const { return spix; }
66};
67
68
69struct SourceAndConstAlpha
70{
71 SourceAndConstAlpha(int a) : m_alpha256(a) {
72 m_alpha255 = (m_alpha256 * 255) >> 8;
73 };
74 inline uchar alpha(uchar src) const { return (src * m_alpha256) >> 8; }
75 inline quint16 bytemul(quint16 x) const {
76 uint t = (((x & 0x07e0)*m_alpha255) >> 8) & 0x07e0;
77 t |= (((x & 0xf81f)*(m_alpha255>>2)) >> 6) & 0xf81f;
78 return t;
79 }
80 int m_alpha255;
81 int m_alpha256;
82};
83
84
85/************************************************************************
86 RGB16 (565) format target format
87 ************************************************************************/
88
89static inline quint16 convert_argb32_to_rgb16(quint32 spix)
90{
91 quint32 b = spix;
92 quint32 g = spix;
93 b >>= 8;
94 g >>= 5;
95 b &= 0x0000f800;
96 g &= 0x000007e0;
97 spix >>= 3;
98 b |= g;
99 spix &= 0x0000001f;
100 b |= spix;
101 return b;
102}
103
104struct Blend_RGB16_on_RGB16_NoAlpha {
105 inline void write(quint16 *dst, quint16 src) { *dst = src; }
106};
107
108struct Blend_RGB16_on_RGB16_ConstAlpha {
109 inline Blend_RGB16_on_RGB16_ConstAlpha(quint32 alpha) {
110 m_alpha = (alpha * 255) >> 8;
111 m_ialpha = 255 - m_alpha;
112 }
113
114 inline void write(quint16 *dst, quint16 src) {
115 *dst = BYTE_MUL_RGB16(src, m_alpha) + BYTE_MUL_RGB16(*dst, m_ialpha);
116 }
117
118 quint32 m_alpha;
119 quint32 m_ialpha;
120};
121
122struct Blend_ARGB32_on_RGB16_SourceAlpha {
123 inline void write(quint16 *dst, quint32 src) {
124 const quint8 alpha = qAlpha(src);
125 if(alpha) {
126 quint16 s = convert_argb32_to_rgb16(src);
127 if(alpha < 255)
128 s += BYTE_MUL_RGB16(*dst, 255 - alpha);
129 *dst = s;
130 }
131 }
132};
133
134struct Blend_ARGB32_on_RGB16_SourceAndConstAlpha {
135 inline Blend_ARGB32_on_RGB16_SourceAndConstAlpha(quint32 alpha) {
136 m_alpha = (alpha * 255) >> 8;
137 }
138
139 inline void write(quint16 *dst, quint32 src) {
140 src = BYTE_MUL(src, m_alpha);
141 const quint8 alpha = qAlpha(src);
142 if(alpha) {
143 quint16 s = convert_argb32_to_rgb16(src);
144 if(alpha < 255)
145 s += BYTE_MUL_RGB16(*dst, 255 - alpha);
146 *dst = s;
147 }
148 }
149
150 quint32 m_alpha;
151};
152
153template <typename SRC, typename T>
154void qt_scale_image_16bit(uchar *destPixels, int dbpl,
155 const uchar *srcPixels, int sbpl,
156 const QRectF &target,
157 const QRectF &srcRect,
158 const QRect &clip,
159 T blender)
160{
161 const QRectF targetRect = target.translated(aliasedCoordinateDelta,
162 aliasedCoordinateDelta);
163
164 qreal sx = targetRect.width() / (qreal) srcRect.width();
165 qreal sy = targetRect.height() / (qreal) srcRect.height();
166
167 int ix = 0x00010000 / sx;
168 int iy = 0x00010000 / sy;
169
170// qDebug() << "scale:" << endl
171// << " - target" << targetRect << endl
172// << " - source" << srcRect << endl
173// << " - clip" << clip << endl
174// << " - sx=" << sx << " sy=" << sy << " ix=" << ix << " iy=" << iy;
175
176 int cx1 = clip.x();
177 int cx2 = clip.x() + clip.width();
178 int cy1 = clip.top();
179 int cy2 = clip.y() + clip.height();
180
181 int tx1 = qRound(targetRect.left());
182 int tx2 = qRound(targetRect.right());
183 int ty1 = qRound(targetRect.top());
184 int ty2 = qRound(targetRect.bottom());
185
186 if (tx2 < tx1)
187 qSwap(tx2, tx1);
188
189 if (ty2 < ty1)
190 qSwap(ty2, ty1);
191
192 if (tx1 < cx1)
193 tx1 = cx1;
194
195 if (tx2 >= cx2)
196 tx2 = cx2;
197
198 if (tx1 >= tx2)
199 return;
200
201 if (ty1 < cy1)
202 ty1 = cy1;
203
204 if (ty2 >= cy2)
205 ty2 = cy2;
206
207 if (ty1 >= ty2)
208 return;
209
210 int h = ty2 - ty1;
211 int w = tx2 - tx1;
212
213 const int dstx = int((tx1 + 0.5 - qMin(targetRect.left(), targetRect.right())) * ix);
214 const int dsty = int((ty1 + 0.5 - qMin(targetRect.top(), targetRect.bottom())) * iy);
215
216 quint32 basex = quint32((sx < 0 ? srcRect.right() : srcRect.left()) * 65536) + dstx;
217 quint32 srcy = quint32((sy < 0 ? srcRect.bottom() : srcRect.top()) * 65536) + dsty;
218
219 quint16 *dst = ((quint16 *) (destPixels + ty1 * dbpl)) + tx1;
220
221 while (h--) {
222 const SRC *src = (const SRC *) (srcPixels + (srcy >> 16) * sbpl);
223 int srcx = basex;
224 for (int x=0; x<w; ++x) {
225 blender.write(&dst[x], src[srcx >> 16]);
226 srcx += ix;
227 }
228 dst = (quint16 *)(((uchar *) dst) + dbpl);
229 srcy += iy;
230 }
231}
232
233void qt_scale_image_rgb16_on_rgb16(uchar *destPixels, int dbpl,
234 const uchar *srcPixels, int sbpl,
235 const QRectF &targetRect,
236 const QRectF &sourceRect,
237 const QRect &clip,
238 int const_alpha)
239{
240#ifdef QT_DEBUG_DRAW
241 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",
242 destPixels, dbpl, srcPixels, sbpl,
243 targetRect.x(), targetRect.y(), targetRect.width(), targetRect.height(),
244 sourceRect.x(), sourceRect.y(), sourceRect.width(), sourceRect.height(),
245 const_alpha);
246#endif
247 if (const_alpha == 256) {
248 Blend_RGB16_on_RGB16_NoAlpha noAlpha;
249 qt_scale_image_16bit<quint16>(destPixels, dbpl, srcPixels, sbpl,
250 targetRect, sourceRect, clip, noAlpha);
251 } else {
252 Blend_RGB16_on_RGB16_ConstAlpha constAlpha(const_alpha);
253 qt_scale_image_16bit<quint16>(destPixels, dbpl, srcPixels, sbpl,
254 targetRect, sourceRect, clip, constAlpha);
255 }
256}
257
258void qt_scale_image_argb32_on_rgb16(uchar *destPixels, int dbpl,
259 const uchar *srcPixels, int sbpl,
260 const QRectF &targetRect,
261 const QRectF &sourceRect,
262 const QRect &clip,
263 int const_alpha)
264{
265#ifdef QT_DEBUG_DRAW
266 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",
267 destPixels, dbpl, srcPixels, sbpl,
268 targetRect.x(), targetRect.y(), targetRect.width(), targetRect.height(),
269 sourceRect.x(), sourceRect.y(), sourceRect.width(), sourceRect.height(),
270 const_alpha);
271#endif
272 if (const_alpha == 256) {
273 Blend_ARGB32_on_RGB16_SourceAlpha noAlpha;
274 qt_scale_image_16bit<quint32>(destPixels, dbpl, srcPixels, sbpl,
275 targetRect, sourceRect, clip, noAlpha);
276 } else {
277 Blend_ARGB32_on_RGB16_SourceAndConstAlpha constAlpha(const_alpha);
278 qt_scale_image_16bit<quint32>(destPixels, dbpl, srcPixels, sbpl,
279 targetRect, sourceRect, clip, constAlpha);
280 }
281}
282
283static void qt_blend_rgb16_on_rgb16(uchar *dst, int dbpl,
284 const uchar *src, int sbpl,
285 int w, int h,
286 int const_alpha)
287{
288#ifdef QT_DEBUG_DRAW
289 printf("qt_blend_argb16_on_rgb16: dst=(%p, %d), src=(%p, %d), dim=(%d, %d) alpha=%d\n",
290 dst, dbpl, src, sbpl, w, h, const_alpha);
291#endif
292
293 if (const_alpha == 256) {
294 if (w <= 64) {
295 while (h--) {
296 QT_MEMCPY_USHORT(dst, src, w);
297 dst += dbpl;
298 src += sbpl;
299 }
300 } else {
301 int length = w << 1;
302 while (h--) {
303 memcpy(dst, src, length);
304 dst += dbpl;
305 src += sbpl;
306 }
307 }
308 } else if (const_alpha != 0) {
309 SourceAndConstAlpha alpha(const_alpha); // expects the 0-256 range
310 quint16 *d = (quint16 *) dst;
311 const quint16 *s = (const quint16 *) src;
312 quint8 a = (255 * const_alpha) >> 8;
313 quint8 ia = 255 - a;
314 while (h--) {
315 for (int x=0; x<w; ++x) {
316 d[x] = BYTE_MUL_RGB16(s[x], a) + BYTE_MUL_RGB16(d[x], ia);
317 }
318 d = (quint16 *)(((uchar *) d) + dbpl);
319 s = (const quint16 *)(((const uchar *) s) + sbpl);
320 }
321 }
322}
323
324
325template <typename T> void qt_blend_argb24_on_rgb16(uchar *destPixels, int dbpl,
326 const uchar *srcPixels, int sbpl,
327 int w, int h, const T &alphaFunc)
328{
329 int srcOffset = w*3;
330 int dstJPL = dbpl / 2;
331 quint16 *dst = (quint16 *) destPixels;
332 int dstExtraStride = dstJPL - w;
333
334 for (int y=0; y<h; ++y) {
335 const uchar *src = srcPixels + y * sbpl;
336 const uchar *srcEnd = src + srcOffset;
337 while (src < srcEnd) {
338#if defined(QT_ARCH_ARM) || defined(QT_ARCH_POWERPC) || (defined(QT_ARCH_WINDOWSCE) && !defined(_X86_))
339 // non-16-bit aligned memory access is not possible on PowerPC &
340 // ARM <v6 (QT_ARCH_ARMV6)
341 quint16 spix = (quint16(src[2])<<8) + src[1];
342#else
343 quint16 spix = *(quint16 *) (src + 1);
344#endif
345 uchar alpha = alphaFunc.alpha(*src);
346
347 if (alpha == 255) {
348 *dst = spix;
349 } else if (alpha != 0) {
350#ifdef QT_BLEND_USE_BYTEMUL
351 // truncate green channel to avoid overflow
352 *dst = (alphaFunc.bytemul(spix) & 0xffdf)
353 + (quint16) qrgb565(*dst).byte_mul(qrgb565::ialpha(alpha));
354#else
355 quint16 dpix = *dst;
356 quint32 sia = 255 - alpha;
357
358 quint16 dr = (dpix & 0x0000f800);
359 quint16 dg = (dpix & 0x000007e0);
360 quint16 db = (dpix & 0x0000001f);
361
362 quint32 siar = dr * sia;
363 quint32 siag = dg * sia;
364 quint32 siab = db * sia;
365
366 quint32 rr = ((siar + (siar>>8) + (0x80 << 11)) >> 8) & 0xf800;
367 quint32 rg = ((siag + (siag>>8) + (0x80 << 5)) >> 8) & 0x07e0;
368 quint32 rb = ((siab + (siab>>8) + (0x80 >> 3)) >> 8);
369
370 *dst = alphaFunc.bytemul(spix) + rr + rg + rb;
371#endif
372 }
373
374 ++dst;
375 src += 3;
376 }
377 dst += dstExtraStride;
378 }
379
380}
381
382static void qt_blend_argb24_on_rgb16(uchar *destPixels, int dbpl,
383 const uchar *srcPixels, int sbpl,
384 int w, int h,
385 int const_alpha)
386{
387#ifdef QT_DEBUG_DRAW
388 printf("qt_blend_argb24_on_rgb16: dst=(%p, %d), src=(%p, %d), dim=(%d, %d) alpha=%d\n",
389 destPixels, dbpl, srcPixels, sbpl, w, h, const_alpha);
390#endif
391
392 if (const_alpha != 256) {
393 SourceAndConstAlpha alphaFunc(const_alpha);
394 qt_blend_argb24_on_rgb16(destPixels, dbpl, srcPixels, sbpl, w, h, alphaFunc);
395 } else {
396 SourceOnlyAlpha alphaFunc;
397 qt_blend_argb24_on_rgb16(destPixels, dbpl, srcPixels, sbpl, w, h, alphaFunc);
398 }
399}
400
401
402
403
404static void qt_blend_argb32_on_rgb16_const_alpha(uchar *destPixels, int dbpl,
405 const uchar *srcPixels, int sbpl,
406 int w, int h,
407 int const_alpha)
408{
409 quint16 *dst = (quint16 *) destPixels;
410 const quint32 *src = (const quint32 *) srcPixels;
411
412 const_alpha = (const_alpha * 255) >> 8;
413 for (int y=0; y<h; ++y) {
414 for (int i = 0; i < w; ++i) {
415 uint s = src[i];
416 s = BYTE_MUL(s, const_alpha);
417 int alpha = qAlpha(s);
418 s = convert_argb32_to_rgb16(s);
419 s += BYTE_MUL_RGB16(dst[i], 255 - alpha);
420 dst[i] = s;
421 }
422 dst = (quint16 *)(((uchar *) dst) + dbpl);
423 src = (const quint32 *)(((const uchar *) src) + sbpl);
424 }
425}
426
427static void qt_blend_argb32_on_rgb16(uchar *destPixels, int dbpl,
428 const uchar *srcPixels, int sbpl,
429 int w, int h,
430 int const_alpha)
431{
432 if (const_alpha != 256) {
433 qt_blend_argb32_on_rgb16_const_alpha(destPixels, dbpl, srcPixels, sbpl, w, h, const_alpha);
434 return;
435 }
436
437 quint16 *dst = (quint16 *) destPixels;
438 int dstExtraStride = dbpl / 2 - w;
439
440 const quint32 *src = (const quint32 *) srcPixels;
441 int srcExtraStride = sbpl / 4 - w;
442
443 for (int y=0; y<h; ++y) {
444 int length = w;
445 const int dstAlign = ((quintptr)dst) & 0x3;
446 if (dstAlign) {
447 const quint8 alpha = qAlpha(*src);
448 if (alpha) {
449 quint16 s = convert_argb32_to_rgb16(*src);
450 if (alpha < 255)
451 s += BYTE_MUL_RGB16(*dst, 255 - alpha);
452 *dst = s;
453 }
454 ++dst;
455 ++src;
456 --length;
457 }
458
459 const int length32 = length >> 1;
460 const int srcAlign = ((quintptr)src) & 0x3;
461 if (length32) {
462 if (srcAlign) {
463 for (int i = 0; i < length32; ++i) {
464 quint32 *dest32 = reinterpret_cast<quint32*>(dst);
465 const quint8 a1 = qAlpha(src[0]);
466 const quint8 a2 = qAlpha(src[1]);
467 quint32 s;
468
469 if (!a1 && !a2) {
470 src += 2;
471 dst +=2;
472 continue;
473 }
474
475 s = convert_argb32_to_rgb16(src[0])
476 | (convert_argb32_to_rgb16(src[1]) << 16);
477
478 if (a1 == a2) {
479 if (a1 < 255) {
480 const quint8 sa = ((255 - a1)+1) >> 3;
481 s += BYTE_MUL_RGB16_32(*dest32, sa);
482 }
483 } else {
484 if (a1 < 255)
485 s += BYTE_MUL_RGB16(dst[0], 255 - a1);
486 if (a2 < 255)
487 s += BYTE_MUL_RGB16(dst[1], 255 - a2) << 16;
488 }
489
490 *dest32 = s;
491 src += 2;
492 dst += 2;
493 }
494 } else {
495 for (int i = 0; i < length32; ++i) {
496 quint32 *dest32 = reinterpret_cast<quint32*>(dst);
497 const quint8 a1 = qAlpha(src[0]);
498 const quint8 a2 = qAlpha(src[1]);
499 quint32 s;
500
501 if (!a1 && !a2) {
502 src += 2;
503 dst +=2;
504 continue;
505 }
506
507 const quint64 *src64 =
508 reinterpret_cast<const quint64*>(src);
509 s = qConvertRgb32To16x2(*src64);
510
511 if (a1 == a2) {
512 if (a1 < 255) {
513 const quint8 sa = ((255 - a1)+1) >> 3;
514 s += BYTE_MUL_RGB16_32(*dest32, sa);
515 }
516 } else {
517 if (a1 < 255)
518 s += BYTE_MUL_RGB16(dst[0], 255 - a1);
519 if (a2 < 255)
520 s += BYTE_MUL_RGB16(dst[1], 255 - a2) << 16;
521 }
522
523 *dest32 = s;
524 src += 2;
525 dst += 2;
526 }
527 }
528 }
529 const int tail = length & 0x1;
530 if (tail) {
531 const quint8 alpha = qAlpha(*src);
532 if (alpha) {
533 quint16 s = convert_argb32_to_rgb16(*src);
534 if (alpha < 255)
535 s += BYTE_MUL_RGB16(*dst, 255 - alpha);
536 *dst = s;
537 }
538 ++dst;
539 ++src;
540 }
541 dst += dstExtraStride;
542 src += srcExtraStride;
543 }
544
545}
546
547
548static void qt_blend_rgb32_on_rgb16(uchar *destPixels, int dbpl,
549 const uchar *srcPixels, int sbpl,
550 int w, int h,
551 int const_alpha)
552{
553#ifdef QT_DEBUG_DRAW
554 printf("qt_blend_rgb32_on_rgb16: dst=(%p, %d), src=(%p, %d), dim=(%d, %d) alpha=%d\n",
555 destPixels, dbpl, srcPixels, sbpl, w, h, const_alpha);
556#endif
557
558 if (const_alpha != 256) {
559 qt_blend_argb32_on_rgb16(destPixels, dbpl, srcPixels, sbpl, w, h, const_alpha);
560 return;
561 }
562
563 const quint32 *src = (const quint32 *) srcPixels;
564 int srcExtraStride = (sbpl >> 2) - w;
565
566 int dstJPL = dbpl / 2;
567
568 quint16 *dst = (quint16 *) destPixels;
569 quint16 *dstEnd = dst + dstJPL * h;
570
571 int dstExtraStride = dstJPL - w;
572
573 while (dst < dstEnd) {
574 const quint32 *srcEnd = src + w;
575 while (src < srcEnd) {
576 *dst = convert_argb32_to_rgb16(*src);
577 ++dst;
578 ++src;
579 }
580 dst += dstExtraStride;
581 src += srcExtraStride;
582 }
583}
584
585
586
587/************************************************************************
588 RGB32 (-888) format target format
589 ************************************************************************/
590
591static void qt_blend_argb32_on_argb32(uchar *destPixels, int dbpl,
592 const uchar *srcPixels, int sbpl,
593 int w, int h,
594 int const_alpha)
595{
596#ifdef QT_DEBUG_DRAW
597 fprintf(stdout, "qt_blend_argb32_on_argb32: dst=(%p, %d), src=(%p, %d), dim=(%d, %d) alpha=%d\n",
598 destPixels, dbpl, srcPixels, sbpl, w, h, const_alpha);
599 fflush(stdout);
600#endif
601
602 const uint *src = (const uint *) srcPixels;
603 uint *dst = (uint *) destPixels;
604 if (const_alpha == 256) {
605 for (int y=0; y<h; ++y) {
606 for (int x=0; x<w; ++x) {
607 uint s = src[x];
608 if ((s & 0xff000000) == 0xff000000)
609 dst[x] = s;
610 else {
611 dst[x] = s + BYTE_MUL(dst[x], qAlpha(~s));
612 }
613 }
614 dst = (quint32 *)(((uchar *) dst) + dbpl);
615 src = (const quint32 *)(((const uchar *) src) + sbpl);
616 }
617 } else if (const_alpha != 0) {
618 const_alpha = (const_alpha * 255) >> 8;
619 for (int y=0; y<h; ++y) {
620 for (int x=0; x<w; ++x) {
621 uint s = BYTE_MUL(src[x], const_alpha);
622 dst[x] = s + BYTE_MUL(dst[x], qAlpha(~s));
623 }
624 dst = (quint32 *)(((uchar *) dst) + dbpl);
625 src = (const quint32 *)(((const uchar *) src) + sbpl);
626 }
627 }
628}
629
630
631static void qt_blend_rgb32_on_rgb32(uchar *destPixels, int dbpl,
632 const uchar *srcPixels, int sbpl,
633 int w, int h,
634 int const_alpha)
635{
636#ifdef QT_DEBUG_DRAW
637 fprintf(stdout, "qt_blend_rgb32_on_rgb32: dst=(%p, %d), src=(%p, %d), dim=(%d, %d) alpha=%d\n",
638 destPixels, dbpl, srcPixels, sbpl, w, h, const_alpha);
639 fflush(stdout);
640#endif
641
642 if (const_alpha != 256) {
643 qt_blend_argb32_on_argb32(destPixels, dbpl, srcPixels, sbpl, w, h, const_alpha);
644 return;
645 }
646
647 const uint *src = (const uint *) srcPixels;
648 uint *dst = (uint *) destPixels;
649 if (w <= 64) {
650 for (int y=0; y<h; ++y) {
651 qt_memconvert(dst, src, w);
652 dst = (quint32 *)(((uchar *) dst) + dbpl);
653 src = (const quint32 *)(((const uchar *) src) + sbpl);
654 }
655 } else {
656 int len = w * 4;
657 for (int y=0; y<h; ++y) {
658 memcpy(dst, src, len);
659 dst = (quint32 *)(((uchar *) dst) + dbpl);
660 src = (const quint32 *)(((const uchar *) src) + sbpl);
661 }
662 }
663}
664
665
666
667struct Blend_RGB32_on_RGB32_NoAlpha {
668 inline void write(quint32 *dst, quint32 src) { *dst = src; }
669};
670
671struct Blend_RGB32_on_RGB32_ConstAlpha {
672 inline Blend_RGB32_on_RGB32_ConstAlpha(quint32 alpha) {
673 m_alpha = (alpha * 255) >> 8;
674 m_ialpha = 255 - m_alpha;
675 }
676
677 inline void write(quint32 *dst, quint32 src) {
678 *dst = BYTE_MUL(src, m_alpha) + BYTE_MUL(*dst, m_ialpha);
679 }
680
681 quint32 m_alpha;
682 quint32 m_ialpha;
683};
684
685struct Blend_ARGB32_on_ARGB32_SourceAlpha {
686 inline void write(quint32 *dst, quint32 src) {
687 *dst = src + BYTE_MUL(*dst, qAlpha(~src));
688 }
689};
690
691struct Blend_ARGB32_on_ARGB32_SourceAndConstAlpha {
692 inline Blend_ARGB32_on_ARGB32_SourceAndConstAlpha(quint32 alpha) {
693 m_alpha = (alpha * 255) >> 8;
694 m_ialpha = 255 - m_alpha;
695 }
696
697 inline void write(quint32 *dst, quint32 src) {
698 src = BYTE_MUL(src, m_alpha);
699 *dst = src + BYTE_MUL(*dst, qAlpha(~src));
700 }
701
702 quint32 m_alpha;
703 quint32 m_ialpha;
704};
705
706template <typename T> void qt_scale_image_32bit(uchar *destPixels, int dbpl,
707 const uchar *srcPixels, int sbpl,
708 const QRectF &target,
709 const QRectF &srcRect,
710 const QRect &clip,
711 T blender)
712{
713 const QRectF targetRect = target.translated(aliasedCoordinateDelta,
714 aliasedCoordinateDelta);
715
716 qreal sx = targetRect.width() / (qreal) srcRect.width();
717 qreal sy = targetRect.height() / (qreal) srcRect.height();
718
719 int ix = 0x00010000 / sx;
720 int iy = 0x00010000 / sy;
721
722// qDebug() << "scale:" << endl
723// << " - target" << targetRect << endl
724// << " - source" << srcRect << endl
725// << " - clip" << clip << endl
726// << " - sx=" << sx << " sy=" << sy << " ix=" << ix << " iy=" << iy;
727
728 int cx1 = clip.x();
729 int cx2 = clip.x() + clip.width();
730 int cy1 = clip.top();
731 int cy2 = clip.y() + clip.height();
732
733 int tx1 = qRound(targetRect.left());
734 int tx2 = qRound(targetRect.right());
735 int ty1 = qRound(targetRect.top());
736 int ty2 = qRound(targetRect.bottom());
737
738 if (tx2 < tx1)
739 qSwap(tx2, tx1);
740
741 if (ty2 < ty1)
742 qSwap(ty2, ty1);
743
744 if (tx1 < cx1)
745 tx1 = cx1;
746
747 if (tx2 >= cx2)
748 tx2 = cx2;
749
750 if (tx1 >= tx2)
751 return;
752
753 if (ty1 < cy1)
754 ty1 = cy1;
755
756 if (ty2 >= cy2)
757 ty2 = cy2;
758
759 if (ty1 >= ty2)
760 return;
761
762 int h = ty2 - ty1;
763 int w = tx2 - tx1;
764
765 const int dstx = int((tx1 + 0.5 - qMin(targetRect.left(), targetRect.right())) * ix);
766 const int dsty = int((ty1 + 0.5 - qMin(targetRect.top(), targetRect.bottom())) * iy);
767
768 quint32 basex = quint32((sx < 0 ? srcRect.right() : srcRect.left()) * 65536) + dstx;
769 quint32 srcy = quint32((sy < 0 ? srcRect.bottom() : srcRect.top()) * 65536) + dsty;
770
771 quint32 *dst = ((quint32 *) (destPixels + ty1 * dbpl)) + tx1;
772
773 while (h--) {
774 const uint *src = (const quint32 *) (srcPixels + (srcy >> 16) * sbpl);
775 int srcx = basex;
776 for (int x=0; x<w; ++x) {
777 blender.write(&dst[x], src[srcx >> 16]);
778 srcx += ix;
779 }
780 dst = (quint32 *)(((uchar *) dst) + dbpl);
781 srcy += iy;
782 }
783}
784
785void qt_scale_image_rgb32_on_rgb32(uchar *destPixels, int dbpl,
786 const uchar *srcPixels, int sbpl,
787 const QRectF &targetRect,
788 const QRectF &sourceRect,
789 const QRect &clip,
790 int const_alpha)
791{
792#ifdef QT_DEBUG_DRAW
793 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",
794 destPixels, dbpl, srcPixels, sbpl,
795 targetRect.x(), targetRect.y(), targetRect.width(), targetRect.height(),
796 sourceRect.x(), sourceRect.y(), sourceRect.width(), sourceRect.height(),
797 const_alpha);
798#endif
799 if (const_alpha == 256) {
800 Blend_RGB32_on_RGB32_NoAlpha noAlpha;
801 qt_scale_image_32bit(destPixels, dbpl, srcPixels, sbpl,
802 targetRect, sourceRect, clip, noAlpha);
803 } else {
804 Blend_RGB32_on_RGB32_ConstAlpha constAlpha(const_alpha);
805 qt_scale_image_32bit(destPixels, dbpl, srcPixels, sbpl,
806 targetRect, sourceRect, clip, constAlpha);
807 }
808}
809
810void qt_scale_image_argb32_on_argb32(uchar *destPixels, int dbpl,
811 const uchar *srcPixels, int sbpl,
812 const QRectF &targetRect,
813 const QRectF &sourceRect,
814 const QRect &clip,
815 int const_alpha)
816{
817#ifdef QT_DEBUG_DRAW
818 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",
819 destPixels, dbpl, srcPixels, sbpl,
820 targetRect.x(), targetRect.y(), targetRect.width(), targetRect.height(),
821 sourceRect.x(), sourceRect.y(), sourceRect.width(), sourceRect.height(),
822 const_alpha);
823#endif
824 if (const_alpha == 256) {
825 Blend_ARGB32_on_ARGB32_SourceAlpha sourceAlpha;
826 qt_scale_image_32bit(destPixels, dbpl, srcPixels, sbpl,
827 targetRect, sourceRect, clip, sourceAlpha);
828 } else {
829 Blend_ARGB32_on_ARGB32_SourceAndConstAlpha constAlpha(const_alpha);
830 qt_scale_image_32bit(destPixels, dbpl, srcPixels, sbpl,
831 targetRect, sourceRect, clip, constAlpha);
832 }
833}
834
835
836
837SrcOverScaleFunc qScaleFunctions[QImage::NImageFormats][QImage::NImageFormats] = {
838 { // Format_Invalid
839 0, // Format_Invalid,
840 0, // Format_Mono,
841 0, // Format_MonoLSB,
842 0, // Format_Indexed8,
843 0, // Format_RGB32,
844 0, // Format_ARGB32,
845 0, // Format_ARGB32_Premultiplied,
846 0, // Format_RGB16,
847 0, // Format_ARGB8565_Premultiplied,
848 0, // Format_RGB666,
849 0, // Format_ARGB6666_Premultiplied,
850 0, // Format_RGB555,
851 0, // Format_ARGB8555_Premultiplied,
852 0, // Format_RGB888,
853 0, // Format_RGB444,
854 0 // Format_ARGB4444_Premultiplied,
855 },
856 { // Format_Mono
857 0, // Format_Invalid,
858 0, // Format_Mono,
859 0, // Format_MonoLSB,
860 0, // Format_Indexed8,
861 0, // Format_RGB32,
862 0, // Format_ARGB32,
863 0, // Format_ARGB32_Premultiplied,
864 0, // Format_RGB16,
865 0, // Format_ARGB8565_Premultiplied,
866 0, // Format_RGB666,
867 0, // Format_ARGB6666_Premultiplied,
868 0, // Format_RGB555,
869 0, // Format_ARGB8555_Premultiplied,
870 0, // Format_RGB888,
871 0, // Format_RGB444,
872 0 // Format_ARGB4444_Premultiplied,
873 },
874 { // Format_MonoLSB
875 0, // Format_Invalid,
876 0, // Format_Mono,
877 0, // Format_MonoLSB,
878 0, // Format_Indexed8,
879 0, // Format_RGB32,
880 0, // Format_ARGB32,
881 0, // Format_ARGB32_Premultiplied,
882 0, // Format_RGB16,
883 0, // Format_ARGB8565_Premultiplied,
884 0, // Format_RGB666,
885 0, // Format_ARGB6666_Premultiplied,
886 0, // Format_RGB555,
887 0, // Format_ARGB8555_Premultiplied,
888 0, // Format_RGB888,
889 0, // Format_RGB444,
890 0 // Format_ARGB4444_Premultiplied,
891 },
892 { // Format_Indexed8
893 0, // Format_Invalid,
894 0, // Format_Mono,
895 0, // Format_MonoLSB,
896 0, // Format_Indexed8,
897 0, // Format_RGB32,
898 0, // Format_ARGB32,
899 0, // Format_ARGB32_Premultiplied,
900 0, // Format_RGB16,
901 0, // Format_ARGB8565_Premultiplied,
902 0, // Format_RGB666,
903 0, // Format_ARGB6666_Premultiplied,
904 0, // Format_RGB555,
905 0, // Format_ARGB8555_Premultiplied,
906 0, // Format_RGB888,
907 0, // Format_RGB444,
908 0 // Format_ARGB4444_Premultiplied,
909 },
910 { // Format_RGB32
911 0, // Format_Invalid,
912 0, // Format_Mono,
913 0, // Format_MonoLSB,
914 0, // Format_Indexed8,
915 qt_scale_image_rgb32_on_rgb32, // Format_RGB32,
916 0, // Format_ARGB32,
917 qt_scale_image_argb32_on_argb32, // Format_ARGB32_Premultiplied,
918 0, // Format_RGB16,
919 0, // Format_ARGB8565_Premultiplied,
920 0, // Format_RGB666,
921 0, // Format_ARGB6666_Premultiplied,
922 0, // Format_RGB555,
923 0, // Format_ARGB8555_Premultiplied,
924 0, // Format_RGB888,
925 0, // Format_RGB444,
926 0 // Format_ARGB4444_Premultiplied,
927 },
928 { // Format_ARGB32
929 0, // Format_Invalid,
930 0, // Format_Mono,
931 0, // Format_MonoLSB,
932 0, // Format_Indexed8,
933 0, // Format_RGB32,
934 0, // Format_ARGB32,
935 0, // Format_ARGB32_Premultiplied,
936 0, // Format_RGB16,
937 0, // Format_ARGB8565_Premultiplied,
938 0, // Format_RGB666,
939 0, // Format_ARGB6666_Premultiplied,
940 0, // Format_RGB555,
941 0, // Format_ARGB8555_Premultiplied,
942 0, // Format_RGB888,
943 0, // Format_RGB444,
944 0 // Format_ARGB4444_Premultiplied,
945 },
946 { // Format_ARGB32_Premultiplied
947 0, // Format_Invalid,
948 0, // Format_Mono,
949 0, // Format_MonoLSB,
950 0, // Format_Indexed8,
951 qt_scale_image_rgb32_on_rgb32, // Format_RGB32,
952 0, // Format_ARGB32,
953 qt_scale_image_argb32_on_argb32, // Format_ARGB32_Premultiplied,
954 0, // Format_RGB16,
955 0, // Format_ARGB8565_Premultiplied,
956 0, // Format_RGB666,
957 0, // Format_ARGB6666_Premultiplied,
958 0, // Format_RGB555,
959 0, // Format_ARGB8555_Premultiplied,
960 0, // Format_RGB888,
961 0, // Format_RGB444,
962 0 // Format_ARGB4444_Premultiplied,
963 },
964 { // Format_RGB16
965 0, // Format_Invalid,
966 0, // Format_Mono,
967 0, // Format_MonoLSB,
968 0, // Format_Indexed8,
969 0, // Format_RGB32,
970 0, // Format_ARGB32,
971 qt_scale_image_argb32_on_rgb16, // Format_ARGB32_Premultiplied,
972 qt_scale_image_rgb16_on_rgb16, // Format_RGB16,
973 0, // Format_ARGB8565_Premultiplied,
974 0, // Format_RGB666,
975 0, // Format_ARGB6666_Premultiplied,
976 0, // Format_RGB555,
977 0, // Format_ARGB8555_Premultiplied,
978 0, // Format_RGB888,
979 0, // Format_RGB444,
980 0 // Format_ARGB4444_Premultiplied,
981 },
982 { // Format_ARGB8565_Premultiplied
983 0, // Format_Invalid,
984 0, // Format_Mono,
985 0, // Format_MonoLSB,
986 0, // Format_Indexed8,
987 0, // Format_RGB32,
988 0, // Format_ARGB32,
989 0, // Format_ARGB32_Premultiplied,
990 0, // Format_RGB16,
991 0, // Format_ARGB8565_Premultiplied,
992 0, // Format_RGB666,
993 0, // Format_ARGB6666_Premultiplied,
994 0, // Format_RGB555,
995 0, // Format_ARGB8555_Premultiplied,
996 0, // Format_RGB888,
997 0, // Format_RGB444,
998 0 // Format_ARGB4444_Premultiplied,
999 },
1000 { // Format_RGB666
1001 0, // Format_Invalid,
1002 0, // Format_Mono,
1003 0, // Format_MonoLSB,
1004 0, // Format_Indexed8,
1005 0, // Format_RGB32,
1006 0, // Format_ARGB32,
1007 0, // Format_ARGB32_Premultiplied,
1008 0, // Format_RGB16,
1009 0, // Format_ARGB8565_Premultiplied,
1010 0, // Format_RGB666,
1011 0, // Format_ARGB6666_Premultiplied,
1012 0, // Format_RGB555,
1013 0, // Format_ARGB8555_Premultiplied,
1014 0, // Format_RGB888,
1015 0, // Format_RGB444,
1016 0 // Format_ARGB4444_Premultiplied,
1017 },
1018 { // Format_ARGB6666_Premultiplied
1019 0, // Format_Invalid,
1020 0, // Format_Mono,
1021 0, // Format_MonoLSB,
1022 0, // Format_Indexed8,
1023 0, // Format_RGB32,
1024 0, // Format_ARGB32,
1025 0, // Format_ARGB32_Premultiplied,
1026 0, // Format_RGB16,
1027 0, // Format_ARGB8565_Premultiplied,
1028 0, // Format_RGB666,
1029 0, // Format_ARGB6666_Premultiplied,
1030 0, // Format_RGB555,
1031 0, // Format_ARGB8555_Premultiplied,
1032 0, // Format_RGB888,
1033 0, // Format_RGB444,
1034 0 // Format_ARGB4444_Premultiplied,
1035 },
1036 { // Format_RGB555
1037 0, // Format_Invalid,
1038 0, // Format_Mono,
1039 0, // Format_MonoLSB,
1040 0, // Format_Indexed8,
1041 0, // Format_RGB32,
1042 0, // Format_ARGB32,
1043 0, // Format_ARGB32_Premultiplied,
1044 0, // Format_RGB16,
1045 0, // Format_ARGB8565_Premultiplied,
1046 0, // Format_RGB666,
1047 0, // Format_ARGB6666_Premultiplied,
1048 0, // Format_RGB555,
1049 0, // Format_ARGB8555_Premultiplied,
1050 0, // Format_RGB888,
1051 0, // Format_RGB444,
1052 0 // Format_ARGB4444_Premultiplied,
1053 },
1054 { // Format_ARGB8555_Premultiplied
1055 0, // Format_Invalid,
1056 0, // Format_Mono,
1057 0, // Format_MonoLSB,
1058 0, // Format_Indexed8,
1059 0, // Format_RGB32,
1060 0, // Format_ARGB32,
1061 0, // Format_ARGB32_Premultiplied,
1062 0, // Format_RGB16,
1063 0, // Format_ARGB8565_Premultiplied,
1064 0, // Format_RGB666,
1065 0, // Format_ARGB6666_Premultiplied,
1066 0, // Format_RGB555,
1067 0, // Format_ARGB8555_Premultiplied,
1068 0, // Format_RGB888,
1069 0, // Format_RGB444,
1070 0 // Format_ARGB4444_Premultiplied,
1071 },
1072 { // Format_RGB888
1073 0, // Format_Invalid,
1074 0, // Format_Mono,
1075 0, // Format_MonoLSB,
1076 0, // Format_Indexed8,
1077 0, // Format_RGB32,
1078 0, // Format_ARGB32,
1079 0, // Format_ARGB32_Premultiplied,
1080 0, // Format_RGB16,
1081 0, // Format_ARGB8565_Premultiplied,
1082 0, // Format_RGB666,
1083 0, // Format_ARGB6666_Premultiplied,
1084 0, // Format_RGB555,
1085 0, // Format_ARGB8555_Premultiplied,
1086 0, // Format_RGB888,
1087 0, // Format_RGB444,
1088 0 // Format_ARGB4444_Premultiplied,
1089 },
1090 { // Format_RGB444
1091 0, // Format_Invalid,
1092 0, // Format_Mono,
1093 0, // Format_MonoLSB,
1094 0, // Format_Indexed8,
1095 0, // Format_RGB32,
1096 0, // Format_ARGB32,
1097 0, // Format_ARGB32_Premultiplied,
1098 0, // Format_RGB16,
1099 0, // Format_ARGB8565_Premultiplied,
1100 0, // Format_RGB666,
1101 0, // Format_ARGB6666_Premultiplied,
1102 0, // Format_RGB555,
1103 0, // Format_ARGB8555_Premultiplied,
1104 0, // Format_RGB888,
1105 0, // Format_RGB444,
1106 0 // Format_ARGB4444_Premultiplied,
1107 },
1108 { // Format_ARGB4444_Premultiplied
1109 0, // Format_Invalid,
1110 0, // Format_Mono,
1111 0, // Format_MonoLSB,
1112 0, // Format_Indexed8,
1113 0, // Format_RGB32,
1114 0, // Format_ARGB32,
1115 0, // Format_ARGB32_Premultiplied,
1116 0, // Format_RGB16,
1117 0, // Format_ARGB8565_Premultiplied,
1118 0, // Format_RGB666,
1119 0, // Format_ARGB6666_Premultiplied,
1120 0, // Format_RGB555,
1121 0, // Format_ARGB8555_Premultiplied,
1122 0, // Format_RGB888,
1123 0, // Format_RGB444,
1124 0 // Format_ARGB4444_Premultiplied,
1125 }
1126};
1127
1128
1129SrcOverBlendFunc qBlendFunctions[QImage::NImageFormats][QImage::NImageFormats] = {
1130 { // Format_Invalid
1131 0, // Format_Invalid,
1132 0, // Format_Mono,
1133 0, // Format_MonoLSB,
1134 0, // Format_Indexed8,
1135 0, // Format_RGB32,
1136 0, // Format_ARGB32,
1137 0, // Format_ARGB32_Premultiplied,
1138 0, // Format_RGB16,
1139 0, // Format_ARGB8565_Premultiplied,
1140 0, // Format_RGB666,
1141 0, // Format_ARGB6666_Premultiplied,
1142 0, // Format_RGB555,
1143 0, // Format_ARGB8555_Premultiplied,
1144 0, // Format_RGB888,
1145 0, // Format_RGB444,
1146 0 // Format_ARGB4444_Premultiplied,
1147 },
1148 { // Format_Mono
1149 0, // Format_Invalid,
1150 0, // Format_Mono,
1151 0, // Format_MonoLSB,
1152 0, // Format_Indexed8,
1153 0, // Format_RGB32,
1154 0, // Format_ARGB32,
1155 0, // Format_ARGB32_Premultiplied,
1156 0, // Format_RGB16,
1157 0, // Format_ARGB8565_Premultiplied,
1158 0, // Format_RGB666,
1159 0, // Format_ARGB6666_Premultiplied,
1160 0, // Format_RGB555,
1161 0, // Format_ARGB8555_Premultiplied,
1162 0, // Format_RGB888,
1163 0, // Format_RGB444,
1164 0 // Format_ARGB4444_Premultiplied,
1165 },
1166 { // Format_MonoLSB
1167 0, // Format_Invalid,
1168 0, // Format_Mono,
1169 0, // Format_MonoLSB,
1170 0, // Format_Indexed8,
1171 0, // Format_RGB32,
1172 0, // Format_ARGB32,
1173 0, // Format_ARGB32_Premultiplied,
1174 0, // Format_RGB16,
1175 0, // Format_ARGB8565_Premultiplied,
1176 0, // Format_RGB666,
1177 0, // Format_ARGB6666_Premultiplied,
1178 0, // Format_RGB555,
1179 0, // Format_ARGB8555_Premultiplied,
1180 0, // Format_RGB888,
1181 0, // Format_RGB444,
1182 0 // Format_ARGB4444_Premultiplied,
1183 },
1184 { // Format_Indexed8
1185 0, // Format_Invalid,
1186 0, // Format_Mono,
1187 0, // Format_MonoLSB,
1188 0, // Format_Indexed8,
1189 0, // Format_RGB32,
1190 0, // Format_ARGB32,
1191 0, // Format_ARGB32_Premultiplied,
1192 0, // Format_RGB16,
1193 0, // Format_ARGB8565_Premultiplied,
1194 0, // Format_RGB666,
1195 0, // Format_ARGB6666_Premultiplied,
1196 0, // Format_RGB555,
1197 0, // Format_ARGB8555_Premultiplied,
1198 0, // Format_RGB888,
1199 0, // Format_RGB444,
1200 0 // Format_ARGB4444_Premultiplied,
1201 },
1202 { // Format_RGB32
1203 0, // Format_Invalid,
1204 0, // Format_Mono,
1205 0, // Format_MonoLSB,
1206 0, // Format_Indexed8,
1207 qt_blend_rgb32_on_rgb32, // Format_RGB32,
1208 0, // Format_ARGB32,
1209 qt_blend_argb32_on_argb32, // Format_ARGB32_Premultiplied,
1210 0, // Format_RGB16,
1211 0, // Format_ARGB8565_Premultiplied,
1212 0, // Format_RGB666,
1213 0, // Format_ARGB6666_Premultiplied,
1214 0, // Format_RGB555,
1215 0, // Format_ARGB8555_Premultiplied,
1216 0, // Format_RGB888,
1217 0, // Format_RGB444,
1218 0 // Format_ARGB4444_Premultiplied,
1219 },
1220 { // Format_ARGB32
1221 0, // Format_Invalid,
1222 0, // Format_Mono,
1223 0, // Format_MonoLSB,
1224 0, // Format_Indexed8,
1225 0, // Format_RGB32,
1226 0, // Format_ARGB32,
1227 0, // Format_ARGB32_Premultiplied,
1228 0, // Format_RGB16,
1229 0, // Format_ARGB8565_Premultiplied,
1230 0, // Format_RGB666,
1231 0, // Format_ARGB6666_Premultiplied,
1232 0, // Format_RGB555,
1233 0, // Format_ARGB8555_Premultiplied,
1234 0, // Format_RGB888,
1235 0, // Format_RGB444,
1236 0 // Format_ARGB4444_Premultiplied,
1237 },
1238 { // Format_ARGB32_Premultiplied
1239 0, // Format_Invalid,
1240 0, // Format_Mono,
1241 0, // Format_MonoLSB,
1242 0, // Format_Indexed8,
1243 qt_blend_rgb32_on_rgb32, // Format_RGB32,
1244 0, // Format_ARGB32,
1245 qt_blend_argb32_on_argb32, // Format_ARGB32_Premultiplied,
1246 0, // Format_RGB16,
1247 0, // Format_ARGB8565_Premultiplied,
1248 0, // Format_RGB666,
1249 0, // Format_ARGB6666_Premultiplied,
1250 0, // Format_RGB555,
1251 0, // Format_ARGB8555_Premultiplied,
1252 0, // Format_RGB888,
1253 0, // Format_RGB444,
1254 0 // Format_ARGB4444_Premultiplied,
1255 },
1256 { // Format_RGB16
1257 0, // Format_Invalid,
1258 0, // Format_Mono,
1259 0, // Format_MonoLSB,
1260 0, // Format_Indexed8,
1261 qt_blend_rgb32_on_rgb16, // Format_RGB32,
1262 0, // Format_ARGB32,
1263 qt_blend_argb32_on_rgb16, // Format_ARGB32_Premultiplied,
1264 qt_blend_rgb16_on_rgb16, // Format_RGB16,
1265 qt_blend_argb24_on_rgb16, // Format_ARGB8565_Premultiplied,
1266 0, // Format_RGB666,
1267 0, // Format_ARGB6666_Premultiplied,
1268 0, // Format_RGB555,
1269 0, // Format_ARGB8555_Premultiplied,
1270 0, // Format_RGB888,
1271 0, // Format_RGB444,
1272 0 // Format_ARGB4444_Premultiplied,
1273 },
1274 { // Format_ARGB8565_Premultiplied
1275 0, // Format_Invalid,
1276 0, // Format_Mono,
1277 0, // Format_MonoLSB,
1278 0, // Format_Indexed8,
1279 0, // Format_RGB32,
1280 0, // Format_ARGB32,
1281 0, // Format_ARGB32_Premultiplied,
1282 0, // Format_RGB16,
1283 0, // Format_ARGB8565_Premultiplied,
1284 0, // Format_RGB666,
1285 0, // Format_ARGB6666_Premultiplied,
1286 0, // Format_RGB555,
1287 0, // Format_ARGB8555_Premultiplied,
1288 0, // Format_RGB888,
1289 0, // Format_RGB444,
1290 0 // Format_ARGB4444_Premultiplied,
1291 },
1292 { // Format_RGB666
1293 0, // Format_Invalid,
1294 0, // Format_Mono,
1295 0, // Format_MonoLSB,
1296 0, // Format_Indexed8,
1297 0, // Format_RGB32,
1298 0, // Format_ARGB32,
1299 0, // Format_ARGB32_Premultiplied,
1300 0, // Format_RGB16,
1301 0, // Format_ARGB8565_Premultiplied,
1302 0, // Format_RGB666,
1303 0, // Format_ARGB6666_Premultiplied,
1304 0, // Format_RGB555,
1305 0, // Format_ARGB8555_Premultiplied,
1306 0, // Format_RGB888,
1307 0, // Format_RGB444,
1308 0 // Format_ARGB4444_Premultiplied,
1309 },
1310 { // Format_ARGB6666_Premultiplied
1311 0, // Format_Invalid,
1312 0, // Format_Mono,
1313 0, // Format_MonoLSB,
1314 0, // Format_Indexed8,
1315 0, // Format_RGB32,
1316 0, // Format_ARGB32,
1317 0, // Format_ARGB32_Premultiplied,
1318 0, // Format_RGB16,
1319 0, // Format_ARGB8565_Premultiplied,
1320 0, // Format_RGB666,
1321 0, // Format_ARGB6666_Premultiplied,
1322 0, // Format_RGB555,
1323 0, // Format_ARGB8555_Premultiplied,
1324 0, // Format_RGB888,
1325 0, // Format_RGB444,
1326 0 // Format_ARGB4444_Premultiplied,
1327 },
1328 { // Format_RGB555
1329 0, // Format_Invalid,
1330 0, // Format_Mono,
1331 0, // Format_MonoLSB,
1332 0, // Format_Indexed8,
1333 0, // Format_RGB32,
1334 0, // Format_ARGB32,
1335 0, // Format_ARGB32_Premultiplied,
1336 0, // Format_RGB16,
1337 0, // Format_ARGB8565_Premultiplied,
1338 0, // Format_RGB666,
1339 0, // Format_ARGB6666_Premultiplied,
1340 0, // Format_RGB555,
1341 0, // Format_ARGB8555_Premultiplied,
1342 0, // Format_RGB888,
1343 0, // Format_RGB444,
1344 0 // Format_ARGB4444_Premultiplied,
1345 },
1346 { // Format_ARGB8555_Premultiplied
1347 0, // Format_Invalid,
1348 0, // Format_Mono,
1349 0, // Format_MonoLSB,
1350 0, // Format_Indexed8,
1351 0, // Format_RGB32,
1352 0, // Format_ARGB32,
1353 0, // Format_ARGB32_Premultiplied,
1354 0, // Format_RGB16,
1355 0, // Format_ARGB8565_Premultiplied,
1356 0, // Format_RGB666,
1357 0, // Format_ARGB6666_Premultiplied,
1358 0, // Format_RGB555,
1359 0, // Format_ARGB8555_Premultiplied,
1360 0, // Format_RGB888,
1361 0, // Format_RGB444,
1362 0 // Format_ARGB4444_Premultiplied,
1363 },
1364 { // Format_RGB888
1365 0, // Format_Invalid,
1366 0, // Format_Mono,
1367 0, // Format_MonoLSB,
1368 0, // Format_Indexed8,
1369 0, // Format_RGB32,
1370 0, // Format_ARGB32,
1371 0, // Format_ARGB32_Premultiplied,
1372 0, // Format_RGB16,
1373 0, // Format_ARGB8565_Premultiplied,
1374 0, // Format_RGB666,
1375 0, // Format_ARGB6666_Premultiplied,
1376 0, // Format_RGB555,
1377 0, // Format_ARGB8555_Premultiplied,
1378 0, // Format_RGB888,
1379 0, // Format_RGB444,
1380 0 // Format_ARGB4444_Premultiplied,
1381 },
1382 { // Format_RGB444
1383 0, // Format_Invalid,
1384 0, // Format_Mono,
1385 0, // Format_MonoLSB,
1386 0, // Format_Indexed8,
1387 0, // Format_RGB32,
1388 0, // Format_ARGB32,
1389 0, // Format_ARGB32_Premultiplied,
1390 0, // Format_RGB16,
1391 0, // Format_ARGB8565_Premultiplied,
1392 0, // Format_RGB666,
1393 0, // Format_ARGB6666_Premultiplied,
1394 0, // Format_RGB555,
1395 0, // Format_ARGB8555_Premultiplied,
1396 0, // Format_RGB888,
1397 0, // Format_RGB444,
1398 0 // Format_ARGB4444_Premultiplied,
1399 },
1400 { // Format_ARGB4444_Premultiplied
1401 0, // Format_Invalid,
1402 0, // Format_Mono,
1403 0, // Format_MonoLSB,
1404 0, // Format_Indexed8,
1405 0, // Format_RGB32,
1406 0, // Format_ARGB32,
1407 0, // Format_ARGB32_Premultiplied,
1408 0, // Format_RGB16,
1409 0, // Format_ARGB8565_Premultiplied,
1410 0, // Format_RGB666,
1411 0, // Format_ARGB6666_Premultiplied,
1412 0, // Format_RGB555,
1413 0, // Format_ARGB8555_Premultiplied,
1414 0, // Format_RGB888,
1415 0, // Format_RGB444,
1416 0 // Format_ARGB4444_Premultiplied,
1417 }
1418};
1419
1420
1421QT_END_NAMESPACE
Note: See TracBrowser for help on using the repository browser.