bool QBmpHandler::write(const QImage &img)
{
- QImage image;
- switch (img.format()) {
- case QImage::Format_ARGB8565_Premultiplied:
- case QImage::Format_ARGB8555_Premultiplied:
- case QImage::Format_ARGB6666_Premultiplied:
- case QImage::Format_ARGB4444_Premultiplied:
- image = img.convertToFormat(QImage::Format_ARGB32);
- break;
- case QImage::Format_RGB16:
- case QImage::Format_RGB888:
- case QImage::Format_RGB666:
- case QImage::Format_RGB555:
- case QImage::Format_RGB444:
+ QImage image(img);
+ if (image.format() == QImage::Format_RGB16) {
image = img.convertToFormat(QImage::Format_RGB32);
- break;
- default:
- image = img;
}
QIODevice *d = device();
# error No image format available for streaming
#endif
-static inline bool checkPixelSize(const QImage::Format format)
-{
- switch (format) {
- case QImage::Format_ARGB8565_Premultiplied:
- return (sizeof(qargb8565) == 3);
- case QImage::Format_RGB666:
- return (sizeof(qrgb666) == 3);
- case QImage::Format_ARGB6666_Premultiplied:
- return (sizeof(qargb6666) == 3);
- case QImage::Format_RGB555:
- return (sizeof(qrgb555) == 2);
- case QImage::Format_ARGB8555_Premultiplied:
- return (sizeof(qargb8555) == 3);
- case QImage::Format_RGB888:
- return (sizeof(qrgb888) == 3);
- case QImage::Format_RGB444:
- return (sizeof(qrgb444) == 2);
- case QImage::Format_ARGB4444_Premultiplied:
- return (sizeof(qargb4444) == 2);
- default:
- return true;
- }
-}
-
-
#define QIMAGE_SANITYCHECK_MEMORY(image) \
if (Q_UNLIKELY((image).isNull())) { \
qWarning("QImage: out of memory, returning null image"); \
if (!size.isValid() || format == QImage::Format_Invalid)
return 0; // invalid parameter(s)
- if (!checkPixelSize(format)) {
- qWarning("QImageData::create(): Invalid pixel size for format %i",
- format);
- return 0;
- }
-
uint width = size.width();
uint height = size.height();
uint depth = qt_depthForFormat(format);
}
} break;
- case QImage::Format_ARGB8555_Premultiplied:
- case QImage::Format_ARGB8565_Premultiplied: {
- uchar *bits = data;
- uchar *end_bits = data + bytes_per_line;
-
- for (int y=0; y<height && !has_alpha_pixels; ++y) {
- while (bits < end_bits) {
- has_alpha_pixels |= bits[0] != 0;
- bits += 3;
- }
- bits = end_bits;
- end_bits += bytes_per_line;
- }
- } break;
-
- case QImage::Format_ARGB6666_Premultiplied: {
- uchar *bits = data;
- uchar *end_bits = data + bytes_per_line;
-
- for (int y=0; y<height && !has_alpha_pixels; ++y) {
- while (bits < end_bits) {
- has_alpha_pixels |= (bits[0] & 0xfc) != 0;
- bits += 3;
- }
- bits = end_bits;
- end_bits += bytes_per_line;
- }
- } break;
-
- case QImage::Format_ARGB4444_Premultiplied: {
- uchar *bits = data;
- uchar *end_bits = data + bytes_per_line;
-
- for (int y=0; y<height && !has_alpha_pixels; ++y) {
- while (bits < end_bits) {
- has_alpha_pixels |= (bits[0] & 0xf0) != 0;
- bits += 2;
- }
- bits = end_bits;
- end_bits += bytes_per_line;
- }
- } break;
-
default:
break;
}
\o
The depth() function returns the depth of the image. The supported
- depths are 1 (monochrome), 8, 16, 24 and 32 bits. The
- bitPlaneCount() function tells how many of those bits that are
- used. For more information see the
- \l {QImage#Image Formats}{Image Formats} section.
+ depths are 1 (monochrome), 8, 16 and 32 bits. The bitPlaneCount()
+ function tells how many of those bits that are used. For more
+ information see the \l {QImage#Image Formats}{Image Formats}
+ section.
The format(), bytesPerLine(), and byteCount() functions provide
low-level information about the data stored in the image.
\value Format_RGB16 The image is stored using a 16-bit RGB format (5-6-5).
- \value Format_ARGB8565_Premultiplied The image is stored using a
- premultiplied 24-bit ARGB format (8-5-6-5).
- \value Format_RGB666 The image is stored using a 24-bit RGB format (6-6-6).
- The unused most significant bits is always zero.
- \value Format_ARGB6666_Premultiplied The image is stored using a
- premultiplied 24-bit ARGB format (6-6-6-6).
- \value Format_RGB555 The image is stored using a 16-bit RGB format (5-5-5).
- The unused most significant bit is always zero.
- \value Format_ARGB8555_Premultiplied The image is stored using a
- premultiplied 24-bit ARGB format (8-5-5-5).
- \value Format_RGB888 The image is stored using a 24-bit RGB format (8-8-8).
- \value Format_RGB444 The image is stored using a 16-bit RGB format (4-4-4).
- The unused bits are always zero.
- \value Format_ARGB4444_Premultiplied The image is stored using a
- premultiplied 16-bit ARGB format (4-4-4-4).
-
\note Drawing into a QImage with QImage::Format_Indexed8 is not
supported.
if (format == QImage::Format_Invalid)
return Q_NULLPTR;
- if (!checkPixelSize(format)) {
- qWarning("QImageData::create(): Invalid pixel size for format %i",
- format);
- return Q_NULLPTR;
- }
-
const int depth = qt_depthForFormat(format);
const int calc_bytes_per_line = ((width * depth + 31)/32) * 4;
const int min_bytes_per_line = (width * depth + 7)/8;
The image depth is the number of bits used to store a single
pixel, also called bits per pixel (bpp).
- The supported depths are 1, 8, 16, 24 and 32.
+ The supported depths are 1, 8, 16 and 32.
\sa bitPlaneCount(), convertToFormat(), {QImage#Image Formats}{Image Formats},
{QImage#Image Information}{Image Information}
qt_rectfill<quint16>(reinterpret_cast<quint16*>(d->data), pixel,
0, 0, d->width, d->height, d->bytes_per_line);
return;
- } else if (d->depth == 24) {
- qt_rectfill<quint24>(reinterpret_cast<quint24*>(d->data), pixel,
- 0, 0, d->width, d->height, d->bytes_per_line);
- return;
}
if (d->format == Format_RGB32)
fill(pixel);
} else if (d->depth == 16 && d->format == QImage::Format_RGB16) {
- qrgb565 p(color.rgba());
- fill((uint) p.rawValue());
+ fill((uint) color.rgba());
} else if (d->depth == 1) {
if (color == Qt::color1)
CONVERT_DECL(quint32, quint16)
CONVERT_DECL(quint16, quint32)
-CONVERT_DECL(quint32, qargb8565)
-CONVERT_DECL(qargb8565, quint32)
-CONVERT_DECL(quint32, qrgb555)
-CONVERT_DECL(qrgb666, quint32)
-CONVERT_DECL(quint32, qrgb666)
-CONVERT_DECL(qargb6666, quint32)
-CONVERT_DECL(quint32, qargb6666)
-CONVERT_DECL(qrgb555, quint32)
-CONVERT_DECL(quint16, qrgb555)
-CONVERT_DECL(qrgb555, quint16)
-CONVERT_DECL(quint32, qrgb888)
-CONVERT_DECL(qrgb888, quint32)
-CONVERT_DECL(quint32, qargb8555)
-CONVERT_DECL(qargb8555, quint32)
-CONVERT_DECL(quint32, qrgb444)
-CONVERT_DECL(qrgb444, quint32)
-CONVERT_DECL(quint32, qargb4444)
-CONVERT_DECL(qargb4444, quint32)
#undef CONVERT_DECL
#define CONVERT_PTR(DST, SRC) convert_##SRC##_to_##DST
Format_ARGB32,
Format_ARGB32_Premultiplied,
Format_RGB16,
- Format_ARGB8565_Premultiplied,
- Format_RGB666,
- Format_ARGB6666_Premultiplied,
- Format_RGB555,
- Format_ARGB8555_Premultiplied,
- Format_RGB888
- Format_RGB444
- Format_ARGB4444_Premultiplied
*/
static Image_Converter converter_map[QImage::NImageFormats][QImage::NImageFormats] =
{
{
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
+ 0, 0, 0, 0, 0, 0, 0, 0
},
{
0,
convert_Mono_to_X32,
convert_Mono_to_X32,
convert_Mono_to_X32,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
0
}, // Format_Mono
convert_Mono_to_X32,
convert_Mono_to_X32,
convert_Mono_to_X32,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
0
}, // Format_MonoLSB
convert_Indexed8_to_X32,
convert_Indexed8_to_X32,
convert_Indexed8_to_X32,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
0
}, // Format_Indexed8
mask_alpha_converter,
mask_alpha_converter,
CONVERT_PTR(quint16, quint32),
- CONVERT_PTR(qargb8565, quint32),
- CONVERT_PTR(qrgb666, quint32),
- CONVERT_PTR(qargb6666, quint32),
- CONVERT_PTR(qrgb555, quint32),
- CONVERT_PTR(qargb8555, quint32),
- CONVERT_PTR(qrgb888, quint32),
- CONVERT_PTR(qrgb444, quint32),
- CONVERT_PTR(qargb4444, quint32)
}, // Format_RGB32
{
mask_alpha_converter,
0,
convert_ARGB_to_ARGB_PM,
- CONVERT_PTR(quint16, quint32),
- CONVERT_PTR(qargb8565, quint32),
- CONVERT_PTR(qrgb666, quint32),
- CONVERT_PTR(qargb6666, quint32),
- CONVERT_PTR(qrgb555, quint32),
- CONVERT_PTR(qargb8555, quint32),
- CONVERT_PTR(qrgb888, quint32),
- CONVERT_PTR(qrgb444, quint32),
- CONVERT_PTR(qargb4444, quint32)
+ CONVERT_PTR(quint16, quint32)
}, // Format_ARGB32
{
convert_ARGB_PM_to_RGB,
convert_ARGB_PM_to_ARGB,
0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
0
}, // Format_ARGB32_Premultiplied
CONVERT_PTR(quint32, quint16),
CONVERT_PTR(quint32, quint16),
CONVERT_PTR(quint32, quint16),
- 0,
- 0,
- 0,
- 0,
- CONVERT_PTR(qrgb555, quint16),
- 0,
- 0,
- 0,
0
}, // Format_RGB16
-
- {
- 0,
- 0,
- 0,
- 0,
- CONVERT_PTR(quint32, qargb8565),
- CONVERT_PTR(quint32, qargb8565),
- CONVERT_PTR(quint32, qargb8565),
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0
- }, // Format_ARGB8565_Premultiplied
-
- {
- 0,
- 0,
- 0,
- 0,
- CONVERT_PTR(quint32, qrgb666),
- CONVERT_PTR(quint32, qrgb666),
- CONVERT_PTR(quint32, qrgb666),
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0
- }, // Format_RGB666
-
- {
- 0,
- 0,
- 0,
- 0,
- CONVERT_PTR(quint32, qargb6666),
- CONVERT_PTR(quint32, qargb6666),
- CONVERT_PTR(quint32, qargb6666),
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0
- }, // Format_ARGB6666_Premultiplied
-
- {
- 0,
- 0,
- 0,
- 0,
- CONVERT_PTR(quint32, qrgb555),
- CONVERT_PTR(quint32, qrgb555),
- CONVERT_PTR(quint32, qrgb555),
- CONVERT_PTR(quint16, qrgb555),
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0
- }, // Format_RGB555
-
- {
- 0,
- 0,
- 0,
- 0,
- CONVERT_PTR(quint32, qargb8555),
- CONVERT_PTR(quint32, qargb8555),
- CONVERT_PTR(quint32, qargb8555),
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0
- }, // Format_ARGB8555_Premultiplied
-
- {
- 0,
- 0,
- 0,
- 0,
- CONVERT_PTR(quint32, qrgb888),
- CONVERT_PTR(quint32, qrgb888),
- CONVERT_PTR(quint32, qrgb888),
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0
- }, // Format_RGB888
-
- {
- 0,
- 0,
- 0,
- 0,
- CONVERT_PTR(quint32, qrgb444),
- CONVERT_PTR(quint32, qrgb444),
- CONVERT_PTR(quint32, qrgb444),
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0
- }, // Format_RGB444
-
- {
- 0,
- 0,
- 0,
- 0,
- CONVERT_PTR(quint32, qargb4444),
- CONVERT_PTR(quint32, qargb4444),
- CONVERT_PTR(quint32, qargb4444),
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0
- } // Format_ARGB4444_Premultiplied
};
/*!
return d->colortable.at((*(s + (x >> 3)) >> (x & 7)) & 1);
case Format_Indexed8:
return d->colortable.at((int)s[x]);
- case Format_ARGB8565_Premultiplied:
- return qt_colorConvert<quint32, qargb8565>(reinterpret_cast<const qargb8565*>(s)[x], 0);
- case Format_RGB666:
- return qt_colorConvert<quint32, qrgb666>(reinterpret_cast<const qrgb666*>(s)[x], 0);
- case Format_ARGB6666_Premultiplied:
- return qt_colorConvert<quint32, qargb6666>(reinterpret_cast<const qargb6666*>(s)[x], 0);
- case Format_RGB555:
- return qt_colorConvert<quint32, qrgb555>(reinterpret_cast<const qrgb555*>(s)[x], 0);
- case Format_ARGB8555_Premultiplied:
- return qt_colorConvert<quint32, qargb8555>(reinterpret_cast<const qargb8555*>(s)[x], 0);
- case Format_RGB888:
- return qt_colorConvert<quint32, qrgb888>(reinterpret_cast<const qrgb888*>(s)[x], 0);
- case Format_RGB444:
- return qt_colorConvert<quint32, qrgb444>(reinterpret_cast<const qrgb444*>(s)[x], 0);
- case Format_ARGB4444_Premultiplied:
- return qt_colorConvert<quint32, qargb4444>(reinterpret_cast<const qargb4444*>(s)[x], 0);
case Format_RGB16:
return qt_colorConvert<quint32, quint16>(reinterpret_cast<const quint16*>(s)[x], 0);
default:
case Format_RGB16:
((quint16 *)s)[x] = qt_colorConvert<quint16, quint32p>(p, 0);
break;
- case Format_ARGB8565_Premultiplied:
- ((qargb8565*)s)[x] = qt_colorConvert<qargb8565, quint32p>(p, 0);
- break;
- case Format_RGB666:
- ((qrgb666*)s)[x] = qt_colorConvert<qrgb666, quint32p>(p, 0);
- break;
- case Format_ARGB6666_Premultiplied:
- ((qargb6666*)s)[x] = qt_colorConvert<qargb6666, quint32p>(p, 0);
- break;
- case Format_RGB555:
- ((qrgb555*)s)[x] = qt_colorConvert<qrgb555, quint32p>(p, 0);
- break;
- case Format_ARGB8555_Premultiplied:
- ((qargb8555*)s)[x] = qt_colorConvert<qargb8555, quint32p>(p, 0);
- break;
- case Format_RGB888:
- ((qrgb888*)s)[x] = qt_colorConvert<qrgb888, quint32p>(p, 0);
- break;
- case Format_RGB444:
- ((qrgb444*)s)[x] = qt_colorConvert<qrgb444, quint32p>(p, 0);
- break;
- case Format_ARGB4444_Premultiplied:
- ((qargb4444*)s)[x] = qt_colorConvert<qargb4444, quint32p>(p, 0);
- break;
case Format_Invalid:
case NImageFormats:
Q_ASSERT(false);
while (p--)
if (!qIsGray(qt_colorConvert<quint32, quint16>(*b++, 0)))
return false;
- } else if (d->format == QImage::Format_RGB888) {
- int p = width()*height();
- const qrgb888* b = (const qrgb888 *)constBits();
- while (p--)
- if (!qIsGray(qt_colorConvert<quint32, qrgb888>(*b++, 0)))
- return false;
} else {
if (d->colortable.isEmpty())
return true;
switch (depth()) {
case 32:
- case 24:
case 16:
return allGray();
case 8: {
case 32:
do_mirror_data<quint32>(result.d, d, dstX0, dstY0, dstXIncr, dstYIncr, w, h);
break;
- case 24:
- do_mirror_data<quint24>(result.d, d, dstX0, dstY0, dstXIncr, dstYIncr, w, h);
- break;
case 16:
do_mirror_data<quint16>(result.d, d, dstX0, dstY0, dstXIncr, dstYIncr, w, h);
break;
}
}
break;
- case Format_ARGB8565_Premultiplied:
- res = QImage(d->width, d->height, d->format);
- QIMAGE_SANITYCHECK_MEMORY(res);
- for (int i = 0; i < d->height; i++) {
- const quint8 *p = constScanLine(i);
- quint8 *q = res.scanLine(i);
- const quint8 *end = p + d->width * sizeof(qargb8565);
- while (p < end) {
- q[0] = p[0];
- q[1] = (p[1] & 0xe0) | (p[2] >> 3);
- q[2] = (p[2] & 0x07) | (p[1] << 3);
- p += sizeof(qargb8565);
- q += sizeof(qargb8565);
- }
- }
- break;
- case Format_RGB666:
- res = QImage(d->width, d->height, d->format);
- QIMAGE_SANITYCHECK_MEMORY(res);
- for (int i = 0; i < d->height; i++) {
- qrgb666 *q = reinterpret_cast<qrgb666*>(res.scanLine(i));
- const qrgb666 *p = reinterpret_cast<const qrgb666*>(constScanLine(i));
- const qrgb666 *end = p + d->width;
- while (p < end) {
- const QRgb rgb = quint32(*p++);
- *q++ = qRgb(qBlue(rgb), qGreen(rgb), qRed(rgb));
- }
- }
- break;
- case Format_ARGB6666_Premultiplied:
- res = QImage(d->width, d->height, d->format);
- QIMAGE_SANITYCHECK_MEMORY(res);
- for (int i = 0; i < d->height; i++) {
- const quint8 *p = constScanLine(i);
- const quint8 *end = p + d->width * sizeof(qargb6666);
- quint8 *q = res.scanLine(i);
- while (p < end) {
- q[0] = (p[1] >> 4) | ((p[2] & 0x3) << 4) | (p[0] & 0xc0);
- q[1] = (p[1] & 0xf) | (p[0] << 4);
- q[2] = (p[2] & 0xfc) | ((p[0] >> 4) & 0x3);
- p += sizeof(qargb6666);
- q += sizeof(qargb6666);
- }
- }
- break;
- case Format_RGB555:
- res = QImage(d->width, d->height, d->format);
- QIMAGE_SANITYCHECK_MEMORY(res);
- for (int i = 0; i < d->height; i++) {
- quint16 *q = (quint16*)res.scanLine(i);
- const quint16 *p = (const quint16*)constScanLine(i);
- const quint16 *end = p + d->width;
- while (p < end) {
- *q = ((*p << 10) & 0x7c00) | ((*p >> 10) & 0x1f) | (*p & 0x3e0);
- p++;
- q++;
- }
- }
- break;
- case Format_ARGB8555_Premultiplied:
- res = QImage(d->width, d->height, d->format);
- QIMAGE_SANITYCHECK_MEMORY(res);
- for (int i = 0; i < d->height; i++) {
- const quint8 *p = constScanLine(i);
- quint8 *q = res.scanLine(i);
- const quint8 *end = p + d->width * sizeof(qargb8555);
- while (p < end) {
- q[0] = p[0];
- q[1] = (p[1] & 0xe0) | (p[2] >> 2);
- q[2] = (p[2] & 0x03) | ((p[1] << 2) & 0x7f);
- p += sizeof(qargb8555);
- q += sizeof(qargb8555);
- }
- }
- break;
- case Format_RGB888:
- res = QImage(d->width, d->height, d->format);
- QIMAGE_SANITYCHECK_MEMORY(res);
- for (int i = 0; i < d->height; i++) {
- quint8 *q = res.scanLine(i);
- const quint8 *p = constScanLine(i);
- const quint8 *end = p + d->width * sizeof(qrgb888);
- while (p < end) {
- q[0] = p[2];
- q[1] = p[1];
- q[2] = p[0];
- q += sizeof(qrgb888);
- p += sizeof(qrgb888);
- }
- }
- break;
- case Format_RGB444:
- case Format_ARGB4444_Premultiplied:
- res = QImage(d->width, d->height, d->format);
- QIMAGE_SANITYCHECK_MEMORY(res);
- for (int i = 0; i < d->height; i++) {
- quint16 *q = reinterpret_cast<quint16*>(res.scanLine(i));
- const quint16 *p = reinterpret_cast<const quint16*>(constScanLine(i));
- const quint16 *end = p + d->width;
- while (p < end) {
- *q = (*p & 0xf0f0) | ((*p & 0x0f) << 8) | ((*p & 0xf00) >> 8);
- p++;
- q++;
- }
- }
- break;
}
return res;
}
}
break;
- case 24: // 24 bpp transform
- while (dptr < maxp) {
- if (trigx < maxws && trigy < maxhs) {
- const uchar *p2 = sptr+sbpl*(trigy>>12) + ((trigx>>12)*3);
- dptr[0] = p2[0];
- dptr[1] = p2[1];
- dptr[2] = p2[2];
- }
- trigx += m11;
- trigy += m12;
- dptr += 3;
- }
- break;
-
case 32: // 32 bpp transform
while (dptr < maxp) {
if (trigx < maxws && trigy < maxhs)
{
return d && (d->format == Format_ARGB32_Premultiplied
|| d->format == Format_ARGB32
- || d->format == Format_ARGB8565_Premultiplied
- || d->format == Format_ARGB8555_Premultiplied
- || d->format == Format_ARGB6666_Premultiplied
- || d->format == Format_ARGB4444_Premultiplied
|| (d->has_alpha_clut && (d->format == Format_Indexed8
|| d->format == Format_Mono
|| d->format == Format_MonoLSB)));
case QImage::Format_RGB32:
bpc = 24;
break;
- case QImage::Format_RGB666:
- bpc = 18;
- break;
- case QImage::Format_RGB555:
- bpc = 15;
- break;
- case QImage::Format_ARGB8555_Premultiplied:
- bpc = 23;
- break;
- case QImage::Format_RGB444:
- bpc = 12;
- break;
default:
bpc = qt_depthForFormat(d->format);
break;
reinterpret_cast<quint32*>(out.bits()),
out.bytesPerLine());
break;
- case QImage::Format_RGB666:
- case QImage::Format_ARGB6666_Premultiplied:
- case QImage::Format_ARGB8565_Premultiplied:
- case QImage::Format_ARGB8555_Premultiplied:
- case QImage::Format_RGB888:
- qt_memrotate270(reinterpret_cast<const quint24*>(image.constBits()),
- w, h, image.bytesPerLine(),
- reinterpret_cast<quint24*>(out.bits()),
- out.bytesPerLine());
- break;
- case QImage::Format_RGB555:
case QImage::Format_RGB16:
- case QImage::Format_ARGB4444_Premultiplied:
qt_memrotate270(reinterpret_cast<const quint16*>(image.constBits()),
w, h, image.bytesPerLine(),
reinterpret_cast<quint16*>(out.bits()),
reinterpret_cast<quint32*>(out.bits()),
out.bytesPerLine());
break;
- case QImage::Format_RGB666:
- case QImage::Format_ARGB6666_Premultiplied:
- case QImage::Format_ARGB8565_Premultiplied:
- case QImage::Format_ARGB8555_Premultiplied:
- case QImage::Format_RGB888:
- qt_memrotate90(reinterpret_cast<const quint24*>(image.constBits()),
- w, h, image.bytesPerLine(),
- reinterpret_cast<quint24*>(out.bits()),
- out.bytesPerLine());
- break;
- case QImage::Format_RGB555:
case QImage::Format_RGB16:
- case QImage::Format_ARGB4444_Premultiplied:
qt_memrotate90(reinterpret_cast<const quint16*>(image.constBits()),
w, h, image.bytesPerLine(),
reinterpret_cast<quint16*>(out.bits()),
break;
case 1:
case 16:
- case 24:
case 32:
memset(dImage.bits(), 0x00, dImage.byteCount());
break;
Format_ARGB32,
Format_ARGB32_Premultiplied,
Format_RGB16,
- Format_ARGB8565_Premultiplied,
- Format_RGB666,
- Format_ARGB6666_Premultiplied,
- Format_RGB555,
- Format_ARGB8555_Premultiplied,
- Format_RGB888,
- Format_RGB444,
- Format_ARGB4444_Premultiplied,
-#if 0
- // reserved for future use
- Format_RGB15,
- Format_Grayscale16,
- Format_Grayscale8,
- Format_Grayscale4,
- Format_Grayscale4LSB,
- Format_Grayscale2,
- Format_Grayscale2LSB
-#endif
NImageFormats
};
case QImage::Format_ARGB32:
case QImage::Format_ARGB32_Premultiplied:
return 32;
- case QImage::Format_RGB555:
case QImage::Format_RGB16:
- case QImage::Format_RGB444:
- case QImage::Format_ARGB4444_Premultiplied:
return 16;
- case QImage::Format_RGB666:
- case QImage::Format_ARGB6666_Premultiplied:
- case QImage::Format_ARGB8565_Premultiplied:
- case QImage::Format_ARGB8555_Premultiplied:
- case QImage::Format_RGB888:
- return 24;
}
return 0;
}
QImage::Format opaqueFormat = QImage::systemFormat();
QImage::Format alphaFormat = QImage::Format_ARGB32_Premultiplied;
- // We don't care about the others...
- if (opaqueFormat == QImage::Format_RGB16) {
- alphaFormat = QImage::Format_ARGB8565_Premultiplied;
- }
-
if (!sourceImage.hasAlphaChannel()) {
format = opaqueFormat;
} else if ((flags & Qt::NoOpaqueDetection) == 0
void QRasterPixmapData::fill(const QColor &color)
{
if (color.alpha() != 255 && !image.hasAlphaChannel()) {
- switch (image.format()) {
- case QImage::Format_RGB666: {
- image = image.convertToFormat(QImage::Format_ARGB6666_Premultiplied);
- break;
- }
- case QImage::Format_RGB444: {
- image = image.convertToFormat(QImage::Format_ARGB4444_Premultiplied);
- break;
- }
- default: {
- image = image.convertToFormat(QImage::Format_ARGB32_Premultiplied);
- break;
- }
- }
+ image = image.convertToFormat(QImage::Format_ARGB32_Premultiplied);
}
image.fill(color);
}
return dest;
- } else if (source.format() == QImage::Format_ARGB8565_Premultiplied) {
- QImage dest(source.width() / 2, source.height() / 2, srcImage.format());
-
- const uchar *src = srcImage.constBits();
- int sx = srcImage.bytesPerLine();
- int sx2 = sx << 1;
-
- uchar *dst = dest.bits();
- int dx = dest.bytesPerLine();
- int ww = dest.width();
- int hh = dest.height();
-
- for (int y = hh; y; --y, dst += dx, src += sx2) {
- const uchar *p1 = src;
- const uchar *p2 = src + sx;
- uchar *q = dst;
- for (int x = ww; x; --x, q += 3, p1 += 6, p2 += 6) {
- // alpha
- q[0] = AVG(AVG(p1[0], p1[3]), AVG(p2[0], p2[3]));
- // rgb
- const quint16 p16_1 = (p1[2] << 8) | p1[1];
- const quint16 p16_2 = (p1[5] << 8) | p1[4];
- const quint16 p16_3 = (p2[2] << 8) | p2[1];
- const quint16 p16_4 = (p2[5] << 8) | p2[4];
- const quint16 result = AVG16(AVG16(p16_1, p16_2), AVG16(p16_3, p16_4));
- q[1] = result & 0xff;
- q[2] = result >> 8;
- }
- }
-
- return dest;
} else if (source.format() != QImage::Format_ARGB32_Premultiplied
- && source.format() != QImage::Format_RGB32)
- {
+ && source.format() != QImage::Format_RGB32) {
srcImage = source.convertToFormat(QImage::Format_ARGB32_Premultiplied);
}
// Qt==ARGB==Big(ARGB)==Little(BGRA). But RGB888 is RGB regardless
#if Q_BYTE_ORDER == Q_LITTLE_ENDIAN
- if (image.format() != QImage::Format_RGB888) {
- png_set_bgr(png_ptr);
- }
+ png_set_bgr(png_ptr);
#endif
QPoint offset = image.offset();
if (image.depth() != 1)
png_set_packing(png_ptr);
- if (color_type == PNG_COLOR_TYPE_RGB && image.format() != QImage::Format_RGB888)
+ if (color_type == PNG_COLOR_TYPE_RGB)
png_set_filler(png_ptr, 0, QFILLER_ORDER);
int height = image.height();
case QImage::Format_Indexed8:
case QImage::Format_RGB32:
case QImage::Format_ARGB32:
- case QImage::Format_RGB888:
{
png_bytep* row_pointers = new png_bytep[height];
for (int y=0; y<height; y++)
image = image.convertToFormat(QImage::Format_Mono);
} else if (image.depth() == 1) {
image = image.convertToFormat(QImage::Format_Indexed8);
- } else {
- switch (image.format()) {
- case QImage::Format_RGB16:
- case QImage::Format_RGB666:
- case QImage::Format_RGB555:
- case QImage::Format_RGB888:
- case QImage::Format_RGB444:
- image = image.convertToFormat(QImage::Format_RGB32);
- break;
- case QImage::Format_ARGB8565_Premultiplied:
- case QImage::Format_ARGB6666_Premultiplied:
- case QImage::Format_ARGB8555_Premultiplied:
- case QImage::Format_ARGB4444_Premultiplied:
- image = image.convertToFormat(QImage::Format_ARGB32);
- break;
- default:
- break;
- }
+ } else if (image.format() == QImage::Format_RGB16) {
+ image = image.convertToFormat(QImage::Format_RGB32);
}
if (image.depth() == 1 && image.colorCount() == 2) {
| ((((c) << 8) & 0xf80000) | (((c) << 3) & 0x70000));
}
-static inline void interpolate_pixel(qrgb565 &dest, quint8 a, const qrgb565 &src, quint8 b)
-{
- const quint16 x = dest.rawValue();
- const quint16 y = src.rawValue();
- quint16 t = (((x & 0x07e0) * a + (y & 0x07e0) * b) >> 5) & 0x07e0;
- t |= (((x & 0xf81f) * a + (y & 0xf81f) * b) >> 5) & 0xf81f;
- dest = t;
-}
-
/*
Destination fetch. This is simple as we don't have to do bounds checks or
transformations
destFetchARGB32, // Format_ARGB32,
destFetchARGB32P, // Format_ARGB32_Premultiplied
destFetchRGB16, // Format_RGB16
- destFetch<qargb8565>, // Format_ARGB8565_Premultiplied
- destFetch<qrgb666>, // Format_RGB666
- destFetch<qargb6666>, // Format_ARGB6666_Premultiplied
- destFetch<qrgb555>, // Format_RGB555
- destFetch<qargb8555>, // Format_ARGB8555_Premultiplied
- destFetch<qrgb888>, // Format_RGB888
- destFetch<qrgb444>, // Format_RGB444
- destFetch<qargb4444> // Format_ARGB4444_Premultiplied
};
/*
destStoreARGB32, // Format_ARGB32,
0, // Format_ARGB32_Premultiplied
destStoreRGB16, // Format_RGB16
- destStore<qargb8565>, // Format_ARGB8565_Premultiplied
- destStore<qrgb666>, // Format_RGB666
- destStore<qargb6666>, // Format_ARGB6666_Premultiplied
- destStore<qrgb555>, // Format_RGB555
- destStore<qargb8555>, // Format_ARGB8555_Premultiplied
- destStore<qrgb888>, // Format_RGB888
- destStore<qrgb444>, // Format_RGB444
- destStore<qargb4444> // Format_ARGB4444_Premultiplied
};
/*
}
template<>
-uint QT_FASTCALL qt_fetchPixel<QImage::Format_ARGB8565_Premultiplied>(const uchar *scanLine,
- int x,
- const QVector<QRgb> *)
-{
- const qargb8565 color = reinterpret_cast<const qargb8565*>(scanLine)[x];
- return qt_colorConvert<quint32, qargb8565>(color, 0);
-}
-
-template<>
-uint QT_FASTCALL qt_fetchPixel<QImage::Format_RGB666>(const uchar *scanLine,
- int x,
- const QVector<QRgb> *)
-{
- const qrgb666 color = reinterpret_cast<const qrgb666*>(scanLine)[x];
- return qt_colorConvert<quint32, qrgb666>(color, 0);
-}
-
-template<>
-uint QT_FASTCALL qt_fetchPixel<QImage::Format_ARGB6666_Premultiplied>(const uchar *scanLine,
- int x,
- const QVector<QRgb> *)
-{
- const qargb6666 color = reinterpret_cast<const qargb6666*>(scanLine)[x];
- return qt_colorConvert<quint32, qargb6666>(color, 0);
-}
-
-template<>
-uint QT_FASTCALL qt_fetchPixel<QImage::Format_RGB555>(const uchar *scanLine,
- int x,
- const QVector<QRgb> *)
-{
- const qrgb555 color = reinterpret_cast<const qrgb555*>(scanLine)[x];
- return qt_colorConvert<quint32, qrgb555>(color, 0);
-}
-
-template<>
-uint QT_FASTCALL qt_fetchPixel<QImage::Format_ARGB8555_Premultiplied>(const uchar *scanLine,
- int x,
- const QVector<QRgb> *)
-{
- const qargb8555 color = reinterpret_cast<const qargb8555*>(scanLine)[x];
- return qt_colorConvert<quint32, qargb8555>(color, 0);
-}
-
-template<>
-uint QT_FASTCALL qt_fetchPixel<QImage::Format_RGB888>(const uchar *scanLine,
- int x,
- const QVector<QRgb> *)
-{
- const qrgb888 color = reinterpret_cast<const qrgb888*>(scanLine)[x];
- return qt_colorConvert<quint32, qrgb888>(color, 0);
-}
-
-template<>
-uint QT_FASTCALL qt_fetchPixel<QImage::Format_RGB444>(const uchar *scanLine,
- int x,
- const QVector<QRgb> *)
-{
- const qrgb444 color = reinterpret_cast<const qrgb444*>(scanLine)[x];
- return qt_colorConvert<quint32, qrgb444>(color, 0);
-}
-
-template<>
-uint QT_FASTCALL qt_fetchPixel<QImage::Format_ARGB4444_Premultiplied>(const uchar *scanLine,
- int x,
- const QVector<QRgb> *)
-{
- const qargb4444 color = reinterpret_cast<const qargb4444*>(scanLine)[x];
- return qt_colorConvert<quint32, qargb4444>(color, 0);
-}
-
-template<>
uint QT_FASTCALL qt_fetchPixel<QImage::Format_Invalid>(const uchar *,
int ,
const QVector<QRgb> *)
qt_fetchPixel<QImage::Format_ARGB32_Premultiplied>,
qt_fetchPixel<QImage::Format_ARGB32>,
qt_fetchPixel<QImage::Format_ARGB32_Premultiplied>,
- qt_fetchPixel<QImage::Format_RGB16>,
- qt_fetchPixel<QImage::Format_ARGB8565_Premultiplied>,
- qt_fetchPixel<QImage::Format_RGB666>,
- qt_fetchPixel<QImage::Format_ARGB6666_Premultiplied>,
- qt_fetchPixel<QImage::Format_RGB555>,
- qt_fetchPixel<QImage::Format_ARGB8555_Premultiplied>,
- qt_fetchPixel<QImage::Format_RGB888>,
- qt_fetchPixel<QImage::Format_RGB444>,
- qt_fetchPixel<QImage::Format_ARGB4444_Premultiplied>
+ qt_fetchPixel<QImage::Format_RGB16>
};
enum TextureBlendType {
qt_fetchUntransformed<QImage::Format_ARGB32_Premultiplied>, // RGB32
qt_fetchUntransformed<QImage::Format_ARGB32>, // ARGB32
qt_fetchUntransformed<QImage::Format_ARGB32_Premultiplied>, // ARGB32_Premultiplied
- qt_fetchUntransformed<QImage::Format_RGB16>, // RGB16
- qt_fetchUntransformed<QImage::Format_ARGB8565_Premultiplied>,// ARGB8565_Premultiplied
- qt_fetchUntransformed<QImage::Format_RGB666>, // RGB666
- qt_fetchUntransformed<QImage::Format_ARGB6666_Premultiplied>,// ARGB6666_Premultiplied
- qt_fetchUntransformed<QImage::Format_RGB555>, // RGB555
- qt_fetchUntransformed<QImage::Format_ARGB8555_Premultiplied>,// ARGB8555_Premultiplied
- qt_fetchUntransformed<QImage::Format_RGB888>, // RGB888
- qt_fetchUntransformed<QImage::Format_RGB444>, // RGB444
- qt_fetchUntransformed<QImage::Format_ARGB4444_Premultiplied> // ARGB4444_Premultiplied
+ qt_fetchUntransformed<QImage::Format_RGB16> // RGB16
},
// Tiled
{
qt_fetchUntransformed<QImage::Format_ARGB32_Premultiplied>, // RGB32
qt_fetchUntransformed<QImage::Format_ARGB32>, // ARGB32
qt_fetchUntransformed<QImage::Format_ARGB32_Premultiplied>, // ARGB32_Premultiplied
- qt_fetchUntransformed<QImage::Format_RGB16>, // RGB16
- qt_fetchUntransformed<QImage::Format_ARGB8565_Premultiplied>,// ARGB8565_Premultiplied
- qt_fetchUntransformed<QImage::Format_RGB666>, // RGB666
- qt_fetchUntransformed<QImage::Format_ARGB6666_Premultiplied>,// ARGB6666_Premultiplied
- qt_fetchUntransformed<QImage::Format_RGB555>, // RGB555
- qt_fetchUntransformed<QImage::Format_ARGB8555_Premultiplied>,// ARGB8555_Premultiplied
- qt_fetchUntransformed<QImage::Format_RGB888>, // RGB888
- qt_fetchUntransformed<QImage::Format_RGB444>, // RGB444
- qt_fetchUntransformed<QImage::Format_ARGB4444_Premultiplied> // ARGB4444_Premultiplied
+ qt_fetchUntransformed<QImage::Format_RGB16> // RGB16
},
// Transformed
{
fetchTransformed<BlendTransformed>, // RGB32
fetchTransformed<BlendTransformed>, // ARGB32
fetchTransformed<BlendTransformed>, // ARGB32_Premultiplied
- fetchTransformed<BlendTransformed>, // RGB16
- fetchTransformed<BlendTransformed>, // ARGB8565_Premultiplied
- fetchTransformed<BlendTransformed>, // RGB666
- fetchTransformed<BlendTransformed>, // ARGB6666_Premultiplied
- fetchTransformed<BlendTransformed>, // RGB555
- fetchTransformed<BlendTransformed>, // ARGB8555_Premultiplied
- fetchTransformed<BlendTransformed>, // RGB888
- fetchTransformed<BlendTransformed>, // RGB444
- fetchTransformed<BlendTransformed>, // ARGB4444_Premultiplied
+ fetchTransformed<BlendTransformed> // RGB16
},
{
0, // TransformedTiled
fetchTransformed<BlendTransformedTiled>, // RGB32
fetchTransformed<BlendTransformedTiled>, // ARGB32
fetchTransformed<BlendTransformedTiled>, // ARGB32_Premultiplied
- fetchTransformed<BlendTransformedTiled>, // RGB16
- fetchTransformed<BlendTransformedTiled>, // ARGB8565_Premultiplied
- fetchTransformed<BlendTransformedTiled>, // RGB666
- fetchTransformed<BlendTransformedTiled>, // ARGB6666_Premultiplied
- fetchTransformed<BlendTransformedTiled>, // RGB555
- fetchTransformed<BlendTransformedTiled>, // ARGB8555_Premultiplied
- fetchTransformed<BlendTransformedTiled>, // RGB888
- fetchTransformed<BlendTransformedTiled>, // RGB444
- fetchTransformed<BlendTransformedTiled>, // ARGB4444_Premultiplied
+ fetchTransformed<BlendTransformedTiled> // RGB16
},
{
0, // Bilinear
fetchTransformedBilinear<BlendTransformedBilinear, QImage::Format_ARGB32>, // ARGB32
fetchTransformedBilinear<BlendTransformedBilinear, QImage::Format_ARGB32_Premultiplied>, // ARGB32_Premultiplied
fetchTransformedBilinear<BlendTransformedBilinear, QImage::Format_Invalid>, // RGB16
- fetchTransformedBilinear<BlendTransformedBilinear, QImage::Format_Invalid>, // ARGB8565_Premultiplied
- fetchTransformedBilinear<BlendTransformedBilinear, QImage::Format_Invalid>, // RGB666
- fetchTransformedBilinear<BlendTransformedBilinear, QImage::Format_Invalid>, // ARGB6666_Premultiplied
- fetchTransformedBilinear<BlendTransformedBilinear, QImage::Format_Invalid>, // RGB555
- fetchTransformedBilinear<BlendTransformedBilinear, QImage::Format_Invalid>, // ARGB8555_Premultiplied
- fetchTransformedBilinear<BlendTransformedBilinear, QImage::Format_Invalid>, // RGB888
- fetchTransformedBilinear<BlendTransformedBilinear, QImage::Format_Invalid>, // RGB444
- fetchTransformedBilinear<BlendTransformedBilinear, QImage::Format_Invalid> // ARGB4444_Premultiplied
},
{
0, // BilinearTiled
fetchTransformedBilinear<BlendTransformedBilinearTiled, QImage::Format_ARGB32_Premultiplied>, // RGB32
fetchTransformedBilinear<BlendTransformedBilinearTiled, QImage::Format_ARGB32>, // ARGB32
fetchTransformedBilinear<BlendTransformedBilinearTiled, QImage::Format_ARGB32_Premultiplied>, // ARGB32_Premultiplied
- fetchTransformedBilinear<BlendTransformedBilinearTiled, QImage::Format_Invalid>, // RGB16
- fetchTransformedBilinear<BlendTransformedBilinearTiled, QImage::Format_Invalid>, // ARGB8565_Premultiplied
- fetchTransformedBilinear<BlendTransformedBilinearTiled, QImage::Format_Invalid>, // RGB666
- fetchTransformedBilinear<BlendTransformedBilinearTiled, QImage::Format_Invalid>, // ARGB6666_Premultiplied
- fetchTransformedBilinear<BlendTransformedBilinearTiled, QImage::Format_Invalid>, // RGB555
- fetchTransformedBilinear<BlendTransformedBilinearTiled, QImage::Format_Invalid>, // ARGB8555_Premultiplied
- fetchTransformedBilinear<BlendTransformedBilinearTiled, QImage::Format_Invalid>, // RGB888
- fetchTransformedBilinear<BlendTransformedBilinearTiled, QImage::Format_Invalid>, // RGB444
- fetchTransformedBilinear<BlendTransformedBilinearTiled, QImage::Format_Invalid> // ARGB4444_Premultiplied
+ fetchTransformedBilinear<BlendTransformedBilinearTiled, QImage::Format_Invalid> // RGB16
},
};
}
}
-static void blend_color_argb(int count, const QSpan *spans, void *userData)
-{
- QSpanData *data = reinterpret_cast<QSpanData *>(userData);
-
- Operator op = getOperator(data, spans, count);
-
- while (count--) {
- uint *target = ((uint *)data->rasterBuffer->scanLine(spans->y)) + spans->x;
- op.funcSolid(target, spans->len, data->solid.color, spans->coverage);
- ++spans;
- }
-}
-
static void blend_src_generic(int count, const QSpan *spans, void *userData)
{
QSpanData *data = reinterpret_cast<QSpanData *>(userData);
}
}
-static void blend_untransformed_argb(int count, const QSpan *spans, void *userData)
-{
- QSpanData *data = reinterpret_cast<QSpanData *>(userData);
- Operator op = getOperator(data, spans, count);
-
- const int image_width = data->texture.width;
- const int image_height = data->texture.height;
- int xoff = -qRound(-data->dx);
- int yoff = -qRound(-data->dy);
-
- while (count--) {
- int x = spans->x;
- int length = spans->len;
- int sx = xoff + x;
- int sy = yoff + spans->y;
- if (sy >= 0 && sy < image_height && sx < image_width) {
- if (sx < 0) {
- x -= sx;
- length += sx;
- sx = 0;
- }
- if (sx + length > image_width)
- length = image_width - sx;
- if (length > 0) {
- const int coverage = (spans->coverage * data->texture.const_alpha) >> 8;
- const uint *src = (const uint *)data->texture.scanLine(sy) + sx;
- uint *dest = ((uint *)data->rasterBuffer->scanLine(spans->y)) + x;
- op.func(dest, src, length, coverage);
- }
- }
- ++spans;
- }
-}
-
-static void QT_FASTCALL blendUntransformed(qrgb565 *dest, const qrgb565 *src,
- quint8 coverage, int length)
-{
- Q_ASSERT(coverage > 0 && coverage < 255);
-
- const quint8 alpha = qrgb565::alpha(coverage);
- if (alpha) {
- const quint8 ialpha = qrgb565::ialpha(coverage);
- for (int i = 0; i < length; ++i)
- interpolate_pixel(dest[i], ialpha, src[i], alpha);
- }
-}
-
-static void blend_untransformed_rgb565(int count, const QSpan *spans,
- void *userData)
-{
- QSpanData *data = reinterpret_cast<QSpanData*>(userData);
- QPainter::CompositionMode mode = data->rasterBuffer->compositionMode;
-
- if (mode != QPainter::CompositionMode_SourceOver &&
- mode != QPainter::CompositionMode_Source)
- {
- blend_src_generic(count, spans, userData);
- return;
- }
-
- const int image_width = data->texture.width;
- const int image_height = data->texture.height;
- int xoff = -qRound(-data->dx);
- int yoff = -qRound(-data->dy);
-
- while (count--) {
- const quint8 coverage = (data->texture.const_alpha * spans->coverage) >> 8;
- if (coverage == 0) {
- ++spans;
- continue;
- }
-
- int x = spans->x;
- int length = spans->len;
- int sx = xoff + x;
- int sy = yoff + spans->y;
- if (sy >= 0 && sy < image_height && sx < image_width) {
- if (sx < 0) {
- x -= sx;
- length += sx;
- sx = 0;
- }
- if (sx + length > image_width)
- length = image_width - sx;
- if (length > 0) {
- qrgb565 *dest = ((qrgb565*)data->rasterBuffer->scanLine(spans->y)) + x;
- const qrgb565 *src = (const qrgb565*)data->texture.scanLine(sy) + sx;
- if (coverage == 255) {
- qt_memconvert<qrgb565, qrgb565>(dest, src, length);
- } else {
- blendUntransformed(dest, src, coverage, length);
- }
- }
- }
- ++spans;
- }
-}
-
static void blend_tiled_generic(int count, const QSpan *spans, void *userData)
{
QSpanData *data = reinterpret_cast<QSpanData *>(userData);
}
}
-static void blend_tiled_argb(int count, const QSpan *spans, void *userData)
-{
- QSpanData *data = reinterpret_cast<QSpanData *>(userData);
- Operator op = getOperator(data, spans, count);
-
- int image_width = data->texture.width;
- int image_height = data->texture.height;
- int xoff = -qRound(-data->dx) % image_width;
- int yoff = -qRound(-data->dy) % image_height;
-
- if (xoff < 0)
- xoff += image_width;
- if (yoff < 0)
- yoff += image_height;
-
- while (count--) {
- int x = spans->x;
- int length = spans->len;
- int sx = (xoff + spans->x) % image_width;
- int sy = (spans->y + yoff) % image_height;
- if (sx < 0)
- sx += image_width;
- if (sy < 0)
- sy += image_height;
-
- const int coverage = (spans->coverage * data->texture.const_alpha) >> 8;
- while (length) {
- int l = qMin(image_width - sx, length);
- if (buffer_size < l)
- l = buffer_size;
- const uint *src = (const uint *)data->texture.scanLine(sy) + sx;
- uint *dest = ((uint *)data->rasterBuffer->scanLine(spans->y)) + x;
- op.func(dest, src, l, coverage);
- x += l;
- length -= l;
- sx = 0;
- }
- ++spans;
- }
-}
-
-static void blend_tiled_rgb565(int count, const QSpan *spans, void *userData)
-{
- QSpanData *data = reinterpret_cast<QSpanData*>(userData);
- QPainter::CompositionMode mode = data->rasterBuffer->compositionMode;
-
- if (mode != QPainter::CompositionMode_SourceOver &&
- mode != QPainter::CompositionMode_Source)
- {
- blend_src_generic(count, spans, userData);
- return;
- }
-
- const int image_width = data->texture.width;
- const int image_height = data->texture.height;
- int xoff = -qRound(-data->dx) % image_width;
- int yoff = -qRound(-data->dy) % image_height;
-
- if (xoff < 0)
- xoff += image_width;
- if (yoff < 0)
- yoff += image_height;
-
- while (count--) {
- const quint8 coverage = (data->texture.const_alpha * spans->coverage) >> 8;
- if (coverage == 0) {
- ++spans;
- continue;
- }
-
- int x = spans->x;
- int length = spans->len;
- int sx = (xoff + spans->x) % image_width;
- int sy = (spans->y + yoff) % image_height;
- if (sx < 0)
- sx += image_width;
- if (sy < 0)
- sy += image_height;
-
- if (coverage == 255) {
- // Copy the first texture block
- length = qMin(image_width,length);
- int tx = x;
- while (length) {
- int l = qMin(image_width - sx, length);
- if (buffer_size < l)
- l = buffer_size;
- qrgb565 *dest = ((qrgb565*)data->rasterBuffer->scanLine(spans->y)) + tx;
- const qrgb565 *src = (const qrgb565*)data->texture.scanLine(sy) + sx;
-
- qt_memconvert<qrgb565, qrgb565>(dest, src, l);
- length -= l;
- tx += l;
- sx = 0;
- }
-
- // Now use the rasterBuffer as the source of the texture,
- // We can now progressively copy larger blocks
- // - Less cpu time in code figuring out what to copy
- // We are dealing with one block of data
- // - More likely to fit in the cache
- // - can use memcpy
- int copy_image_width = qMin(image_width, int(spans->len));
- length = spans->len - copy_image_width;
- qrgb565 *src = ((qrgb565*)data->rasterBuffer->scanLine(spans->y)) + x;
- qrgb565 *dest = src + copy_image_width;
- while (copy_image_width < length) {
- qt_memconvert(dest, src, copy_image_width);
- dest += copy_image_width;
- length -= copy_image_width;
- copy_image_width *= 2;
- }
- if (length > 0)
- qt_memconvert(dest, src, length);
- } else {
- while (length) {
- int l = qMin(image_width - sx, length);
- if (buffer_size < l)
- l = buffer_size;
- qrgb565 *dest = ((qrgb565*)data->rasterBuffer->scanLine(spans->y)) + x;
- const qrgb565 *src = (const qrgb565*)data->texture.scanLine(sy) + sx;
- blendUntransformed(dest, src, coverage, l);
-
- x += l;
- length -= l;
- sx = 0;
- }
- }
- ++spans;
- }
-}
-
-static void blend_transformed_bilinear_rgb565(int count, const QSpan *spans,
- void *userData)
-{
- QSpanData *data = reinterpret_cast<QSpanData*>(userData);
- QPainter::CompositionMode mode = data->rasterBuffer->compositionMode;
-
-
- if (mode != QPainter::CompositionMode_SourceOver) {
- blend_src_generic(count, spans, userData);
- return;
- }
-
- qrgb565 buffer[buffer_size];
-
- const int src_minx = data->texture.x1;
- const int src_miny = data->texture.y1;
- const int src_maxx = data->texture.x2 - 1;
- const int src_maxy = data->texture.y2 - 1;
- const qreal fdx = data->m11;
- const qreal fdy = data->m12;
- const qreal fdw = data->m13;
-
- while (count--) {
- const quint8 coverage = (data->texture.const_alpha * spans->coverage) >> 8;
- if (coverage == 0) {
- ++spans;
- continue;
- }
-
- qrgb565 *dest = (qrgb565*)data->rasterBuffer->scanLine(spans->y)
- + spans->x;
-
- const qreal cx = spans->x + qreal(0.5);
- const qreal cy = spans->y + qreal(0.5);
-
- qreal x = data->m21 * cy + data->m11 * cx + data->dx;
- qreal y = data->m22 * cy + data->m12 * cx + data->dy;
- qreal w = data->m23 * cy + data->m13 * cx + data->m33;
-
- int length = spans->len;
- while (length) {
- const int l = qMin(length, buffer_size);
- const qrgb565 *end = buffer + l;
- qrgb565 *b = buffer;
- while (b < end) {
- const qreal iw = w == 0 ? 1 : 1 / w;
- const qreal px = x * iw - qreal(0.5);
- const qreal py = y * iw - qreal(0.5);
-
- int x1 = int(px) - (px < 0);
- int x2;
- int y1 = int(py) - (py < 0);
- int y2;
-
- const int distx = int((px - x1) * 256);
- const int disty = int((py - y1) * 256);
-
- if (x1 < src_minx) {
- x2 = x1 = src_minx;
- } else if (x1 >= src_maxx) {
- x2 = x1 = src_maxx;
- } else {
- x2 = x1 + 1;
- }
- if (y1 < src_miny) {
- y2 = y1 = src_miny;
- } else if (y1 >= src_maxy) {
- y2 = y1 = src_maxy;
- } else {
- y2 = y1 + 1;
- }
-
- const qrgb565 *src1 = (const qrgb565*)data->texture.scanLine(y1);
- const qrgb565 *src2 = (const qrgb565*)data->texture.scanLine(y2);
- qrgb565 tl = src1[x1];
- const qrgb565 tr = src1[x2];
- qrgb565 bl = src2[x1];
- const qrgb565 br = src2[x2];
- const quint8 ax = qrgb565::alpha(distx);
- const quint8 iax = qrgb565::ialpha(distx);
-
- interpolate_pixel(tl, iax, tr, ax);
- interpolate_pixel(bl, iax, br, ax);
- interpolate_pixel(tl, qrgb565::ialpha(disty),
- bl, qrgb565::alpha(disty));
- *b = tl;
- ++b;
-
- x += fdx;
- y += fdy;
- w += fdw;
- }
- if (coverage == 255) {
- qt_memconvert(dest, buffer, l);
- } else {
- blendUntransformed(dest, buffer, coverage, l);
- }
-
- dest += l;
- length -= l;
- }
- ++spans;
- }
-}
-
-static void blend_transformed_argb(int count, const QSpan *spans, void *userData)
-{
- QSpanData *data = reinterpret_cast<QSpanData *>(userData);
- CompositionFunction func = functionForMode[data->rasterBuffer->compositionMode];
- uint buffer[buffer_size];
-
- int image_width = data->texture.width;
- int image_height = data->texture.height;
- const int scanline_offset = data->texture.bytesPerLine / 4;
- const qreal fdx = data->m11;
- const qreal fdy = data->m12;
- const qreal fdw = data->m13;
-
- while (count--) {
- void *t = data->rasterBuffer->scanLine(spans->y);
-
- uint *target = ((uint *)t) + spans->x;
- uint *image_bits = (uint *)data->texture.imageData;
-
- const qreal cx = spans->x + qreal(0.5);
- const qreal cy = spans->y + qreal(0.5);
-
- qreal x = data->m21 * cy + data->m11 * cx + data->dx;
- qreal y = data->m22 * cy + data->m12 * cx + data->dy;
- qreal w = data->m23 * cy + data->m13 * cx + data->m33;
-
- int length = spans->len;
- const int coverage = (spans->coverage * data->texture.const_alpha) >> 8;
- while (length) {
- int l = qMin(length, buffer_size);
- const uint *end = buffer + l;
- uint *b = buffer;
- while (b < end) {
- const qreal iw = w == 0 ? 1 : 1 / w;
- const qreal tx = x * iw;
- const qreal ty = y * iw;
- const int px = int(tx) - (tx < 0);
- const int py = int(ty) - (ty < 0);
-
- bool out = (px < 0) || (px >= image_width)
- || (py < 0) || (py >= image_height);
-
- int y_offset = py * scanline_offset;
- *b = out ? uint(0) : image_bits[y_offset + px];
- x += fdx;
- y += fdy;
- w += fdw;
-
- ++b;
- }
- func(target, buffer, l, coverage);
- target += l;
- length -= l;
- }
- ++spans;
- }
-}
-
-static void blend_transformed_rgb565(int count, const QSpan *spans,
- void *userData)
-{
- QSpanData *data = reinterpret_cast<QSpanData*>(userData);
- QPainter::CompositionMode mode = data->rasterBuffer->compositionMode;
-
- if (mode != QPainter::CompositionMode_SourceOver) {
- blend_src_generic(count, spans, userData);
- return;
- }
-
- qrgb565 buffer[buffer_size];
- const int image_width = data->texture.width;
- const int image_height = data->texture.height;
- const qreal fdx = data->m11;
- const qreal fdy = data->m12;
- const qreal fdw = data->m13;
-
- while (count--) {
- const quint8 coverage = (data->texture.const_alpha * spans->coverage) >> 8;
- if (coverage == 0) {
- ++spans;
- continue;
- }
-
- qrgb565 *dest = (qrgb565*)data->rasterBuffer->scanLine(spans->y)
- + spans->x;
-
- const qreal cx = spans->x + qreal(0.5);
- const qreal cy = spans->y + qreal(0.5);
-
- qreal x = data->m21 * cy + data->m11 * cx + data->dx;
- qreal y = data->m22 * cy + data->m12 * cx + data->dy;
- qreal w = data->m23 * cy + data->m13 * cx + data->m33;
-
- int length = spans->len;
- while (length) {
- const int l = qMin(length, buffer_size);
- const qrgb565 *end = buffer + l;
- qrgb565 *b = buffer;
- while (b < end) {
- const qreal iw = w == 0 ? 1 : 1 / w;
- const qreal tx = x * iw;
- const qreal ty = y * iw;
-
- const int px = int(tx) - (tx < 0);
- const int py = int(ty) - (ty < 0);
-
- if ((px < 0) || (px >= image_width) ||
- (py < 0) || (py >= image_height))
- {
- *b = 0;
- } else {
- *b = ((const qrgb565*)data->texture.scanLine(py))[px];
- }
- ++b;
-
- x += fdx;
- y += fdy;
- w += fdw;
- }
- if (coverage == 255) {
- qt_memconvert(dest, buffer, l);
- } else {
- blendUntransformed(dest, buffer, coverage, l);
- }
-
- dest += l;
- length -= l;
- }
- ++spans;
- }
-}
-
-static void blend_transformed_tiled_argb(int count, const QSpan *spans, void *userData)
-{
- QSpanData *data = reinterpret_cast<QSpanData *>(userData);
- CompositionFunction func = functionForMode[data->rasterBuffer->compositionMode];
- uint buffer[buffer_size];
-
- int image_width = data->texture.width;
- int image_height = data->texture.height;
- const int scanline_offset = data->texture.bytesPerLine / 4;
- const qreal fdx = data->m11;
- const qreal fdy = data->m12;
- const qreal fdw = data->m13;
-
- while (count--) {
- void *t = data->rasterBuffer->scanLine(spans->y);
-
- uint *target = ((uint *)t) + spans->x;
- uint *image_bits = (uint *)data->texture.imageData;
-
- const qreal cx = spans->x + qreal(0.5);
- const qreal cy = spans->y + qreal(0.5);
-
- qreal x = data->m21 * cy + data->m11 * cx + data->dx;
- qreal y = data->m22 * cy + data->m12 * cx + data->dy;
- qreal w = data->m23 * cy + data->m13 * cx + data->m33;
-
- const int coverage = (spans->coverage * data->texture.const_alpha) >> 8;
- int length = spans->len;
- while (length) {
- int l = qMin(length, buffer_size);
- const uint *end = buffer + l;
- uint *b = buffer;
- while (b < end) {
- const qreal iw = w == 0 ? 1 : 1 / w;
- const qreal tx = x * iw;
- const qreal ty = y * iw;
- int px = int(tx) - (tx < 0);
- int py = int(ty) - (ty < 0);
-
- px %= image_width;
- py %= image_height;
- if (px < 0) px += image_width;
- if (py < 0) py += image_height;
- int y_offset = py * scanline_offset;
-
- Q_ASSERT(px >= 0 && px < image_width);
- Q_ASSERT(py >= 0 && py < image_height);
-
- *b = image_bits[y_offset + px];
- x += fdx;
- y += fdy;
- w += fdw;
- //force increment to avoid /0
- if (!w) {
- w += fdw;
- }
- ++b;
- }
- func(target, buffer, l, coverage);
- target += l;
- length -= l;
- }
- ++spans;
- }
-}
-
-static void blend_transformed_tiled_rgb565(int count, const QSpan *spans,
- void *userData)
-{
- QSpanData *data = reinterpret_cast<QSpanData*>(userData);
- QPainter::CompositionMode mode = data->rasterBuffer->compositionMode;
-
- if (mode != QPainter::CompositionMode_SourceOver) {
- blend_src_generic(count, spans, userData);
- return;
- }
-
- qrgb565 buffer[buffer_size];
- const int image_width = data->texture.width;
- const int image_height = data->texture.height;
- const qreal fdx = data->m11;
- const qreal fdy = data->m12;
- const qreal fdw = data->m13;
-
- while (count--) {
- const quint8 coverage = (data->texture.const_alpha * spans->coverage) >> 8;
- if (coverage == 0) {
- ++spans;
- continue;
- }
-
- qrgb565 *dest = (qrgb565*)data->rasterBuffer->scanLine(spans->y)
- + spans->x;
-
- const qreal cx = spans->x + qreal(0.5);
- const qreal cy = spans->y + qreal(0.5);
-
- qreal x = data->m21 * cy + data->m11 * cx + data->dx;
- qreal y = data->m22 * cy + data->m12 * cx + data->dy;
- qreal w = data->m23 * cy + data->m13 * cx + data->m33;
-
- int length = spans->len;
- while (length) {
- const int l = qMin(length, buffer_size);
- const qrgb565 *end = buffer + l;
- qrgb565 *b = buffer;
- while (b < end) {
- const qreal iw = w == 0 ? 1 : 1 / w;
- const qreal tx = x * iw;
- const qreal ty = y * iw;
-
- int px = int(tx) - (tx < 0);
- int py = int(ty) - (ty < 0);
-
- px %= image_width;
- py %= image_height;
- if (px < 0)
- px += image_width;
- if (py < 0)
- py += image_height;
-
- *b = ((const qrgb565*)data->texture.scanLine(py))[px];
- ++b;
-
- x += fdx;
- y += fdy;
- w += fdw;
- // force increment to avoid /0
- if (!w)
- w += fdw;
- }
- if (coverage == 255) {
- qt_memconvert(dest, buffer, l);
- } else {
- blendUntransformed(dest, buffer, coverage, l);
- }
-
- dest += l;
- length -= l;
- }
- ++spans;
- }
-}
-
/* Image formats here are target formats */
static const ProcessSpans processTextureSpans[NBlendTypes][QImage::NImageFormats] = {
// Untransformed
blend_untransformed_generic, // Indexed8
blend_untransformed_generic, // RGB32
blend_untransformed_generic, // ARGB32
- blend_untransformed_argb, // ARGB32_Premultiplied
- blend_untransformed_rgb565, // RGB16
- blend_untransformed_generic, // argb8565
- blend_untransformed_generic, // rgb666
- blend_untransformed_generic, // argb6666
- blend_untransformed_generic, // rgb555
- blend_untransformed_generic, // argb8555
- blend_untransformed_generic, // rgb888
- blend_untransformed_generic, // rgb444
- blend_untransformed_generic // argb4444
+ blend_untransformed_generic, // ARGB32_Premultiplied
+ blend_untransformed_generic // RGB16
},
// Tiled
{
blend_tiled_generic, // Indexed8
blend_tiled_generic, // RGB32
blend_tiled_generic, // ARGB32
- blend_tiled_argb, // ARGB32_Premultiplied
- blend_tiled_rgb565, // RGB16
- blend_tiled_generic, // argb8565
- blend_tiled_generic, // rgb666
- blend_tiled_generic, // argb6666
- blend_tiled_generic, // rgb555
- blend_tiled_generic, // argb8555
- blend_tiled_generic, // rgb888
- blend_tiled_generic, // rgb444
- blend_tiled_generic, // argb4444
+ blend_tiled_generic, // ARGB32_Premultiplied
+ blend_tiled_generic // RGB16
},
// Transformed
{
blend_src_generic, // Indexed8
blend_src_generic, // RGB32
blend_src_generic, // ARGB32
- blend_transformed_argb, // ARGB32_Premultiplied
- blend_transformed_rgb565, // RGB16
- blend_src_generic, // argb8565
- blend_src_generic, // rgb666
- blend_src_generic, // argb6666
- blend_src_generic, // rgb555
- blend_src_generic, // argb8555
- blend_src_generic, // rgb888
- blend_src_generic, // rgb444
- blend_src_generic // argb4444
+ blend_src_generic, // ARGB32_Premultiplied
+ blend_src_generic // RGB16
},
// TransformedTiled
{
blend_src_generic, // Indexed8
blend_src_generic, // RGB32
blend_src_generic, // ARGB32
- blend_transformed_tiled_argb, // ARGB32_Premultiplied
- blend_transformed_tiled_rgb565, // RGB16
- blend_src_generic, // argb8565
- blend_src_generic, // rgb666
- blend_src_generic, // argb6666
- blend_src_generic, // rgb555
- blend_src_generic, // argb8555
- blend_src_generic, // rgb888
- blend_src_generic, // rgb444
- blend_src_generic // argb4444
+ blend_src_generic, // ARGB32_Premultiplied
+ blend_src_generic // RGB16
},
// Bilinear
{
blend_src_generic, // RGB32
blend_src_generic, // ARGB32
blend_src_generic, // ARGB32_Premultiplied
- blend_transformed_bilinear_rgb565, // RGB16
- blend_src_generic, // argb8565
- blend_src_generic, // rgb666
- blend_src_generic, // argb6666
- blend_src_generic, // rgb555
- blend_src_generic, // argb8555
- blend_src_generic, // rgb888
- blend_src_generic, // rgb444
- blend_src_generic, // argb4444
+ blend_src_generic // RGB16
},
// BilinearTiled
{
blend_src_generic, // RGB32
blend_src_generic, // ARGB32
blend_src_generic, // ARGB32_Premultiplied
- blend_src_generic, // RGB16
- blend_src_generic, // ARGB8565_Premultiplied
- blend_src_generic, // RGB666
- blend_src_generic, // ARGB6666_Premultiplied
- blend_src_generic, // RGB555
- blend_src_generic, // ARGB8555_Premultiplied
- blend_src_generic, // RGB888
- blend_src_generic, // RGB444
- blend_src_generic, // ARGB4444_Premultiplied
+ blend_src_generic // RGB16
}
};
QT_RECTFILL(quint32)
QT_RECTFILL(quint16)
-QT_RECTFILL(qargb8565)
-QT_RECTFILL(qrgb666)
-QT_RECTFILL(qargb6666)
-QT_RECTFILL(qrgb555)
-QT_RECTFILL(qargb8555)
-QT_RECTFILL(qrgb888)
-QT_RECTFILL(qrgb444)
-QT_RECTFILL(qargb4444)
#undef QT_RECTFILL
inline static void qt_rectfill_nonpremul_quint32(QRasterBuffer *rasterBuffer,
},
// Format_RGB32,
{
- blend_color_argb,
+ blend_color_generic,
qt_gradient_quint32,
qt_bitmapblit_quint32,
qt_alphamapblit_quint32,
},
// Format_ARGB32_Premultiplied
{
- blend_color_argb,
+ blend_color_generic,
qt_gradient_quint32,
qt_bitmapblit_quint32,
qt_alphamapblit_quint32,
qt_alphamapblit_quint16,
0,
qt_rectfill_quint16
- },
- // Format_ARGB8565_Premultiplied
- {
- blend_color_generic,
- blend_src_generic,
- 0, 0, 0,
- qt_rectfill_qargb8565
- },
- // Format_RGB666
- {
- blend_color_generic,
- blend_src_generic,
- 0, 0, 0,
- qt_rectfill_qrgb666
- },
- // Format_ARGB6666_Premultiplied
- {
- blend_color_generic,
- blend_src_generic,
- 0, 0, 0,
- qt_rectfill_qargb6666
- },
- // Format_RGB555
- {
- blend_color_generic,
- blend_src_generic,
- 0, 0, 0,
- qt_rectfill_qrgb555
- },
- // Format_ARGB8555_Premultiplied
- {
- blend_color_generic,
- blend_src_generic,
- 0, 0, 0,
- qt_rectfill_qargb8555
- },
- // Format_RGB888
- {
- blend_color_generic,
- blend_src_generic,
- 0, 0, 0,
- qt_rectfill_qrgb888
- },
- // Format_RGB444
- {
- blend_color_generic,
- blend_src_generic,
- 0, 0, 0,
- qt_rectfill_qrgb444
- },
- // Format_ARGB4444_Premultiplied
- {
- blend_color_generic,
- blend_src_generic,
- 0, 0, 0,
- qt_rectfill_qargb4444
}
};
quint32 data;
};
-class qrgb565;
-
-class qargb8565
-{
-public:
- static inline bool hasAlpha() { return true; }
-
- inline qargb8565() {}
- inline qargb8565(quint32 v);
- inline explicit qargb8565(quint32p v);
- inline qargb8565(const qargb8565 &v);
- inline qargb8565(const qrgb565 &v);
-
- inline operator quint32() const;
- inline operator quint16() const;
-
- inline qargb8565 operator+(qargb8565 v) const;
- inline bool operator==(const qargb8565 &v) const;
-
- inline quint32 rawValue() const;
-
-private:
- friend class qrgb565;
- quint8 data[3];
-};
-
-class qrgb565
-{
-public:
- static inline bool hasAlpha() { return false; }
-
- qrgb565(int v = 0) : data(v) {}
-
- inline explicit qrgb565(quint32p v);
- inline explicit qrgb565(quint32 v);
- inline explicit qrgb565(const qargb8565 &v);
-
- inline operator quint32() const;
- inline operator quint16() const;
-
- inline qrgb565 operator+(qrgb565 v) const;
-
- static inline quint8 alpha(quint8 a) { return (a + 1) >> 3; }
- static inline quint8 ialpha(quint8 a) { return 0x20 - alpha(a); }
-
- inline bool operator==(const qrgb565 &v) const;
- inline quint16 rawValue() const { return data; }
-
-private:
- friend class qargb8565;
- quint16 data;
-};
-
-qargb8565::qargb8565(quint32 v)
-{
- *this = qargb8565(quint32p(v));
-}
-
-qargb8565::qargb8565(quint32p v)
-{
- data[0] = qAlpha(v);
- const int r = qRed(v);
- const int g = qGreen(v);
- const int b = qBlue(v);
- data[1] = ((g << 3) & 0xe0) | (b >> 3);
- data[2] = (r & 0xf8) | (g >> 5);
-}
-
-qargb8565::qargb8565(const qargb8565 &v)
-{
- data[0] = v.data[0];
- data[1] = v.data[1];
- data[2] = v.data[2];
-}
-
-qargb8565::qargb8565(const qrgb565 &v)
-{
- data[0] = 0xff;
- data[1] = v.data & 0xff;
- data[2] = v.data >> 8;
-}
-
-qargb8565::operator quint32() const
-{
- const quint16 rgb = (data[2] << 8) | data[1];
- const int a = data[0];
- const int r = (rgb & 0xf800);
- const int g = (rgb & 0x07e0);
- const int b = (rgb & 0x001f);
- const int tr = qMin(a, (r >> 8) | (r >> 13));
- const int tg = qMin(a, (g >> 3) | (g >> 9));
- const int tb = qMin(a, (b << 3) | (b >> 2));
- return qRgba(tr, tg, tb, data[0]);
-}
-
-qargb8565::operator quint16() const
-{
- return (data[2] << 8) | data[1];
-}
-
-qargb8565 qargb8565::operator+(qargb8565 v) const
-{
- qargb8565 t;
- t.data[0] = data[0] + v.data[0];
- const quint16 rgb = ((data[2] + v.data[2]) << 8)
- + (data[1] + v.data[1]);
- t.data[1] = rgb & 0xff;
- t.data[2] = rgb >> 8;
- return t;
-}
-
-bool qargb8565::operator==(const qargb8565 &v) const
-{
- return data[0] == v.data[0]
- && data[1] == v.data[1]
- && data[2] == v.data[2];
-}
-
-quint32 qargb8565::rawValue() const
-{
- return (data[2] << 16) | (data[1] << 8) | data[0];
-}
-
-qrgb565::qrgb565(quint32p v)
-{
- *this = qrgb565(quint32(v));
-}
-
-qrgb565::qrgb565(quint32 v)
-{
- const int r = qRed(v) << 8;
- const int g = qGreen(v) << 3;
- const int b = qBlue(v) >> 3;
-
- data = (r & 0xf800) | (g & 0x07e0)| (b & 0x001f);
-}
-
-qrgb565::qrgb565(const qargb8565 &v)
-{
- data = (v.data[2] << 8) | v.data[1];
-}
-
-qrgb565::operator quint32() const
-{
- const int r = (data & 0xf800);
- const int g = (data & 0x07e0);
- const int b = (data & 0x001f);
- const int tr = (r >> 8) | (r >> 13);
- const int tg = (g >> 3) | (g >> 9);
- const int tb = (b << 3) | (b >> 2);
- return qRgb(tr, tg, tb);
-}
-
-qrgb565::operator quint16() const
-{
- return data;
-}
-
-qrgb565 qrgb565::operator+(qrgb565 v) const
-{
- qrgb565 t;
- t.data = data + v.data;
- return t;
-}
-
-bool qrgb565::operator==(const qrgb565 &v) const
-{
- return data == v.data;
-}
-
-class qrgb555;
-
-class qargb8555
-{
-public:
- static inline bool hasAlpha() { return true; }
-
- qargb8555() {}
- inline qargb8555(quint32 v);
- inline explicit qargb8555(quint32p v);
- inline qargb8555(const qargb8555 &v);
- inline qargb8555(const qrgb555 &v);
-
- inline operator quint32() const;
-
- inline qargb8555 operator+(qargb8555 v) const;
-
- inline bool operator==(const qargb8555 &v) const;
-
-private:
- friend class qrgb555;
- quint8 data[3];
-};
-
-class qrgb555
-{
-public:
- static inline bool hasAlpha() { return false; }
-
- inline qrgb555(int v = 0) : data(v) {}
-
- inline explicit qrgb555(quint32p v) { *this = qrgb555(quint32(v)); }
-
- inline explicit qrgb555(quint32 v)
- {
- const int r = qRed(v) << 7;
- const int g = qGreen(v) << 2;
- const int b = qBlue(v) >> 3;
-
- data = (r & 0x7c00) | (g & 0x03e0) | (b & 0x001f);
- }
-
- inline explicit qrgb555(quint16 v)
- {
- data = ((v >> 1) & (0x7c00 | 0x03e0)) |
- (v & 0x001f);
- }
-
- inline explicit qrgb555(const qargb8555 &v);
-
- inline operator quint32() const
- {
- const int r = (data & 0x7c00);
- const int g = (data & 0x03e0);
- const int b = (data & 0x001f);
- const int tr = (r >> 7) | (r >> 12);
- const int tg = (g >> 2) | (g >> 7);
- const int tb = (b << 3) | (b >> 2);
-
- return qRgb(tr, tg, tb);
- }
-
- inline operator quint16() const
- {
- const int r = ((data & 0x7c00) << 1) & 0xf800;
- const int g = (((data & 0x03e0) << 1) | ((data >> 4) & 0x0020)) & 0x07e0;
- const int b = (data & 0x001f);
-
- return r | g | b;
- }
-
- inline qrgb555 operator+(qrgb555 v) const;
-
- inline bool operator==(const qrgb555 &v) const { return v.data == data; }
- inline bool operator!=(const qrgb555 &v) const { return v.data != data; }
-
-private:
- friend class qargb8555;
- quint16 data;
-};
-
-qrgb555::qrgb555(const qargb8555 &v)
-{
- data = (v.data[2] << 8) | v.data[1];
-}
-
-qrgb555 qrgb555::operator+(qrgb555 v) const
-{
- qrgb555 t;
- t.data = data + v.data;
- return t;
-}
-
-qargb8555::qargb8555(quint32 v)
-{
- v = quint32p(v);
- data[0] = qAlpha(v);
- const int r = qRed(v);
- const int g = qGreen(v);
- const int b = qBlue(v);
- data[1] = ((g << 2) & 0xe0) | (b >> 3);
- data[2] = ((r >> 1) & 0x7c) | (g >> 6);
-
-}
-
-qargb8555::qargb8555(quint32p v)
-{
- data[0] = qAlpha(v);
- const int r = qRed(v);
- const int g = qGreen(v);
- const int b = qBlue(v);
- data[1] = ((g << 2) & 0xe0) | (b >> 3);
- data[2] = ((r >> 1) & 0x7c) | (g >> 6);
-}
-
-qargb8555::qargb8555(const qargb8555 &v)
-{
- data[0] = v.data[0];
- data[1] = v.data[1];
- data[2] = v.data[2];
-}
-
-qargb8555::qargb8555(const qrgb555 &v)
-{
- data[0] = 0xff;
- data[1] = v.data & 0xff;
- data[2] = v.data >> 8;
-}
-
-qargb8555::operator quint32() const
-{
- const quint16 rgb = (data[2] << 8) | data[1];
- const int r = (rgb & 0x7c00);
- const int g = (rgb & 0x03e0);
- const int b = (rgb & 0x001f);
- const int tr = (r >> 7) | (r >> 12);
- const int tg = (g >> 2) | (g >> 7);
- const int tb = (b << 3) | (b >> 2);
-
- return qRgba(tr, tg, tb, data[0]);
-}
-
-bool qargb8555::operator==(const qargb8555 &v) const
-{
- return data[0] == v.data[0]
- && data[1] == v.data[1]
- && data[2] == v.data[2];
-}
-
-qargb8555 qargb8555::operator+(qargb8555 v) const
-{
- qargb8555 t;
- t.data[0] = data[0] + v.data[0];
- const quint16 rgb = ((data[2] + v.data[2]) << 8)
- + (data[1] + v.data[1]);
- t.data[1] = rgb & 0xff;
- t.data[2] = rgb >> 8;
- return t;
-}
-
-class qrgb666;
-
-class qargb6666
-{
-public:
- static inline bool hasAlpha() { return true; }
-
- inline qargb6666() {}
- inline qargb6666(quint32 v) { *this = qargb6666(quint32p(v)); }
- inline explicit qargb6666(quint32p v);
- inline qargb6666(const qargb6666 &v);
- inline qargb6666(const qrgb666 &v);
-
- inline operator quint32 () const;
-
- inline qargb6666 operator+(qargb6666 v) const;
- inline bool operator==(const qargb6666 &v) const;
-
-private:
- friend class qrgb666;
- quint8 data[3];
-};
-
-class qrgb666
-{
-public:
- static inline bool hasAlpha() { return false; }
-
- inline qrgb666() {}
- inline qrgb666(quint32 v);
- inline qrgb666(const qargb6666 &v);
-
- inline operator quint32 () const;
-
- inline qrgb666 operator+(qrgb666 v) const;
-
- inline bool operator==(const qrgb666 &v) const;
- inline bool operator!=(const qrgb666 &v) const { return !(*this == v); }
-
-private:
- friend class qargb6666;
- quint8 data[3];
-};
-
-qrgb666::qrgb666(quint32 v)
-{
- const uchar b = qBlue(v);
- const uchar g = qGreen(v);
- const uchar r = qRed(v);
- const uint p = (b >> 2) | ((g >> 2) << 6) | ((r >> 2) << 12);
- data[0] = qBlue(p);
- data[1] = qGreen(p);
- data[2] = qRed(p);
-}
-
-qrgb666::qrgb666(const qargb6666 &v)
-{
- data[0] = v.data[0];
- data[1] = v.data[1];
- data[2] = v.data[2] & 0x03;
-}
-
-qrgb666::operator quint32 () const
-{
- const uchar r = (data[2] << 6) | ((data[1] & 0xf0) >> 2) | (data[2] & 0x3);
- const uchar g = (data[1] << 4) | ((data[0] & 0xc0) >> 4) | ((data[1] & 0x0f) >> 2);
- const uchar b = (data[0] << 2) | ((data[0] & 0x3f) >> 4);
- return qRgb(r, g, b);
-}
-
-qrgb666 qrgb666::operator+(qrgb666 v) const
-{
- const quint32 x1 = (data[2] << 16) | (data[1] << 8) | data[0];
- const quint32 x2 = (v.data[2] << 16) | (v.data[1] << 8) | v.data[0];
- const quint32 t = x1 + x2;
- qrgb666 r;
- r.data[0] = t & 0xff;
- r.data[1] = (t >> 8) & 0xff;
- r.data[2] = (t >> 16) & 0xff;
- return r;
-}
-
-bool qrgb666::operator==(const qrgb666 &v) const
-{
- return (data[0] == v.data[0] &&
- data[1] == v.data[1] &&
- data[2] == v.data[2]);
-}
-
-qargb6666::qargb6666(quint32p v)
-{
- const quint8 b = qBlue(v) >> 2;
- const quint8 g = qGreen(v) >> 2;
- const quint8 r = qRed(v) >> 2;
- const quint8 a = qAlpha(v) >> 2;
- const uint p = (a << 18) | (r << 12) | (g << 6) | b;
- data[0] = qBlue(p);
- data[1] = qGreen(p);
- data[2] = qRed(p);
-}
-
-qargb6666::qargb6666(const qargb6666 &v)
-{
- data[0] = v.data[0];
- data[1] = v.data[1];
- data[2] = v.data[2];
-}
-
-qargb6666::qargb6666(const qrgb666 &v)
-{
- data[0] = v.data[0];
- data[1] = v.data[1];
- data[2] = (v.data[2] | 0xfc);
-}
-
-qargb6666::operator quint32 () const
-{
- const quint8 r = (data[2] << 6) | ((data[1] & 0xf0) >> 2) | (data[2] & 0x3);
- const quint8 g = (data[1] << 4) | ((data[0] & 0xc0) >> 4) | ((data[1] & 0x0f) >> 2);
- const quint8 b = (data[0] << 2) | ((data[0] & 0x3f) >> 4);
- const quint8 a = (data[2] & 0xfc) | (data[2] >> 6);
- return qRgba(r, g, b, a);
-}
-
-qargb6666 qargb6666::operator+(qargb6666 v) const
-{
- const quint32 x1 = (data[2] << 16) | (data[1] << 8) | data[0];
- const quint32 x2 = (v.data[2] << 16) | (v.data[1] << 8) | v.data[0];
- const quint32 t = x1 + x2;
- qargb6666 r;
- r.data[0] = t & 0xff;
- r.data[1] = (t >> 8) & 0xff;
- r.data[2] = (t >> 16) & 0xff;
- return r;
-}
-
-bool qargb6666::operator==(const qargb6666 &v) const
-{
- return data[0] == v.data[0]
- && data[1] == v.data[1]
- && data[2] == v.data[2];
-}
-
-class qrgb888
-{
-public:
- static inline bool hasAlpha() { return false; }
-
- inline qrgb888() {}
- inline qrgb888(quint32 v);
-
- inline operator quint32() const;
-
- inline qrgb888 operator+(qrgb888 v) const;
- inline bool operator==(qrgb888 v) const;
-
-private:
- uchar data[3];
-};
-
-qrgb888::qrgb888(quint32 v)
-{
- data[0] = qRed(v);
- data[1] = qGreen(v);
- data[2] = qBlue(v);
-}
-
-qrgb888::operator quint32() const
-{
- return qRgb(data[0], data[1], data[2]);
-}
-
-qrgb888 qrgb888::operator+(qrgb888 v) const
-{
- qrgb888 t = *this;
- t.data[0] += v.data[0];
- t.data[1] += v.data[1];
- t.data[2] += v.data[2];
- return t;
-}
-
-bool qrgb888::operator==(qrgb888 v) const
-{
- return (data[0] == v.data[0] &&
- data[1] == v.data[1] &&
- data[2] == v.data[2]);
-}
-
-// hw: endianess??
-class quint24
-{
-public:
- inline quint24(quint32 v)
- {
- data[0] = qBlue(v);
- data[1] = qGreen(v);
- data[2] = qRed(v);
- }
-
- inline operator quint32 () const
- {
- return qRgb(data[2], data[1], data[0]);
- }
-
- inline bool operator==(const quint24 &v) const
- {
- return data[0] == v.data[0]
- && data[1] == v.data[1]
- && data[2] == v.data[2];
- }
-
-private:
- uchar data[3];
-};
-
-class qrgb444;
-
-class qargb4444
-{
-public:
- static inline bool hasAlpha() { return true; }
-
- inline qargb4444() {}
- inline qargb4444(quint32 v) { *this = qargb4444(quint32p(v)); }
- inline explicit qargb4444(quint32p v);
- inline qargb4444(const qrgb444 &v);
-
- inline operator quint32() const;
- inline operator quint8() const;
-
- inline qargb4444 operator+(qargb4444 v) const;
-
- inline bool operator==(const qargb4444 &v) const { return data == v.data; }
-
-private:
- friend class qrgb444;
- quint16 data;
-};
-
-class qrgb444
-{
-public:
- static inline bool hasAlpha() { return false; }
-
- inline qrgb444() {}
- inline qrgb444(quint32 v);
- inline explicit qrgb444(qargb4444 v);
-
- inline operator quint32() const;
- inline operator quint8() const;
-
- inline qrgb444 operator+(qrgb444 v) const;
-
- inline bool operator==(const qrgb444 &v) const { return data == v.data; }
- inline bool operator!=(const qrgb444 &v) const { return data != v.data; }
-
-private:
- friend class qargb4444;
- quint16 data;
-};
-
-
-qargb4444::qargb4444(quint32p color)
-{
- quint32 v = color;
- v &= 0xf0f0f0f0;
- const int a = qAlpha(v) << 8;
- const int r = qRed(v) << 4;
- const int g = qGreen(v);
- const int b = qBlue(v) >> 4;
-
- data = a | r | g | b;
-}
-
-qargb4444::qargb4444(const qrgb444 &v)
-{
- data = v.data | 0xf000;
-}
-
-qargb4444::operator quint32() const
-{
- const int a = (data & 0xf000);
- const int r = (data & 0x0f00);
- const int g = (data & 0x00f0);
- const int b = (data & 0x000f);
- const int ta = (a >> 8) | (a >> 12);
- const int tr = (r >> 4) | (r >> 8);
- const int tg = g | (g >> 4);
- const int tb = (b << 4) | b;
-
- return qRgba(tr, tg, tb, ta);
-}
-
-qargb4444::operator quint8() const
-{
- // hw: optimize!
- return operator quint32();
-}
-
-qargb4444 qargb4444::operator+(qargb4444 v) const
-{
- qargb4444 t;
- t.data = data + v.data;
- return t;
-}
-
-qrgb444::qrgb444(quint32 v)
-{
- v &= 0xf0f0f0f0;
- const int r = qRed(v) << 4;
- const int g = qGreen(v);
- const int b = qBlue(v) >> 4;
-
- data = r | g | b;
-}
-
-qrgb444::qrgb444(qargb4444 v)
-{
- data = v.data & 0x0fff;
-}
-
-qrgb444::operator quint32() const
-{
- const int r = (data & 0x0f00);
- const int g = (data & 0x00f0);
- const int b = (data & 0x000f);
- const int tr = (r >> 4) | (r >> 8);
- const int tg = g | (g >> 4);
- const int tb = (b << 4) | b;
-
- return qRgb(tr, tg, tb);
-}
-
-qrgb444::operator quint8() const
-{
- // hw: optimize!
- return operator quint32();
-}
-
-qrgb444 qrgb444::operator+(qrgb444 v) const
-{
- qrgb444 t;
- t.data = data + v.data;
- return t;
-}
-
-
template <class DST, class SRC>
inline DST qt_colorConvert(const SRC color, const DST dummy)
{
::memcpy(dest, src, count * sizeof(T)); \
}
QT_TRIVIAL_MEMCONVERT_IMPL(quint32)
-QT_TRIVIAL_MEMCONVERT_IMPL(qrgb888)
-QT_TRIVIAL_MEMCONVERT_IMPL(qargb6666)
-QT_TRIVIAL_MEMCONVERT_IMPL(qrgb666)
QT_TRIVIAL_MEMCONVERT_IMPL(quint16)
-QT_TRIVIAL_MEMCONVERT_IMPL(qrgb565)
-QT_TRIVIAL_MEMCONVERT_IMPL(qargb8565)
-QT_TRIVIAL_MEMCONVERT_IMPL(qargb8555)
-QT_TRIVIAL_MEMCONVERT_IMPL(qrgb555)
-QT_TRIVIAL_MEMCONVERT_IMPL(qargb4444)
-QT_TRIVIAL_MEMCONVERT_IMPL(qrgb444)
#undef QT_TRIVIAL_MEMCONVERT_IMPL
template <class DST, class SRC>
}
QT_RECTCONVERT_TRIVIAL_IMPL(quint32)
-QT_RECTCONVERT_TRIVIAL_IMPL(qrgb888)
-QT_RECTCONVERT_TRIVIAL_IMPL(qargb6666)
-QT_RECTCONVERT_TRIVIAL_IMPL(qrgb666)
-QT_RECTCONVERT_TRIVIAL_IMPL(qrgb565)
-QT_RECTCONVERT_TRIVIAL_IMPL(qargb8565)
QT_RECTCONVERT_TRIVIAL_IMPL(quint16)
-QT_RECTCONVERT_TRIVIAL_IMPL(qargb8555)
-QT_RECTCONVERT_TRIVIAL_IMPL(qrgb555)
-QT_RECTCONVERT_TRIVIAL_IMPL(qargb4444)
-QT_RECTCONVERT_TRIVIAL_IMPL(qrgb444)
#undef QT_RECTCONVERT_TRIVIAL_IMPL
static inline int qt_div_255(int x) { return (x + (x>>8) + 0x80) >> 8; }
QT_IMPL_MEMROTATE(quint8, quint8)
QT_IMPL_MEMROTATE(quint16, quint16)
-QT_IMPL_MEMROTATE(quint24, quint24)
QT_IMPL_MEMROTATE(quint32, quint32)
#undef QT_IMPL_MEMROTATE
case QImage::Format_Mono:
d->mono_surface = true;
break;
- case QImage::Format_ARGB8565_Premultiplied:
- case QImage::Format_ARGB8555_Premultiplied:
- case QImage::Format_ARGB6666_Premultiplied:
- case QImage::Format_ARGB4444_Premultiplied:
case QImage::Format_ARGB32_Premultiplied:
case QImage::Format_ARGB32:
gccaps |= PorterDuff;
break;
case QImage::Format_RGB32:
- case QImage::Format_RGB444:
- case QImage::Format_RGB555:
- case QImage::Format_RGB666:
- case QImage::Format_RGB888:
case QImage::Format_RGB16:
break;
default:
QRgb color = img.pixel(sr_l, sr_t);
switch (img.format()) {
case QImage::Format_ARGB32_Premultiplied:
- case QImage::Format_ARGB8565_Premultiplied:
- case QImage::Format_ARGB6666_Premultiplied:
- case QImage::Format_ARGB8555_Premultiplied:
- case QImage::Format_ARGB4444_Premultiplied:
// Combine premultiplied color with the opacity set on the painter.
d->solid_color_filler.solid.color =
((((color & 0x00ff00ff) * s->intOpacity) >> 8) & 0x00ff00ff)
}
}
break;
- case QImage::Format_RGB888:
- memcpy(row, image.constScanLine(cinfo.next_scanline), w * 3);
- break;
case QImage::Format_RGB32:
case QImage::Format_ARGB32:
case QImage::Format_ARGB32_Premultiplied:
{
Q_OBJECT
private slots:
- void convertRgb888ToRGB32_data();
- void convertRgb888ToRGB32();
+ void convertRgb16ToRGB32_data();
+ void convertRgb16ToRGB32();
private:
- QImage generateImageRgb888(int width, int height);
+ QImage generateImage(int width, int height);
};
-void tst_QImageConversion::convertRgb888ToRGB32_data()
+void tst_QImageConversion::convertRgb16ToRGB32_data()
{
QTest::addColumn<QImage>("inputImage");
// height = 5000 to get interesting timing.
// 3 pixels wide -> smaller than regular vector of 128bits
- QTest::newRow("width: 3px; height: 5000px;") << generateImageRgb888(3, 5000);
+ QTest::newRow("width: 3px; height: 5000px;") << generateImage(3, 5000);
// 8 pixels wide -> potential for 2 vectors
- QTest::newRow("width: 8px; height: 5000px;") << generateImageRgb888(3, 5000);
+ QTest::newRow("width: 8px; height: 5000px;") << generateImage(3, 5000);
// 16 pixels, minimum for the SSSE3 implementation
- QTest::newRow("width: 16px; height: 5000px;") << generateImageRgb888(16, 5000);
+ QTest::newRow("width: 16px; height: 5000px;") << generateImage(16, 5000);
// 50 pixels, more realistic use case
- QTest::newRow("width: 50px; height: 5000px;") << generateImageRgb888(50, 5000);
+ QTest::newRow("width: 50px; height: 5000px;") << generateImage(50, 5000);
// 2000 pixels -> typical values for pictures
- QTest::newRow("width: 2000px; height: 5000px;") << generateImageRgb888(2000, 5000);
+ QTest::newRow("width: 2000px; height: 5000px;") << generateImage(2000, 5000);
}
-void tst_QImageConversion::convertRgb888ToRGB32()
+void tst_QImageConversion::convertRgb16ToRGB32()
{
QFETCH(QImage, inputImage);
}
/*
- Fill a RGB888 image with "random" pixel values.
+ Fill a RGB16 image with "random" pixel values.
*/
-QImage tst_QImageConversion::generateImageRgb888(int width, int height)
+QImage tst_QImageConversion::generateImage(int width, int height)
{
- QImage image(width, height, QImage::Format_RGB888);
+ QImage image(width, height, QImage::Format_RGB16);
const int byteWidth = width * 3;
for (int y = 0; y < image.height(); ++y) {
for (int tar=4; tar<QImage::NImageFormats; ++tar) {
for (int src=4; src<QImage::NImageFormats; ++src) {
- // skip the low-priority formats to keep resultset manageable...
- if (tar == QImage::Format_RGB444 || src == QImage::Format_RGB444
- || tar == QImage::Format_RGB555 || src == QImage::Format_RGB555
- || tar == QImage::Format_RGB666 || src == QImage::Format_RGB666
- || tar == QImage::Format_RGB888 || src == QImage::Format_RGB888
- || tar == QImage::Format_ARGB4444_Premultiplied
- || src == QImage::Format_ARGB4444_Premultiplied
- || tar == QImage::Format_ARGB6666_Premultiplied
- || src == QImage::Format_ARGB6666_Premultiplied)
- continue;
-
foreach (const QSize &s, sizes) {
for (int type=0; type<=3; ++type) {
QString name = QString::fromLatin1("%1 on %2, (%3x%4), %5")
QTest::addColumn<int>("imageType");
QTest::newRow("imagetype=ARGB32_Pre") << (int)QImage::Format_ARGB32_Premultiplied;
- QTest::newRow("imagetype=ARGB8565_Pre") << (int)QImage::Format_ARGB8565_Premultiplied;
+ QTest::newRow("imagetype=RGB16") << (int)QImage::Format_RGB16;
}
void tst_QPainter::drawScaledImageRoundedRect()
QTest::addColumn<int>("imageType");
QTest::newRow("imagetype=ARGB32_Pre") << (int)QImage::Format_ARGB32_Premultiplied;
- QTest::newRow("imagetype=ARGB8565_Pre") << (int)QImage::Format_ARGB8565_Premultiplied;
+ QTest::newRow("imagetype=RGB16") << (int)QImage::Format_RGB16;
}
void tst_QPainter::drawTransformedImageRoundedRect()
for (float i = 0; i < 3; i += .1)
QTest::newRow(QString(QLatin1String("scale=%1; imagetype=ARGB32_Pre")).arg(i).toLatin1()) << i << (int)QImage::Format_ARGB32_Premultiplied;
//for (float i = 0; i < 3; i += .1)
- // QTest::newRow(QString(QLatin1String("scale=%1; imagetype=ARGB8565_Pre")).arg(i).toLatin1()) << i << (int)QImage::Format_ARGB8565_Premultiplied;
+ // QTest::newRow(QString(QLatin1String("scale=%1; imagetype=RGB16")).arg(i).toLatin1()) << i << (int)QImage::Format_RGB16;
}
//code from QDeclarativeRectangle for drawing rounded rects
for (float angle = 0; angle < 360; angle += 10)
QTest::newRow(QString(QLatin1String("angle=%1; imagetype=ARGB32_Pre")).arg(angle).toLatin1()) << transformForAngle(angle) << (int)QImage::Format_ARGB32_Premultiplied;
//for (float angle = 0; angle < 360; angle += 10)
- // QTest::newRow(QString(QLatin1String("angle=%1; imagetype=ARGB8565_Pre")).arg(angle).toLatin1()) << transformForAngle(angle) << (int)QImage::Format_ARGB8565_Premultiplied;
+ // QTest::newRow(QString(QLatin1String("angle=%1; imagetype=RGB16")).arg(angle).toLatin1()) << transformForAngle(angle) << (int)QImage::Format_RGB16;
}
QTest::addColumn<int>("imageType");
QTest::newRow("imagetype=ARGB32_Pre") << (int)QImage::Format_ARGB32_Premultiplied;
- QTest::newRow("imagetype=ARGB8565_Pre") << (int)QImage::Format_ARGB8565_Premultiplied;
+ QTest::newRow("imagetype=RGB16") << (int)QImage::Format_RGB16;
}
void tst_QPainter::drawTransformedTransparentImage()
QTest::addColumn<int>("imageType");
QTest::newRow("imagetype=ARGB32_Pre") << (int)QImage::Format_ARGB32_Premultiplied;
- QTest::newRow("imagetype=ARGB8565_Pre") << (int)QImage::Format_ARGB8565_Premultiplied;
+ QTest::newRow("imagetype=RGB16") << (int)QImage::Format_RGB16;
}
void tst_QPainter::drawTransformedSemiTransparentImage()
QTest::addColumn<int>("imageType");
QTest::newRow("imagetype=ARGB32_Pre") << (int)QImage::Format_ARGB32_Premultiplied;
- QTest::newRow("imagetype=ARGB8565_Pre") << (int)QImage::Format_ARGB8565_Premultiplied;
+ QTest::newRow("imagetype=RGB16") << (int)QImage::Format_RGB16;
}
void tst_QPainter::drawTransformedFilledImage()