| 1 | /****************************************************************************
|
|---|
| 2 | **
|
|---|
| 3 | ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
|
|---|
| 4 | ** All rights reserved.
|
|---|
| 5 | ** Contact: Nokia Corporation ([email protected])
|
|---|
| 6 | **
|
|---|
| 7 | ** This file is part of the QtGui module of the Qt Toolkit.
|
|---|
| 8 | **
|
|---|
| 9 | ** $QT_BEGIN_LICENSE:LGPL$
|
|---|
| 10 | ** Commercial Usage
|
|---|
| 11 | ** Licensees holding valid Qt Commercial licenses may use this file in
|
|---|
| 12 | ** accordance with the Qt Commercial License Agreement provided with the
|
|---|
| 13 | ** Software or, alternatively, in accordance with the terms contained in
|
|---|
| 14 | ** a written agreement between you and Nokia.
|
|---|
| 15 | **
|
|---|
| 16 | ** GNU Lesser General Public License Usage
|
|---|
| 17 | ** Alternatively, this file may be used under the terms of the GNU Lesser
|
|---|
| 18 | ** General Public License version 2.1 as published by the Free Software
|
|---|
| 19 | ** Foundation and appearing in the file LICENSE.LGPL included in the
|
|---|
| 20 | ** packaging of this file. Please review the following information to
|
|---|
| 21 | ** ensure the GNU Lesser General Public License version 2.1 requirements
|
|---|
| 22 | ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
|---|
| 23 | **
|
|---|
| 24 | ** In addition, as a special exception, Nokia gives you certain additional
|
|---|
| 25 | ** rights. These rights are described in the Nokia Qt LGPL Exception
|
|---|
| 26 | ** version 1.1, included in the file LGPL_EXCEPTION.txt in this 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 have questions regarding the use of this file, please contact
|
|---|
| 37 | ** Nokia at [email protected].
|
|---|
| 38 | ** $QT_END_LICENSE$
|
|---|
| 39 | **
|
|---|
| 40 | ****************************************************************************/
|
|---|
| 41 |
|
|---|
| 42 | #ifndef QDRAWHELPER_P_H
|
|---|
| 43 | #define QDRAWHELPER_P_H
|
|---|
| 44 |
|
|---|
| 45 | //
|
|---|
| 46 | // W A R N I N G
|
|---|
| 47 | // -------------
|
|---|
| 48 | //
|
|---|
| 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.
|
|---|
| 52 | //
|
|---|
| 53 | // We mean it.
|
|---|
| 54 | //
|
|---|
| 55 |
|
|---|
| 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
|
|---|
| 63 | #endif
|
|---|
| 64 | #include "private/qrasterdefs_p.h"
|
|---|
| 65 | #include <private/qsimd_p.h>
|
|---|
| 66 |
|
|---|
| 67 | #ifdef Q_WS_QWS
|
|---|
| 68 | #include "QtGui/qscreen_qws.h"
|
|---|
| 69 | #endif
|
|---|
| 70 |
|
|---|
| 71 | QT_BEGIN_NAMESPACE
|
|---|
| 72 |
|
|---|
| 73 | #if defined(Q_CC_MSVC) && _MSCVER <= 1300 && !defined(Q_CC_INTEL)
|
|---|
| 74 | #define Q_STATIC_TEMPLATE_SPECIALIZATION static
|
|---|
| 75 | #else
|
|---|
| 76 | #define Q_STATIC_TEMPLATE_SPECIALIZATION
|
|---|
| 77 | #endif
|
|---|
| 78 |
|
|---|
| 79 | #if defined(Q_CC_RVCT)
|
|---|
| 80 | // RVCT doesn't like static template functions
|
|---|
| 81 | # define Q_STATIC_TEMPLATE_FUNCTION
|
|---|
| 82 | # define Q_STATIC_INLINE_FUNCTION static __forceinline
|
|---|
| 83 | #else
|
|---|
| 84 | # define Q_STATIC_TEMPLATE_FUNCTION static
|
|---|
| 85 | # define Q_STATIC_INLINE_FUNCTION static inline
|
|---|
| 86 | #endif
|
|---|
| 87 |
|
|---|
| 88 | static const uint AMASK = 0xff000000;
|
|---|
| 89 | static const uint RMASK = 0x00ff0000;
|
|---|
| 90 | static const uint GMASK = 0x0000ff00;
|
|---|
| 91 | static const uint BMASK = 0x000000ff;
|
|---|
| 92 |
|
|---|
| 93 | /*******************************************************************************
|
|---|
| 94 | * QSpan
|
|---|
| 95 | *
|
|---|
| 96 | * duplicate definition of FT_Span
|
|---|
| 97 | */
|
|---|
| 98 | typedef QT_FT_Span QSpan;
|
|---|
| 99 |
|
|---|
| 100 | struct QSolidData;
|
|---|
| 101 | struct QTextureData;
|
|---|
| 102 | struct QGradientData;
|
|---|
| 103 | struct QLinearGradientData;
|
|---|
| 104 | struct QRadialGradientData;
|
|---|
| 105 | struct QConicalGradientData;
|
|---|
| 106 | struct QSpanData;
|
|---|
| 107 | class QGradient;
|
|---|
| 108 | class QRasterBuffer;
|
|---|
| 109 | class QClipData;
|
|---|
| 110 | class QRasterPaintEngineState;
|
|---|
| 111 |
|
|---|
| 112 | typedef QT_FT_SpanFunc ProcessSpans;
|
|---|
| 113 | typedef void (*BitmapBlitFunc)(QRasterBuffer *rasterBuffer,
|
|---|
| 114 | int x, int y, quint32 color,
|
|---|
| 115 | const uchar *bitmap,
|
|---|
| 116 | int mapWidth, int mapHeight, int mapStride);
|
|---|
| 117 |
|
|---|
| 118 | typedef void (*AlphamapBlitFunc)(QRasterBuffer *rasterBuffer,
|
|---|
| 119 | int x, int y, quint32 color,
|
|---|
| 120 | const uchar *bitmap,
|
|---|
| 121 | int mapWidth, int mapHeight, int mapStride,
|
|---|
| 122 | const QClipData *clip);
|
|---|
| 123 |
|
|---|
| 124 | typedef void (*AlphaRGBBlitFunc)(QRasterBuffer *rasterBuffer,
|
|---|
| 125 | int x, int y, quint32 color,
|
|---|
| 126 | const uint *rgbmask,
|
|---|
| 127 | int mapWidth, int mapHeight, int mapStride,
|
|---|
| 128 | const QClipData *clip);
|
|---|
| 129 |
|
|---|
| 130 | typedef void (*RectFillFunc)(QRasterBuffer *rasterBuffer,
|
|---|
| 131 | int x, int y, int width, int height,
|
|---|
| 132 | quint32 color);
|
|---|
| 133 |
|
|---|
| 134 | typedef void (*SrcOverBlendFunc)(uchar *destPixels, int dbpl,
|
|---|
| 135 | const uchar *src, int spbl,
|
|---|
| 136 | int w, int h,
|
|---|
| 137 | int const_alpha);
|
|---|
| 138 |
|
|---|
| 139 | typedef void (*SrcOverScaleFunc)(uchar *destPixels, int dbpl,
|
|---|
| 140 | const uchar *src, int spbl,
|
|---|
| 141 | const QRectF &targetRect,
|
|---|
| 142 | const QRectF &sourceRect,
|
|---|
| 143 | const QRect &clipRect,
|
|---|
| 144 | int const_alpha);
|
|---|
| 145 |
|
|---|
| 146 | typedef void (*SrcOverTransformFunc)(uchar *destPixels, int dbpl,
|
|---|
| 147 | const uchar *src, int spbl,
|
|---|
| 148 | const QRectF &targetRect,
|
|---|
| 149 | const QRectF &sourceRect,
|
|---|
| 150 | const QRect &clipRect,
|
|---|
| 151 | const QTransform &targetRectTransform,
|
|---|
| 152 | int const_alpha);
|
|---|
| 153 |
|
|---|
| 154 | typedef void (*MemRotateFunc)(const uchar *srcPixels, int w, int h, int sbpl, uchar *destPixels, int dbpl);
|
|---|
| 155 |
|
|---|
| 156 | struct DrawHelper {
|
|---|
| 157 | ProcessSpans blendColor;
|
|---|
| 158 | ProcessSpans blendGradient;
|
|---|
| 159 | BitmapBlitFunc bitmapBlit;
|
|---|
| 160 | AlphamapBlitFunc alphamapBlit;
|
|---|
| 161 | AlphaRGBBlitFunc alphaRGBBlit;
|
|---|
| 162 | RectFillFunc fillRect;
|
|---|
| 163 | };
|
|---|
| 164 |
|
|---|
| 165 | extern SrcOverBlendFunc qBlendFunctions[QImage::NImageFormats][QImage::NImageFormats];
|
|---|
| 166 | extern SrcOverScaleFunc qScaleFunctions[QImage::NImageFormats][QImage::NImageFormats];
|
|---|
| 167 | extern SrcOverTransformFunc qTransformFunctions[QImage::NImageFormats][QImage::NImageFormats];
|
|---|
| 168 | extern MemRotateFunc qMemRotateFunctions[QImage::NImageFormats][3];
|
|---|
| 169 |
|
|---|
| 170 | extern DrawHelper qDrawHelper[QImage::NImageFormats];
|
|---|
| 171 |
|
|---|
| 172 | void qBlendTexture(int count, const QSpan *spans, void *userData);
|
|---|
| 173 | #if defined(Q_WS_QWS) && !defined(QT_NO_RASTERCALLBACKS)
|
|---|
| 174 | extern DrawHelper qDrawHelperCallback[QImage::NImageFormats];
|
|---|
| 175 | void qBlendTextureCallback(int count, const QSpan *spans, void *userData);
|
|---|
| 176 | #endif
|
|---|
| 177 |
|
|---|
| 178 | typedef void (QT_FASTCALL *CompositionFunction)(uint *dest, const uint *src, int length, uint const_alpha);
|
|---|
| 179 | typedef void (QT_FASTCALL *CompositionFunctionSolid)(uint *dest, int length, uint color, uint const_alpha);
|
|---|
| 180 |
|
|---|
| 181 | void qInitDrawhelperAsm();
|
|---|
| 182 |
|
|---|
| 183 | class QRasterPaintEngine;
|
|---|
| 184 |
|
|---|
| 185 | struct QSolidData
|
|---|
| 186 | {
|
|---|
| 187 | uint color;
|
|---|
| 188 | };
|
|---|
| 189 |
|
|---|
| 190 | struct QLinearGradientData
|
|---|
| 191 | {
|
|---|
| 192 | struct {
|
|---|
| 193 | qreal x;
|
|---|
| 194 | qreal y;
|
|---|
| 195 | } origin;
|
|---|
| 196 | struct {
|
|---|
| 197 | qreal x;
|
|---|
| 198 | qreal y;
|
|---|
| 199 | } end;
|
|---|
| 200 | };
|
|---|
| 201 |
|
|---|
| 202 | struct QRadialGradientData
|
|---|
| 203 | {
|
|---|
| 204 | struct {
|
|---|
| 205 | qreal x;
|
|---|
| 206 | qreal y;
|
|---|
| 207 | } center;
|
|---|
| 208 | struct {
|
|---|
| 209 | qreal x;
|
|---|
| 210 | qreal y;
|
|---|
| 211 | } focal;
|
|---|
| 212 | qreal radius;
|
|---|
| 213 | };
|
|---|
| 214 |
|
|---|
| 215 | struct QConicalGradientData
|
|---|
| 216 | {
|
|---|
| 217 | struct {
|
|---|
| 218 | qreal x;
|
|---|
| 219 | qreal y;
|
|---|
| 220 | } center;
|
|---|
| 221 | qreal angle;
|
|---|
| 222 | };
|
|---|
| 223 |
|
|---|
| 224 | struct QGradientData
|
|---|
| 225 | {
|
|---|
| 226 | QGradient::Spread spread;
|
|---|
| 227 |
|
|---|
| 228 | union {
|
|---|
| 229 | QLinearGradientData linear;
|
|---|
| 230 | QRadialGradientData radial;
|
|---|
| 231 | QConicalGradientData conical;
|
|---|
| 232 | };
|
|---|
| 233 |
|
|---|
| 234 | #ifdef Q_WS_QWS
|
|---|
| 235 | #define GRADIENT_STOPTABLE_SIZE 256
|
|---|
| 236 | #else
|
|---|
| 237 | #define GRADIENT_STOPTABLE_SIZE 1024
|
|---|
| 238 | #endif
|
|---|
| 239 |
|
|---|
| 240 | uint* colorTable; //[GRADIENT_STOPTABLE_SIZE];
|
|---|
| 241 |
|
|---|
| 242 | uint alphaColor : 1;
|
|---|
| 243 | };
|
|---|
| 244 |
|
|---|
| 245 | struct QTextureData
|
|---|
| 246 | {
|
|---|
| 247 | const uchar *imageData;
|
|---|
| 248 | const uchar *scanLine(int y) const { return imageData + y*bytesPerLine; }
|
|---|
| 249 |
|
|---|
| 250 | int width;
|
|---|
| 251 | int height;
|
|---|
| 252 | // clip rect
|
|---|
| 253 | int x1;
|
|---|
| 254 | int y1;
|
|---|
| 255 | int x2;
|
|---|
| 256 | int y2;
|
|---|
| 257 | int bytesPerLine;
|
|---|
| 258 | QImage::Format format;
|
|---|
| 259 | const QVector<QRgb> *colorTable;
|
|---|
| 260 | bool hasAlpha;
|
|---|
| 261 | enum Type {
|
|---|
| 262 | Plain,
|
|---|
| 263 | Tiled
|
|---|
| 264 | };
|
|---|
| 265 | Type type;
|
|---|
| 266 | int const_alpha;
|
|---|
| 267 | };
|
|---|
| 268 |
|
|---|
| 269 | struct QSpanData
|
|---|
| 270 | {
|
|---|
| 271 | QSpanData() : tempImage(0) {}
|
|---|
| 272 | ~QSpanData() { delete tempImage; }
|
|---|
| 273 |
|
|---|
| 274 | QRasterBuffer *rasterBuffer;
|
|---|
| 275 | #ifdef Q_WS_QWS
|
|---|
| 276 | QRasterPaintEngine *rasterEngine;
|
|---|
| 277 | #endif
|
|---|
| 278 | ProcessSpans blend;
|
|---|
| 279 | ProcessSpans unclipped_blend;
|
|---|
| 280 | BitmapBlitFunc bitmapBlit;
|
|---|
| 281 | AlphamapBlitFunc alphamapBlit;
|
|---|
| 282 | AlphaRGBBlitFunc alphaRGBBlit;
|
|---|
| 283 | RectFillFunc fillRect;
|
|---|
| 284 | qreal m11, m12, m13, m21, m22, m23, m33, dx, dy; // inverse xform matrix
|
|---|
| 285 | const QClipData *clip;
|
|---|
| 286 | enum Type {
|
|---|
| 287 | None,
|
|---|
| 288 | Solid,
|
|---|
| 289 | LinearGradient,
|
|---|
| 290 | RadialGradient,
|
|---|
| 291 | ConicalGradient,
|
|---|
| 292 | Texture
|
|---|
| 293 | } type : 8;
|
|---|
| 294 | int txop : 8;
|
|---|
| 295 | int fast_matrix : 1;
|
|---|
| 296 | bool bilinear;
|
|---|
| 297 | QImage *tempImage;
|
|---|
| 298 | union {
|
|---|
| 299 | QSolidData solid;
|
|---|
| 300 | QGradientData gradient;
|
|---|
| 301 | QTextureData texture;
|
|---|
| 302 | };
|
|---|
| 303 |
|
|---|
| 304 | void init(QRasterBuffer *rb, const QRasterPaintEngine *pe);
|
|---|
| 305 | void setup(const QBrush &brush, int alpha, QPainter::CompositionMode compositionMode);
|
|---|
| 306 | void setupMatrix(const QTransform &matrix, int bilinear);
|
|---|
| 307 | void initTexture(const QImage *image, int alpha, QTextureData::Type = QTextureData::Plain, const QRect &sourceRect = QRect());
|
|---|
| 308 | void adjustSpanMethods();
|
|---|
| 309 | };
|
|---|
| 310 |
|
|---|
| 311 | #if defined(Q_CC_RVCT)
|
|---|
| 312 | # pragma push
|
|---|
| 313 | # pragma arm
|
|---|
| 314 | #endif
|
|---|
| 315 | Q_STATIC_INLINE_FUNCTION uint INTERPOLATE_PIXEL_255(uint x, uint a, uint y, uint b) {
|
|---|
| 316 | uint t = (x & 0xff00ff) * a + (y & 0xff00ff) * b;
|
|---|
| 317 | t = (t + ((t >> 8) & 0xff00ff) + 0x800080) >> 8;
|
|---|
| 318 | t &= 0xff00ff;
|
|---|
| 319 |
|
|---|
| 320 | x = ((x >> 8) & 0xff00ff) * a + ((y >> 8) & 0xff00ff) * b;
|
|---|
| 321 | x = (x + ((x >> 8) & 0xff00ff) + 0x800080);
|
|---|
| 322 | x &= 0xff00ff00;
|
|---|
| 323 | x |= t;
|
|---|
| 324 | return x;
|
|---|
| 325 | }
|
|---|
| 326 | #if defined(Q_CC_RVCT)
|
|---|
| 327 | # pragma pop
|
|---|
| 328 | #endif
|
|---|
| 329 |
|
|---|
| 330 | #if QT_POINTER_SIZE == 8 // 64-bit versions
|
|---|
| 331 |
|
|---|
| 332 | Q_STATIC_INLINE_FUNCTION uint INTERPOLATE_PIXEL_256(uint x, uint a, uint y, uint b) {
|
|---|
| 333 | quint64 t = (((quint64(x)) | ((quint64(x)) << 24)) & 0x00ff00ff00ff00ff) * a;
|
|---|
| 334 | t += (((quint64(y)) | ((quint64(y)) << 24)) & 0x00ff00ff00ff00ff) * b;
|
|---|
| 335 | t >>= 8;
|
|---|
| 336 | t &= 0x00ff00ff00ff00ff;
|
|---|
| 337 | return (uint(t)) | (uint(t >> 24));
|
|---|
| 338 | }
|
|---|
| 339 |
|
|---|
| 340 | Q_STATIC_INLINE_FUNCTION uint BYTE_MUL(uint x, uint a) {
|
|---|
| 341 | quint64 t = (((quint64(x)) | ((quint64(x)) << 24)) & 0x00ff00ff00ff00ff) * a;
|
|---|
| 342 | t = (t + ((t >> 8) & 0xff00ff00ff00ff) + 0x80008000800080) >> 8;
|
|---|
| 343 | t &= 0x00ff00ff00ff00ff;
|
|---|
| 344 | return (uint(t)) | (uint(t >> 24));
|
|---|
| 345 | }
|
|---|
| 346 |
|
|---|
| 347 | Q_STATIC_INLINE_FUNCTION uint PREMUL(uint x) {
|
|---|
| 348 | uint a = x >> 24;
|
|---|
| 349 | quint64 t = (((quint64(x)) | ((quint64(x)) << 24)) & 0x00ff00ff00ff00ff) * a;
|
|---|
| 350 | t = (t + ((t >> 8) & 0xff00ff00ff00ff) + 0x80008000800080) >> 8;
|
|---|
| 351 | t &= 0x000000ff00ff00ff;
|
|---|
| 352 | return (uint(t)) | (uint(t >> 24)) | (a << 24);
|
|---|
| 353 | }
|
|---|
| 354 |
|
|---|
| 355 | #else // 32-bit versions
|
|---|
| 356 |
|
|---|
| 357 | Q_STATIC_INLINE_FUNCTION uint INTERPOLATE_PIXEL_256(uint x, uint a, uint y, uint b) {
|
|---|
| 358 | uint t = (x & 0xff00ff) * a + (y & 0xff00ff) * b;
|
|---|
| 359 | t >>= 8;
|
|---|
| 360 | t &= 0xff00ff;
|
|---|
| 361 |
|
|---|
| 362 | x = ((x >> 8) & 0xff00ff) * a + ((y >> 8) & 0xff00ff) * b;
|
|---|
| 363 | x &= 0xff00ff00;
|
|---|
| 364 | x |= t;
|
|---|
| 365 | return x;
|
|---|
| 366 | }
|
|---|
| 367 |
|
|---|
| 368 | #if defined(Q_CC_RVCT)
|
|---|
| 369 | # pragma push
|
|---|
| 370 | # pragma arm
|
|---|
| 371 | #endif
|
|---|
| 372 | Q_STATIC_INLINE_FUNCTION uint BYTE_MUL(uint x, uint a) {
|
|---|
| 373 | uint t = (x & 0xff00ff) * a;
|
|---|
| 374 | t = (t + ((t >> 8) & 0xff00ff) + 0x800080) >> 8;
|
|---|
| 375 | t &= 0xff00ff;
|
|---|
| 376 |
|
|---|
| 377 | x = ((x >> 8) & 0xff00ff) * a;
|
|---|
| 378 | x = (x + ((x >> 8) & 0xff00ff) + 0x800080);
|
|---|
| 379 | x &= 0xff00ff00;
|
|---|
| 380 | x |= t;
|
|---|
| 381 | return x;
|
|---|
| 382 | }
|
|---|
| 383 | #if defined(Q_CC_RVCT)
|
|---|
| 384 | # pragma pop
|
|---|
| 385 | #endif
|
|---|
| 386 |
|
|---|
| 387 | Q_STATIC_INLINE_FUNCTION uint PREMUL(uint x) {
|
|---|
| 388 | uint a = x >> 24;
|
|---|
| 389 | uint t = (x & 0xff00ff) * a;
|
|---|
| 390 | t = (t + ((t >> 8) & 0xff00ff) + 0x800080) >> 8;
|
|---|
| 391 | t &= 0xff00ff;
|
|---|
| 392 |
|
|---|
| 393 | x = ((x >> 8) & 0xff) * a;
|
|---|
| 394 | x = (x + ((x >> 8) & 0xff) + 0x80);
|
|---|
| 395 | x &= 0xff00;
|
|---|
| 396 | x |= t | (a << 24);
|
|---|
| 397 | return x;
|
|---|
| 398 | }
|
|---|
| 399 | #endif
|
|---|
| 400 |
|
|---|
| 401 |
|
|---|
| 402 | Q_STATIC_INLINE_FUNCTION uint BYTE_MUL_RGB16(uint x, uint a) {
|
|---|
| 403 | a += 1;
|
|---|
| 404 | uint t = (((x & 0x07e0)*a) >> 8) & 0x07e0;
|
|---|
| 405 | t |= (((x & 0xf81f)*(a>>2)) >> 6) & 0xf81f;
|
|---|
| 406 | return t;
|
|---|
| 407 | }
|
|---|
| 408 |
|
|---|
| 409 | Q_STATIC_INLINE_FUNCTION uint BYTE_MUL_RGB16_32(uint x, uint a) {
|
|---|
| 410 | uint t = (((x & 0xf81f07e0) >> 5)*a) & 0xf81f07e0;
|
|---|
| 411 | t |= (((x & 0x07e0f81f)*a) >> 5) & 0x07e0f81f;
|
|---|
| 412 | return t;
|
|---|
| 413 | }
|
|---|
| 414 |
|
|---|
| 415 | #define INV_PREMUL(p) \
|
|---|
| 416 | (qAlpha(p) == 0 ? 0 : \
|
|---|
| 417 | ((qAlpha(p) << 24) \
|
|---|
| 418 | | (((255*qRed(p))/ qAlpha(p)) << 16) \
|
|---|
| 419 | | (((255*qGreen(p)) / qAlpha(p)) << 8) \
|
|---|
| 420 | | ((255*qBlue(p)) / qAlpha(p))))
|
|---|
| 421 |
|
|---|
| 422 | template <class DST, class SRC>
|
|---|
| 423 | inline DST qt_colorConvert(SRC color, DST dummy)
|
|---|
| 424 | {
|
|---|
| 425 | Q_UNUSED(dummy);
|
|---|
| 426 | return DST(color);
|
|---|
| 427 | }
|
|---|
| 428 |
|
|---|
| 429 |
|
|---|
| 430 | template <>
|
|---|
| 431 | inline quint32 qt_colorConvert(quint16 color, quint32 dummy)
|
|---|
| 432 | {
|
|---|
| 433 | Q_UNUSED(dummy);
|
|---|
| 434 | const int r = (color & 0xf800);
|
|---|
| 435 | const int g = (color & 0x07e0);
|
|---|
| 436 | const int b = (color & 0x001f);
|
|---|
| 437 | const int tr = (r >> 8) | (r >> 13);
|
|---|
| 438 | const int tg = (g >> 3) | (g >> 9);
|
|---|
| 439 | const int tb = (b << 3) | (b >> 2);
|
|---|
| 440 |
|
|---|
| 441 | return qRgb(tr, tg, tb);
|
|---|
| 442 | }
|
|---|
| 443 |
|
|---|
| 444 | template <>
|
|---|
| 445 | inline quint16 qt_colorConvert(quint32 color, quint16 dummy)
|
|---|
| 446 | {
|
|---|
| 447 | Q_UNUSED(dummy);
|
|---|
| 448 | const int r = qRed(color) << 8;
|
|---|
| 449 | const int g = qGreen(color) << 3;
|
|---|
| 450 | const int b = qBlue(color) >> 3;
|
|---|
| 451 |
|
|---|
| 452 | return (r & 0xf800) | (g & 0x07e0)| (b & 0x001f);
|
|---|
| 453 | }
|
|---|
| 454 |
|
|---|
| 455 | class quint32p
|
|---|
| 456 | {
|
|---|
| 457 | public:
|
|---|
| 458 | inline quint32p(quint32 v) : data(PREMUL(v)) {}
|
|---|
| 459 |
|
|---|
| 460 | inline operator quint32() const { return data; }
|
|---|
| 461 |
|
|---|
| 462 | inline operator quint16() const
|
|---|
| 463 | {
|
|---|
| 464 | return qt_colorConvert<quint16, quint32>(data, 0);
|
|---|
| 465 | }
|
|---|
| 466 |
|
|---|
| 467 | Q_STATIC_INLINE_FUNCTION quint32p fromRawData(quint32 v)
|
|---|
| 468 | {
|
|---|
| 469 | quint32p p;
|
|---|
| 470 | p.data = v;
|
|---|
| 471 | return p;
|
|---|
| 472 | }
|
|---|
| 473 |
|
|---|
| 474 | private:
|
|---|
| 475 | quint32p() {}
|
|---|
| 476 | quint32 data;
|
|---|
| 477 | } Q_PACKED;
|
|---|
| 478 |
|
|---|
| 479 | class qabgr8888
|
|---|
| 480 | {
|
|---|
| 481 | public:
|
|---|
| 482 | inline qabgr8888(quint32 v)
|
|---|
| 483 | {
|
|---|
| 484 | data = qRgba(qBlue(v), qGreen(v), qRed(v), qAlpha(v));
|
|---|
| 485 | }
|
|---|
| 486 |
|
|---|
| 487 | inline bool operator==(const qabgr8888 &v) const { return data == v.data; }
|
|---|
| 488 |
|
|---|
| 489 | private:
|
|---|
| 490 | quint32 data;
|
|---|
| 491 | } Q_PACKED;
|
|---|
| 492 |
|
|---|
| 493 | class qrgb565;
|
|---|
| 494 |
|
|---|
| 495 | class qargb8565
|
|---|
| 496 | {
|
|---|
| 497 | public:
|
|---|
| 498 | Q_STATIC_INLINE_FUNCTION bool hasAlpha() { return true; }
|
|---|
| 499 |
|
|---|
| 500 | inline qargb8565() {}
|
|---|
| 501 | inline qargb8565(quint32 v);
|
|---|
| 502 | inline explicit qargb8565(quint32p v);
|
|---|
| 503 | inline qargb8565(const qargb8565 &v);
|
|---|
| 504 | inline qargb8565(const qrgb565 &v);
|
|---|
| 505 |
|
|---|
| 506 | inline operator quint32() const;
|
|---|
| 507 | inline operator quint16() const;
|
|---|
| 508 |
|
|---|
| 509 | inline quint8 alpha() const { return data[0]; }
|
|---|
| 510 | inline qargb8565 truncedAlpha() {
|
|---|
| 511 | data[0] &= 0xf8;
|
|---|
| 512 | data[1] &= 0xdf;
|
|---|
| 513 | return *this;
|
|---|
| 514 | }
|
|---|
| 515 | Q_STATIC_INLINE_FUNCTION quint8 alpha(quint8 a) { return (a + 1) >> 3; }
|
|---|
| 516 | Q_STATIC_INLINE_FUNCTION quint8 ialpha(quint8 a) { return 0x20 - alpha(a); }
|
|---|
| 517 |
|
|---|
| 518 | inline qargb8565 byte_mul(quint8 a) const;
|
|---|
| 519 | inline qargb8565 operator+(qargb8565 v) const;
|
|---|
| 520 | inline bool operator==(const qargb8565 &v) const;
|
|---|
| 521 |
|
|---|
| 522 | inline quint32 rawValue() const;
|
|---|
| 523 | inline quint16 rawValue16() const;
|
|---|
| 524 |
|
|---|
| 525 | private:
|
|---|
| 526 | friend class qrgb565;
|
|---|
| 527 |
|
|---|
| 528 | quint8 data[3];
|
|---|
| 529 | } Q_PACKED;
|
|---|
| 530 |
|
|---|
| 531 | class qrgb565
|
|---|
| 532 | {
|
|---|
| 533 | public:
|
|---|
| 534 | Q_STATIC_INLINE_FUNCTION bool hasAlpha() { return false; }
|
|---|
| 535 |
|
|---|
| 536 | qrgb565(int v = 0) : data(v) {}
|
|---|
| 537 |
|
|---|
| 538 | inline explicit qrgb565(quint32p v);
|
|---|
| 539 | inline explicit qrgb565(quint32 v);
|
|---|
| 540 | inline explicit qrgb565(const qargb8565 &v);
|
|---|
| 541 |
|
|---|
| 542 | inline operator quint32() const;
|
|---|
| 543 | inline operator quint16() const;
|
|---|
| 544 |
|
|---|
| 545 | inline qrgb565 operator+(qrgb565 v) const;
|
|---|
| 546 |
|
|---|
| 547 | inline quint8 alpha() const { return 0xff; }
|
|---|
| 548 | inline qrgb565 truncedAlpha() { return *this; }
|
|---|
| 549 | Q_STATIC_INLINE_FUNCTION quint8 alpha(quint8 a) { return (a + 1) >> 3; }
|
|---|
| 550 | Q_STATIC_INLINE_FUNCTION quint8 ialpha(quint8 a) { return 0x20 - alpha(a); }
|
|---|
| 551 |
|
|---|
| 552 | inline qrgb565 byte_mul(quint8 a) const;
|
|---|
| 553 |
|
|---|
| 554 | inline bool operator==(const qrgb565 &v) const;
|
|---|
| 555 | inline quint16 rawValue() const { return data; }
|
|---|
| 556 |
|
|---|
| 557 | private:
|
|---|
| 558 | friend class qargb8565;
|
|---|
| 559 |
|
|---|
| 560 | quint16 data;
|
|---|
| 561 | } Q_PACKED;
|
|---|
| 562 |
|
|---|
| 563 | qargb8565::qargb8565(quint32 v)
|
|---|
| 564 | {
|
|---|
| 565 | *this = qargb8565(quint32p(v));
|
|---|
| 566 | }
|
|---|
| 567 |
|
|---|
| 568 | qargb8565::qargb8565(quint32p v)
|
|---|
| 569 | {
|
|---|
| 570 | data[0] = qAlpha(v);
|
|---|
| 571 | const int r = qRed(v);
|
|---|
| 572 | const int g = qGreen(v);
|
|---|
| 573 | const int b = qBlue(v);
|
|---|
| 574 | data[1] = ((g << 3) & 0xe0) | (b >> 3);
|
|---|
| 575 | data[2] = (r & 0xf8) | (g >> 5);
|
|---|
| 576 | }
|
|---|
| 577 |
|
|---|
| 578 | qargb8565::qargb8565(const qargb8565 &v)
|
|---|
| 579 | {
|
|---|
| 580 | data[0] = v.data[0];
|
|---|
| 581 | data[1] = v.data[1];
|
|---|
| 582 | data[2] = v.data[2];
|
|---|
| 583 | }
|
|---|
| 584 |
|
|---|
| 585 | qargb8565::qargb8565(const qrgb565 &v)
|
|---|
| 586 | {
|
|---|
| 587 | data[0] = 0xff;
|
|---|
| 588 | data[1] = v.data & 0xff;
|
|---|
| 589 | data[2] = v.data >> 8;
|
|---|
| 590 | }
|
|---|
| 591 |
|
|---|
| 592 | qargb8565::operator quint32() const
|
|---|
| 593 | {
|
|---|
| 594 | const quint16 rgb = (data[2] << 8) | data[1];
|
|---|
| 595 | const int a = data[0];
|
|---|
| 596 | const int r = (rgb & 0xf800);
|
|---|
| 597 | const int g = (rgb & 0x07e0);
|
|---|
| 598 | const int b = (rgb & 0x001f);
|
|---|
| 599 | const int tr = qMin(a, (r >> 8) | (r >> 13));
|
|---|
| 600 | const int tg = qMin(a, (g >> 3) | (g >> 9));
|
|---|
| 601 | const int tb = qMin(a, (b << 3) | (b >> 2));
|
|---|
| 602 | return qRgba(tr, tg, tb, data[0]);
|
|---|
| 603 | }
|
|---|
| 604 |
|
|---|
| 605 | qargb8565::operator quint16() const
|
|---|
| 606 | {
|
|---|
| 607 | return (data[2] << 8) | data[1];
|
|---|
| 608 | }
|
|---|
| 609 |
|
|---|
| 610 | qargb8565 qargb8565::operator+(qargb8565 v) const
|
|---|
| 611 | {
|
|---|
| 612 | qargb8565 t;
|
|---|
| 613 | t.data[0] = data[0] + v.data[0];
|
|---|
| 614 | const quint16 rgb = ((data[2] + v.data[2]) << 8)
|
|---|
| 615 | + (data[1] + v.data[1]);
|
|---|
| 616 | t.data[1] = rgb & 0xff;
|
|---|
| 617 | t.data[2] = rgb >> 8;
|
|---|
| 618 | return t;
|
|---|
| 619 | }
|
|---|
| 620 |
|
|---|
| 621 | qargb8565 qargb8565::byte_mul(quint8 a) const
|
|---|
| 622 | {
|
|---|
| 623 | qargb8565 result;
|
|---|
| 624 | result.data[0] = (data[0] * a) >> 5;
|
|---|
| 625 |
|
|---|
| 626 | const quint16 x = (data[2] << 8) | data[1];
|
|---|
| 627 | const quint16 t = ((((x & 0x07e0) >> 5) * a) & 0x07e0) |
|
|---|
| 628 | ((((x & 0xf81f) * a) >> 5) & 0xf81f);
|
|---|
| 629 | result.data[1] = t & 0xff;
|
|---|
| 630 | result.data[2] = t >> 8;
|
|---|
| 631 | return result;
|
|---|
| 632 | }
|
|---|
| 633 |
|
|---|
| 634 | bool qargb8565::operator==(const qargb8565 &v) const
|
|---|
| 635 | {
|
|---|
| 636 | return data[0] == v.data[0]
|
|---|
| 637 | && data[1] == v.data[1]
|
|---|
| 638 | && data[2] == v.data[2];
|
|---|
| 639 | }
|
|---|
| 640 |
|
|---|
| 641 | quint32 qargb8565::rawValue() const
|
|---|
| 642 | {
|
|---|
| 643 | return (data[2] << 16) | (data[1] << 8) | data[0];
|
|---|
| 644 | }
|
|---|
| 645 |
|
|---|
| 646 | quint16 qargb8565::rawValue16() const
|
|---|
| 647 | {
|
|---|
| 648 | return (data[2] << 8) | data[1];
|
|---|
| 649 | }
|
|---|
| 650 |
|
|---|
| 651 | qrgb565::qrgb565(quint32p v)
|
|---|
| 652 | {
|
|---|
| 653 | *this = qrgb565(quint32(v));
|
|---|
| 654 | }
|
|---|
| 655 |
|
|---|
| 656 | qrgb565::qrgb565(quint32 v)
|
|---|
| 657 | {
|
|---|
| 658 | const int r = qRed(v) << 8;
|
|---|
| 659 | const int g = qGreen(v) << 3;
|
|---|
| 660 | const int b = qBlue(v) >> 3;
|
|---|
| 661 |
|
|---|
| 662 | data = (r & 0xf800) | (g & 0x07e0)| (b & 0x001f);
|
|---|
| 663 | }
|
|---|
| 664 |
|
|---|
| 665 | qrgb565::qrgb565(const qargb8565 &v)
|
|---|
| 666 | {
|
|---|
| 667 | data = (v.data[2] << 8) | v.data[1];
|
|---|
| 668 | }
|
|---|
| 669 |
|
|---|
| 670 | qrgb565::operator quint32() const
|
|---|
| 671 | {
|
|---|
| 672 | const int r = (data & 0xf800);
|
|---|
| 673 | const int g = (data & 0x07e0);
|
|---|
| 674 | const int b = (data & 0x001f);
|
|---|
| 675 | const int tr = (r >> 8) | (r >> 13);
|
|---|
| 676 | const int tg = (g >> 3) | (g >> 9);
|
|---|
| 677 | const int tb = (b << 3) | (b >> 2);
|
|---|
| 678 | return qRgb(tr, tg, tb);
|
|---|
| 679 | }
|
|---|
| 680 |
|
|---|
| 681 | qrgb565::operator quint16() const
|
|---|
| 682 | {
|
|---|
| 683 | return data;
|
|---|
| 684 | }
|
|---|
| 685 |
|
|---|
| 686 | qrgb565 qrgb565::operator+(qrgb565 v) const
|
|---|
| 687 | {
|
|---|
| 688 | qrgb565 t;
|
|---|
| 689 | t.data = data + v.data;
|
|---|
| 690 | return t;
|
|---|
| 691 | }
|
|---|
| 692 |
|
|---|
| 693 | qrgb565 qrgb565::byte_mul(quint8 a) const
|
|---|
| 694 | {
|
|---|
| 695 | qrgb565 result;
|
|---|
| 696 | result.data = ((((data & 0x07e0) >> 5) * a) & 0x07e0) |
|
|---|
| 697 | ((((data & 0xf81f) * a) >> 5) & 0xf81f);
|
|---|
| 698 | return result;
|
|---|
| 699 | }
|
|---|
| 700 |
|
|---|
| 701 | bool qrgb565::operator==(const qrgb565 &v) const
|
|---|
| 702 | {
|
|---|
| 703 | return data == v.data;
|
|---|
| 704 | }
|
|---|
| 705 |
|
|---|
| 706 | class qbgr565
|
|---|
| 707 | {
|
|---|
| 708 | public:
|
|---|
| 709 | inline qbgr565(quint16 v)
|
|---|
| 710 | {
|
|---|
| 711 | data = ((v & 0x001f) << 11) |
|
|---|
| 712 | (v & 0x07e0) |
|
|---|
| 713 | ((v & 0xf800) >> 11);
|
|---|
| 714 | }
|
|---|
| 715 |
|
|---|
| 716 | inline bool operator==(const qbgr565 &v) const
|
|---|
| 717 | {
|
|---|
| 718 | return data == v.data;
|
|---|
| 719 | }
|
|---|
| 720 |
|
|---|
| 721 | private:
|
|---|
| 722 | quint16 data;
|
|---|
| 723 | } Q_PACKED;
|
|---|
| 724 |
|
|---|
| 725 | class qrgb555;
|
|---|
| 726 |
|
|---|
| 727 | class qargb8555
|
|---|
| 728 | {
|
|---|
| 729 | public:
|
|---|
| 730 | Q_STATIC_INLINE_FUNCTION bool hasAlpha() { return true; }
|
|---|
| 731 |
|
|---|
| 732 | qargb8555() {}
|
|---|
| 733 | inline qargb8555(quint32 v);
|
|---|
| 734 | inline explicit qargb8555(quint32p v);
|
|---|
| 735 | inline qargb8555(const qargb8555 &v);
|
|---|
| 736 | inline qargb8555(const qrgb555 &v);
|
|---|
| 737 |
|
|---|
| 738 | inline operator quint32() const;
|
|---|
| 739 |
|
|---|
| 740 | inline quint8 alpha() const { return data[0]; }
|
|---|
| 741 | inline qargb8555 truncedAlpha() { data[0] &= 0xf8; return *this; }
|
|---|
| 742 | Q_STATIC_INLINE_FUNCTION quint8 alpha(quint8 a) { return (a + 1) >> 3; }
|
|---|
| 743 | Q_STATIC_INLINE_FUNCTION quint8 ialpha(quint8 a) { return 0x20 - alpha(a); }
|
|---|
| 744 |
|
|---|
| 745 | inline qargb8555 operator+(qargb8555 v) const;
|
|---|
| 746 | inline qargb8555 byte_mul(quint8 a) const;
|
|---|
| 747 |
|
|---|
| 748 | inline bool operator==(const qargb8555 &v) const;
|
|---|
| 749 |
|
|---|
| 750 | inline quint32 rawValue() const;
|
|---|
| 751 |
|
|---|
| 752 | private:
|
|---|
| 753 | friend class qrgb555;
|
|---|
| 754 | quint8 data[3];
|
|---|
| 755 | } Q_PACKED;
|
|---|
| 756 |
|
|---|
| 757 | class qrgb555
|
|---|
| 758 | {
|
|---|
| 759 | public:
|
|---|
| 760 | Q_STATIC_INLINE_FUNCTION bool hasAlpha() { return false; }
|
|---|
| 761 |
|
|---|
| 762 | inline qrgb555(int v = 0) : data(v) {}
|
|---|
| 763 |
|
|---|
| 764 | inline explicit qrgb555(quint32p v) { *this = qrgb555(quint32(v)); }
|
|---|
| 765 |
|
|---|
| 766 | inline explicit qrgb555(quint32 v)
|
|---|
| 767 | {
|
|---|
| 768 | const int r = qRed(v) << 7;
|
|---|
| 769 | const int g = qGreen(v) << 2;
|
|---|
| 770 | const int b = qBlue(v) >> 3;
|
|---|
| 771 |
|
|---|
| 772 | data = (r & 0x7c00) | (g & 0x03e0) | (b & 0x001f);
|
|---|
| 773 | }
|
|---|
| 774 |
|
|---|
| 775 | inline explicit qrgb555(quint16 v)
|
|---|
| 776 | {
|
|---|
| 777 | data = ((v >> 1) & (0x7c00 | 0x03e0)) |
|
|---|
| 778 | (v & 0x001f);
|
|---|
| 779 | }
|
|---|
| 780 |
|
|---|
| 781 | inline explicit qrgb555(const qargb8555 &v);
|
|---|
| 782 |
|
|---|
| 783 | inline operator quint32() const
|
|---|
| 784 | {
|
|---|
| 785 | const int r = (data & 0x7c00);
|
|---|
| 786 | const int g = (data & 0x03e0);
|
|---|
| 787 | const int b = (data & 0x001f);
|
|---|
| 788 | const int tr = (r >> 7) | (r >> 12);
|
|---|
| 789 | const int tg = (g >> 2) | (g >> 7);
|
|---|
| 790 | const int tb = (b << 3) | (b >> 2);
|
|---|
| 791 |
|
|---|
| 792 | return qRgb(tr, tg, tb);
|
|---|
| 793 | }
|
|---|
| 794 |
|
|---|
| 795 | inline operator quint16() const
|
|---|
| 796 | {
|
|---|
| 797 | const int r = ((data & 0x7c00) << 1) & 0xf800;
|
|---|
| 798 | const int g = (((data & 0x03e0) << 1) | ((data >> 4) & 0x0020)) & 0x07e0;
|
|---|
| 799 | const int b = (data & 0x001f);
|
|---|
| 800 |
|
|---|
| 801 | return r | g | b;
|
|---|
| 802 | }
|
|---|
| 803 |
|
|---|
| 804 | inline qrgb555 operator+(qrgb555 v) const;
|
|---|
| 805 | inline qrgb555 byte_mul(quint8 a) const;
|
|---|
| 806 |
|
|---|
| 807 | inline quint8 alpha() const { return 0xff; }
|
|---|
| 808 | inline qrgb555 truncedAlpha() { return *this; }
|
|---|
| 809 | Q_STATIC_INLINE_FUNCTION quint8 alpha(quint8 a) { return (a + 1) >> 3; }
|
|---|
| 810 | Q_STATIC_INLINE_FUNCTION quint8 ialpha(quint8 a) { return 0x20 - alpha(a); }
|
|---|
| 811 |
|
|---|
| 812 | inline bool operator==(const qrgb555 &v) const { return v.data == data; }
|
|---|
| 813 | inline bool operator!=(const qrgb555 &v) const { return v.data != data; }
|
|---|
| 814 |
|
|---|
| 815 | inline quint16 rawValue() const { return data; }
|
|---|
| 816 |
|
|---|
| 817 | private:
|
|---|
| 818 | friend class qargb8555;
|
|---|
| 819 | friend class qbgr555;
|
|---|
| 820 | quint16 data;
|
|---|
| 821 |
|
|---|
| 822 | } Q_PACKED;
|
|---|
| 823 |
|
|---|
| 824 | qrgb555::qrgb555(const qargb8555 &v)
|
|---|
| 825 | {
|
|---|
| 826 | data = (v.data[2] << 8) | v.data[1];
|
|---|
| 827 | }
|
|---|
| 828 |
|
|---|
| 829 | qrgb555 qrgb555::operator+(qrgb555 v) const
|
|---|
| 830 | {
|
|---|
| 831 | qrgb555 t;
|
|---|
| 832 | t.data = data + v.data;
|
|---|
| 833 | return t;
|
|---|
| 834 | }
|
|---|
| 835 |
|
|---|
| 836 | qrgb555 qrgb555::byte_mul(quint8 a) const
|
|---|
| 837 | {
|
|---|
| 838 | quint16 t = (((data & 0x3e0) * a) >> 5) & 0x03e0;
|
|---|
| 839 | t |= (((data & 0x7c1f) * a) >> 5) & 0x7c1f;
|
|---|
| 840 |
|
|---|
| 841 | qrgb555 result;
|
|---|
| 842 | result.data = t;
|
|---|
| 843 | return result;
|
|---|
| 844 | }
|
|---|
| 845 |
|
|---|
| 846 | class qbgr555
|
|---|
| 847 | {
|
|---|
| 848 | public:
|
|---|
| 849 | inline qbgr555(quint32 v) { *this = qbgr555(qrgb555(v)); }
|
|---|
| 850 |
|
|---|
| 851 | inline qbgr555(qrgb555 v)
|
|---|
| 852 | {
|
|---|
| 853 | data = ((v.data & 0x001f) << 10) |
|
|---|
| 854 | (v.data & 0x03e0) |
|
|---|
| 855 | ((v.data & 0x7c00) >> 10);
|
|---|
| 856 | }
|
|---|
| 857 |
|
|---|
| 858 | inline bool operator==(const qbgr555 &v) const
|
|---|
| 859 | {
|
|---|
| 860 | return data == v.data;
|
|---|
| 861 | }
|
|---|
| 862 |
|
|---|
| 863 | private:
|
|---|
| 864 | quint16 data;
|
|---|
| 865 | } Q_PACKED;
|
|---|
| 866 |
|
|---|
| 867 | qargb8555::qargb8555(quint32 v)
|
|---|
| 868 | {
|
|---|
| 869 | v = quint32p(v);
|
|---|
| 870 | data[0] = qAlpha(v);
|
|---|
| 871 | const int r = qRed(v);
|
|---|
| 872 | const int g = qGreen(v);
|
|---|
| 873 | const int b = qBlue(v);
|
|---|
| 874 | data[1] = ((g << 2) & 0xe0) | (b >> 3);
|
|---|
| 875 | data[2] = ((r >> 1) & 0x7c) | (g >> 6);
|
|---|
| 876 |
|
|---|
| 877 | }
|
|---|
| 878 |
|
|---|
| 879 | qargb8555::qargb8555(quint32p v)
|
|---|
| 880 | {
|
|---|
| 881 | data[0] = qAlpha(v);
|
|---|
| 882 | const int r = qRed(v);
|
|---|
| 883 | const int g = qGreen(v);
|
|---|
| 884 | const int b = qBlue(v);
|
|---|
| 885 | data[1] = ((g << 2) & 0xe0) | (b >> 3);
|
|---|
| 886 | data[2] = ((r >> 1) & 0x7c) | (g >> 6);
|
|---|
| 887 | }
|
|---|
| 888 |
|
|---|
| 889 | qargb8555::qargb8555(const qargb8555 &v)
|
|---|
| 890 | {
|
|---|
| 891 | data[0] = v.data[0];
|
|---|
| 892 | data[1] = v.data[1];
|
|---|
| 893 | data[2] = v.data[2];
|
|---|
| 894 | }
|
|---|
| 895 |
|
|---|
| 896 | qargb8555::qargb8555(const qrgb555 &v)
|
|---|
| 897 | {
|
|---|
| 898 | data[0] = 0xff;
|
|---|
| 899 | data[1] = v.data & 0xff;
|
|---|
| 900 | data[2] = v.data >> 8;
|
|---|
| 901 | }
|
|---|
| 902 |
|
|---|
| 903 | qargb8555::operator quint32() const
|
|---|
| 904 | {
|
|---|
| 905 | const quint16 rgb = (data[2] << 8) | data[1];
|
|---|
| 906 | const int r = (rgb & 0x7c00);
|
|---|
| 907 | const int g = (rgb & 0x03e0);
|
|---|
| 908 | const int b = (rgb & 0x001f);
|
|---|
| 909 | const int tr = (r >> 7) | (r >> 12);
|
|---|
| 910 | const int tg = (g >> 2) | (g >> 7);
|
|---|
| 911 | const int tb = (b << 3) | (b >> 2);
|
|---|
| 912 |
|
|---|
| 913 | return qRgba(tr, tg, tb, data[0]);
|
|---|
| 914 | }
|
|---|
| 915 |
|
|---|
| 916 | bool qargb8555::operator==(const qargb8555 &v) const
|
|---|
| 917 | {
|
|---|
| 918 | return data[0] == v.data[0]
|
|---|
| 919 | && data[1] == v.data[1]
|
|---|
| 920 | && data[2] == v.data[2];
|
|---|
| 921 | }
|
|---|
| 922 |
|
|---|
| 923 | quint32 qargb8555::rawValue() const
|
|---|
| 924 | {
|
|---|
| 925 | return (data[2] << 16) | (data[1] << 8) | data[0];
|
|---|
| 926 | }
|
|---|
| 927 |
|
|---|
| 928 | qargb8555 qargb8555::operator+(qargb8555 v) const
|
|---|
| 929 | {
|
|---|
| 930 | qargb8555 t;
|
|---|
| 931 | t.data[0] = data[0] + v.data[0];
|
|---|
| 932 | const quint16 rgb = ((data[2] + v.data[2]) << 8)
|
|---|
| 933 | + (data[1] + v.data[1]);
|
|---|
| 934 | t.data[1] = rgb & 0xff;
|
|---|
| 935 | t.data[2] = rgb >> 8;
|
|---|
| 936 | return t;
|
|---|
| 937 | }
|
|---|
| 938 |
|
|---|
| 939 | qargb8555 qargb8555::byte_mul(quint8 a) const
|
|---|
| 940 | {
|
|---|
| 941 | qargb8555 result;
|
|---|
| 942 | result.data[0] = (data[0] * a) >> 5;
|
|---|
| 943 |
|
|---|
| 944 | const quint16 x = (data[2] << 8) | data[1];
|
|---|
| 945 | quint16 t = (((x & 0x3e0) * a) >> 5) & 0x03e0;
|
|---|
| 946 | t |= (((x & 0x7c1f) * a) >> 5) & 0x7c1f;
|
|---|
| 947 | result.data[1] = t & 0xff;
|
|---|
| 948 | result.data[2] = t >> 8;
|
|---|
| 949 | return result;
|
|---|
| 950 |
|
|---|
| 951 | }
|
|---|
| 952 |
|
|---|
| 953 | class qrgb666;
|
|---|
| 954 |
|
|---|
| 955 | class qargb6666
|
|---|
| 956 | {
|
|---|
| 957 | public:
|
|---|
| 958 | Q_STATIC_INLINE_FUNCTION bool hasAlpha() { return true; }
|
|---|
| 959 |
|
|---|
| 960 | inline qargb6666() {}
|
|---|
| 961 | inline qargb6666(quint32 v) { *this = qargb6666(quint32p(v)); }
|
|---|
| 962 | inline explicit qargb6666(quint32p v);
|
|---|
| 963 | inline qargb6666(const qargb6666 &v);
|
|---|
| 964 | inline qargb6666(const qrgb666 &v);
|
|---|
| 965 |
|
|---|
| 966 | inline operator quint32 () const;
|
|---|
| 967 |
|
|---|
| 968 | inline quint8 alpha() const;
|
|---|
| 969 | inline qargb6666 truncedAlpha() { return *this; }
|
|---|
| 970 | Q_STATIC_INLINE_FUNCTION quint8 alpha(quint8 a) { return (a + 1) >> 2; }
|
|---|
| 971 | Q_STATIC_INLINE_FUNCTION quint8 ialpha(quint8 a) { return (255 - a + 1) >> 2; }
|
|---|
| 972 |
|
|---|
| 973 | inline qargb6666 byte_mul(quint8 a) const;
|
|---|
| 974 | inline qargb6666 operator+(qargb6666 v) const;
|
|---|
| 975 | inline bool operator==(const qargb6666 &v) const;
|
|---|
| 976 |
|
|---|
| 977 | inline quint32 rawValue() const;
|
|---|
| 978 |
|
|---|
| 979 | private:
|
|---|
| 980 | friend class qrgb666;
|
|---|
| 981 | quint8 data[3];
|
|---|
| 982 |
|
|---|
| 983 | } Q_PACKED;
|
|---|
| 984 |
|
|---|
| 985 | class qrgb666
|
|---|
| 986 | {
|
|---|
| 987 | public:
|
|---|
| 988 | Q_STATIC_INLINE_FUNCTION bool hasAlpha() { return false; }
|
|---|
| 989 |
|
|---|
| 990 | inline qrgb666() {}
|
|---|
| 991 | inline qrgb666(quint32 v);
|
|---|
| 992 | inline qrgb666(const qargb6666 &v);
|
|---|
| 993 |
|
|---|
| 994 | inline operator quint32 () const;
|
|---|
| 995 |
|
|---|
| 996 | inline quint8 alpha() const { return 0xff; }
|
|---|
| 997 | inline qrgb666 truncedAlpha() { return *this; }
|
|---|
| 998 | Q_STATIC_INLINE_FUNCTION quint8 alpha(quint8 a) { return (a + 1) >> 2; }
|
|---|
| 999 | Q_STATIC_INLINE_FUNCTION quint8 ialpha(quint8 a) { return (255 - a + 1) >> 2; }
|
|---|
| 1000 |
|
|---|
| 1001 | inline qrgb666 operator+(qrgb666 v) const;
|
|---|
| 1002 | inline qrgb666 byte_mul(quint8 a) const;
|
|---|
| 1003 |
|
|---|
| 1004 | inline bool operator==(const qrgb666 &v) const;
|
|---|
| 1005 | inline bool operator!=(const qrgb666 &v) const { return !(*this == v); }
|
|---|
| 1006 |
|
|---|
| 1007 | inline quint32 rawValue() const
|
|---|
| 1008 | {
|
|---|
| 1009 | return (data[2] << 16) | (data[1] << 8) | data[0];
|
|---|
| 1010 | }
|
|---|
| 1011 |
|
|---|
| 1012 | private:
|
|---|
| 1013 | friend class qargb6666;
|
|---|
| 1014 |
|
|---|
| 1015 | quint8 data[3];
|
|---|
| 1016 | } Q_PACKED;
|
|---|
| 1017 |
|
|---|
| 1018 | qrgb666::qrgb666(quint32 v)
|
|---|
| 1019 | {
|
|---|
| 1020 | const uchar b = qBlue(v);
|
|---|
| 1021 | const uchar g = qGreen(v);
|
|---|
| 1022 | const uchar r = qRed(v);
|
|---|
| 1023 | const uint p = (b >> 2) | ((g >> 2) << 6) | ((r >> 2) << 12);
|
|---|
| 1024 | data[0] = qBlue(p);
|
|---|
| 1025 | data[1] = qGreen(p);
|
|---|
| 1026 | data[2] = qRed(p);
|
|---|
| 1027 | }
|
|---|
| 1028 |
|
|---|
| 1029 | qrgb666::qrgb666(const qargb6666 &v)
|
|---|
| 1030 | {
|
|---|
| 1031 | data[0] = v.data[0];
|
|---|
| 1032 | data[1] = v.data[1];
|
|---|
| 1033 | data[2] = v.data[2] & 0x03;
|
|---|
| 1034 | }
|
|---|
| 1035 |
|
|---|
| 1036 | qrgb666::operator quint32 () const
|
|---|
| 1037 | {
|
|---|
| 1038 | const uchar r = (data[2] << 6) | ((data[1] & 0xf0) >> 2) | (data[2] & 0x3);
|
|---|
| 1039 | const uchar g = (data[1] << 4) | ((data[0] & 0xc0) >> 4) | ((data[1] & 0x0f) >> 2);
|
|---|
| 1040 | const uchar b = (data[0] << 2) | ((data[0] & 0x3f) >> 4);
|
|---|
| 1041 | return qRgb(r, g, b);
|
|---|
| 1042 | }
|
|---|
| 1043 |
|
|---|
| 1044 | qrgb666 qrgb666::operator+(qrgb666 v) const
|
|---|
| 1045 | {
|
|---|
| 1046 | const quint32 x1 = (data[2] << 16) | (data[1] << 8) | data[0];
|
|---|
| 1047 | const quint32 x2 = (v.data[2] << 16) | (v.data[1] << 8) | v.data[0];
|
|---|
| 1048 | const quint32 t = x1 + x2;
|
|---|
| 1049 | qrgb666 r;
|
|---|
| 1050 | r.data[0] = t & 0xff;
|
|---|
| 1051 | r.data[1] = (t >> 8) & 0xff;
|
|---|
| 1052 | r.data[2] = (t >> 16) & 0xff;
|
|---|
| 1053 | return r;
|
|---|
| 1054 | }
|
|---|
| 1055 |
|
|---|
| 1056 | qrgb666 qrgb666::byte_mul(quint8 a) const
|
|---|
| 1057 | {
|
|---|
| 1058 | const quint32 x = (data[2] << 16) | (data[1] << 8) | data[0];
|
|---|
| 1059 | const quint32 t = ((((x & 0x03f03f) * a) >> 6) & 0x03f03f) |
|
|---|
| 1060 | ((((x & 0x000fc0) * a) >> 6) & 0x000fc0);
|
|---|
| 1061 |
|
|---|
| 1062 | qrgb666 r;
|
|---|
| 1063 | r.data[0] = t & 0xff;
|
|---|
| 1064 | r.data[1] = (t >> 8) & 0xff;
|
|---|
| 1065 | r.data[2] = (t >> 16) & 0xff;
|
|---|
| 1066 | return r;
|
|---|
| 1067 | }
|
|---|
| 1068 |
|
|---|
| 1069 | bool qrgb666::operator==(const qrgb666 &v) const
|
|---|
| 1070 | {
|
|---|
| 1071 | return (data[0] == v.data[0] &&
|
|---|
| 1072 | data[1] == v.data[1] &&
|
|---|
| 1073 | data[2] == v.data[2]);
|
|---|
| 1074 | }
|
|---|
| 1075 |
|
|---|
| 1076 | qargb6666::qargb6666(quint32p v)
|
|---|
| 1077 | {
|
|---|
| 1078 | const quint8 b = qBlue(v) >> 2;
|
|---|
| 1079 | const quint8 g = qGreen(v) >> 2;
|
|---|
| 1080 | const quint8 r = qRed(v) >> 2;
|
|---|
| 1081 | const quint8 a = qAlpha(v) >> 2;
|
|---|
| 1082 | const uint p = (a << 18) | (r << 12) | (g << 6) | b;
|
|---|
| 1083 | data[0] = qBlue(p);
|
|---|
| 1084 | data[1] = qGreen(p);
|
|---|
| 1085 | data[2] = qRed(p);
|
|---|
| 1086 | }
|
|---|
| 1087 |
|
|---|
| 1088 | qargb6666::qargb6666(const qargb6666 &v)
|
|---|
| 1089 | {
|
|---|
| 1090 | data[0] = v.data[0];
|
|---|
| 1091 | data[1] = v.data[1];
|
|---|
| 1092 | data[2] = v.data[2];
|
|---|
| 1093 | }
|
|---|
| 1094 |
|
|---|
| 1095 | qargb6666::qargb6666(const qrgb666 &v)
|
|---|
| 1096 | {
|
|---|
| 1097 | data[0] = v.data[0];
|
|---|
| 1098 | data[1] = v.data[1];
|
|---|
| 1099 | data[2] = (v.data[2] | 0xfc);
|
|---|
| 1100 | }
|
|---|
| 1101 |
|
|---|
| 1102 | qargb6666::operator quint32 () const
|
|---|
| 1103 | {
|
|---|
| 1104 | const quint8 r = (data[2] << 6) | ((data[1] & 0xf0) >> 2) | (data[2] & 0x3);
|
|---|
| 1105 | const quint8 g = (data[1] << 4) | ((data[0] & 0xc0) >> 4) | ((data[1] & 0x0f) >> 2);
|
|---|
| 1106 | const quint8 b = (data[0] << 2) | ((data[0] & 0x3f) >> 4);
|
|---|
| 1107 | const quint8 a = (data[2] & 0xfc) | (data[2] >> 6);
|
|---|
| 1108 | return qRgba(r, g, b, a);
|
|---|
| 1109 | }
|
|---|
| 1110 |
|
|---|
| 1111 | qargb6666 qargb6666::operator+(qargb6666 v) const
|
|---|
| 1112 | {
|
|---|
| 1113 | const quint32 x1 = (data[2] << 16) | (data[1] << 8) | data[0];
|
|---|
| 1114 | const quint32 x2 = (v.data[2] << 16) | (v.data[1] << 8) | v.data[0];
|
|---|
| 1115 | const quint32 t = x1 + x2;
|
|---|
| 1116 | qargb6666 r;
|
|---|
| 1117 | r.data[0] = t & 0xff;
|
|---|
| 1118 | r.data[1] = (t >> 8) & 0xff;
|
|---|
| 1119 | r.data[2] = (t >> 16) & 0xff;
|
|---|
| 1120 | return r;
|
|---|
| 1121 | }
|
|---|
| 1122 |
|
|---|
| 1123 | quint8 qargb6666::alpha() const
|
|---|
| 1124 | {
|
|---|
| 1125 | return (data[2] & 0xfc) | (data[2] >> 6);
|
|---|
| 1126 | }
|
|---|
| 1127 |
|
|---|
| 1128 | inline qargb6666 qargb6666::byte_mul(quint8 a) const
|
|---|
| 1129 | {
|
|---|
| 1130 | const quint32 x = (data[2] << 16) | (data[1] << 8) | data[0];
|
|---|
| 1131 | const quint32 t = ((((x & 0x03f03f) * a) >> 6) & 0x03f03f) |
|
|---|
| 1132 | ((((x & 0xfc0fc0) * a) >> 6) & 0xfc0fc0);
|
|---|
| 1133 |
|
|---|
| 1134 | qargb6666 r;
|
|---|
| 1135 | r.data[0] = t & 0xff;
|
|---|
| 1136 | r.data[1] = (t >> 8) & 0xff;
|
|---|
| 1137 | r.data[2] = (t >> 16) & 0xff;
|
|---|
| 1138 | return r;
|
|---|
| 1139 | }
|
|---|
| 1140 |
|
|---|
| 1141 | bool qargb6666::operator==(const qargb6666 &v) const
|
|---|
| 1142 | {
|
|---|
| 1143 | return data[0] == v.data[0]
|
|---|
| 1144 | && data[1] == v.data[1]
|
|---|
| 1145 | && data[2] == v.data[2];
|
|---|
| 1146 | }
|
|---|
| 1147 |
|
|---|
| 1148 | quint32 qargb6666::rawValue() const
|
|---|
| 1149 | {
|
|---|
| 1150 | return (data[2] << 16) | (data[1] << 8) | data[0];
|
|---|
| 1151 | }
|
|---|
| 1152 |
|
|---|
| 1153 | class qrgb888
|
|---|
| 1154 | {
|
|---|
| 1155 | public:
|
|---|
| 1156 | Q_STATIC_INLINE_FUNCTION bool hasAlpha() { return false; }
|
|---|
| 1157 |
|
|---|
| 1158 | inline qrgb888() {}
|
|---|
| 1159 | inline qrgb888(quint32 v);
|
|---|
| 1160 |
|
|---|
| 1161 | inline operator quint32() const;
|
|---|
| 1162 |
|
|---|
| 1163 | inline quint8 alpha() const { return 0xff; }
|
|---|
| 1164 | inline qrgb888 truncedAlpha() { return *this; }
|
|---|
| 1165 | Q_STATIC_INLINE_FUNCTION quint8 alpha(quint8 a) { return a; }
|
|---|
| 1166 | Q_STATIC_INLINE_FUNCTION quint8 ialpha(quint8 a) { return 255 - a; }
|
|---|
| 1167 |
|
|---|
| 1168 | inline qrgb888 byte_mul(quint8 a) const;
|
|---|
| 1169 | inline qrgb888 operator+(qrgb888 v) const;
|
|---|
| 1170 | inline bool operator==(qrgb888 v) const;
|
|---|
| 1171 |
|
|---|
| 1172 | inline quint32 rawValue() const;
|
|---|
| 1173 |
|
|---|
| 1174 | private:
|
|---|
| 1175 | uchar data[3];
|
|---|
| 1176 |
|
|---|
| 1177 | } Q_PACKED;
|
|---|
| 1178 |
|
|---|
| 1179 | qrgb888::qrgb888(quint32 v)
|
|---|
| 1180 | {
|
|---|
| 1181 | data[0] = qRed(v);
|
|---|
| 1182 | data[1] = qGreen(v);
|
|---|
| 1183 | data[2] = qBlue(v);
|
|---|
| 1184 | }
|
|---|
| 1185 |
|
|---|
| 1186 | qrgb888::operator quint32() const
|
|---|
| 1187 | {
|
|---|
| 1188 | return qRgb(data[0], data[1], data[2]);
|
|---|
| 1189 | }
|
|---|
| 1190 |
|
|---|
| 1191 | qrgb888 qrgb888::operator+(qrgb888 v) const
|
|---|
| 1192 | {
|
|---|
| 1193 | qrgb888 t = *this;
|
|---|
| 1194 | t.data[0] += v.data[0];
|
|---|
| 1195 | t.data[1] += v.data[1];
|
|---|
| 1196 | t.data[2] += v.data[2];
|
|---|
| 1197 | return t;
|
|---|
| 1198 | }
|
|---|
| 1199 |
|
|---|
| 1200 | qrgb888 qrgb888::byte_mul(quint8 a) const
|
|---|
| 1201 | {
|
|---|
| 1202 | quint32 x(*this);
|
|---|
| 1203 |
|
|---|
| 1204 | quint32 t = (x & 0xff00ff) * a;
|
|---|
| 1205 | t = (t + ((t >> 8) & 0xff00ff) + 0x800080) >> 8;
|
|---|
| 1206 | t &= 0xff00ff;
|
|---|
| 1207 |
|
|---|
| 1208 | x = ((x >> 8) & 0xff00ff) * a;
|
|---|
| 1209 | x = (x + ((x >> 8) & 0xff00ff) + 0x800080);
|
|---|
| 1210 | x &= 0xff00ff00;
|
|---|
| 1211 | x |= t;
|
|---|
| 1212 | return qrgb888(x);
|
|---|
| 1213 | }
|
|---|
| 1214 |
|
|---|
| 1215 | bool qrgb888::operator==(qrgb888 v) const
|
|---|
| 1216 | {
|
|---|
| 1217 | return (data[0] == v.data[0] &&
|
|---|
| 1218 | data[1] == v.data[1] &&
|
|---|
| 1219 | data[2] == v.data[2]);
|
|---|
| 1220 | }
|
|---|
| 1221 |
|
|---|
| 1222 | quint32 qrgb888::rawValue() const
|
|---|
| 1223 | {
|
|---|
| 1224 | return (data[2] << 16) | (data[1] << 8) | data[0];
|
|---|
| 1225 | }
|
|---|
| 1226 |
|
|---|
| 1227 | template <>
|
|---|
| 1228 | inline qrgb888 qt_colorConvert(quint32 color, qrgb888 dummy)
|
|---|
| 1229 | {
|
|---|
| 1230 | Q_UNUSED(dummy);
|
|---|
| 1231 | return qrgb888(color);
|
|---|
| 1232 | }
|
|---|
| 1233 |
|
|---|
| 1234 | template <>
|
|---|
| 1235 | inline quint32 qt_colorConvert(qrgb888 color, quint32 dummy)
|
|---|
| 1236 | {
|
|---|
| 1237 | Q_UNUSED(dummy);
|
|---|
| 1238 | return quint32(color);
|
|---|
| 1239 | }
|
|---|
| 1240 |
|
|---|
| 1241 | #ifdef QT_QWS_DEPTH_8
|
|---|
| 1242 | template <>
|
|---|
| 1243 | inline quint8 qt_colorConvert(quint32 color, quint8 dummy)
|
|---|
| 1244 | {
|
|---|
| 1245 | Q_UNUSED(dummy);
|
|---|
| 1246 |
|
|---|
| 1247 | uchar r = ((qRed(color) & 0xf8) + 0x19) / 0x33;
|
|---|
| 1248 | uchar g = ((qGreen(color) &0xf8) + 0x19) / 0x33;
|
|---|
| 1249 | uchar b = ((qBlue(color) &0xf8) + 0x19) / 0x33;
|
|---|
| 1250 |
|
|---|
| 1251 | return r*6*6 + g*6 + b;
|
|---|
| 1252 | }
|
|---|
| 1253 |
|
|---|
| 1254 | template <>
|
|---|
| 1255 | inline quint8 qt_colorConvert(quint16 color, quint8 dummy)
|
|---|
| 1256 | {
|
|---|
| 1257 | Q_UNUSED(dummy);
|
|---|
| 1258 |
|
|---|
| 1259 | uchar r = (color & 0xf800) >> (11-3);
|
|---|
| 1260 | uchar g = (color & 0x07c0) >> (6-3);
|
|---|
| 1261 | uchar b = (color & 0x001f) << 3;
|
|---|
| 1262 |
|
|---|
| 1263 | uchar tr = (r + 0x19) / 0x33;
|
|---|
| 1264 | uchar tg = (g + 0x19) / 0x33;
|
|---|
| 1265 | uchar tb = (b + 0x19) / 0x33;
|
|---|
| 1266 |
|
|---|
| 1267 | return tr*6*6 + tg*6 + tb;
|
|---|
| 1268 | }
|
|---|
| 1269 |
|
|---|
| 1270 | #endif // QT_QWS_DEPTH_8
|
|---|
| 1271 |
|
|---|
| 1272 | // hw: endianess??
|
|---|
| 1273 | class quint24
|
|---|
| 1274 | {
|
|---|
| 1275 | public:
|
|---|
| 1276 | inline quint24(quint32 v)
|
|---|
| 1277 | {
|
|---|
| 1278 | data[0] = qBlue(v);
|
|---|
| 1279 | data[1] = qGreen(v);
|
|---|
| 1280 | data[2] = qRed(v);
|
|---|
| 1281 | }
|
|---|
| 1282 |
|
|---|
| 1283 | inline operator quint32 ()
|
|---|
| 1284 | {
|
|---|
| 1285 | return qRgb(data[2], data[1], data[0]);
|
|---|
| 1286 | }
|
|---|
| 1287 |
|
|---|
| 1288 | inline bool operator==(const quint24 &v) const
|
|---|
| 1289 | {
|
|---|
| 1290 | return data[0] == v.data[0]
|
|---|
| 1291 | && data[1] == v.data[1]
|
|---|
| 1292 | && data[2] == v.data[2];
|
|---|
| 1293 | }
|
|---|
| 1294 |
|
|---|
| 1295 | private:
|
|---|
| 1296 | uchar data[3];
|
|---|
| 1297 | } Q_PACKED;
|
|---|
| 1298 |
|
|---|
| 1299 | template <>
|
|---|
| 1300 | inline quint24 qt_colorConvert(quint32 color, quint24 dummy)
|
|---|
| 1301 | {
|
|---|
| 1302 | Q_UNUSED(dummy);
|
|---|
| 1303 | return quint24(color);
|
|---|
| 1304 | }
|
|---|
| 1305 |
|
|---|
| 1306 | // hw: endianess??
|
|---|
| 1307 | class quint18
|
|---|
| 1308 | {
|
|---|
| 1309 | public:
|
|---|
| 1310 | inline quint18(quint32 v)
|
|---|
| 1311 | {
|
|---|
| 1312 | uchar b = qBlue(v);
|
|---|
| 1313 | uchar g = qGreen(v);
|
|---|
| 1314 | uchar r = qRed(v);
|
|---|
| 1315 | uint p = (b >> 2) | ((g >> 2) << 6) | ((r >> 2) << 12);
|
|---|
| 1316 | data[0] = qBlue(p);
|
|---|
| 1317 | data[1] = qGreen(p);
|
|---|
| 1318 | data[2] = qRed(p);
|
|---|
| 1319 | }
|
|---|
| 1320 |
|
|---|
| 1321 | inline operator quint32 ()
|
|---|
| 1322 | {
|
|---|
| 1323 | const uchar r = (data[2] << 6) | ((data[1] & 0xf0) >> 2) | (data[2] & 0x3);
|
|---|
| 1324 | const uchar g = (data[1] << 4) | ((data[0] & 0xc0) >> 4) | ((data[1] & 0x0f) >> 2);
|
|---|
| 1325 | const uchar b = (data[0] << 2) | ((data[0] & 0x3f) >> 4);
|
|---|
| 1326 | return qRgb(r, g, b);
|
|---|
| 1327 | }
|
|---|
| 1328 |
|
|---|
| 1329 | private:
|
|---|
| 1330 | uchar data[3];
|
|---|
| 1331 | } Q_PACKED;
|
|---|
| 1332 |
|
|---|
| 1333 | template <>
|
|---|
| 1334 | inline quint18 qt_colorConvert(quint32 color, quint18 dummy)
|
|---|
| 1335 | {
|
|---|
| 1336 | Q_UNUSED(dummy);
|
|---|
| 1337 | return quint18(color);
|
|---|
| 1338 | }
|
|---|
| 1339 |
|
|---|
| 1340 | class qrgb444;
|
|---|
| 1341 |
|
|---|
| 1342 | class qargb4444
|
|---|
| 1343 | {
|
|---|
| 1344 | public:
|
|---|
| 1345 | Q_STATIC_INLINE_FUNCTION bool hasAlpha() { return true; }
|
|---|
| 1346 |
|
|---|
| 1347 | inline qargb4444() {}
|
|---|
| 1348 | inline qargb4444(quint32 v) { *this = qargb4444(quint32p(v)); }
|
|---|
| 1349 | inline explicit qargb4444(quint32p v);
|
|---|
| 1350 | inline qargb4444(const qrgb444 &v);
|
|---|
| 1351 |
|
|---|
| 1352 | inline operator quint32() const;
|
|---|
| 1353 | inline operator quint8() const;
|
|---|
| 1354 |
|
|---|
| 1355 | inline qargb4444 operator+(qargb4444 v) const;
|
|---|
| 1356 |
|
|---|
| 1357 | inline quint8 alpha() const { return ((data & 0xf000) >> 8) | ((data & 0xf000) >> 12); }
|
|---|
| 1358 | inline qargb4444 truncedAlpha() { return *this; }
|
|---|
| 1359 | Q_STATIC_INLINE_FUNCTION quint8 alpha(quint8 a) { return (a + 1) >> 4; }
|
|---|
| 1360 | Q_STATIC_INLINE_FUNCTION quint8 ialpha(quint8 a) { return 0x10 - alpha(a); }
|
|---|
| 1361 | inline qargb4444 byte_mul(quint8 a) const;
|
|---|
| 1362 |
|
|---|
| 1363 | inline bool operator==(const qargb4444 &v) const { return data == v.data; }
|
|---|
| 1364 |
|
|---|
| 1365 | inline quint16 rawValue() const { return data; }
|
|---|
| 1366 |
|
|---|
| 1367 | private:
|
|---|
| 1368 | friend class qrgb444;
|
|---|
| 1369 | quint16 data;
|
|---|
| 1370 |
|
|---|
| 1371 | } Q_PACKED;
|
|---|
| 1372 |
|
|---|
| 1373 | class qrgb444
|
|---|
| 1374 | {
|
|---|
| 1375 | public:
|
|---|
| 1376 | Q_STATIC_INLINE_FUNCTION bool hasAlpha() { return false; }
|
|---|
| 1377 |
|
|---|
| 1378 | inline qrgb444() {}
|
|---|
| 1379 | inline qrgb444(quint32 v);
|
|---|
| 1380 | inline explicit qrgb444(qargb4444 v);
|
|---|
| 1381 |
|
|---|
| 1382 | inline operator quint32() const;
|
|---|
| 1383 | inline operator quint8() const;
|
|---|
| 1384 |
|
|---|
| 1385 | inline qrgb444 operator+(qrgb444 v) const;
|
|---|
| 1386 | inline quint8 alpha() const { return 0xff; }
|
|---|
| 1387 | inline qrgb444 truncedAlpha() { return *this; }
|
|---|
| 1388 | Q_STATIC_INLINE_FUNCTION quint8 alpha(quint8 a) { return (a + 1) >> 4; }
|
|---|
| 1389 | Q_STATIC_INLINE_FUNCTION quint8 ialpha(quint8 a) { return 0x10 - alpha(a); }
|
|---|
| 1390 | inline qrgb444 byte_mul(quint8 a) const;
|
|---|
| 1391 |
|
|---|
| 1392 | inline bool operator==(const qrgb444 &v) const { return data == v.data; }
|
|---|
| 1393 | inline bool operator!=(const qrgb444 &v) const { return data != v.data; }
|
|---|
| 1394 |
|
|---|
| 1395 | inline quint16 rawValue() const { return data; }
|
|---|
| 1396 |
|
|---|
| 1397 | private:
|
|---|
| 1398 | friend class qargb4444;
|
|---|
| 1399 | quint16 data;
|
|---|
| 1400 |
|
|---|
| 1401 | } Q_PACKED;
|
|---|
| 1402 |
|
|---|
| 1403 |
|
|---|
| 1404 | qargb4444::qargb4444(quint32p color)
|
|---|
| 1405 | {
|
|---|
| 1406 | quint32 v = color;
|
|---|
| 1407 | v &= 0xf0f0f0f0;
|
|---|
| 1408 | const int a = qAlpha(v) << 8;
|
|---|
| 1409 | const int r = qRed(v) << 4;
|
|---|
| 1410 | const int g = qGreen(v);
|
|---|
| 1411 | const int b = qBlue(v) >> 4;
|
|---|
| 1412 |
|
|---|
| 1413 | data = a | r | g | b;
|
|---|
| 1414 | }
|
|---|
| 1415 |
|
|---|
| 1416 | qargb4444::qargb4444(const qrgb444 &v)
|
|---|
| 1417 | {
|
|---|
| 1418 | data = v.data | 0xf000;
|
|---|
| 1419 | }
|
|---|
| 1420 |
|
|---|
| 1421 | qargb4444::operator quint32() const
|
|---|
| 1422 | {
|
|---|
| 1423 | const int a = (data & 0xf000);
|
|---|
| 1424 | const int r = (data & 0x0f00);
|
|---|
| 1425 | const int g = (data & 0x00f0);
|
|---|
| 1426 | const int b = (data & 0x000f);
|
|---|
| 1427 | const int ta = (a >> 8) | (a >> 12);
|
|---|
| 1428 | const int tr = (r >> 4) | (r >> 8);
|
|---|
| 1429 | const int tg = g | (g >> 4);
|
|---|
| 1430 | const int tb = (b << 4) | b;
|
|---|
| 1431 |
|
|---|
| 1432 | return qRgba(tr, tg, tb, ta);
|
|---|
| 1433 | }
|
|---|
| 1434 |
|
|---|
| 1435 | qargb4444::operator quint8() const
|
|---|
| 1436 | {
|
|---|
| 1437 | // hw: optimize!
|
|---|
| 1438 | return qt_colorConvert<quint8, quint32>(operator quint32(), 0);
|
|---|
| 1439 | }
|
|---|
| 1440 |
|
|---|
| 1441 | qargb4444 qargb4444::operator+(qargb4444 v) const
|
|---|
| 1442 | {
|
|---|
| 1443 | qargb4444 t;
|
|---|
| 1444 | t.data = data + v.data;
|
|---|
| 1445 | return t;
|
|---|
| 1446 | }
|
|---|
| 1447 |
|
|---|
| 1448 | qargb4444 qargb4444::byte_mul(quint8 a) const
|
|---|
| 1449 | {
|
|---|
| 1450 | quint16 t = (((data & 0xf0f0) * a) >> 4) & 0xf0f0;
|
|---|
| 1451 | t |= (((data & 0x0f0f) * a) >> 4) & 0x0f0f;
|
|---|
| 1452 |
|
|---|
| 1453 | qargb4444 result;
|
|---|
| 1454 | result.data = t;
|
|---|
| 1455 | return result;
|
|---|
| 1456 | }
|
|---|
| 1457 |
|
|---|
| 1458 | qrgb444::qrgb444(quint32 v)
|
|---|
| 1459 | {
|
|---|
| 1460 | v &= 0xf0f0f0f0;
|
|---|
| 1461 | const int r = qRed(v) << 4;
|
|---|
| 1462 | const int g = qGreen(v);
|
|---|
| 1463 | const int b = qBlue(v) >> 4;
|
|---|
| 1464 |
|
|---|
| 1465 | data = r | g | b;
|
|---|
| 1466 | }
|
|---|
| 1467 |
|
|---|
| 1468 | qrgb444::qrgb444(qargb4444 v)
|
|---|
| 1469 | {
|
|---|
| 1470 | data = v.data & 0x0fff;
|
|---|
| 1471 | }
|
|---|
| 1472 |
|
|---|
| 1473 | qrgb444::operator quint32() const
|
|---|
| 1474 | {
|
|---|
| 1475 | const int r = (data & 0x0f00);
|
|---|
| 1476 | const int g = (data & 0x00f0);
|
|---|
| 1477 | const int b = (data & 0x000f);
|
|---|
| 1478 | const int tr = (r >> 4) | (r >> 8);
|
|---|
| 1479 | const int tg = g | (g >> 4);
|
|---|
| 1480 | const int tb = (b << 4) | b;
|
|---|
| 1481 |
|
|---|
| 1482 | return qRgb(tr, tg, tb);
|
|---|
| 1483 | }
|
|---|
| 1484 |
|
|---|
| 1485 | qrgb444::operator quint8() const
|
|---|
| 1486 | {
|
|---|
| 1487 | // hw: optimize!
|
|---|
| 1488 | return qt_colorConvert<quint8, quint32>(operator quint32(), 0);
|
|---|
| 1489 | }
|
|---|
| 1490 |
|
|---|
| 1491 | qrgb444 qrgb444::operator+(qrgb444 v) const
|
|---|
| 1492 | {
|
|---|
| 1493 | qrgb444 t;
|
|---|
| 1494 | t.data = data + v.data;
|
|---|
| 1495 | return t;
|
|---|
| 1496 | }
|
|---|
| 1497 |
|
|---|
| 1498 | qrgb444 qrgb444::byte_mul(quint8 a) const
|
|---|
| 1499 | {
|
|---|
| 1500 | quint16 t = (((data & 0xf0f0) * a) >> 4) & 0xf0f0;
|
|---|
| 1501 | t |= (((data & 0x0f0f) * a) >> 4) & 0x0f0f;
|
|---|
| 1502 |
|
|---|
| 1503 | qrgb444 result;
|
|---|
| 1504 | result.data = t;
|
|---|
| 1505 | return result;
|
|---|
| 1506 | }
|
|---|
| 1507 |
|
|---|
| 1508 | #ifdef QT_QWS_DEPTH_GENERIC
|
|---|
| 1509 |
|
|---|
| 1510 | struct qrgb
|
|---|
| 1511 | {
|
|---|
| 1512 | public:
|
|---|
| 1513 | static int bpp;
|
|---|
| 1514 | static int len_red;
|
|---|
| 1515 | static int len_green;
|
|---|
| 1516 | static int len_blue;
|
|---|
| 1517 | static int len_alpha;
|
|---|
| 1518 | static int off_red;
|
|---|
| 1519 | static int off_green;
|
|---|
| 1520 | static int off_blue;
|
|---|
| 1521 | static int off_alpha;
|
|---|
| 1522 | } Q_PACKED;
|
|---|
| 1523 |
|
|---|
| 1524 | template <typename SRC>
|
|---|
| 1525 | Q_STATIC_TEMPLATE_FUNCTION inline quint32 qt_convertToRgb(SRC color);
|
|---|
| 1526 |
|
|---|
| 1527 | template <>
|
|---|
| 1528 | inline quint32 qt_convertToRgb(quint32 color)
|
|---|
| 1529 | {
|
|---|
| 1530 | const int r = qRed(color) >> (8 - qrgb::len_red);
|
|---|
| 1531 | const int g = qGreen(color) >> (8 - qrgb::len_green);
|
|---|
| 1532 | const int b = qBlue(color) >> (8 - qrgb::len_blue);
|
|---|
| 1533 | const int a = qAlpha(color) >> (8 - qrgb::len_alpha);
|
|---|
| 1534 | const quint32 v = (r << qrgb::off_red)
|
|---|
| 1535 | | (g << qrgb::off_green)
|
|---|
| 1536 | | (b << qrgb::off_blue)
|
|---|
| 1537 | | (a << qrgb::off_alpha);
|
|---|
| 1538 |
|
|---|
| 1539 | return v;
|
|---|
| 1540 | }
|
|---|
| 1541 |
|
|---|
| 1542 | template <>
|
|---|
| 1543 | inline quint32 qt_convertToRgb(quint16 color)
|
|---|
| 1544 | {
|
|---|
| 1545 | return qt_convertToRgb(qt_colorConvert<quint32, quint16>(color, 0));
|
|---|
| 1546 | }
|
|---|
| 1547 |
|
|---|
| 1548 | class qrgb_generic16
|
|---|
| 1549 | {
|
|---|
| 1550 | public:
|
|---|
| 1551 | inline qrgb_generic16(quint32 color)
|
|---|
| 1552 | {
|
|---|
| 1553 | const int r = qRed(color) >> (8 - qrgb::len_red);
|
|---|
| 1554 | const int g = qGreen(color) >> (8 - qrgb::len_green);
|
|---|
| 1555 | const int b = qBlue(color) >> (8 - qrgb::len_blue);
|
|---|
| 1556 | const int a = qAlpha(color) >> (8 - qrgb::len_alpha);
|
|---|
| 1557 | data = (r << qrgb::off_red)
|
|---|
| 1558 | | (g << qrgb::off_green)
|
|---|
| 1559 | | (b << qrgb::off_blue)
|
|---|
| 1560 | | (a << qrgb::off_alpha);
|
|---|
| 1561 | }
|
|---|
| 1562 |
|
|---|
| 1563 | inline operator quint16 () { return data; }
|
|---|
| 1564 | inline quint32 operator<<(int shift) const { return data << shift; }
|
|---|
| 1565 |
|
|---|
| 1566 | private:
|
|---|
| 1567 | quint16 data;
|
|---|
| 1568 | } Q_PACKED;
|
|---|
| 1569 |
|
|---|
| 1570 | template <>
|
|---|
| 1571 | inline qrgb_generic16 qt_colorConvert(quint32 color, qrgb_generic16 dummy)
|
|---|
| 1572 | {
|
|---|
| 1573 | Q_UNUSED(dummy);
|
|---|
| 1574 | return qrgb_generic16(color);
|
|---|
| 1575 | }
|
|---|
| 1576 |
|
|---|
| 1577 | template <>
|
|---|
| 1578 | inline qrgb_generic16 qt_colorConvert(quint16 color, qrgb_generic16 dummy)
|
|---|
| 1579 | {
|
|---|
| 1580 | Q_UNUSED(dummy);
|
|---|
| 1581 | return qrgb_generic16(qt_colorConvert<quint32, quint16>(color, 0));
|
|---|
| 1582 | }
|
|---|
| 1583 |
|
|---|
| 1584 | #endif // QT_QWS_DEPTH_GENERIC
|
|---|
| 1585 |
|
|---|
| 1586 | template <class T>
|
|---|
| 1587 | void qt_memfill(T *dest, T value, int count);
|
|---|
| 1588 |
|
|---|
| 1589 | template<> inline void qt_memfill(quint32 *dest, quint32 color, int count)
|
|---|
| 1590 | {
|
|---|
| 1591 | extern void (*qt_memfill32)(quint32 *dest, quint32 value, int count);
|
|---|
| 1592 | qt_memfill32(dest, color, count);
|
|---|
| 1593 | }
|
|---|
| 1594 |
|
|---|
| 1595 | template<> inline void qt_memfill(quint16 *dest, quint16 color, int count)
|
|---|
| 1596 | {
|
|---|
| 1597 | extern void (*qt_memfill16)(quint16 *dest, quint16 value, int count);
|
|---|
| 1598 | qt_memfill16(dest, color, count);
|
|---|
| 1599 | }
|
|---|
| 1600 |
|
|---|
| 1601 | template<> inline void qt_memfill(quint8 *dest, quint8 color, int count)
|
|---|
| 1602 | {
|
|---|
| 1603 | memset(dest, color, count);
|
|---|
| 1604 | }
|
|---|
| 1605 |
|
|---|
| 1606 | template <class T>
|
|---|
| 1607 | inline void qt_memfill(T *dest, T value, int count)
|
|---|
| 1608 | {
|
|---|
| 1609 | if (!count)
|
|---|
| 1610 | return;
|
|---|
| 1611 |
|
|---|
| 1612 | int n = (count + 7) / 8;
|
|---|
| 1613 | switch (count & 0x07)
|
|---|
| 1614 | {
|
|---|
| 1615 | case 0: do { *dest++ = value;
|
|---|
| 1616 | case 7: *dest++ = value;
|
|---|
| 1617 | case 6: *dest++ = value;
|
|---|
| 1618 | case 5: *dest++ = value;
|
|---|
| 1619 | case 4: *dest++ = value;
|
|---|
| 1620 | case 3: *dest++ = value;
|
|---|
| 1621 | case 2: *dest++ = value;
|
|---|
| 1622 | case 1: *dest++ = value;
|
|---|
| 1623 | } while (--n > 0);
|
|---|
| 1624 | }
|
|---|
| 1625 | }
|
|---|
| 1626 |
|
|---|
| 1627 | template <class T>
|
|---|
| 1628 | inline void qt_rectfill(T *dest, T value,
|
|---|
| 1629 | int x, int y, int width, int height, int stride)
|
|---|
| 1630 | {
|
|---|
| 1631 | char *d = reinterpret_cast<char*>(dest + x) + y * stride;
|
|---|
| 1632 | if (uint(stride) == (width * sizeof(T))) {
|
|---|
| 1633 | qt_memfill(reinterpret_cast<T*>(d), value, width * height);
|
|---|
| 1634 | } else {
|
|---|
| 1635 | for (int j = 0; j < height; ++j) {
|
|---|
| 1636 | dest = reinterpret_cast<T*>(d);
|
|---|
| 1637 | qt_memfill(dest, value, width);
|
|---|
| 1638 | d += stride;
|
|---|
| 1639 | }
|
|---|
| 1640 | }
|
|---|
| 1641 | }
|
|---|
| 1642 |
|
|---|
| 1643 | template <class DST, class SRC>
|
|---|
| 1644 | inline void qt_memconvert(DST *dest, const SRC *src, int count)
|
|---|
| 1645 | {
|
|---|
| 1646 | if (sizeof(DST) == 1) {
|
|---|
| 1647 | while (count) {
|
|---|
| 1648 | int n = 1;
|
|---|
| 1649 | const SRC color = *src++;
|
|---|
| 1650 | const DST dstColor = qt_colorConvert<DST, SRC>(color, 0);
|
|---|
| 1651 | while (--count && (*src == color || dstColor == qt_colorConvert<DST, SRC>(*src, 0))) {
|
|---|
| 1652 | ++n;
|
|---|
| 1653 | ++src;
|
|---|
| 1654 | }
|
|---|
| 1655 | qt_memfill(dest, dstColor, n);
|
|---|
| 1656 | dest += n;
|
|---|
| 1657 | }
|
|---|
| 1658 | } else {
|
|---|
| 1659 | /* Duff's device */
|
|---|
| 1660 | int n = (count + 7) / 8;
|
|---|
| 1661 | switch (count & 0x07)
|
|---|
| 1662 | {
|
|---|
| 1663 | case 0: do { *dest++ = qt_colorConvert<DST, SRC>(*src++, 0);
|
|---|
| 1664 | case 7: *dest++ = qt_colorConvert<DST, SRC>(*src++, 0);
|
|---|
| 1665 | case 6: *dest++ = qt_colorConvert<DST, SRC>(*src++, 0);
|
|---|
| 1666 | case 5: *dest++ = qt_colorConvert<DST, SRC>(*src++, 0);
|
|---|
| 1667 | case 4: *dest++ = qt_colorConvert<DST, SRC>(*src++, 0);
|
|---|
| 1668 | case 3: *dest++ = qt_colorConvert<DST, SRC>(*src++, 0);
|
|---|
| 1669 | case 2: *dest++ = qt_colorConvert<DST, SRC>(*src++, 0);
|
|---|
| 1670 | case 1: *dest++ = qt_colorConvert<DST, SRC>(*src++, 0);
|
|---|
| 1671 | } while (--n > 0);
|
|---|
| 1672 | }
|
|---|
| 1673 | }
|
|---|
| 1674 | }
|
|---|
| 1675 |
|
|---|
| 1676 | #define QT_TRIVIAL_MEMCONVERT_IMPL(T) \
|
|---|
| 1677 | template <> \
|
|---|
| 1678 | inline void qt_memconvert(T *dest, const T *src, int count) \
|
|---|
| 1679 | { \
|
|---|
| 1680 | memcpy(dest, src, count * sizeof(T)); \
|
|---|
| 1681 | }
|
|---|
| 1682 | QT_TRIVIAL_MEMCONVERT_IMPL(quint32)
|
|---|
| 1683 | QT_TRIVIAL_MEMCONVERT_IMPL(qrgb888)
|
|---|
| 1684 | QT_TRIVIAL_MEMCONVERT_IMPL(qargb6666)
|
|---|
| 1685 | QT_TRIVIAL_MEMCONVERT_IMPL(qrgb666)
|
|---|
| 1686 | QT_TRIVIAL_MEMCONVERT_IMPL(quint16)
|
|---|
| 1687 | QT_TRIVIAL_MEMCONVERT_IMPL(qrgb565)
|
|---|
| 1688 | QT_TRIVIAL_MEMCONVERT_IMPL(qargb8565)
|
|---|
| 1689 | QT_TRIVIAL_MEMCONVERT_IMPL(qargb8555)
|
|---|
| 1690 | QT_TRIVIAL_MEMCONVERT_IMPL(qrgb555)
|
|---|
| 1691 | QT_TRIVIAL_MEMCONVERT_IMPL(qargb4444)
|
|---|
| 1692 | QT_TRIVIAL_MEMCONVERT_IMPL(qrgb444)
|
|---|
| 1693 | #undef QT_TRIVIAL_MEMCONVERT_IMPL
|
|---|
| 1694 |
|
|---|
| 1695 | #if Q_BYTE_ORDER == Q_LITTLE_ENDIAN
|
|---|
| 1696 | template <>
|
|---|
| 1697 | inline void qt_memconvert(qrgb666 *dest, const quint32 *src, int count)
|
|---|
| 1698 | {
|
|---|
| 1699 | if (count < 3) {
|
|---|
| 1700 | switch (count) {
|
|---|
| 1701 | case 2: *dest++ = qrgb666(*src++);
|
|---|
| 1702 | case 1: *dest = qrgb666(*src);
|
|---|
| 1703 | }
|
|---|
| 1704 | return;
|
|---|
| 1705 | }
|
|---|
| 1706 |
|
|---|
| 1707 | const int align = (quintptr(dest) & 3);
|
|---|
| 1708 | switch (align) {
|
|---|
| 1709 | case 1: *dest++ = qrgb666(*src++); --count;
|
|---|
| 1710 | case 2: *dest++ = qrgb666(*src++); --count;
|
|---|
| 1711 | case 3: *dest++ = qrgb666(*src++); --count;
|
|---|
| 1712 | }
|
|---|
| 1713 |
|
|---|
| 1714 | quint32 *dest32 = reinterpret_cast<quint32*>(dest);
|
|---|
| 1715 | int sourceCount = count >> 2;
|
|---|
| 1716 | while (sourceCount--) {
|
|---|
| 1717 | dest32[0] = ((src[1] & 0x00000c00) << 20)
|
|---|
| 1718 | | ((src[1] & 0x000000fc) << 22)
|
|---|
| 1719 | | ((src[0] & 0x00fc0000) >> 6)
|
|---|
| 1720 | | ((src[0] & 0x0000fc00) >> 4)
|
|---|
| 1721 | | ((src[0] & 0x000000fc) >> 2);
|
|---|
| 1722 | dest32[1] = ((src[2] & 0x003c0000) << 10)
|
|---|
| 1723 | | ((src[2] & 0x0000fc00) << 12)
|
|---|
| 1724 | | ((src[2] & 0x000000fc) << 14)
|
|---|
| 1725 | | ((src[1] & 0x00fc0000) >> 14)
|
|---|
| 1726 | | ((src[1] & 0x0000f000) >> 12);
|
|---|
| 1727 | dest32[2] = ((src[3] & 0x00fc0000) << 2)
|
|---|
| 1728 | | ((src[3] & 0x0000fc00) << 4)
|
|---|
| 1729 | | ((src[3] & 0x000000fc) << 6)
|
|---|
| 1730 | | ((src[2] & 0x00c00000) >> 22);
|
|---|
| 1731 | dest32 += 3;
|
|---|
| 1732 | src += 4;
|
|---|
| 1733 | }
|
|---|
| 1734 |
|
|---|
| 1735 | dest = reinterpret_cast<qrgb666*>(dest32);
|
|---|
| 1736 | switch (count & 3) {
|
|---|
| 1737 | case 3: *dest++ = qrgb666(*src++);
|
|---|
| 1738 | case 2: *dest++ = qrgb666(*src++);
|
|---|
| 1739 | case 1: *dest = qrgb666(*src);
|
|---|
| 1740 | }
|
|---|
| 1741 | }
|
|---|
| 1742 | #endif // Q_BYTE_ORDER
|
|---|
| 1743 |
|
|---|
| 1744 | template <class T>
|
|---|
| 1745 | inline void qt_rectcopy(T *dest, const T *src,
|
|---|
| 1746 | int x, int y, int width, int height,
|
|---|
| 1747 | int dstStride, int srcStride)
|
|---|
| 1748 | {
|
|---|
| 1749 | char *d = (char*)(dest + x) + y * dstStride;
|
|---|
| 1750 | const char *s = (char*)(src);
|
|---|
| 1751 | for (int i = 0; i < height; ++i) {
|
|---|
| 1752 | ::memcpy(d, s, width * sizeof(T));
|
|---|
| 1753 | d += dstStride;
|
|---|
| 1754 | s += srcStride;
|
|---|
| 1755 | }
|
|---|
| 1756 | }
|
|---|
| 1757 |
|
|---|
| 1758 | template <class DST, class SRC>
|
|---|
| 1759 | inline void qt_rectconvert(DST *dest, const SRC *src,
|
|---|
| 1760 | int x, int y, int width, int height,
|
|---|
| 1761 | int dstStride, int srcStride)
|
|---|
| 1762 | {
|
|---|
| 1763 | char *d = (char*)(dest + x) + y * dstStride;
|
|---|
| 1764 | const char *s = (char*)(src);
|
|---|
| 1765 | for (int i = 0; i < height; ++i) {
|
|---|
| 1766 | qt_memconvert<DST,SRC>((DST*)d, (const SRC*)s, width);
|
|---|
| 1767 | d += dstStride;
|
|---|
| 1768 | s += srcStride;
|
|---|
| 1769 | }
|
|---|
| 1770 | }
|
|---|
| 1771 |
|
|---|
| 1772 | #define QT_RECTCONVERT_TRIVIAL_IMPL(T) \
|
|---|
| 1773 | template <> \
|
|---|
| 1774 | inline void qt_rectconvert(T *dest, const T *src, \
|
|---|
| 1775 | int x, int y, int width, int height, \
|
|---|
| 1776 | int dstStride, int srcStride) \
|
|---|
| 1777 | { \
|
|---|
| 1778 | qt_rectcopy(dest, src, x, y, width, height, dstStride, srcStride); \
|
|---|
| 1779 | }
|
|---|
| 1780 | QT_RECTCONVERT_TRIVIAL_IMPL(quint32)
|
|---|
| 1781 | QT_RECTCONVERT_TRIVIAL_IMPL(qrgb888)
|
|---|
| 1782 | QT_RECTCONVERT_TRIVIAL_IMPL(qargb6666)
|
|---|
| 1783 | QT_RECTCONVERT_TRIVIAL_IMPL(qrgb666)
|
|---|
| 1784 | QT_RECTCONVERT_TRIVIAL_IMPL(qrgb565)
|
|---|
| 1785 | QT_RECTCONVERT_TRIVIAL_IMPL(qargb8565)
|
|---|
| 1786 | QT_RECTCONVERT_TRIVIAL_IMPL(quint16)
|
|---|
| 1787 | QT_RECTCONVERT_TRIVIAL_IMPL(qargb8555)
|
|---|
| 1788 | QT_RECTCONVERT_TRIVIAL_IMPL(qrgb555)
|
|---|
| 1789 | QT_RECTCONVERT_TRIVIAL_IMPL(qargb4444)
|
|---|
| 1790 | QT_RECTCONVERT_TRIVIAL_IMPL(qrgb444)
|
|---|
| 1791 | #undef QT_RECTCONVERT_TRIVIAL_IMPL
|
|---|
| 1792 |
|
|---|
| 1793 | #ifdef QT_QWS_DEPTH_GENERIC
|
|---|
| 1794 | template <> void qt_rectconvert(qrgb *dest, const quint32 *src,
|
|---|
| 1795 | int x, int y, int width, int height,
|
|---|
| 1796 | int dstStride, int srcStride);
|
|---|
| 1797 |
|
|---|
| 1798 | template <> void qt_rectconvert(qrgb *dest, const quint16 *src,
|
|---|
| 1799 | int x, int y, int width, int height,
|
|---|
| 1800 | int dstStride, int srcStride);
|
|---|
| 1801 | #endif // QT_QWS_DEPTH_GENERIC
|
|---|
| 1802 |
|
|---|
| 1803 | #define QT_MEMFILL_UINT(dest, length, color) \
|
|---|
| 1804 | qt_memfill<quint32>(dest, color, length);
|
|---|
| 1805 |
|
|---|
| 1806 | #define QT_MEMFILL_USHORT(dest, length, color) \
|
|---|
| 1807 | qt_memfill<quint16>(dest, color, length);
|
|---|
| 1808 |
|
|---|
| 1809 | #define QT_MEMCPY_REV_UINT(dest, src, length) \
|
|---|
| 1810 | do { \
|
|---|
| 1811 | /* Duff's device */ \
|
|---|
| 1812 | uint *_d = (uint*)(dest) + length; \
|
|---|
| 1813 | const uint *_s = (uint*)(src) + length; \
|
|---|
| 1814 | register int n = ((length) + 7) / 8; \
|
|---|
| 1815 | switch ((length) & 0x07) \
|
|---|
| 1816 | { \
|
|---|
| 1817 | case 0: do { *--_d = *--_s; \
|
|---|
| 1818 | case 7: *--_d = *--_s; \
|
|---|
| 1819 | case 6: *--_d = *--_s; \
|
|---|
| 1820 | case 5: *--_d = *--_s; \
|
|---|
| 1821 | case 4: *--_d = *--_s; \
|
|---|
| 1822 | case 3: *--_d = *--_s; \
|
|---|
| 1823 | case 2: *--_d = *--_s; \
|
|---|
| 1824 | case 1: *--_d = *--_s; \
|
|---|
| 1825 | } while (--n > 0); \
|
|---|
| 1826 | } \
|
|---|
| 1827 | } while (0)
|
|---|
| 1828 |
|
|---|
| 1829 | #define QT_MEMCPY_USHORT(dest, src, length) \
|
|---|
| 1830 | do { \
|
|---|
| 1831 | /* Duff's device */ \
|
|---|
| 1832 | ushort *_d = (ushort*)(dest); \
|
|---|
| 1833 | const ushort *_s = (ushort*)(src); \
|
|---|
| 1834 | register int n = ((length) + 7) / 8; \
|
|---|
| 1835 | switch ((length) & 0x07) \
|
|---|
| 1836 | { \
|
|---|
| 1837 | case 0: do { *_d++ = *_s++; \
|
|---|
| 1838 | case 7: *_d++ = *_s++; \
|
|---|
| 1839 | case 6: *_d++ = *_s++; \
|
|---|
| 1840 | case 5: *_d++ = *_s++; \
|
|---|
| 1841 | case 4: *_d++ = *_s++; \
|
|---|
| 1842 | case 3: *_d++ = *_s++; \
|
|---|
| 1843 | case 2: *_d++ = *_s++; \
|
|---|
| 1844 | case 1: *_d++ = *_s++; \
|
|---|
| 1845 | } while (--n > 0); \
|
|---|
| 1846 | } \
|
|---|
| 1847 | } while (0)
|
|---|
| 1848 |
|
|---|
| 1849 | #if defined(Q_CC_RVCT)
|
|---|
| 1850 | # pragma push
|
|---|
| 1851 | # pragma arm
|
|---|
| 1852 | #endif
|
|---|
| 1853 | Q_STATIC_INLINE_FUNCTION int qt_div_255(int x) { return (x + (x>>8) + 0x80) >> 8; }
|
|---|
| 1854 | #if defined(Q_CC_RVCT)
|
|---|
| 1855 | # pragma pop
|
|---|
| 1856 | #endif
|
|---|
| 1857 |
|
|---|
| 1858 | inline ushort qConvertRgb32To16(uint c)
|
|---|
| 1859 | {
|
|---|
| 1860 | return (((c) >> 3) & 0x001f)
|
|---|
| 1861 | | (((c) >> 5) & 0x07e0)
|
|---|
| 1862 | | (((c) >> 8) & 0xf800);
|
|---|
| 1863 | }
|
|---|
| 1864 |
|
|---|
| 1865 | #if defined(Q_WS_QWS) || (QT_VERSION >= 0x040400)
|
|---|
| 1866 | inline quint32 qConvertRgb32To16x2(quint64 c)
|
|---|
| 1867 | {
|
|---|
| 1868 | c = (((c) >> 3) & Q_UINT64_C(0x001f0000001f))
|
|---|
| 1869 | | (((c) >> 5) & Q_UINT64_C(0x07e0000007e0))
|
|---|
| 1870 | | (((c) >> 8) & Q_UINT64_C(0xf8000000f800));
|
|---|
| 1871 | return c | (c >> 16);
|
|---|
| 1872 | }
|
|---|
| 1873 | #endif
|
|---|
| 1874 |
|
|---|
| 1875 | inline QRgb qConvertRgb16To32(uint c)
|
|---|
| 1876 | {
|
|---|
| 1877 | return 0xff000000
|
|---|
| 1878 | | ((((c) << 3) & 0xf8) | (((c) >> 2) & 0x7))
|
|---|
| 1879 | | ((((c) << 5) & 0xfc00) | (((c) >> 1) & 0x300))
|
|---|
| 1880 | | ((((c) << 8) & 0xf80000) | (((c) << 3) & 0x70000));
|
|---|
| 1881 | }
|
|---|
| 1882 |
|
|---|
| 1883 | inline int qRed565(quint16 rgb) {
|
|---|
| 1884 | const int r = (rgb & 0xf800);
|
|---|
| 1885 | return (r >> 8) | (r >> 13);
|
|---|
| 1886 | }
|
|---|
| 1887 |
|
|---|
| 1888 | inline int qGreen565(quint16 rgb) {
|
|---|
| 1889 | const int g = (rgb & 0x07e0);
|
|---|
| 1890 | return (g >> 3) | (g >> 9);
|
|---|
| 1891 | }
|
|---|
| 1892 |
|
|---|
| 1893 | inline int qBlue565(quint16 rgb) {
|
|---|
| 1894 | const int b = (rgb & 0x001f);
|
|---|
| 1895 | return (b << 3) | (b >> 2);
|
|---|
| 1896 | }
|
|---|
| 1897 |
|
|---|
| 1898 | const uint qt_bayer_matrix[16][16] = {
|
|---|
| 1899 | { 0x1, 0xc0, 0x30, 0xf0, 0xc, 0xcc, 0x3c, 0xfc,
|
|---|
| 1900 | 0x3, 0xc3, 0x33, 0xf3, 0xf, 0xcf, 0x3f, 0xff},
|
|---|
| 1901 | { 0x80, 0x40, 0xb0, 0x70, 0x8c, 0x4c, 0xbc, 0x7c,
|
|---|
| 1902 | 0x83, 0x43, 0xb3, 0x73, 0x8f, 0x4f, 0xbf, 0x7f},
|
|---|
| 1903 | { 0x20, 0xe0, 0x10, 0xd0, 0x2c, 0xec, 0x1c, 0xdc,
|
|---|
| 1904 | 0x23, 0xe3, 0x13, 0xd3, 0x2f, 0xef, 0x1f, 0xdf},
|
|---|
| 1905 | { 0xa0, 0x60, 0x90, 0x50, 0xac, 0x6c, 0x9c, 0x5c,
|
|---|
| 1906 | 0xa3, 0x63, 0x93, 0x53, 0xaf, 0x6f, 0x9f, 0x5f},
|
|---|
| 1907 | { 0x8, 0xc8, 0x38, 0xf8, 0x4, 0xc4, 0x34, 0xf4,
|
|---|
| 1908 | 0xb, 0xcb, 0x3b, 0xfb, 0x7, 0xc7, 0x37, 0xf7},
|
|---|
| 1909 | { 0x88, 0x48, 0xb8, 0x78, 0x84, 0x44, 0xb4, 0x74,
|
|---|
| 1910 | 0x8b, 0x4b, 0xbb, 0x7b, 0x87, 0x47, 0xb7, 0x77},
|
|---|
| 1911 | { 0x28, 0xe8, 0x18, 0xd8, 0x24, 0xe4, 0x14, 0xd4,
|
|---|
| 1912 | 0x2b, 0xeb, 0x1b, 0xdb, 0x27, 0xe7, 0x17, 0xd7},
|
|---|
| 1913 | { 0xa8, 0x68, 0x98, 0x58, 0xa4, 0x64, 0x94, 0x54,
|
|---|
| 1914 | 0xab, 0x6b, 0x9b, 0x5b, 0xa7, 0x67, 0x97, 0x57},
|
|---|
| 1915 | { 0x2, 0xc2, 0x32, 0xf2, 0xe, 0xce, 0x3e, 0xfe,
|
|---|
| 1916 | 0x1, 0xc1, 0x31, 0xf1, 0xd, 0xcd, 0x3d, 0xfd},
|
|---|
| 1917 | { 0x82, 0x42, 0xb2, 0x72, 0x8e, 0x4e, 0xbe, 0x7e,
|
|---|
| 1918 | 0x81, 0x41, 0xb1, 0x71, 0x8d, 0x4d, 0xbd, 0x7d},
|
|---|
| 1919 | { 0x22, 0xe2, 0x12, 0xd2, 0x2e, 0xee, 0x1e, 0xde,
|
|---|
| 1920 | 0x21, 0xe1, 0x11, 0xd1, 0x2d, 0xed, 0x1d, 0xdd},
|
|---|
| 1921 | { 0xa2, 0x62, 0x92, 0x52, 0xae, 0x6e, 0x9e, 0x5e,
|
|---|
| 1922 | 0xa1, 0x61, 0x91, 0x51, 0xad, 0x6d, 0x9d, 0x5d},
|
|---|
| 1923 | { 0xa, 0xca, 0x3a, 0xfa, 0x6, 0xc6, 0x36, 0xf6,
|
|---|
| 1924 | 0x9, 0xc9, 0x39, 0xf9, 0x5, 0xc5, 0x35, 0xf5},
|
|---|
| 1925 | { 0x8a, 0x4a, 0xba, 0x7a, 0x86, 0x46, 0xb6, 0x76,
|
|---|
| 1926 | 0x89, 0x49, 0xb9, 0x79, 0x85, 0x45, 0xb5, 0x75},
|
|---|
| 1927 | { 0x2a, 0xea, 0x1a, 0xda, 0x26, 0xe6, 0x16, 0xd6,
|
|---|
| 1928 | 0x29, 0xe9, 0x19, 0xd9, 0x25, 0xe5, 0x15, 0xd5},
|
|---|
| 1929 | { 0xaa, 0x6a, 0x9a, 0x5a, 0xa6, 0x66, 0x96, 0x56,
|
|---|
| 1930 | 0xa9, 0x69, 0x99, 0x59, 0xa5, 0x65, 0x95, 0x55}
|
|---|
| 1931 | };
|
|---|
| 1932 |
|
|---|
| 1933 | #define ARGB_COMBINE_ALPHA(argb, alpha) \
|
|---|
| 1934 | ((((argb >> 24) * alpha) >> 8) << 24) | (argb & 0x00ffffff)
|
|---|
| 1935 |
|
|---|
| 1936 |
|
|---|
| 1937 | #if QT_POINTER_SIZE == 8 // 64-bit versions
|
|---|
| 1938 | #define AMIX(mask) (qMin(((qint64(s)&mask) + (qint64(d)&mask)), qint64(mask)))
|
|---|
| 1939 | #define MIX(mask) (qMin(((qint64(s)&mask) + (qint64(d)&mask)), qint64(mask)))
|
|---|
| 1940 | #else // 32 bits
|
|---|
| 1941 | // The mask for alpha can overflow over 32 bits
|
|---|
| 1942 | #define AMIX(mask) quint32(qMin(((qint64(s)&mask) + (qint64(d)&mask)), qint64(mask)))
|
|---|
| 1943 | #define MIX(mask) (qMin(((quint32(s)&mask) + (quint32(d)&mask)), quint32(mask)))
|
|---|
| 1944 | #endif
|
|---|
| 1945 |
|
|---|
| 1946 | inline int comp_func_Plus_one_pixel_const_alpha(uint d, const uint s, const uint const_alpha, const uint one_minus_const_alpha)
|
|---|
| 1947 | {
|
|---|
| 1948 | const int result = (AMIX(AMASK) | MIX(RMASK) | MIX(GMASK) | MIX(BMASK));
|
|---|
| 1949 | return INTERPOLATE_PIXEL_255(result, const_alpha, d, one_minus_const_alpha);
|
|---|
| 1950 | }
|
|---|
| 1951 |
|
|---|
| 1952 | inline int comp_func_Plus_one_pixel(uint d, const uint s)
|
|---|
| 1953 | {
|
|---|
| 1954 | const int result = (AMIX(AMASK) | MIX(RMASK) | MIX(GMASK) | MIX(BMASK));
|
|---|
| 1955 | return result;
|
|---|
| 1956 | }
|
|---|
| 1957 |
|
|---|
| 1958 | #undef MIX
|
|---|
| 1959 | #undef AMIX
|
|---|
| 1960 |
|
|---|
| 1961 | // prototypes of all the composition functions
|
|---|
| 1962 | void QT_FASTCALL comp_func_SourceOver(uint *dest, const uint *src, int length, uint const_alpha);
|
|---|
| 1963 | void QT_FASTCALL comp_func_DestinationOver(uint *dest, const uint *src, int length, uint const_alpha);
|
|---|
| 1964 | void QT_FASTCALL comp_func_Clear(uint *dest, const uint *, int length, uint const_alpha);
|
|---|
| 1965 | void QT_FASTCALL comp_func_Source(uint *dest, const uint *src, int length, uint const_alpha);
|
|---|
| 1966 | void QT_FASTCALL comp_func_Destination(uint *, const uint *, int, uint);
|
|---|
| 1967 | void QT_FASTCALL comp_func_SourceIn(uint *dest, const uint *src, int length, uint const_alpha);
|
|---|
| 1968 | void QT_FASTCALL comp_func_DestinationIn(uint *dest, const uint *src, int length, uint const_alpha);
|
|---|
| 1969 | void QT_FASTCALL comp_func_SourceOut(uint *dest, const uint *src, int length, uint const_alpha);
|
|---|
| 1970 | void QT_FASTCALL comp_func_DestinationOut(uint *dest, const uint *src, int length, uint const_alpha);
|
|---|
| 1971 | void QT_FASTCALL comp_func_SourceAtop(uint *dest, const uint *src, int length, uint const_alpha);
|
|---|
| 1972 | void QT_FASTCALL comp_func_DestinationAtop(uint *dest, const uint *src, int length, uint const_alpha);
|
|---|
| 1973 | void QT_FASTCALL comp_func_XOR(uint *dest, const uint *src, int length, uint const_alpha);
|
|---|
| 1974 | void QT_FASTCALL comp_func_Plus(uint *dest, const uint *src, int length, uint const_alpha);
|
|---|
| 1975 | void QT_FASTCALL comp_func_Multiply(uint *dest, const uint *src, int length, uint const_alpha);
|
|---|
| 1976 | void QT_FASTCALL comp_func_Screen(uint *dest, const uint *src, int length, uint const_alpha);
|
|---|
| 1977 | void QT_FASTCALL comp_func_Overlay(uint *dest, const uint *src, int length, uint const_alpha);
|
|---|
| 1978 | void QT_FASTCALL comp_func_Darken(uint *dest, const uint *src, int length, uint const_alpha);
|
|---|
| 1979 | void QT_FASTCALL comp_func_Lighten(uint *dest, const uint *src, int length, uint const_alpha);
|
|---|
| 1980 | void QT_FASTCALL comp_func_ColorDodge(uint *dest, const uint *src, int length, uint const_alpha);
|
|---|
| 1981 | void QT_FASTCALL comp_func_ColorBurn(uint *dest, const uint *src, int length, uint const_alpha);
|
|---|
| 1982 | void QT_FASTCALL comp_func_HardLight(uint *dest, const uint *src, int length, uint const_alpha);
|
|---|
| 1983 | void QT_FASTCALL comp_func_SoftLight(uint *dest, const uint *src, int length, uint const_alpha);
|
|---|
| 1984 | void QT_FASTCALL comp_func_Difference(uint *dest, const uint *src, int length, uint const_alpha);
|
|---|
| 1985 | void QT_FASTCALL comp_func_Exclusion(uint *dest, const uint *src, int length, uint const_alpha);
|
|---|
| 1986 | void QT_FASTCALL rasterop_SourceOrDestination(uint *dest, const uint *src, int length, uint const_alpha);
|
|---|
| 1987 | void QT_FASTCALL rasterop_SourceAndDestination(uint *dest, const uint *src, int length, uint const_alpha);
|
|---|
| 1988 | void QT_FASTCALL rasterop_SourceXorDestination(uint *dest, const uint *src, int length, uint const_alpha);
|
|---|
| 1989 | void QT_FASTCALL rasterop_NotSourceAndNotDestination(uint *dest, const uint *src, int length, uint const_alpha);
|
|---|
| 1990 | void QT_FASTCALL rasterop_NotSourceOrNotDestination(uint *dest, const uint *src, int length, uint const_alpha);
|
|---|
| 1991 | void QT_FASTCALL rasterop_NotSourceXorDestination(uint *dest, const uint *src, int length, uint const_alpha);
|
|---|
| 1992 | void QT_FASTCALL rasterop_NotSource(uint *dest, const uint *src, int length, uint const_alpha);
|
|---|
| 1993 | void QT_FASTCALL rasterop_NotSourceAndDestination(uint *dest, const uint *src, int length, uint const_alpha);
|
|---|
| 1994 | void QT_FASTCALL rasterop_SourceAndNotDestination(uint *dest, const uint *src, int length, uint const_alpha);
|
|---|
| 1995 |
|
|---|
| 1996 | // prototypes of all the solid composition functions
|
|---|
| 1997 | void QT_FASTCALL comp_func_solid_SourceOver(uint *dest, int length, uint color, uint const_alpha);
|
|---|
| 1998 | void QT_FASTCALL comp_func_solid_DestinationOver(uint *dest, int length, uint color, uint const_alpha);
|
|---|
| 1999 | void QT_FASTCALL comp_func_solid_Clear(uint *dest, int length, uint color, uint const_alpha);
|
|---|
| 2000 | void QT_FASTCALL comp_func_solid_Source(uint *dest, int length, uint color, uint const_alpha);
|
|---|
| 2001 | void QT_FASTCALL comp_func_solid_Destination(uint *dest, int length, uint color, uint const_alpha);
|
|---|
| 2002 | void QT_FASTCALL comp_func_solid_SourceIn(uint *dest, int length, uint color, uint const_alpha);
|
|---|
| 2003 | void QT_FASTCALL comp_func_solid_DestinationIn(uint *dest, int length, uint color, uint const_alpha);
|
|---|
| 2004 | void QT_FASTCALL comp_func_solid_SourceOut(uint *dest, int length, uint color, uint const_alpha);
|
|---|
| 2005 | void QT_FASTCALL comp_func_solid_DestinationOut(uint *dest, int length, uint color, uint const_alpha);
|
|---|
| 2006 | void QT_FASTCALL comp_func_solid_SourceAtop(uint *dest, int length, uint color, uint const_alpha);
|
|---|
| 2007 | void QT_FASTCALL comp_func_solid_DestinationAtop(uint *dest, int length, uint color, uint const_alpha);
|
|---|
| 2008 | void QT_FASTCALL comp_func_solid_XOR(uint *dest, int length, uint color, uint const_alpha);
|
|---|
| 2009 | void QT_FASTCALL comp_func_solid_Plus(uint *dest, int length, uint color, uint const_alpha);
|
|---|
| 2010 | void QT_FASTCALL comp_func_solid_Multiply(uint *dest, int length, uint color, uint const_alpha);
|
|---|
| 2011 | void QT_FASTCALL comp_func_solid_Screen(uint *dest, int length, uint color, uint const_alpha);
|
|---|
| 2012 | void QT_FASTCALL comp_func_solid_Overlay(uint *dest, int length, uint color, uint const_alpha);
|
|---|
| 2013 | void QT_FASTCALL comp_func_solid_Darken(uint *dest, int length, uint color, uint const_alpha);
|
|---|
| 2014 | void QT_FASTCALL comp_func_solid_Lighten(uint *dest, int length, uint color, uint const_alpha);
|
|---|
| 2015 | void QT_FASTCALL comp_func_solid_ColorDodge(uint *dest, int length, uint color, uint const_alpha);
|
|---|
| 2016 | void QT_FASTCALL comp_func_solid_ColorBurn(uint *dest, int length, uint color, uint const_alpha);
|
|---|
| 2017 | void QT_FASTCALL comp_func_solid_HardLight(uint *dest, int length, uint color, uint const_alpha);
|
|---|
| 2018 | void QT_FASTCALL comp_func_solid_SoftLight(uint *dest, int length, uint color, uint const_alpha);
|
|---|
| 2019 | void QT_FASTCALL comp_func_solid_Difference(uint *dest, int length, uint color, uint const_alpha);
|
|---|
| 2020 | void QT_FASTCALL comp_func_solid_Exclusion(uint *dest, int length, uint color, uint const_alpha);
|
|---|
| 2021 | void QT_FASTCALL rasterop_solid_SourceOrDestination(uint *dest, int length, uint color, uint const_alpha);
|
|---|
| 2022 | void QT_FASTCALL rasterop_solid_SourceAndDestination(uint *dest, int length, uint color, uint const_alpha);
|
|---|
| 2023 | void QT_FASTCALL rasterop_solid_SourceXorDestination(uint *dest, int length, uint color, uint const_alpha);
|
|---|
| 2024 | void QT_FASTCALL rasterop_solid_NotSourceAndNotDestination(uint *dest, int length, uint color, uint const_alpha);
|
|---|
| 2025 | void QT_FASTCALL rasterop_solid_NotSourceOrNotDestination(uint *dest, int length, uint color, uint const_alpha);
|
|---|
| 2026 | void QT_FASTCALL rasterop_solid_NotSourceXorDestination(uint *dest, int length, uint color, uint const_alpha);
|
|---|
| 2027 | void QT_FASTCALL rasterop_solid_NotSource(uint *dest, int length, uint color, uint const_alpha);
|
|---|
| 2028 | void QT_FASTCALL rasterop_solid_NotSourceAndDestination(uint *dest, int length, uint color, uint const_alpha);
|
|---|
| 2029 | void QT_FASTCALL rasterop_solid_SourceAndNotDestination(uint *dest, int length, uint color, uint const_alpha);
|
|---|
| 2030 |
|
|---|
| 2031 | QT_END_NAMESPACE
|
|---|
| 2032 |
|
|---|
| 2033 | #endif // QDRAWHELPER_P_H
|
|---|