1 /****************************************************************************
3 ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
4 ** All rights reserved.
5 ** Contact: Nokia Corporation (qt-info@nokia.com)
7 ** This file is part of the QtGui module of the Qt Toolkit.
9 ** $QT_BEGIN_LICENSE:LGPL$
10 ** GNU Lesser General Public License Usage
11 ** This file may be used under the terms of the GNU Lesser General Public
12 ** License version 2.1 as published by the Free Software Foundation and
13 ** appearing in the file LICENSE.LGPL included in the packaging of this
14 ** file. Please review the following information to ensure the GNU Lesser
15 ** General Public License version 2.1 requirements will be met:
16 ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
18 ** In addition, as a special exception, Nokia gives you certain additional
19 ** rights. These rights are described in the Nokia Qt LGPL Exception
20 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
22 ** GNU General Public License Usage
23 ** Alternatively, this file may be used under the terms of the GNU General
24 ** Public License version 3.0 as published by the Free Software Foundation
25 ** and appearing in the file LICENSE.GPL included in the packaging of this
26 ** file. Please review the following information to ensure the GNU General
27 ** Public License version 3.0 requirements will be met:
28 ** http://www.gnu.org/copyleft/gpl.html.
31 ** Alternatively, this file may be used in accordance with the terms and
32 ** conditions contained in a signed written agreement between you and Nokia.
40 ****************************************************************************/
42 #ifndef QDRAWHELPER_P_H
43 #define QDRAWHELPER_P_H
49 // This file is not part of the Qt API. It exists purely as an
50 // implementation detail. This header file may change from version to
51 // version without notice, or even be removed.
56 #include "QtCore/qglobal.h"
57 #include "QtGui/qcolor.h"
58 #include "QtGui/qpainter.h"
59 #include "QtGui/qimage.h"
60 #ifndef QT_FT_BEGIN_HEADER
61 #define QT_FT_BEGIN_HEADER
62 #define QT_FT_END_HEADER
64 #include "private/qrasterdefs_p.h"
65 #include <private/qsimd_p.h>
66 #include <private/qmath_p.h>
69 #include "QtGui/qscreen_qws.h"
74 #if defined(Q_CC_MSVC) && _MSCVER <= 1300 && !defined(Q_CC_INTEL)
75 #define Q_STATIC_TEMPLATE_SPECIALIZATION static
77 #define Q_STATIC_TEMPLATE_SPECIALIZATION
80 #if defined(Q_CC_RVCT)
81 // RVCT doesn't like static template functions
82 # define Q_STATIC_TEMPLATE_FUNCTION
83 # define Q_STATIC_INLINE_FUNCTION static __forceinline
85 # define Q_STATIC_TEMPLATE_FUNCTION static
86 # define Q_STATIC_INLINE_FUNCTION static inline
89 static const uint AMASK = 0xff000000;
90 static const uint RMASK = 0x00ff0000;
91 static const uint GMASK = 0x0000ff00;
92 static const uint BMASK = 0x000000ff;
94 /*******************************************************************************
97 * duplicate definition of FT_Span
99 typedef QT_FT_Span QSpan;
103 struct QGradientData;
104 struct QLinearGradientData;
105 struct QRadialGradientData;
106 struct QConicalGradientData;
111 class QRasterPaintEngineState;
113 typedef QT_FT_SpanFunc ProcessSpans;
114 typedef void (*BitmapBlitFunc)(QRasterBuffer *rasterBuffer,
115 int x, int y, quint32 color,
117 int mapWidth, int mapHeight, int mapStride);
119 typedef void (*AlphamapBlitFunc)(QRasterBuffer *rasterBuffer,
120 int x, int y, quint32 color,
122 int mapWidth, int mapHeight, int mapStride,
123 const QClipData *clip);
125 typedef void (*AlphaRGBBlitFunc)(QRasterBuffer *rasterBuffer,
126 int x, int y, quint32 color,
128 int mapWidth, int mapHeight, int mapStride,
129 const QClipData *clip);
131 typedef void (*RectFillFunc)(QRasterBuffer *rasterBuffer,
132 int x, int y, int width, int height,
135 typedef void (*SrcOverBlendFunc)(uchar *destPixels, int dbpl,
136 const uchar *src, int spbl,
140 typedef void (*SrcOverScaleFunc)(uchar *destPixels, int dbpl,
141 const uchar *src, int spbl,
142 const QRectF &targetRect,
143 const QRectF &sourceRect,
144 const QRect &clipRect,
147 typedef void (*SrcOverTransformFunc)(uchar *destPixels, int dbpl,
148 const uchar *src, int spbl,
149 const QRectF &targetRect,
150 const QRectF &sourceRect,
151 const QRect &clipRect,
152 const QTransform &targetRectTransform,
155 typedef void (*MemRotateFunc)(const uchar *srcPixels, int w, int h, int sbpl, uchar *destPixels, int dbpl);
158 ProcessSpans blendColor;
159 ProcessSpans blendGradient;
160 BitmapBlitFunc bitmapBlit;
161 AlphamapBlitFunc alphamapBlit;
162 AlphaRGBBlitFunc alphaRGBBlit;
163 RectFillFunc fillRect;
166 extern SrcOverBlendFunc qBlendFunctions[QImage::NImageFormats][QImage::NImageFormats];
167 extern SrcOverScaleFunc qScaleFunctions[QImage::NImageFormats][QImage::NImageFormats];
168 extern SrcOverTransformFunc qTransformFunctions[QImage::NImageFormats][QImage::NImageFormats];
169 extern MemRotateFunc qMemRotateFunctions[QImage::NImageFormats][3];
171 extern DrawHelper qDrawHelper[QImage::NImageFormats];
173 void qBlendTexture(int count, const QSpan *spans, void *userData);
174 #if defined(Q_WS_QWS) && !defined(QT_NO_RASTERCALLBACKS)
175 extern DrawHelper qDrawHelperCallback[QImage::NImageFormats];
176 void qBlendTextureCallback(int count, const QSpan *spans, void *userData);
179 typedef void (QT_FASTCALL *CompositionFunction)(uint *dest, const uint *src, int length, uint const_alpha);
180 typedef void (QT_FASTCALL *CompositionFunctionSolid)(uint *dest, int length, uint color, uint const_alpha);
182 struct LinearGradientValues
190 struct RadialGradientValues
202 typedef uint* (QT_FASTCALL *DestFetchProc)(uint *buffer, QRasterBuffer *rasterBuffer, int x, int y, int length);
203 typedef void (QT_FASTCALL *DestStoreProc)(QRasterBuffer *rasterBuffer, int x, int y, const uint *buffer, int length);
204 typedef const uint* (QT_FASTCALL *SourceFetchProc)(uint *buffer, const Operator *o, const QSpanData *data, int y, int x, int length);
208 QPainter::CompositionMode mode;
209 DestFetchProc dest_fetch;
210 DestStoreProc dest_store;
211 SourceFetchProc src_fetch;
212 CompositionFunctionSolid funcSolid;
213 CompositionFunction func;
215 LinearGradientValues linear;
216 RadialGradientValues radial;
220 void qInitDrawhelperAsm();
222 class QRasterPaintEngine;
229 struct QLinearGradientData
241 struct QRadialGradientData
255 struct QConicalGradientData
266 QGradient::Spread spread;
269 QLinearGradientData linear;
270 QRadialGradientData radial;
271 QConicalGradientData conical;
275 #define GRADIENT_STOPTABLE_SIZE 256
276 #define GRADIENT_STOPTABLE_SIZE_SHIFT 8
278 #define GRADIENT_STOPTABLE_SIZE 1024
279 #define GRADIENT_STOPTABLE_SIZE_SHIFT 10
282 uint* colorTable; //[GRADIENT_STOPTABLE_SIZE];
289 const uchar *imageData;
290 const uchar *scanLine(int y) const { return imageData + y*bytesPerLine; }
300 QImage::Format format;
301 const QVector<QRgb> *colorTable;
313 QSpanData() : tempImage(0) {}
314 ~QSpanData() { delete tempImage; }
316 QRasterBuffer *rasterBuffer;
318 QRasterPaintEngine *rasterEngine;
321 ProcessSpans unclipped_blend;
322 BitmapBlitFunc bitmapBlit;
323 AlphamapBlitFunc alphamapBlit;
324 AlphaRGBBlitFunc alphaRGBBlit;
325 RectFillFunc fillRect;
326 qreal m11, m12, m13, m21, m22, m23, m33, dx, dy; // inverse xform matrix
327 const QClipData *clip;
342 QGradientData gradient;
343 QTextureData texture;
346 void init(QRasterBuffer *rb, const QRasterPaintEngine *pe);
347 void setup(const QBrush &brush, int alpha, QPainter::CompositionMode compositionMode);
348 void setupMatrix(const QTransform &matrix, int bilinear);
349 void initTexture(const QImage *image, int alpha, QTextureData::Type = QTextureData::Plain, const QRect &sourceRect = QRect());
350 void adjustSpanMethods();
353 static inline uint qt_gradient_clamp(const QGradientData *data, int ipos)
355 if (ipos < 0 || ipos >= GRADIENT_STOPTABLE_SIZE) {
356 if (data->spread == QGradient::RepeatSpread) {
357 ipos = ipos % GRADIENT_STOPTABLE_SIZE;
358 ipos = ipos < 0 ? GRADIENT_STOPTABLE_SIZE + ipos : ipos;
359 } else if (data->spread == QGradient::ReflectSpread) {
360 const int limit = GRADIENT_STOPTABLE_SIZE * 2;
362 ipos = ipos < 0 ? limit + ipos : ipos;
363 ipos = ipos >= GRADIENT_STOPTABLE_SIZE ? limit - 1 - ipos : ipos;
367 else if (ipos >= GRADIENT_STOPTABLE_SIZE)
368 ipos = GRADIENT_STOPTABLE_SIZE-1;
373 Q_ASSERT(ipos < GRADIENT_STOPTABLE_SIZE);
378 static inline uint qt_gradient_pixel(const QGradientData *data, qreal pos)
380 int ipos = int(pos * (GRADIENT_STOPTABLE_SIZE - 1) + qreal(0.5));
381 return data->colorTable[qt_gradient_clamp(data, ipos)];
384 static inline qreal qRadialDeterminant(qreal a, qreal b, qreal c)
386 return (b * b) - (4 * a * c);
389 template <class RadialFetchFunc>
390 const uint * QT_FASTCALL qt_fetch_radial_gradient_template(uint *buffer, const Operator *op, const QSpanData *data,
391 int y, int x, int length)
393 // avoid division by zero
394 if (qFuzzyIsNull(op->radial.a)) {
395 extern void (*qt_memfill32)(quint32 *dest, quint32 value, int count);
396 qt_memfill32(buffer, 0, length);
400 const uint *b = buffer;
401 qreal rx = data->m21 * (y + qreal(0.5))
402 + data->dx + data->m11 * (x + qreal(0.5));
403 qreal ry = data->m22 * (y + qreal(0.5))
404 + data->dy + data->m12 * (x + qreal(0.5));
405 bool affine = !data->m13 && !data->m23;
407 uint *end = buffer + length;
409 rx -= data->gradient.radial.focal.x;
410 ry -= data->gradient.radial.focal.y;
412 qreal inv_a = 1 / qreal(2 * op->radial.a);
414 const qreal delta_rx = data->m11;
415 const qreal delta_ry = data->m12;
417 qreal b = 2*(op->radial.dr*data->gradient.radial.focal.radius + rx * op->radial.dx + ry * op->radial.dy);
418 qreal delta_b = 2*(delta_rx * op->radial.dx + delta_ry * op->radial.dy);
419 const qreal b_delta_b = 2 * b * delta_b;
420 const qreal delta_b_delta_b = 2 * delta_b * delta_b;
422 const qreal bb = b * b;
423 const qreal delta_bb = delta_b * delta_b;
428 const qreal rxrxryry = rx * rx + ry * ry;
429 const qreal delta_rxrxryry = delta_rx * delta_rx + delta_ry * delta_ry;
430 const qreal rx_plus_ry = 2*(rx * delta_rx + ry * delta_ry);
431 const qreal delta_rx_plus_ry = 2 * delta_rxrxryry;
435 qreal det = (bb - 4 * op->radial.a * (op->radial.sqrfr - rxrxryry)) * inv_a;
436 qreal delta_det = (b_delta_b + delta_bb + 4 * op->radial.a * (rx_plus_ry + delta_rxrxryry)) * inv_a;
437 const qreal delta_delta_det = (delta_b_delta_b + 4 * op->radial.a * delta_rx_plus_ry) * inv_a;
439 RadialFetchFunc::fetch(buffer, end, op, data, det, delta_det, delta_delta_det, b, delta_b);
441 qreal rw = data->m23 * (y + qreal(0.5))
442 + data->m33 + data->m13 * (x + qreal(0.5));
444 while (buffer < end) {
448 qreal invRw = 1 / rw;
449 qreal gx = rx * invRw - data->gradient.radial.focal.x;
450 qreal gy = ry * invRw - data->gradient.radial.focal.y;
451 qreal b = 2*(op->radial.dr*data->gradient.radial.focal.radius + gx*op->radial.dx + gy*op->radial.dy);
452 qreal det = qRadialDeterminant(op->radial.a, b, op->radial.sqrfr - (gx*gx + gy*gy));
456 qreal detSqrt = qSqrt(det);
458 qreal s0 = (-b - detSqrt) * op->radial.inv2a;
459 qreal s1 = (-b + detSqrt) * op->radial.inv2a;
461 qreal s = qMax(s0, s1);
463 if (data->gradient.radial.focal.radius + op->radial.dr * s >= 0)
464 result = qt_gradient_pixel(&data->gradient, s);
481 template <class Simd>
482 class QRadialFetchSimd
485 static void fetch(uint *buffer, uint *end, const Operator *op, const QSpanData *data, qreal det,
486 qreal delta_det, qreal delta_delta_det, qreal b, qreal delta_b)
488 typename Simd::Vect_buffer_f det_vec;
489 typename Simd::Vect_buffer_f delta_det4_vec;
490 typename Simd::Vect_buffer_f b_vec;
492 for (int i = 0; i < 4; ++i) {
494 delta_det4_vec.f[i] = 4 * delta_det;
498 delta_det += delta_delta_det;
502 const typename Simd::Float32x4 v_delta_delta_det16 = Simd::v_dup(16 * delta_delta_det);
503 const typename Simd::Float32x4 v_delta_delta_det6 = Simd::v_dup(6 * delta_delta_det);
504 const typename Simd::Float32x4 v_delta_b4 = Simd::v_dup(4 * delta_b);
506 const typename Simd::Float32x4 v_r0 = Simd::v_dup(data->gradient.radial.focal.radius);
507 const typename Simd::Float32x4 v_dr = Simd::v_dup(op->radial.dr);
509 const typename Simd::Float32x4 v_min = Simd::v_dup(0.0f);
510 const typename Simd::Float32x4 v_max = Simd::v_dup(float(GRADIENT_STOPTABLE_SIZE-1));
511 const typename Simd::Float32x4 v_half = Simd::v_dup(0.5f);
513 const typename Simd::Int32x4 v_repeat_mask = Simd::v_dup(~(uint(0xffffff) << GRADIENT_STOPTABLE_SIZE_SHIFT));
514 const typename Simd::Int32x4 v_reflect_mask = Simd::v_dup(~(uint(0xffffff) << (GRADIENT_STOPTABLE_SIZE_SHIFT+1)));
516 const typename Simd::Int32x4 v_reflect_limit = Simd::v_dup(2 * GRADIENT_STOPTABLE_SIZE - 1);
518 const int extended_mask = op->radial.extended ? 0x0 : ~0x0;
520 #define FETCH_RADIAL_LOOP_PROLOGUE \
521 while (buffer < end) { \
522 typename Simd::Vect_buffer_i v_buffer_mask; \
523 v_buffer_mask.v = Simd::v_greaterOrEqual(det_vec.v, v_min); \
524 const typename Simd::Float32x4 v_index_local = Simd::v_sub(Simd::v_sqrt(Simd::v_max(v_min, det_vec.v)), b_vec.v); \
525 const typename Simd::Float32x4 v_index = Simd::v_add(Simd::v_mul(v_index_local, v_max), v_half); \
526 v_buffer_mask.v = Simd::v_and(v_buffer_mask.v, Simd::v_greaterOrEqual(Simd::v_add(v_r0, Simd::v_mul(v_dr, v_index_local)), v_min)); \
527 typename Simd::Vect_buffer_i index_vec;
528 #define FETCH_RADIAL_LOOP_CLAMP_REPEAT \
529 index_vec.v = Simd::v_and(v_repeat_mask, Simd::v_toInt(v_index));
530 #define FETCH_RADIAL_LOOP_CLAMP_REFLECT \
531 const typename Simd::Int32x4 v_index_i = Simd::v_and(v_reflect_mask, Simd::v_toInt(v_index)); \
532 const typename Simd::Int32x4 v_index_i_inv = Simd::v_sub(v_reflect_limit, v_index_i); \
533 index_vec.v = Simd::v_min_16(v_index_i, v_index_i_inv);
534 #define FETCH_RADIAL_LOOP_CLAMP_PAD \
535 index_vec.v = Simd::v_toInt(Simd::v_min(v_max, Simd::v_max(v_min, v_index)));
536 #define FETCH_RADIAL_LOOP_EPILOGUE \
537 det_vec.v = Simd::v_add(Simd::v_add(det_vec.v, delta_det4_vec.v), v_delta_delta_det6); \
538 delta_det4_vec.v = Simd::v_add(delta_det4_vec.v, v_delta_delta_det16); \
539 b_vec.v = Simd::v_add(b_vec.v, v_delta_b4); \
540 for (int i = 0; i < 4; ++i) \
541 *buffer++ = (extended_mask | v_buffer_mask.i[i]) & data->gradient.colorTable[index_vec.i[i]]; \
544 #define FETCH_RADIAL_LOOP(FETCH_RADIAL_LOOP_CLAMP) \
545 FETCH_RADIAL_LOOP_PROLOGUE \
546 FETCH_RADIAL_LOOP_CLAMP \
547 FETCH_RADIAL_LOOP_EPILOGUE
549 switch (data->gradient.spread) {
550 case QGradient::RepeatSpread:
551 FETCH_RADIAL_LOOP(FETCH_RADIAL_LOOP_CLAMP_REPEAT)
553 case QGradient::ReflectSpread:
554 FETCH_RADIAL_LOOP(FETCH_RADIAL_LOOP_CLAMP_REFLECT)
556 case QGradient::PadSpread:
557 FETCH_RADIAL_LOOP(FETCH_RADIAL_LOOP_CLAMP_PAD)
565 #if defined(Q_CC_RVCT)
569 Q_STATIC_INLINE_FUNCTION uint INTERPOLATE_PIXEL_255(uint x, uint a, uint y, uint b) {
570 uint t = (x & 0xff00ff) * a + (y & 0xff00ff) * b;
571 t = (t + ((t >> 8) & 0xff00ff) + 0x800080) >> 8;
574 x = ((x >> 8) & 0xff00ff) * a + ((y >> 8) & 0xff00ff) * b;
575 x = (x + ((x >> 8) & 0xff00ff) + 0x800080);
580 #if defined(Q_CC_RVCT)
584 #if QT_POINTER_SIZE == 8 // 64-bit versions
586 Q_STATIC_INLINE_FUNCTION uint INTERPOLATE_PIXEL_256(uint x, uint a, uint y, uint b) {
587 quint64 t = (((quint64(x)) | ((quint64(x)) << 24)) & 0x00ff00ff00ff00ff) * a;
588 t += (((quint64(y)) | ((quint64(y)) << 24)) & 0x00ff00ff00ff00ff) * b;
590 t &= 0x00ff00ff00ff00ff;
591 return (uint(t)) | (uint(t >> 24));
594 Q_STATIC_INLINE_FUNCTION uint BYTE_MUL(uint x, uint a) {
595 quint64 t = (((quint64(x)) | ((quint64(x)) << 24)) & 0x00ff00ff00ff00ff) * a;
596 t = (t + ((t >> 8) & 0xff00ff00ff00ff) + 0x80008000800080) >> 8;
597 t &= 0x00ff00ff00ff00ff;
598 return (uint(t)) | (uint(t >> 24));
601 Q_STATIC_INLINE_FUNCTION uint PREMUL(uint x) {
603 quint64 t = (((quint64(x)) | ((quint64(x)) << 24)) & 0x00ff00ff00ff00ff) * a;
604 t = (t + ((t >> 8) & 0xff00ff00ff00ff) + 0x80008000800080) >> 8;
605 t &= 0x000000ff00ff00ff;
606 return (uint(t)) | (uint(t >> 24)) | (a << 24);
609 #else // 32-bit versions
611 Q_STATIC_INLINE_FUNCTION uint INTERPOLATE_PIXEL_256(uint x, uint a, uint y, uint b) {
612 uint t = (x & 0xff00ff) * a + (y & 0xff00ff) * b;
616 x = ((x >> 8) & 0xff00ff) * a + ((y >> 8) & 0xff00ff) * b;
622 #if defined(Q_CC_RVCT)
626 Q_STATIC_INLINE_FUNCTION uint BYTE_MUL(uint x, uint a) {
627 uint t = (x & 0xff00ff) * a;
628 t = (t + ((t >> 8) & 0xff00ff) + 0x800080) >> 8;
631 x = ((x >> 8) & 0xff00ff) * a;
632 x = (x + ((x >> 8) & 0xff00ff) + 0x800080);
637 #if defined(Q_CC_RVCT)
641 Q_STATIC_INLINE_FUNCTION uint PREMUL(uint x) {
643 uint t = (x & 0xff00ff) * a;
644 t = (t + ((t >> 8) & 0xff00ff) + 0x800080) >> 8;
647 x = ((x >> 8) & 0xff) * a;
648 x = (x + ((x >> 8) & 0xff) + 0x80);
656 Q_STATIC_INLINE_FUNCTION uint BYTE_MUL_RGB16(uint x, uint a) {
658 uint t = (((x & 0x07e0)*a) >> 8) & 0x07e0;
659 t |= (((x & 0xf81f)*(a>>2)) >> 6) & 0xf81f;
663 Q_STATIC_INLINE_FUNCTION uint BYTE_MUL_RGB16_32(uint x, uint a) {
664 uint t = (((x & 0xf81f07e0) >> 5)*a) & 0xf81f07e0;
665 t |= (((x & 0x07e0f81f)*a) >> 5) & 0x07e0f81f;
669 #define INV_PREMUL(p) \
670 (qAlpha(p) == 0 ? 0 : \
672 | (((255*qRed(p))/ qAlpha(p)) << 16) \
673 | (((255*qGreen(p)) / qAlpha(p)) << 8) \
674 | ((255*qBlue(p)) / qAlpha(p))))
676 template <class DST, class SRC>
677 inline DST qt_colorConvert(SRC color, DST dummy)
685 inline quint32 qt_colorConvert(quint16 color, quint32 dummy)
688 const int r = (color & 0xf800);
689 const int g = (color & 0x07e0);
690 const int b = (color & 0x001f);
691 const int tr = (r >> 8) | (r >> 13);
692 const int tg = (g >> 3) | (g >> 9);
693 const int tb = (b << 3) | (b >> 2);
695 return qRgb(tr, tg, tb);
699 inline quint16 qt_colorConvert(quint32 color, quint16 dummy)
702 const int r = qRed(color) << 8;
703 const int g = qGreen(color) << 3;
704 const int b = qBlue(color) >> 3;
706 return (r & 0xf800) | (g & 0x07e0)| (b & 0x001f);
712 inline quint32p(quint32 v) : data(PREMUL(v)) {}
714 inline operator quint32() const { return data; }
716 inline operator quint16() const
718 return qt_colorConvert<quint16, quint32>(data, 0);
721 Q_STATIC_INLINE_FUNCTION quint32p fromRawData(quint32 v)
736 inline qabgr8888(quint32 v)
738 data = qRgba(qBlue(v), qGreen(v), qRed(v), qAlpha(v));
741 inline bool operator==(const qabgr8888 &v) const { return data == v.data; }
752 Q_STATIC_INLINE_FUNCTION bool hasAlpha() { return true; }
754 inline qargb8565() {}
755 inline qargb8565(quint32 v);
756 inline explicit qargb8565(quint32p v);
757 inline qargb8565(const qargb8565 &v);
758 inline qargb8565(const qrgb565 &v);
760 inline operator quint32() const;
761 inline operator quint16() const;
763 inline quint8 alpha() const { return data[0]; }
764 inline qargb8565 truncedAlpha() {
769 Q_STATIC_INLINE_FUNCTION quint8 alpha(quint8 a) { return (a + 1) >> 3; }
770 Q_STATIC_INLINE_FUNCTION quint8 ialpha(quint8 a) { return 0x20 - alpha(a); }
772 inline qargb8565 byte_mul(quint8 a) const;
773 inline qargb8565 operator+(qargb8565 v) const;
774 inline bool operator==(const qargb8565 &v) const;
776 inline quint32 rawValue() const;
777 inline quint16 rawValue16() const;
780 friend class qrgb565;
788 Q_STATIC_INLINE_FUNCTION bool hasAlpha() { return false; }
790 qrgb565(int v = 0) : data(v) {}
792 inline explicit qrgb565(quint32p v);
793 inline explicit qrgb565(quint32 v);
794 inline explicit qrgb565(const qargb8565 &v);
796 inline operator quint32() const;
797 inline operator quint16() const;
799 inline qrgb565 operator+(qrgb565 v) const;
801 inline quint8 alpha() const { return 0xff; }
802 inline qrgb565 truncedAlpha() { return *this; }
803 Q_STATIC_INLINE_FUNCTION quint8 alpha(quint8 a) { return (a + 1) >> 3; }
804 Q_STATIC_INLINE_FUNCTION quint8 ialpha(quint8 a) { return 0x20 - alpha(a); }
806 inline qrgb565 byte_mul(quint8 a) const;
808 inline bool operator==(const qrgb565 &v) const;
809 inline quint16 rawValue() const { return data; }
812 friend class qargb8565;
817 qargb8565::qargb8565(quint32 v)
819 *this = qargb8565(quint32p(v));
822 qargb8565::qargb8565(quint32p v)
825 const int r = qRed(v);
826 const int g = qGreen(v);
827 const int b = qBlue(v);
828 data[1] = ((g << 3) & 0xe0) | (b >> 3);
829 data[2] = (r & 0xf8) | (g >> 5);
832 qargb8565::qargb8565(const qargb8565 &v)
839 qargb8565::qargb8565(const qrgb565 &v)
842 data[1] = v.data & 0xff;
843 data[2] = v.data >> 8;
846 qargb8565::operator quint32() const
848 const quint16 rgb = (data[2] << 8) | data[1];
849 const int a = data[0];
850 const int r = (rgb & 0xf800);
851 const int g = (rgb & 0x07e0);
852 const int b = (rgb & 0x001f);
853 const int tr = qMin(a, (r >> 8) | (r >> 13));
854 const int tg = qMin(a, (g >> 3) | (g >> 9));
855 const int tb = qMin(a, (b << 3) | (b >> 2));
856 return qRgba(tr, tg, tb, data[0]);
859 qargb8565::operator quint16() const
861 return (data[2] << 8) | data[1];
864 qargb8565 qargb8565::operator+(qargb8565 v) const
867 t.data[0] = data[0] + v.data[0];
868 const quint16 rgb = ((data[2] + v.data[2]) << 8)
869 + (data[1] + v.data[1]);
870 t.data[1] = rgb & 0xff;
871 t.data[2] = rgb >> 8;
875 qargb8565 qargb8565::byte_mul(quint8 a) const
878 result.data[0] = (data[0] * a) >> 5;
880 const quint16 x = (data[2] << 8) | data[1];
881 const quint16 t = ((((x & 0x07e0) >> 5) * a) & 0x07e0) |
882 ((((x & 0xf81f) * a) >> 5) & 0xf81f);
883 result.data[1] = t & 0xff;
884 result.data[2] = t >> 8;
888 bool qargb8565::operator==(const qargb8565 &v) const
890 return data[0] == v.data[0]
891 && data[1] == v.data[1]
892 && data[2] == v.data[2];
895 quint32 qargb8565::rawValue() const
897 return (data[2] << 16) | (data[1] << 8) | data[0];
900 quint16 qargb8565::rawValue16() const
902 return (data[2] << 8) | data[1];
905 qrgb565::qrgb565(quint32p v)
907 *this = qrgb565(quint32(v));
910 qrgb565::qrgb565(quint32 v)
912 const int r = qRed(v) << 8;
913 const int g = qGreen(v) << 3;
914 const int b = qBlue(v) >> 3;
916 data = (r & 0xf800) | (g & 0x07e0)| (b & 0x001f);
919 qrgb565::qrgb565(const qargb8565 &v)
921 data = (v.data[2] << 8) | v.data[1];
924 qrgb565::operator quint32() const
926 const int r = (data & 0xf800);
927 const int g = (data & 0x07e0);
928 const int b = (data & 0x001f);
929 const int tr = (r >> 8) | (r >> 13);
930 const int tg = (g >> 3) | (g >> 9);
931 const int tb = (b << 3) | (b >> 2);
932 return qRgb(tr, tg, tb);
935 qrgb565::operator quint16() const
940 qrgb565 qrgb565::operator+(qrgb565 v) const
943 t.data = data + v.data;
947 qrgb565 qrgb565::byte_mul(quint8 a) const
950 result.data = ((((data & 0x07e0) >> 5) * a) & 0x07e0) |
951 ((((data & 0xf81f) * a) >> 5) & 0xf81f);
955 bool qrgb565::operator==(const qrgb565 &v) const
957 return data == v.data;
963 inline qbgr565(quint16 v)
965 data = ((v & 0x001f) << 11) |
967 ((v & 0xf800) >> 11);
970 inline bool operator==(const qbgr565 &v) const
972 return data == v.data;
984 Q_STATIC_INLINE_FUNCTION bool hasAlpha() { return true; }
987 inline qargb8555(quint32 v);
988 inline explicit qargb8555(quint32p v);
989 inline qargb8555(const qargb8555 &v);
990 inline qargb8555(const qrgb555 &v);
992 inline operator quint32() const;
994 inline quint8 alpha() const { return data[0]; }
995 inline qargb8555 truncedAlpha() { data[0] &= 0xf8; return *this; }
996 Q_STATIC_INLINE_FUNCTION quint8 alpha(quint8 a) { return (a + 1) >> 3; }
997 Q_STATIC_INLINE_FUNCTION quint8 ialpha(quint8 a) { return 0x20 - alpha(a); }
999 inline qargb8555 operator+(qargb8555 v) const;
1000 inline qargb8555 byte_mul(quint8 a) const;
1002 inline bool operator==(const qargb8555 &v) const;
1004 inline quint32 rawValue() const;
1007 friend class qrgb555;
1014 Q_STATIC_INLINE_FUNCTION bool hasAlpha() { return false; }
1016 inline qrgb555(int v = 0) : data(v) {}
1018 inline explicit qrgb555(quint32p v) { *this = qrgb555(quint32(v)); }
1020 inline explicit qrgb555(quint32 v)
1022 const int r = qRed(v) << 7;
1023 const int g = qGreen(v) << 2;
1024 const int b = qBlue(v) >> 3;
1026 data = (r & 0x7c00) | (g & 0x03e0) | (b & 0x001f);
1029 inline explicit qrgb555(quint16 v)
1031 data = ((v >> 1) & (0x7c00 | 0x03e0)) |
1035 inline explicit qrgb555(const qargb8555 &v);
1037 inline operator quint32() const
1039 const int r = (data & 0x7c00);
1040 const int g = (data & 0x03e0);
1041 const int b = (data & 0x001f);
1042 const int tr = (r >> 7) | (r >> 12);
1043 const int tg = (g >> 2) | (g >> 7);
1044 const int tb = (b << 3) | (b >> 2);
1046 return qRgb(tr, tg, tb);
1049 inline operator quint16() const
1051 const int r = ((data & 0x7c00) << 1) & 0xf800;
1052 const int g = (((data & 0x03e0) << 1) | ((data >> 4) & 0x0020)) & 0x07e0;
1053 const int b = (data & 0x001f);
1058 inline qrgb555 operator+(qrgb555 v) const;
1059 inline qrgb555 byte_mul(quint8 a) const;
1061 inline quint8 alpha() const { return 0xff; }
1062 inline qrgb555 truncedAlpha() { return *this; }
1063 Q_STATIC_INLINE_FUNCTION quint8 alpha(quint8 a) { return (a + 1) >> 3; }
1064 Q_STATIC_INLINE_FUNCTION quint8 ialpha(quint8 a) { return 0x20 - alpha(a); }
1066 inline bool operator==(const qrgb555 &v) const { return v.data == data; }
1067 inline bool operator!=(const qrgb555 &v) const { return v.data != data; }
1069 inline quint16 rawValue() const { return data; }
1072 friend class qargb8555;
1073 friend class qbgr555;
1078 qrgb555::qrgb555(const qargb8555 &v)
1080 data = (v.data[2] << 8) | v.data[1];
1083 qrgb555 qrgb555::operator+(qrgb555 v) const
1086 t.data = data + v.data;
1090 qrgb555 qrgb555::byte_mul(quint8 a) const
1092 quint16 t = (((data & 0x3e0) * a) >> 5) & 0x03e0;
1093 t |= (((data & 0x7c1f) * a) >> 5) & 0x7c1f;
1103 inline qbgr555(quint32 v) { *this = qbgr555(qrgb555(v)); }
1105 inline qbgr555(qrgb555 v)
1107 data = ((v.data & 0x001f) << 10) |
1109 ((v.data & 0x7c00) >> 10);
1112 inline bool operator==(const qbgr555 &v) const
1114 return data == v.data;
1121 qargb8555::qargb8555(quint32 v)
1124 data[0] = qAlpha(v);
1125 const int r = qRed(v);
1126 const int g = qGreen(v);
1127 const int b = qBlue(v);
1128 data[1] = ((g << 2) & 0xe0) | (b >> 3);
1129 data[2] = ((r >> 1) & 0x7c) | (g >> 6);
1133 qargb8555::qargb8555(quint32p v)
1135 data[0] = qAlpha(v);
1136 const int r = qRed(v);
1137 const int g = qGreen(v);
1138 const int b = qBlue(v);
1139 data[1] = ((g << 2) & 0xe0) | (b >> 3);
1140 data[2] = ((r >> 1) & 0x7c) | (g >> 6);
1143 qargb8555::qargb8555(const qargb8555 &v)
1145 data[0] = v.data[0];
1146 data[1] = v.data[1];
1147 data[2] = v.data[2];
1150 qargb8555::qargb8555(const qrgb555 &v)
1153 data[1] = v.data & 0xff;
1154 data[2] = v.data >> 8;
1157 qargb8555::operator quint32() const
1159 const quint16 rgb = (data[2] << 8) | data[1];
1160 const int r = (rgb & 0x7c00);
1161 const int g = (rgb & 0x03e0);
1162 const int b = (rgb & 0x001f);
1163 const int tr = (r >> 7) | (r >> 12);
1164 const int tg = (g >> 2) | (g >> 7);
1165 const int tb = (b << 3) | (b >> 2);
1167 return qRgba(tr, tg, tb, data[0]);
1170 bool qargb8555::operator==(const qargb8555 &v) const
1172 return data[0] == v.data[0]
1173 && data[1] == v.data[1]
1174 && data[2] == v.data[2];
1177 quint32 qargb8555::rawValue() const
1179 return (data[2] << 16) | (data[1] << 8) | data[0];
1182 qargb8555 qargb8555::operator+(qargb8555 v) const
1185 t.data[0] = data[0] + v.data[0];
1186 const quint16 rgb = ((data[2] + v.data[2]) << 8)
1187 + (data[1] + v.data[1]);
1188 t.data[1] = rgb & 0xff;
1189 t.data[2] = rgb >> 8;
1193 qargb8555 qargb8555::byte_mul(quint8 a) const
1196 result.data[0] = (data[0] * a) >> 5;
1198 const quint16 x = (data[2] << 8) | data[1];
1199 quint16 t = (((x & 0x3e0) * a) >> 5) & 0x03e0;
1200 t |= (((x & 0x7c1f) * a) >> 5) & 0x7c1f;
1201 result.data[1] = t & 0xff;
1202 result.data[2] = t >> 8;
1212 Q_STATIC_INLINE_FUNCTION bool hasAlpha() { return true; }
1214 inline qargb6666() {}
1215 inline qargb6666(quint32 v) { *this = qargb6666(quint32p(v)); }
1216 inline explicit qargb6666(quint32p v);
1217 inline qargb6666(const qargb6666 &v);
1218 inline qargb6666(const qrgb666 &v);
1220 inline operator quint32 () const;
1222 inline quint8 alpha() const;
1223 inline qargb6666 truncedAlpha() { return *this; }
1224 Q_STATIC_INLINE_FUNCTION quint8 alpha(quint8 a) { return (a + 1) >> 2; }
1225 Q_STATIC_INLINE_FUNCTION quint8 ialpha(quint8 a) { return (255 - a + 1) >> 2; }
1227 inline qargb6666 byte_mul(quint8 a) const;
1228 inline qargb6666 operator+(qargb6666 v) const;
1229 inline bool operator==(const qargb6666 &v) const;
1231 inline quint32 rawValue() const;
1234 friend class qrgb666;
1242 Q_STATIC_INLINE_FUNCTION bool hasAlpha() { return false; }
1245 inline qrgb666(quint32 v);
1246 inline qrgb666(const qargb6666 &v);
1248 inline operator quint32 () const;
1250 inline quint8 alpha() const { return 0xff; }
1251 inline qrgb666 truncedAlpha() { return *this; }
1252 Q_STATIC_INLINE_FUNCTION quint8 alpha(quint8 a) { return (a + 1) >> 2; }
1253 Q_STATIC_INLINE_FUNCTION quint8 ialpha(quint8 a) { return (255 - a + 1) >> 2; }
1255 inline qrgb666 operator+(qrgb666 v) const;
1256 inline qrgb666 byte_mul(quint8 a) const;
1258 inline bool operator==(const qrgb666 &v) const;
1259 inline bool operator!=(const qrgb666 &v) const { return !(*this == v); }
1261 inline quint32 rawValue() const
1263 return (data[2] << 16) | (data[1] << 8) | data[0];
1267 friend class qargb6666;
1272 qrgb666::qrgb666(quint32 v)
1274 const uchar b = qBlue(v);
1275 const uchar g = qGreen(v);
1276 const uchar r = qRed(v);
1277 const uint p = (b >> 2) | ((g >> 2) << 6) | ((r >> 2) << 12);
1279 data[1] = qGreen(p);
1283 qrgb666::qrgb666(const qargb6666 &v)
1285 data[0] = v.data[0];
1286 data[1] = v.data[1];
1287 data[2] = v.data[2] & 0x03;
1290 qrgb666::operator quint32 () const
1292 const uchar r = (data[2] << 6) | ((data[1] & 0xf0) >> 2) | (data[2] & 0x3);
1293 const uchar g = (data[1] << 4) | ((data[0] & 0xc0) >> 4) | ((data[1] & 0x0f) >> 2);
1294 const uchar b = (data[0] << 2) | ((data[0] & 0x3f) >> 4);
1295 return qRgb(r, g, b);
1298 qrgb666 qrgb666::operator+(qrgb666 v) const
1300 const quint32 x1 = (data[2] << 16) | (data[1] << 8) | data[0];
1301 const quint32 x2 = (v.data[2] << 16) | (v.data[1] << 8) | v.data[0];
1302 const quint32 t = x1 + x2;
1304 r.data[0] = t & 0xff;
1305 r.data[1] = (t >> 8) & 0xff;
1306 r.data[2] = (t >> 16) & 0xff;
1310 qrgb666 qrgb666::byte_mul(quint8 a) const
1312 const quint32 x = (data[2] << 16) | (data[1] << 8) | data[0];
1313 const quint32 t = ((((x & 0x03f03f) * a) >> 6) & 0x03f03f) |
1314 ((((x & 0x000fc0) * a) >> 6) & 0x000fc0);
1317 r.data[0] = t & 0xff;
1318 r.data[1] = (t >> 8) & 0xff;
1319 r.data[2] = (t >> 16) & 0xff;
1323 bool qrgb666::operator==(const qrgb666 &v) const
1325 return (data[0] == v.data[0] &&
1326 data[1] == v.data[1] &&
1327 data[2] == v.data[2]);
1330 qargb6666::qargb6666(quint32p v)
1332 const quint8 b = qBlue(v) >> 2;
1333 const quint8 g = qGreen(v) >> 2;
1334 const quint8 r = qRed(v) >> 2;
1335 const quint8 a = qAlpha(v) >> 2;
1336 const uint p = (a << 18) | (r << 12) | (g << 6) | b;
1338 data[1] = qGreen(p);
1342 qargb6666::qargb6666(const qargb6666 &v)
1344 data[0] = v.data[0];
1345 data[1] = v.data[1];
1346 data[2] = v.data[2];
1349 qargb6666::qargb6666(const qrgb666 &v)
1351 data[0] = v.data[0];
1352 data[1] = v.data[1];
1353 data[2] = (v.data[2] | 0xfc);
1356 qargb6666::operator quint32 () const
1358 const quint8 r = (data[2] << 6) | ((data[1] & 0xf0) >> 2) | (data[2] & 0x3);
1359 const quint8 g = (data[1] << 4) | ((data[0] & 0xc0) >> 4) | ((data[1] & 0x0f) >> 2);
1360 const quint8 b = (data[0] << 2) | ((data[0] & 0x3f) >> 4);
1361 const quint8 a = (data[2] & 0xfc) | (data[2] >> 6);
1362 return qRgba(r, g, b, a);
1365 qargb6666 qargb6666::operator+(qargb6666 v) const
1367 const quint32 x1 = (data[2] << 16) | (data[1] << 8) | data[0];
1368 const quint32 x2 = (v.data[2] << 16) | (v.data[1] << 8) | v.data[0];
1369 const quint32 t = x1 + x2;
1371 r.data[0] = t & 0xff;
1372 r.data[1] = (t >> 8) & 0xff;
1373 r.data[2] = (t >> 16) & 0xff;
1377 quint8 qargb6666::alpha() const
1379 return (data[2] & 0xfc) | (data[2] >> 6);
1382 inline qargb6666 qargb6666::byte_mul(quint8 a) const
1384 const quint32 x = (data[2] << 16) | (data[1] << 8) | data[0];
1385 const quint32 t = ((((x & 0x03f03f) * a) >> 6) & 0x03f03f) |
1386 ((((x & 0xfc0fc0) * a) >> 6) & 0xfc0fc0);
1389 r.data[0] = t & 0xff;
1390 r.data[1] = (t >> 8) & 0xff;
1391 r.data[2] = (t >> 16) & 0xff;
1395 bool qargb6666::operator==(const qargb6666 &v) const
1397 return data[0] == v.data[0]
1398 && data[1] == v.data[1]
1399 && data[2] == v.data[2];
1402 quint32 qargb6666::rawValue() const
1404 return (data[2] << 16) | (data[1] << 8) | data[0];
1410 Q_STATIC_INLINE_FUNCTION bool hasAlpha() { return false; }
1413 inline qrgb888(quint32 v);
1415 inline operator quint32() const;
1417 inline quint8 alpha() const { return 0xff; }
1418 inline qrgb888 truncedAlpha() { return *this; }
1419 Q_STATIC_INLINE_FUNCTION quint8 alpha(quint8 a) { return a; }
1420 Q_STATIC_INLINE_FUNCTION quint8 ialpha(quint8 a) { return 255 - a; }
1422 inline qrgb888 byte_mul(quint8 a) const;
1423 inline qrgb888 operator+(qrgb888 v) const;
1424 inline bool operator==(qrgb888 v) const;
1426 inline quint32 rawValue() const;
1433 qrgb888::qrgb888(quint32 v)
1436 data[1] = qGreen(v);
1440 qrgb888::operator quint32() const
1442 return qRgb(data[0], data[1], data[2]);
1445 qrgb888 qrgb888::operator+(qrgb888 v) const
1448 t.data[0] += v.data[0];
1449 t.data[1] += v.data[1];
1450 t.data[2] += v.data[2];
1454 qrgb888 qrgb888::byte_mul(quint8 a) const
1458 quint32 t = (x & 0xff00ff) * a;
1459 t = (t + ((t >> 8) & 0xff00ff) + 0x800080) >> 8;
1462 x = ((x >> 8) & 0xff00ff) * a;
1463 x = (x + ((x >> 8) & 0xff00ff) + 0x800080);
1469 bool qrgb888::operator==(qrgb888 v) const
1471 return (data[0] == v.data[0] &&
1472 data[1] == v.data[1] &&
1473 data[2] == v.data[2]);
1476 quint32 qrgb888::rawValue() const
1478 return (data[2] << 16) | (data[1] << 8) | data[0];
1482 inline qrgb888 qt_colorConvert(quint32 color, qrgb888 dummy)
1485 return qrgb888(color);
1489 inline quint32 qt_colorConvert(qrgb888 color, quint32 dummy)
1492 return quint32(color);
1495 #ifdef QT_QWS_DEPTH_8
1497 inline quint8 qt_colorConvert(quint32 color, quint8 dummy)
1501 uchar r = ((qRed(color) & 0xf8) + 0x19) / 0x33;
1502 uchar g = ((qGreen(color) &0xf8) + 0x19) / 0x33;
1503 uchar b = ((qBlue(color) &0xf8) + 0x19) / 0x33;
1505 return r*6*6 + g*6 + b;
1509 inline quint8 qt_colorConvert(quint16 color, quint8 dummy)
1513 uchar r = (color & 0xf800) >> (11-3);
1514 uchar g = (color & 0x07c0) >> (6-3);
1515 uchar b = (color & 0x001f) << 3;
1517 uchar tr = (r + 0x19) / 0x33;
1518 uchar tg = (g + 0x19) / 0x33;
1519 uchar tb = (b + 0x19) / 0x33;
1521 return tr*6*6 + tg*6 + tb;
1524 #endif // QT_QWS_DEPTH_8
1530 inline quint24(quint32 v)
1533 data[1] = qGreen(v);
1537 inline operator quint32 ()
1539 return qRgb(data[2], data[1], data[0]);
1542 inline bool operator==(const quint24 &v) const
1544 return data[0] == v.data[0]
1545 && data[1] == v.data[1]
1546 && data[2] == v.data[2];
1554 inline quint24 qt_colorConvert(quint32 color, quint24 dummy)
1557 return quint24(color);
1564 inline quint18(quint32 v)
1567 uchar g = qGreen(v);
1569 uint p = (b >> 2) | ((g >> 2) << 6) | ((r >> 2) << 12);
1571 data[1] = qGreen(p);
1575 inline operator quint32 ()
1577 const uchar r = (data[2] << 6) | ((data[1] & 0xf0) >> 2) | (data[2] & 0x3);
1578 const uchar g = (data[1] << 4) | ((data[0] & 0xc0) >> 4) | ((data[1] & 0x0f) >> 2);
1579 const uchar b = (data[0] << 2) | ((data[0] & 0x3f) >> 4);
1580 return qRgb(r, g, b);
1588 inline quint18 qt_colorConvert(quint32 color, quint18 dummy)
1591 return quint18(color);
1599 Q_STATIC_INLINE_FUNCTION bool hasAlpha() { return true; }
1601 inline qargb4444() {}
1602 inline qargb4444(quint32 v) { *this = qargb4444(quint32p(v)); }
1603 inline explicit qargb4444(quint32p v);
1604 inline qargb4444(const qrgb444 &v);
1606 inline operator quint32() const;
1607 inline operator quint8() const;
1609 inline qargb4444 operator+(qargb4444 v) const;
1611 inline quint8 alpha() const { return ((data & 0xf000) >> 8) | ((data & 0xf000) >> 12); }
1612 inline qargb4444 truncedAlpha() { return *this; }
1613 Q_STATIC_INLINE_FUNCTION quint8 alpha(quint8 a) { return (a + 1) >> 4; }
1614 Q_STATIC_INLINE_FUNCTION quint8 ialpha(quint8 a) { return 0x10 - alpha(a); }
1615 inline qargb4444 byte_mul(quint8 a) const;
1617 inline bool operator==(const qargb4444 &v) const { return data == v.data; }
1619 inline quint16 rawValue() const { return data; }
1622 friend class qrgb444;
1630 Q_STATIC_INLINE_FUNCTION bool hasAlpha() { return false; }
1633 inline qrgb444(quint32 v);
1634 inline explicit qrgb444(qargb4444 v);
1636 inline operator quint32() const;
1637 inline operator quint8() const;
1639 inline qrgb444 operator+(qrgb444 v) const;
1640 inline quint8 alpha() const { return 0xff; }
1641 inline qrgb444 truncedAlpha() { return *this; }
1642 Q_STATIC_INLINE_FUNCTION quint8 alpha(quint8 a) { return (a + 1) >> 4; }
1643 Q_STATIC_INLINE_FUNCTION quint8 ialpha(quint8 a) { return 0x10 - alpha(a); }
1644 inline qrgb444 byte_mul(quint8 a) const;
1646 inline bool operator==(const qrgb444 &v) const { return data == v.data; }
1647 inline bool operator!=(const qrgb444 &v) const { return data != v.data; }
1649 inline quint16 rawValue() const { return data; }
1652 friend class qargb4444;
1658 qargb4444::qargb4444(quint32p color)
1662 const int a = qAlpha(v) << 8;
1663 const int r = qRed(v) << 4;
1664 const int g = qGreen(v);
1665 const int b = qBlue(v) >> 4;
1667 data = a | r | g | b;
1670 qargb4444::qargb4444(const qrgb444 &v)
1672 data = v.data | 0xf000;
1675 qargb4444::operator quint32() const
1677 const int a = (data & 0xf000);
1678 const int r = (data & 0x0f00);
1679 const int g = (data & 0x00f0);
1680 const int b = (data & 0x000f);
1681 const int ta = (a >> 8) | (a >> 12);
1682 const int tr = (r >> 4) | (r >> 8);
1683 const int tg = g | (g >> 4);
1684 const int tb = (b << 4) | b;
1686 return qRgba(tr, tg, tb, ta);
1689 qargb4444::operator quint8() const
1692 return qt_colorConvert<quint8, quint32>(operator quint32(), 0);
1695 qargb4444 qargb4444::operator+(qargb4444 v) const
1698 t.data = data + v.data;
1702 qargb4444 qargb4444::byte_mul(quint8 a) const
1704 quint16 t = (((data & 0xf0f0) * a) >> 4) & 0xf0f0;
1705 t |= (((data & 0x0f0f) * a) >> 4) & 0x0f0f;
1712 qrgb444::qrgb444(quint32 v)
1715 const int r = qRed(v) << 4;
1716 const int g = qGreen(v);
1717 const int b = qBlue(v) >> 4;
1722 qrgb444::qrgb444(qargb4444 v)
1724 data = v.data & 0x0fff;
1727 qrgb444::operator quint32() const
1729 const int r = (data & 0x0f00);
1730 const int g = (data & 0x00f0);
1731 const int b = (data & 0x000f);
1732 const int tr = (r >> 4) | (r >> 8);
1733 const int tg = g | (g >> 4);
1734 const int tb = (b << 4) | b;
1736 return qRgb(tr, tg, tb);
1739 qrgb444::operator quint8() const
1742 return qt_colorConvert<quint8, quint32>(operator quint32(), 0);
1745 qrgb444 qrgb444::operator+(qrgb444 v) const
1748 t.data = data + v.data;
1752 qrgb444 qrgb444::byte_mul(quint8 a) const
1754 quint16 t = (((data & 0xf0f0) * a) >> 4) & 0xf0f0;
1755 t |= (((data & 0x0f0f) * a) >> 4) & 0x0f0f;
1762 #ifdef QT_QWS_DEPTH_GENERIC
1769 static int len_green;
1770 static int len_blue;
1771 static int len_alpha;
1773 static int off_green;
1774 static int off_blue;
1775 static int off_alpha;
1778 template <typename SRC>
1779 Q_STATIC_TEMPLATE_FUNCTION inline quint32 qt_convertToRgb(SRC color);
1782 inline quint32 qt_convertToRgb(quint32 color)
1784 const int r = qRed(color) >> (8 - qrgb::len_red);
1785 const int g = qGreen(color) >> (8 - qrgb::len_green);
1786 const int b = qBlue(color) >> (8 - qrgb::len_blue);
1787 const int a = qAlpha(color) >> (8 - qrgb::len_alpha);
1788 const quint32 v = (r << qrgb::off_red)
1789 | (g << qrgb::off_green)
1790 | (b << qrgb::off_blue)
1791 | (a << qrgb::off_alpha);
1797 inline quint32 qt_convertToRgb(quint16 color)
1799 return qt_convertToRgb(qt_colorConvert<quint32, quint16>(color, 0));
1802 class qrgb_generic16
1805 inline qrgb_generic16(quint32 color)
1807 const int r = qRed(color) >> (8 - qrgb::len_red);
1808 const int g = qGreen(color) >> (8 - qrgb::len_green);
1809 const int b = qBlue(color) >> (8 - qrgb::len_blue);
1810 const int a = qAlpha(color) >> (8 - qrgb::len_alpha);
1811 data = (r << qrgb::off_red)
1812 | (g << qrgb::off_green)
1813 | (b << qrgb::off_blue)
1814 | (a << qrgb::off_alpha);
1817 inline operator quint16 () { return data; }
1818 inline quint32 operator<<(int shift) const { return data << shift; }
1825 inline qrgb_generic16 qt_colorConvert(quint32 color, qrgb_generic16 dummy)
1828 return qrgb_generic16(color);
1832 inline qrgb_generic16 qt_colorConvert(quint16 color, qrgb_generic16 dummy)
1835 return qrgb_generic16(qt_colorConvert<quint32, quint16>(color, 0));
1838 #endif // QT_QWS_DEPTH_GENERIC
1841 void qt_memfill(T *dest, T value, int count);
1843 template<> inline void qt_memfill(quint32 *dest, quint32 color, int count)
1845 extern void (*qt_memfill32)(quint32 *dest, quint32 value, int count);
1846 qt_memfill32(dest, color, count);
1849 template<> inline void qt_memfill(quint16 *dest, quint16 color, int count)
1851 extern void (*qt_memfill16)(quint16 *dest, quint16 value, int count);
1852 qt_memfill16(dest, color, count);
1855 template<> inline void qt_memfill(quint8 *dest, quint8 color, int count)
1857 memset(dest, color, count);
1861 inline void qt_memfill(T *dest, T value, int count)
1866 int n = (count + 7) / 8;
1867 switch (count & 0x07)
1869 case 0: do { *dest++ = value;
1870 case 7: *dest++ = value;
1871 case 6: *dest++ = value;
1872 case 5: *dest++ = value;
1873 case 4: *dest++ = value;
1874 case 3: *dest++ = value;
1875 case 2: *dest++ = value;
1876 case 1: *dest++ = value;
1882 inline void qt_rectfill(T *dest, T value,
1883 int x, int y, int width, int height, int stride)
1885 char *d = reinterpret_cast<char*>(dest + x) + y * stride;
1886 if (uint(stride) == (width * sizeof(T))) {
1887 qt_memfill(reinterpret_cast<T*>(d), value, width * height);
1889 for (int j = 0; j < height; ++j) {
1890 dest = reinterpret_cast<T*>(d);
1891 qt_memfill(dest, value, width);
1897 template <class DST, class SRC>
1898 inline void qt_memconvert(DST *dest, const SRC *src, int count)
1900 if (sizeof(DST) == 1) {
1903 const SRC color = *src++;
1904 const DST dstColor = qt_colorConvert<DST, SRC>(color, 0);
1905 while (--count && (*src == color || dstColor == qt_colorConvert<DST, SRC>(*src, 0))) {
1909 qt_memfill(dest, dstColor, n);
1914 int n = (count + 7) / 8;
1915 switch (count & 0x07)
1917 case 0: do { *dest++ = qt_colorConvert<DST, SRC>(*src++, 0);
1918 case 7: *dest++ = qt_colorConvert<DST, SRC>(*src++, 0);
1919 case 6: *dest++ = qt_colorConvert<DST, SRC>(*src++, 0);
1920 case 5: *dest++ = qt_colorConvert<DST, SRC>(*src++, 0);
1921 case 4: *dest++ = qt_colorConvert<DST, SRC>(*src++, 0);
1922 case 3: *dest++ = qt_colorConvert<DST, SRC>(*src++, 0);
1923 case 2: *dest++ = qt_colorConvert<DST, SRC>(*src++, 0);
1924 case 1: *dest++ = qt_colorConvert<DST, SRC>(*src++, 0);
1930 #define QT_TRIVIAL_MEMCONVERT_IMPL(T) \
1932 inline void qt_memconvert(T *dest, const T *src, int count) \
1934 memcpy(dest, src, count * sizeof(T)); \
1936 QT_TRIVIAL_MEMCONVERT_IMPL(quint32)
1937 QT_TRIVIAL_MEMCONVERT_IMPL(qrgb888)
1938 QT_TRIVIAL_MEMCONVERT_IMPL(qargb6666)
1939 QT_TRIVIAL_MEMCONVERT_IMPL(qrgb666)
1940 QT_TRIVIAL_MEMCONVERT_IMPL(quint16)
1941 QT_TRIVIAL_MEMCONVERT_IMPL(qrgb565)
1942 QT_TRIVIAL_MEMCONVERT_IMPL(qargb8565)
1943 QT_TRIVIAL_MEMCONVERT_IMPL(qargb8555)
1944 QT_TRIVIAL_MEMCONVERT_IMPL(qrgb555)
1945 QT_TRIVIAL_MEMCONVERT_IMPL(qargb4444)
1946 QT_TRIVIAL_MEMCONVERT_IMPL(qrgb444)
1947 #undef QT_TRIVIAL_MEMCONVERT_IMPL
1949 #if Q_BYTE_ORDER == Q_LITTLE_ENDIAN
1951 inline void qt_memconvert(qrgb666 *dest, const quint32 *src, int count)
1955 case 2: *dest++ = qrgb666(*src++);
1956 case 1: *dest = qrgb666(*src);
1961 const int align = (quintptr(dest) & 3);
1963 case 1: *dest++ = qrgb666(*src++); --count;
1964 case 2: *dest++ = qrgb666(*src++); --count;
1965 case 3: *dest++ = qrgb666(*src++); --count;
1968 quint32 *dest32 = reinterpret_cast<quint32*>(dest);
1969 int sourceCount = count >> 2;
1970 while (sourceCount--) {
1971 dest32[0] = ((src[1] & 0x00000c00) << 20)
1972 | ((src[1] & 0x000000fc) << 22)
1973 | ((src[0] & 0x00fc0000) >> 6)
1974 | ((src[0] & 0x0000fc00) >> 4)
1975 | ((src[0] & 0x000000fc) >> 2);
1976 dest32[1] = ((src[2] & 0x003c0000) << 10)
1977 | ((src[2] & 0x0000fc00) << 12)
1978 | ((src[2] & 0x000000fc) << 14)
1979 | ((src[1] & 0x00fc0000) >> 14)
1980 | ((src[1] & 0x0000f000) >> 12);
1981 dest32[2] = ((src[3] & 0x00fc0000) << 2)
1982 | ((src[3] & 0x0000fc00) << 4)
1983 | ((src[3] & 0x000000fc) << 6)
1984 | ((src[2] & 0x00c00000) >> 22);
1989 dest = reinterpret_cast<qrgb666*>(dest32);
1990 switch (count & 3) {
1991 case 3: *dest++ = qrgb666(*src++);
1992 case 2: *dest++ = qrgb666(*src++);
1993 case 1: *dest = qrgb666(*src);
1996 #endif // Q_BYTE_ORDER
1999 inline void qt_rectcopy(T *dest, const T *src,
2000 int x, int y, int width, int height,
2001 int dstStride, int srcStride)
2003 char *d = (char*)(dest + x) + y * dstStride;
2004 const char *s = (char*)(src);
2005 for (int i = 0; i < height; ++i) {
2006 ::memcpy(d, s, width * sizeof(T));
2012 template <class DST, class SRC>
2013 inline void qt_rectconvert(DST *dest, const SRC *src,
2014 int x, int y, int width, int height,
2015 int dstStride, int srcStride)
2017 char *d = (char*)(dest + x) + y * dstStride;
2018 const char *s = (char*)(src);
2019 for (int i = 0; i < height; ++i) {
2020 qt_memconvert<DST,SRC>((DST*)d, (const SRC*)s, width);
2026 #define QT_RECTCONVERT_TRIVIAL_IMPL(T) \
2028 inline void qt_rectconvert(T *dest, const T *src, \
2029 int x, int y, int width, int height, \
2030 int dstStride, int srcStride) \
2032 qt_rectcopy(dest, src, x, y, width, height, dstStride, srcStride); \
2034 QT_RECTCONVERT_TRIVIAL_IMPL(quint32)
2035 QT_RECTCONVERT_TRIVIAL_IMPL(qrgb888)
2036 QT_RECTCONVERT_TRIVIAL_IMPL(qargb6666)
2037 QT_RECTCONVERT_TRIVIAL_IMPL(qrgb666)
2038 QT_RECTCONVERT_TRIVIAL_IMPL(qrgb565)
2039 QT_RECTCONVERT_TRIVIAL_IMPL(qargb8565)
2040 QT_RECTCONVERT_TRIVIAL_IMPL(quint16)
2041 QT_RECTCONVERT_TRIVIAL_IMPL(qargb8555)
2042 QT_RECTCONVERT_TRIVIAL_IMPL(qrgb555)
2043 QT_RECTCONVERT_TRIVIAL_IMPL(qargb4444)
2044 QT_RECTCONVERT_TRIVIAL_IMPL(qrgb444)
2045 #undef QT_RECTCONVERT_TRIVIAL_IMPL
2047 #ifdef QT_QWS_DEPTH_GENERIC
2048 template <> void qt_rectconvert(qrgb *dest, const quint32 *src,
2049 int x, int y, int width, int height,
2050 int dstStride, int srcStride);
2052 template <> void qt_rectconvert(qrgb *dest, const quint16 *src,
2053 int x, int y, int width, int height,
2054 int dstStride, int srcStride);
2055 #endif // QT_QWS_DEPTH_GENERIC
2057 #define QT_MEMFILL_UINT(dest, length, color) \
2058 qt_memfill<quint32>(dest, color, length);
2060 #define QT_MEMFILL_USHORT(dest, length, color) \
2061 qt_memfill<quint16>(dest, color, length);
2063 #define QT_MEMCPY_REV_UINT(dest, src, length) \
2065 /* Duff's device */ \
2066 uint *_d = (uint*)(dest) + length; \
2067 const uint *_s = (uint*)(src) + length; \
2068 register int n = ((length) + 7) / 8; \
2069 switch ((length) & 0x07) \
2071 case 0: do { *--_d = *--_s; \
2072 case 7: *--_d = *--_s; \
2073 case 6: *--_d = *--_s; \
2074 case 5: *--_d = *--_s; \
2075 case 4: *--_d = *--_s; \
2076 case 3: *--_d = *--_s; \
2077 case 2: *--_d = *--_s; \
2078 case 1: *--_d = *--_s; \
2079 } while (--n > 0); \
2083 #define QT_MEMCPY_USHORT(dest, src, length) \
2085 /* Duff's device */ \
2086 ushort *_d = (ushort*)(dest); \
2087 const ushort *_s = (ushort*)(src); \
2088 register int n = ((length) + 7) / 8; \
2089 switch ((length) & 0x07) \
2091 case 0: do { *_d++ = *_s++; \
2092 case 7: *_d++ = *_s++; \
2093 case 6: *_d++ = *_s++; \
2094 case 5: *_d++ = *_s++; \
2095 case 4: *_d++ = *_s++; \
2096 case 3: *_d++ = *_s++; \
2097 case 2: *_d++ = *_s++; \
2098 case 1: *_d++ = *_s++; \
2099 } while (--n > 0); \
2103 #if defined(Q_CC_RVCT)
2107 Q_STATIC_INLINE_FUNCTION int qt_div_255(int x) { return (x + (x>>8) + 0x80) >> 8; }
2108 #if defined(Q_CC_RVCT)
2112 inline ushort qConvertRgb32To16(uint c)
2114 return (((c) >> 3) & 0x001f)
2115 | (((c) >> 5) & 0x07e0)
2116 | (((c) >> 8) & 0xf800);
2119 #if defined(Q_WS_QWS) || (QT_VERSION >= 0x040400)
2120 inline quint32 qConvertRgb32To16x2(quint64 c)
2122 c = (((c) >> 3) & Q_UINT64_C(0x001f0000001f))
2123 | (((c) >> 5) & Q_UINT64_C(0x07e0000007e0))
2124 | (((c) >> 8) & Q_UINT64_C(0xf8000000f800));
2125 return c | (c >> 16);
2129 inline QRgb qConvertRgb16To32(uint c)
2132 | ((((c) << 3) & 0xf8) | (((c) >> 2) & 0x7))
2133 | ((((c) << 5) & 0xfc00) | (((c) >> 1) & 0x300))
2134 | ((((c) << 8) & 0xf80000) | (((c) << 3) & 0x70000));
2137 inline int qRed565(quint16 rgb) {
2138 const int r = (rgb & 0xf800);
2139 return (r >> 8) | (r >> 13);
2142 inline int qGreen565(quint16 rgb) {
2143 const int g = (rgb & 0x07e0);
2144 return (g >> 3) | (g >> 9);
2147 inline int qBlue565(quint16 rgb) {
2148 const int b = (rgb & 0x001f);
2149 return (b << 3) | (b >> 2);
2152 const uint qt_bayer_matrix[16][16] = {
2153 { 0x1, 0xc0, 0x30, 0xf0, 0xc, 0xcc, 0x3c, 0xfc,
2154 0x3, 0xc3, 0x33, 0xf3, 0xf, 0xcf, 0x3f, 0xff},
2155 { 0x80, 0x40, 0xb0, 0x70, 0x8c, 0x4c, 0xbc, 0x7c,
2156 0x83, 0x43, 0xb3, 0x73, 0x8f, 0x4f, 0xbf, 0x7f},
2157 { 0x20, 0xe0, 0x10, 0xd0, 0x2c, 0xec, 0x1c, 0xdc,
2158 0x23, 0xe3, 0x13, 0xd3, 0x2f, 0xef, 0x1f, 0xdf},
2159 { 0xa0, 0x60, 0x90, 0x50, 0xac, 0x6c, 0x9c, 0x5c,
2160 0xa3, 0x63, 0x93, 0x53, 0xaf, 0x6f, 0x9f, 0x5f},
2161 { 0x8, 0xc8, 0x38, 0xf8, 0x4, 0xc4, 0x34, 0xf4,
2162 0xb, 0xcb, 0x3b, 0xfb, 0x7, 0xc7, 0x37, 0xf7},
2163 { 0x88, 0x48, 0xb8, 0x78, 0x84, 0x44, 0xb4, 0x74,
2164 0x8b, 0x4b, 0xbb, 0x7b, 0x87, 0x47, 0xb7, 0x77},
2165 { 0x28, 0xe8, 0x18, 0xd8, 0x24, 0xe4, 0x14, 0xd4,
2166 0x2b, 0xeb, 0x1b, 0xdb, 0x27, 0xe7, 0x17, 0xd7},
2167 { 0xa8, 0x68, 0x98, 0x58, 0xa4, 0x64, 0x94, 0x54,
2168 0xab, 0x6b, 0x9b, 0x5b, 0xa7, 0x67, 0x97, 0x57},
2169 { 0x2, 0xc2, 0x32, 0xf2, 0xe, 0xce, 0x3e, 0xfe,
2170 0x1, 0xc1, 0x31, 0xf1, 0xd, 0xcd, 0x3d, 0xfd},
2171 { 0x82, 0x42, 0xb2, 0x72, 0x8e, 0x4e, 0xbe, 0x7e,
2172 0x81, 0x41, 0xb1, 0x71, 0x8d, 0x4d, 0xbd, 0x7d},
2173 { 0x22, 0xe2, 0x12, 0xd2, 0x2e, 0xee, 0x1e, 0xde,
2174 0x21, 0xe1, 0x11, 0xd1, 0x2d, 0xed, 0x1d, 0xdd},
2175 { 0xa2, 0x62, 0x92, 0x52, 0xae, 0x6e, 0x9e, 0x5e,
2176 0xa1, 0x61, 0x91, 0x51, 0xad, 0x6d, 0x9d, 0x5d},
2177 { 0xa, 0xca, 0x3a, 0xfa, 0x6, 0xc6, 0x36, 0xf6,
2178 0x9, 0xc9, 0x39, 0xf9, 0x5, 0xc5, 0x35, 0xf5},
2179 { 0x8a, 0x4a, 0xba, 0x7a, 0x86, 0x46, 0xb6, 0x76,
2180 0x89, 0x49, 0xb9, 0x79, 0x85, 0x45, 0xb5, 0x75},
2181 { 0x2a, 0xea, 0x1a, 0xda, 0x26, 0xe6, 0x16, 0xd6,
2182 0x29, 0xe9, 0x19, 0xd9, 0x25, 0xe5, 0x15, 0xd5},
2183 { 0xaa, 0x6a, 0x9a, 0x5a, 0xa6, 0x66, 0x96, 0x56,
2184 0xa9, 0x69, 0x99, 0x59, 0xa5, 0x65, 0x95, 0x55}
2187 #define ARGB_COMBINE_ALPHA(argb, alpha) \
2188 ((((argb >> 24) * alpha) >> 8) << 24) | (argb & 0x00ffffff)
2191 #if QT_POINTER_SIZE == 8 // 64-bit versions
2192 #define AMIX(mask) (qMin(((qint64(s)&mask) + (qint64(d)&mask)), qint64(mask)))
2193 #define MIX(mask) (qMin(((qint64(s)&mask) + (qint64(d)&mask)), qint64(mask)))
2195 // The mask for alpha can overflow over 32 bits
2196 #define AMIX(mask) quint32(qMin(((qint64(s)&mask) + (qint64(d)&mask)), qint64(mask)))
2197 #define MIX(mask) (qMin(((quint32(s)&mask) + (quint32(d)&mask)), quint32(mask)))
2200 inline int comp_func_Plus_one_pixel_const_alpha(uint d, const uint s, const uint const_alpha, const uint one_minus_const_alpha)
2202 const int result = (AMIX(AMASK) | MIX(RMASK) | MIX(GMASK) | MIX(BMASK));
2203 return INTERPOLATE_PIXEL_255(result, const_alpha, d, one_minus_const_alpha);
2206 inline int comp_func_Plus_one_pixel(uint d, const uint s)
2208 const int result = (AMIX(AMASK) | MIX(RMASK) | MIX(GMASK) | MIX(BMASK));
2215 // prototypes of all the composition functions
2216 void QT_FASTCALL comp_func_SourceOver(uint *dest, const uint *src, int length, uint const_alpha);
2217 void QT_FASTCALL comp_func_DestinationOver(uint *dest, const uint *src, int length, uint const_alpha);
2218 void QT_FASTCALL comp_func_Clear(uint *dest, const uint *, int length, uint const_alpha);
2219 void QT_FASTCALL comp_func_Source(uint *dest, const uint *src, int length, uint const_alpha);
2220 void QT_FASTCALL comp_func_Destination(uint *, const uint *, int, uint);
2221 void QT_FASTCALL comp_func_SourceIn(uint *dest, const uint *src, int length, uint const_alpha);
2222 void QT_FASTCALL comp_func_DestinationIn(uint *dest, const uint *src, int length, uint const_alpha);
2223 void QT_FASTCALL comp_func_SourceOut(uint *dest, const uint *src, int length, uint const_alpha);
2224 void QT_FASTCALL comp_func_DestinationOut(uint *dest, const uint *src, int length, uint const_alpha);
2225 void QT_FASTCALL comp_func_SourceAtop(uint *dest, const uint *src, int length, uint const_alpha);
2226 void QT_FASTCALL comp_func_DestinationAtop(uint *dest, const uint *src, int length, uint const_alpha);
2227 void QT_FASTCALL comp_func_XOR(uint *dest, const uint *src, int length, uint const_alpha);
2228 void QT_FASTCALL comp_func_Plus(uint *dest, const uint *src, int length, uint const_alpha);
2229 void QT_FASTCALL comp_func_Multiply(uint *dest, const uint *src, int length, uint const_alpha);
2230 void QT_FASTCALL comp_func_Screen(uint *dest, const uint *src, int length, uint const_alpha);
2231 void QT_FASTCALL comp_func_Overlay(uint *dest, const uint *src, int length, uint const_alpha);
2232 void QT_FASTCALL comp_func_Darken(uint *dest, const uint *src, int length, uint const_alpha);
2233 void QT_FASTCALL comp_func_Lighten(uint *dest, const uint *src, int length, uint const_alpha);
2234 void QT_FASTCALL comp_func_ColorDodge(uint *dest, const uint *src, int length, uint const_alpha);
2235 void QT_FASTCALL comp_func_ColorBurn(uint *dest, const uint *src, int length, uint const_alpha);
2236 void QT_FASTCALL comp_func_HardLight(uint *dest, const uint *src, int length, uint const_alpha);
2237 void QT_FASTCALL comp_func_SoftLight(uint *dest, const uint *src, int length, uint const_alpha);
2238 void QT_FASTCALL comp_func_Difference(uint *dest, const uint *src, int length, uint const_alpha);
2239 void QT_FASTCALL comp_func_Exclusion(uint *dest, const uint *src, int length, uint const_alpha);
2240 void QT_FASTCALL rasterop_SourceOrDestination(uint *dest, const uint *src, int length, uint const_alpha);
2241 void QT_FASTCALL rasterop_SourceAndDestination(uint *dest, const uint *src, int length, uint const_alpha);
2242 void QT_FASTCALL rasterop_SourceXorDestination(uint *dest, const uint *src, int length, uint const_alpha);
2243 void QT_FASTCALL rasterop_NotSourceAndNotDestination(uint *dest, const uint *src, int length, uint const_alpha);
2244 void QT_FASTCALL rasterop_NotSourceOrNotDestination(uint *dest, const uint *src, int length, uint const_alpha);
2245 void QT_FASTCALL rasterop_NotSourceXorDestination(uint *dest, const uint *src, int length, uint const_alpha);
2246 void QT_FASTCALL rasterop_NotSource(uint *dest, const uint *src, int length, uint const_alpha);
2247 void QT_FASTCALL rasterop_NotSourceAndDestination(uint *dest, const uint *src, int length, uint const_alpha);
2248 void QT_FASTCALL rasterop_SourceAndNotDestination(uint *dest, const uint *src, int length, uint const_alpha);
2250 // prototypes of all the solid composition functions
2251 void QT_FASTCALL comp_func_solid_SourceOver(uint *dest, int length, uint color, uint const_alpha);
2252 void QT_FASTCALL comp_func_solid_DestinationOver(uint *dest, int length, uint color, uint const_alpha);
2253 void QT_FASTCALL comp_func_solid_Clear(uint *dest, int length, uint color, uint const_alpha);
2254 void QT_FASTCALL comp_func_solid_Source(uint *dest, int length, uint color, uint const_alpha);
2255 void QT_FASTCALL comp_func_solid_Destination(uint *dest, int length, uint color, uint const_alpha);
2256 void QT_FASTCALL comp_func_solid_SourceIn(uint *dest, int length, uint color, uint const_alpha);
2257 void QT_FASTCALL comp_func_solid_DestinationIn(uint *dest, int length, uint color, uint const_alpha);
2258 void QT_FASTCALL comp_func_solid_SourceOut(uint *dest, int length, uint color, uint const_alpha);
2259 void QT_FASTCALL comp_func_solid_DestinationOut(uint *dest, int length, uint color, uint const_alpha);
2260 void QT_FASTCALL comp_func_solid_SourceAtop(uint *dest, int length, uint color, uint const_alpha);
2261 void QT_FASTCALL comp_func_solid_DestinationAtop(uint *dest, int length, uint color, uint const_alpha);
2262 void QT_FASTCALL comp_func_solid_XOR(uint *dest, int length, uint color, uint const_alpha);
2263 void QT_FASTCALL comp_func_solid_Plus(uint *dest, int length, uint color, uint const_alpha);
2264 void QT_FASTCALL comp_func_solid_Multiply(uint *dest, int length, uint color, uint const_alpha);
2265 void QT_FASTCALL comp_func_solid_Screen(uint *dest, int length, uint color, uint const_alpha);
2266 void QT_FASTCALL comp_func_solid_Overlay(uint *dest, int length, uint color, uint const_alpha);
2267 void QT_FASTCALL comp_func_solid_Darken(uint *dest, int length, uint color, uint const_alpha);
2268 void QT_FASTCALL comp_func_solid_Lighten(uint *dest, int length, uint color, uint const_alpha);
2269 void QT_FASTCALL comp_func_solid_ColorDodge(uint *dest, int length, uint color, uint const_alpha);
2270 void QT_FASTCALL comp_func_solid_ColorBurn(uint *dest, int length, uint color, uint const_alpha);
2271 void QT_FASTCALL comp_func_solid_HardLight(uint *dest, int length, uint color, uint const_alpha);
2272 void QT_FASTCALL comp_func_solid_SoftLight(uint *dest, int length, uint color, uint const_alpha);
2273 void QT_FASTCALL comp_func_solid_Difference(uint *dest, int length, uint color, uint const_alpha);
2274 void QT_FASTCALL comp_func_solid_Exclusion(uint *dest, int length, uint color, uint const_alpha);
2275 void QT_FASTCALL rasterop_solid_SourceOrDestination(uint *dest, int length, uint color, uint const_alpha);
2276 void QT_FASTCALL rasterop_solid_SourceAndDestination(uint *dest, int length, uint color, uint const_alpha);
2277 void QT_FASTCALL rasterop_solid_SourceXorDestination(uint *dest, int length, uint color, uint const_alpha);
2278 void QT_FASTCALL rasterop_solid_NotSourceAndNotDestination(uint *dest, int length, uint color, uint const_alpha);
2279 void QT_FASTCALL rasterop_solid_NotSourceOrNotDestination(uint *dest, int length, uint color, uint const_alpha);
2280 void QT_FASTCALL rasterop_solid_NotSourceXorDestination(uint *dest, int length, uint color, uint const_alpha);
2281 void QT_FASTCALL rasterop_solid_NotSource(uint *dest, int length, uint color, uint const_alpha);
2282 void QT_FASTCALL rasterop_solid_NotSourceAndDestination(uint *dest, int length, uint color, uint const_alpha);
2283 void QT_FASTCALL rasterop_solid_SourceAndNotDestination(uint *dest, int length, uint color, uint const_alpha);
2287 #endif // QDRAWHELPER_P_H