Cleanup conversion parameters

Removes the now unused QPixelLayout parameter, simplifies the colorTable
passing and prepares for adding dithering.

Change-Id: Iaf7698b248b857804d8921bf118e7cfabbabff87
Reviewed-by: Gunnar Sletta <gunnar@sletta.org>
This commit is contained in:
Allan Sandfeld Jensen 2015-05-11 15:24:58 +02:00
parent f34e73a16a
commit 887f51aaa6
9 changed files with 115 additions and 109 deletions

View File

@ -2275,7 +2275,7 @@ QRgb QImage::pixel(int x, int y) const
const QPixelLayout *layout = &qPixelLayouts[d->format]; const QPixelLayout *layout = &qPixelLayouts[d->format];
uint result; uint result;
const uint *ptr = qFetchPixels[layout->bpp](&result, s, x, 1); const uint *ptr = qFetchPixels[layout->bpp](&result, s, x, 1);
return *layout->convertToARGB32PM(&result, ptr, 1, layout, 0); return *layout->convertToARGB32PM(&result, ptr, 1, 0, 0);
} }
/*! /*!
@ -2377,7 +2377,7 @@ void QImage::setPixel(int x, int y, uint index_or_rgb)
const QPixelLayout *layout = &qPixelLayouts[d->format]; const QPixelLayout *layout = &qPixelLayouts[d->format];
uint result; uint result;
const uint *ptr = layout->convertFromARGB32PM(&result, &index_or_rgb, 1, layout, 0); const uint *ptr = layout->convertFromARGB32PM(&result, &index_or_rgb, 1, 0, 0);
qStorePixels[layout->bpp](s, ptr, x, 1); qStorePixels[layout->bpp](s, ptr, x, 1);
} }
@ -2557,7 +2557,7 @@ bool QImage::allGray() const
while (x < d->width) { while (x < d->width) {
int l = qMin(d->width - x, buffer_size); int l = qMin(d->width - x, buffer_size);
const uint *ptr = fetch(buffer, b, x, l); const uint *ptr = fetch(buffer, b, x, l);
ptr = layout->convertToARGB32PM(buffer, ptr, l, layout, 0); ptr = layout->convertToARGB32PM(buffer, ptr, l, 0, 0);
for (int i = 0; i < l; ++i) { for (int i = 0; i < l; ++i) {
if (!qIsGray(ptr[i])) if (!qIsGray(ptr[i]))
return false; return false;

View File

@ -108,7 +108,7 @@ void qGamma_correct_back_to_linear_cs(QImage *image)
// The drawhelper conversions from/to RGB32 are passthroughs which is not always correct for general image conversion. // The drawhelper conversions from/to RGB32 are passthroughs which is not always correct for general image conversion.
static const uint *QT_FASTCALL convertRGB32FromARGB32PM(uint *buffer, const uint *src, int count, static const uint *QT_FASTCALL convertRGB32FromARGB32PM(uint *buffer, const uint *src, int count,
const QPixelLayout *, const QRgb *) const QVector<QRgb> *, QDitherInfo *)
{ {
for (int i = 0; i < count; ++i) for (int i = 0; i < count; ++i)
buffer[i] = 0xff000000 | qUnpremultiply(src[i]); buffer[i] = 0xff000000 | qUnpremultiply(src[i]);
@ -116,7 +116,7 @@ static const uint *QT_FASTCALL convertRGB32FromARGB32PM(uint *buffer, const uint
} }
static const uint *QT_FASTCALL convertRGB32ToARGB32PM(uint *buffer, const uint *src, int count, static const uint *QT_FASTCALL convertRGB32ToARGB32PM(uint *buffer, const uint *src, int count,
const QPixelLayout *, const QRgb *) const QVector<QRgb> *, QDitherInfo *)
{ {
for (int i = 0; i < count; ++i) for (int i = 0; i < count; ++i)
buffer[i] = 0xff000000 |src[i]; buffer[i] = 0xff000000 |src[i];
@ -124,7 +124,8 @@ static const uint *QT_FASTCALL convertRGB32ToARGB32PM(uint *buffer, const uint *
} }
#ifdef QT_COMPILER_SUPPORTS_SSE4_1 #ifdef QT_COMPILER_SUPPORTS_SSE4_1
extern const uint *QT_FASTCALL convertRGB32FromARGB32PM_sse4(uint *buffer, const uint *src, int count, const QPixelLayout *, const QRgb *); extern const uint *QT_FASTCALL convertRGB32FromARGB32PM_sse4(uint *buffer, const uint *src, int count,
const QVector<QRgb> *, QDitherInfo *);
#endif #endif
void convert_generic(QImageData *dest, const QImageData *src, Qt::ImageConversionFlags) void convert_generic(QImageData *dest, const QImageData *src, Qt::ImageConversionFlags)
@ -164,8 +165,8 @@ void convert_generic(QImageData *dest, const QImageData *src, Qt::ImageConversio
while (x < src->width) { while (x < src->width) {
int l = qMin(src->width - x, buffer_size); int l = qMin(src->width - x, buffer_size);
const uint *ptr = fetch(buffer, srcData, x, l); const uint *ptr = fetch(buffer, srcData, x, l);
ptr = convertToARGB32PM(buffer, ptr, l, srcLayout, 0); ptr = convertToARGB32PM(buffer, ptr, l, 0, 0);
ptr = convertFromARGB32PM(buffer, ptr, l, destLayout, 0); ptr = convertFromARGB32PM(buffer, ptr, l, 0, 0);
store(destData, ptr, x, l); store(destData, ptr, x, l);
x += l; x += l;
} }
@ -213,8 +214,8 @@ bool convert_generic_inplace(QImageData *data, QImage::Format dst_format, Qt::Im
while (x < data->width) { while (x < data->width) {
int l = qMin(data->width - x, buffer_size); int l = qMin(data->width - x, buffer_size);
const uint *ptr = fetch(buffer, srcData, x, l); const uint *ptr = fetch(buffer, srcData, x, l);
ptr = convertToARGB32PM(buffer, ptr, l, srcLayout, 0); ptr = convertToARGB32PM(buffer, ptr, l, 0, 0);
ptr = convertFromARGB32PM(buffer, ptr, l, destLayout, 0); ptr = convertFromARGB32PM(buffer, ptr, l, 0, 0);
// The conversions might be passthrough and not use the buffer, in that case we are already done. // The conversions might be passthrough and not use the buffer, in that case we are already done.
if (srcData != (const uchar*)ptr) if (srcData != (const uchar*)ptr)
store(srcData, ptr, x, l); store(srcData, ptr, x, l);

View File

@ -48,7 +48,7 @@
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
const uint *QT_FASTCALL convertRGB32FromARGB32PM_sse4(uint *buffer, const uint *src, int count, const uint *QT_FASTCALL convertRGB32FromARGB32PM_sse4(uint *buffer, const uint *src, int count,
const QPixelLayout *, const QRgb *) const QVector<QRgb> *, QDitherInfo *)
{ {
for (int i = 0; i < count; ++i) for (int i = 0; i < count; ++i)
buffer[i] = 0xff000000 | qUnpremultiply_sse4(src[i]); buffer[i] = 0xff000000 | qUnpremultiply_sse4(src[i]);

View File

@ -152,7 +152,7 @@ void QBlittablePlatformPixmap::fill(const QColor &color)
uint pixel = qPremultiply(color.rgba()); uint pixel = qPremultiply(color.rgba());
const QPixelLayout *layout = &qPixelLayouts[blittable()->lock()->format()]; const QPixelLayout *layout = &qPixelLayouts[blittable()->lock()->format()];
Q_ASSERT(layout->convertFromARGB32PM); Q_ASSERT(layout->convertFromARGB32PM);
layout->convertFromARGB32PM(&pixel, &pixel, 1, layout, 0); layout->convertFromARGB32PM(&pixel, &pixel, 1, 0, 0);
//so premultiplied formats are supported and ARGB32 and RGB32 //so premultiplied formats are supported and ARGB32 and RGB32
blittable()->lock()->fill(pixel); blittable()->lock()->fill(pixel);

View File

@ -195,7 +195,7 @@ void QRasterPlatformPixmap::fill(const QColor &color)
} }
pixel = qPremultiply(color.rgba()); pixel = qPremultiply(color.rgba());
const QPixelLayout *layout = &qPixelLayouts[image.format()]; const QPixelLayout *layout = &qPixelLayouts[image.format()];
layout->convertFromARGB32PM(&pixel, &pixel, 1, layout, 0); layout->convertFromARGB32PM(&pixel, &pixel, 1, 0, 0);
} else if (image.format() == QImage::Format_Alpha8) { } else if (image.format() == QImage::Format_Alpha8) {
pixel = qAlpha(color.rgba()); pixel = qAlpha(color.rgba());
} else if (image.format() == QImage::Format_Grayscale8) { } else if (image.format() == QImage::Format_Grayscale8) {

View File

@ -168,7 +168,7 @@ template<> Q_DECL_CONSTEXPR QPixelLayout::BPP bitsPerPixel<QImage::Format_ARGB66
template<QImage::Format Format> template<QImage::Format Format>
static const uint *QT_FASTCALL convertToRGB32(uint *buffer, const uint *src, int count, static const uint *QT_FASTCALL convertToRGB32(uint *buffer, const uint *src, int count,
const QPixelLayout *, const QRgb *) const QVector<QRgb> *, QDitherInfo *)
{ {
Q_CONSTEXPR uint redMask = ((1 << redWidth<Format>()) - 1); Q_CONSTEXPR uint redMask = ((1 << redWidth<Format>()) - 1);
Q_CONSTEXPR uint greenMask = ((1 << greenWidth<Format>()) - 1); Q_CONSTEXPR uint greenMask = ((1 << greenWidth<Format>()) - 1);
@ -198,7 +198,7 @@ static const uint *QT_FASTCALL convertToRGB32(uint *buffer, const uint *src, int
template<QImage::Format Format> template<QImage::Format Format>
static const QRgba64 *QT_FASTCALL convertToRGB64(QRgba64 *buffer, const uint *src, int count, static const QRgba64 *QT_FASTCALL convertToRGB64(QRgba64 *buffer, const uint *src, int count,
const QPixelLayout *, const QRgb *) const QVector<QRgb> *, QDitherInfo *)
{ {
Q_CONSTEXPR uint redMask = ((1 << redWidth<Format>()) - 1); Q_CONSTEXPR uint redMask = ((1 << redWidth<Format>()) - 1);
Q_CONSTEXPR uint greenMask = ((1 << greenWidth<Format>()) - 1); Q_CONSTEXPR uint greenMask = ((1 << greenWidth<Format>()) - 1);
@ -228,7 +228,7 @@ static const QRgba64 *QT_FASTCALL convertToRGB64(QRgba64 *buffer, const uint *sr
template<QImage::Format Format> template<QImage::Format Format>
static const uint *QT_FASTCALL convertARGBPMToARGB32PM(uint *buffer, const uint *src, int count, static const uint *QT_FASTCALL convertARGBPMToARGB32PM(uint *buffer, const uint *src, int count,
const QPixelLayout *, const QRgb *) const QVector<QRgb> *, QDitherInfo *)
{ {
Q_CONSTEXPR uint alphaMask = ((1 << alphaWidth<Format>()) - 1); Q_CONSTEXPR uint alphaMask = ((1 << alphaWidth<Format>()) - 1);
Q_CONSTEXPR uint redMask = ((1 << redWidth<Format>()) - 1); Q_CONSTEXPR uint redMask = ((1 << redWidth<Format>()) - 1);
@ -282,7 +282,7 @@ static const uint *QT_FASTCALL convertARGBPMToARGB32PM(uint *buffer, const uint
template<QImage::Format Format> template<QImage::Format Format>
static const QRgba64 *QT_FASTCALL convertARGBPMToARGB64PM(QRgba64 *buffer, const uint *src, int count, static const QRgba64 *QT_FASTCALL convertARGBPMToARGB64PM(QRgba64 *buffer, const uint *src, int count,
const QPixelLayout *, const QRgb *) const QVector<QRgb> *, QDitherInfo *)
{ {
Q_CONSTEXPR uint alphaMask = ((1 << alphaWidth<Format>()) - 1); Q_CONSTEXPR uint alphaMask = ((1 << alphaWidth<Format>()) - 1);
Q_CONSTEXPR uint redMask = ((1 << redWidth<Format>()) - 1); Q_CONSTEXPR uint redMask = ((1 << redWidth<Format>()) - 1);
@ -336,7 +336,7 @@ static const QRgba64 *QT_FASTCALL convertARGBPMToARGB64PM(QRgba64 *buffer, const
template<QImage::Format Format, bool fromRGB> template<QImage::Format Format, bool fromRGB>
static const uint *QT_FASTCALL convertRGBFromARGB32PM(uint *buffer, const uint *src, int count, static const uint *QT_FASTCALL convertRGBFromARGB32PM(uint *buffer, const uint *src, int count,
const QPixelLayout *, const QRgb *) const QVector<QRgb> *, QDitherInfo *)
{ {
Q_CONSTEXPR uint rMask = ((1 << redWidth<Format>()) - 1); Q_CONSTEXPR uint rMask = ((1 << redWidth<Format>()) - 1);
Q_CONSTEXPR uint gMask = ((1 << greenWidth<Format>()) - 1); Q_CONSTEXPR uint gMask = ((1 << greenWidth<Format>()) - 1);
@ -358,7 +358,7 @@ static const uint *QT_FASTCALL convertRGBFromARGB32PM(uint *buffer, const uint *
template<QImage::Format Format, bool fromRGB> template<QImage::Format Format, bool fromRGB>
static const uint *QT_FASTCALL convertARGBPMFromARGB32PM(uint *buffer, const uint *src, int count, static const uint *QT_FASTCALL convertARGBPMFromARGB32PM(uint *buffer, const uint *src, int count,
const QPixelLayout *, const QRgb *) const QVector<QRgb> *, QDitherInfo *)
{ {
Q_CONSTEXPR uint aMask = ((1 << alphaWidth<Format>()) - 1); Q_CONSTEXPR uint aMask = ((1 << alphaWidth<Format>()) - 1);
Q_CONSTEXPR uint rMask = ((1 << redWidth<Format>()) - 1); Q_CONSTEXPR uint rMask = ((1 << redWidth<Format>()) - 1);
@ -418,35 +418,35 @@ template<QImage::Format Format> Q_DECL_CONSTEXPR static inline QPixelLayout pixe
// To convert in place, let 'dest' and 'src' be the same. // To convert in place, let 'dest' and 'src' be the same.
static const uint *QT_FASTCALL convertIndexedToARGB32PM(uint *buffer, const uint *src, int count, static const uint *QT_FASTCALL convertIndexedToARGB32PM(uint *buffer, const uint *src, int count,
const QPixelLayout *, const QRgb *clut) const QVector<QRgb> *clut, QDitherInfo *)
{ {
for (int i = 0; i < count; ++i) for (int i = 0; i < count; ++i)
buffer[i] = qPremultiply(clut[src[i]]); buffer[i] = qPremultiply(clut->at(src[i]));
return buffer; return buffer;
} }
static const QRgba64 *QT_FASTCALL convertIndexedToARGB64PM(QRgba64 *buffer, const uint *src, int count, static const QRgba64 *QT_FASTCALL convertIndexedToARGB64PM(QRgba64 *buffer, const uint *src, int count,
const QPixelLayout *, const QRgb *clut) const QVector<QRgb> *clut, QDitherInfo *)
{ {
for (int i = 0; i < count; ++i) for (int i = 0; i < count; ++i)
buffer[i] = QRgba64::fromArgb32(clut[src[i]]).premultiplied(); buffer[i] = QRgba64::fromArgb32(clut->at(src[i])).premultiplied();
return buffer; return buffer;
} }
static const uint *QT_FASTCALL convertPassThrough(uint *, const uint *src, int, static const uint *QT_FASTCALL convertPassThrough(uint *, const uint *src, int,
const QPixelLayout *, const QRgb *) const QVector<QRgb> *, QDitherInfo *)
{ {
return src; return src;
} }
static const uint *QT_FASTCALL convertARGB32ToARGB32PM(uint *buffer, const uint *src, int count, static const uint *QT_FASTCALL convertARGB32ToARGB32PM(uint *buffer, const uint *src, int count,
const QPixelLayout *, const QRgb *) const QVector<QRgb> *, QDitherInfo *)
{ {
return qt_convertARGB32ToARGB32PM(buffer, src, count); return qt_convertARGB32ToARGB32PM(buffer, src, count);
} }
static const uint *QT_FASTCALL convertRGBA8888PMToARGB32PM(uint *buffer, const uint *src, int count, static const uint *QT_FASTCALL convertRGBA8888PMToARGB32PM(uint *buffer, const uint *src, int count,
const QPixelLayout *, const QRgb *) const QVector<QRgb> *, QDitherInfo *)
{ {
for (int i = 0; i < count; ++i) for (int i = 0; i < count; ++i)
buffer[i] = RGBA2ARGB(src[i]); buffer[i] = RGBA2ARGB(src[i]);
@ -454,13 +454,13 @@ static const uint *QT_FASTCALL convertRGBA8888PMToARGB32PM(uint *buffer, const u
} }
static const uint *QT_FASTCALL convertRGBA8888ToARGB32PM(uint *buffer, const uint *src, int count, static const uint *QT_FASTCALL convertRGBA8888ToARGB32PM(uint *buffer, const uint *src, int count,
const QPixelLayout *, const QRgb *) const QVector<QRgb> *, QDitherInfo *)
{ {
return qt_convertRGBA8888ToARGB32PM(buffer, src, count); return qt_convertRGBA8888ToARGB32PM(buffer, src, count);
} }
static const uint *QT_FASTCALL convertAlpha8ToRGB32(uint *buffer, const uint *src, int count, static const uint *QT_FASTCALL convertAlpha8ToRGB32(uint *buffer, const uint *src, int count,
const QPixelLayout *, const QRgb *) const QVector<QRgb> *, QDitherInfo *)
{ {
for (int i = 0; i < count; ++i) for (int i = 0; i < count; ++i)
buffer[i] = qRgba(0, 0, 0, src[i]); buffer[i] = qRgba(0, 0, 0, src[i]);
@ -468,7 +468,7 @@ static const uint *QT_FASTCALL convertAlpha8ToRGB32(uint *buffer, const uint *sr
} }
static const uint *QT_FASTCALL convertGrayscale8ToRGB32(uint *buffer, const uint *src, int count, static const uint *QT_FASTCALL convertGrayscale8ToRGB32(uint *buffer, const uint *src, int count,
const QPixelLayout *, const QRgb *) const QVector<QRgb> *, QDitherInfo *)
{ {
for (int i = 0; i < count; ++i) for (int i = 0; i < count; ++i)
buffer[i] = qRgb(src[i], src[i], src[i]); buffer[i] = qRgb(src[i], src[i], src[i]);
@ -476,7 +476,7 @@ static const uint *QT_FASTCALL convertGrayscale8ToRGB32(uint *buffer, const uint
} }
static const QRgba64 *QT_FASTCALL convertAlpha8ToRGB64(QRgba64 *buffer, const uint *src, int count, static const QRgba64 *QT_FASTCALL convertAlpha8ToRGB64(QRgba64 *buffer, const uint *src, int count,
const QPixelLayout *, const QRgb *) const QVector<QRgb> *, QDitherInfo *)
{ {
for (int i = 0; i < count; ++i) for (int i = 0; i < count; ++i)
buffer[i] = QRgba64::fromRgba(0, 0, 0, src[i]); buffer[i] = QRgba64::fromRgba(0, 0, 0, src[i]);
@ -484,7 +484,7 @@ static const QRgba64 *QT_FASTCALL convertAlpha8ToRGB64(QRgba64 *buffer, const ui
} }
static const QRgba64 *QT_FASTCALL convertGrayscale8ToRGB64(QRgba64 *buffer, const uint *src, int count, static const QRgba64 *QT_FASTCALL convertGrayscale8ToRGB64(QRgba64 *buffer, const uint *src, int count,
const QPixelLayout *, const QRgb *) const QVector<QRgb> *, QDitherInfo *)
{ {
for (int i = 0; i < count; ++i) for (int i = 0; i < count; ++i)
buffer[i] = QRgba64::fromRgba(src[i], src[i], src[i], 255); buffer[i] = QRgba64::fromRgba(src[i], src[i], src[i], 255);
@ -492,7 +492,7 @@ static const QRgba64 *QT_FASTCALL convertGrayscale8ToRGB64(QRgba64 *buffer, cons
} }
static const uint *QT_FASTCALL convertARGB32FromARGB32PM(uint *buffer, const uint *src, int count, static const uint *QT_FASTCALL convertARGB32FromARGB32PM(uint *buffer, const uint *src, int count,
const QPixelLayout *, const QRgb *) const QVector<QRgb> *, QDitherInfo *)
{ {
for (int i = 0; i < count; ++i) for (int i = 0; i < count; ++i)
buffer[i] = qUnpremultiply(src[i]); buffer[i] = qUnpremultiply(src[i]);
@ -500,7 +500,7 @@ static const uint *QT_FASTCALL convertARGB32FromARGB32PM(uint *buffer, const uin
} }
static const uint *QT_FASTCALL convertRGBA8888PMFromARGB32PM(uint *buffer, const uint *src, int count, static const uint *QT_FASTCALL convertRGBA8888PMFromARGB32PM(uint *buffer, const uint *src, int count,
const QPixelLayout *, const QRgb *) const QVector<QRgb> *, QDitherInfo *)
{ {
for (int i = 0; i < count; ++i) for (int i = 0; i < count; ++i)
buffer[i] = ARGB2RGBA(src[i]); buffer[i] = ARGB2RGBA(src[i]);
@ -551,7 +551,7 @@ static inline void qConvertARGB32PMToARGB64PM_sse2(QRgba64 *buffer, const uint *
#endif #endif
static const QRgba64 *QT_FASTCALL convertRGB32ToRGB64(QRgba64 *buffer, const uint *src, int count, static const QRgba64 *QT_FASTCALL convertRGB32ToRGB64(QRgba64 *buffer, const uint *src, int count,
const QPixelLayout *, const QRgb *) const QVector<QRgb> *, QDitherInfo *)
{ {
#ifdef __SSE2__ #ifdef __SSE2__
qConvertARGB32PMToARGB64PM_sse2<false, true>(buffer, src, count); qConvertARGB32PMToARGB64PM_sse2<false, true>(buffer, src, count);
@ -563,7 +563,7 @@ static const QRgba64 *QT_FASTCALL convertRGB32ToRGB64(QRgba64 *buffer, const uin
} }
static const QRgba64 *QT_FASTCALL convertARGB32ToARGB64PM(QRgba64 *buffer, const uint *src, int count, static const QRgba64 *QT_FASTCALL convertARGB32ToARGB64PM(QRgba64 *buffer, const uint *src, int count,
const QPixelLayout *, const QRgb *) const QVector<QRgb> *, QDitherInfo *)
{ {
#ifdef __SSE2__ #ifdef __SSE2__
qConvertARGB32PMToARGB64PM_sse2<false, false>(buffer, src, count); qConvertARGB32PMToARGB64PM_sse2<false, false>(buffer, src, count);
@ -577,7 +577,7 @@ static const QRgba64 *QT_FASTCALL convertARGB32ToARGB64PM(QRgba64 *buffer, const
} }
static const QRgba64 *QT_FASTCALL convertARGB32PMToARGB64PM(QRgba64 *buffer, const uint *src, int count, static const QRgba64 *QT_FASTCALL convertARGB32PMToARGB64PM(QRgba64 *buffer, const uint *src, int count,
const QPixelLayout *, const QRgb *) const QVector<QRgb> *, QDitherInfo *)
{ {
#ifdef __SSE2__ #ifdef __SSE2__
qConvertARGB32PMToARGB64PM_sse2<false, false>(buffer, src, count); qConvertARGB32PMToARGB64PM_sse2<false, false>(buffer, src, count);
@ -589,7 +589,7 @@ static const QRgba64 *QT_FASTCALL convertARGB32PMToARGB64PM(QRgba64 *buffer, con
} }
static const QRgba64 *QT_FASTCALL convertRGBA8888ToARGB64PM(QRgba64 *buffer, const uint *src, int count, static const QRgba64 *QT_FASTCALL convertRGBA8888ToARGB64PM(QRgba64 *buffer, const uint *src, int count,
const QPixelLayout *, const QRgb *) const QVector<QRgb> *, QDitherInfo *)
{ {
#ifdef __SSE2__ #ifdef __SSE2__
qConvertARGB32PMToARGB64PM_sse2<true, false>(buffer, src, count); qConvertARGB32PMToARGB64PM_sse2<true, false>(buffer, src, count);
@ -603,7 +603,7 @@ static const QRgba64 *QT_FASTCALL convertRGBA8888ToARGB64PM(QRgba64 *buffer, con
} }
static const QRgba64 *QT_FASTCALL convertRGBA8888PMToARGB64PM(QRgba64 *buffer, const uint *src, int count, static const QRgba64 *QT_FASTCALL convertRGBA8888PMToARGB64PM(QRgba64 *buffer, const uint *src, int count,
const QPixelLayout *, const QRgb *) const QVector<QRgb> *, QDitherInfo *)
{ {
#ifdef __SSE2__ #ifdef __SSE2__
qConvertARGB32PMToARGB64PM_sse2<true, false>(buffer, src, count); qConvertARGB32PMToARGB64PM_sse2<true, false>(buffer, src, count);
@ -615,7 +615,7 @@ static const QRgba64 *QT_FASTCALL convertRGBA8888PMToARGB64PM(QRgba64 *buffer, c
} }
static const uint *QT_FASTCALL convertRGBA8888FromARGB32PM(uint *buffer, const uint *src, int count, static const uint *QT_FASTCALL convertRGBA8888FromARGB32PM(uint *buffer, const uint *src, int count,
const QPixelLayout *, const QRgb *) const QVector<QRgb> *, QDitherInfo *)
{ {
for (int i = 0; i < count; ++i) for (int i = 0; i < count; ++i)
buffer[i] = ARGB2RGBA(qUnpremultiply(src[i])); buffer[i] = ARGB2RGBA(qUnpremultiply(src[i]));
@ -623,7 +623,7 @@ static const uint *QT_FASTCALL convertRGBA8888FromARGB32PM(uint *buffer, const u
} }
static const uint *QT_FASTCALL convertRGBXFromRGB32(uint *buffer, const uint *src, int count, static const uint *QT_FASTCALL convertRGBXFromRGB32(uint *buffer, const uint *src, int count,
const QPixelLayout *, const QRgb *) const QVector<QRgb> *, QDitherInfo *)
{ {
for (int i = 0; i < count; ++i) for (int i = 0; i < count; ++i)
buffer[i] = ARGB2RGBA(0xff000000 | src[i]); buffer[i] = ARGB2RGBA(0xff000000 | src[i]);
@ -631,7 +631,7 @@ static const uint *QT_FASTCALL convertRGBXFromRGB32(uint *buffer, const uint *sr
} }
static const uint *QT_FASTCALL convertRGBXFromARGB32PM(uint *buffer, const uint *src, int count, static const uint *QT_FASTCALL convertRGBXFromARGB32PM(uint *buffer, const uint *src, int count,
const QPixelLayout *, const QRgb *) const QVector<QRgb> *, QDitherInfo *)
{ {
for (int i = 0; i < count; ++i) for (int i = 0; i < count; ++i)
buffer[i] = ARGB2RGBA(0xff000000 | qUnpremultiply(src[i])); buffer[i] = ARGB2RGBA(0xff000000 | qUnpremultiply(src[i]));
@ -640,7 +640,7 @@ static const uint *QT_FASTCALL convertRGBXFromARGB32PM(uint *buffer, const uint
template<QtPixelOrder PixelOrder> template<QtPixelOrder PixelOrder>
static const uint *QT_FASTCALL convertA2RGB30PMToARGB32PM(uint *buffer, const uint *src, int count, static const uint *QT_FASTCALL convertA2RGB30PMToARGB32PM(uint *buffer, const uint *src, int count,
const QPixelLayout *, const QRgb *) const QVector<QRgb> *, QDitherInfo *)
{ {
for (int i = 0; i < count; ++i) for (int i = 0; i < count; ++i)
buffer[i] = qConvertA2rgb30ToArgb32<PixelOrder>(src[i]); buffer[i] = qConvertA2rgb30ToArgb32<PixelOrder>(src[i]);
@ -693,7 +693,7 @@ static inline void qConvertA2RGB30PMToARGB64PM_sse2(QRgba64 *buffer, const uint
template<QtPixelOrder PixelOrder> template<QtPixelOrder PixelOrder>
static const QRgba64 *QT_FASTCALL convertA2RGB30PMToARGB64PM(QRgba64 *buffer, const uint *src, int count, static const QRgba64 *QT_FASTCALL convertA2RGB30PMToARGB64PM(QRgba64 *buffer, const uint *src, int count,
const QPixelLayout *, const QRgb *) const QVector<QRgb> *, QDitherInfo *)
{ {
#ifdef __SSE2__ #ifdef __SSE2__
qConvertA2RGB30PMToARGB64PM_sse2<PixelOrder>(buffer, src, count); qConvertA2RGB30PMToARGB64PM_sse2<PixelOrder>(buffer, src, count);
@ -706,7 +706,7 @@ static const QRgba64 *QT_FASTCALL convertA2RGB30PMToARGB64PM(QRgba64 *buffer, co
template<QtPixelOrder PixelOrder> template<QtPixelOrder PixelOrder>
static const uint *QT_FASTCALL convertA2RGB30PMFromARGB32PM(uint *buffer, const uint *src, int count, static const uint *QT_FASTCALL convertA2RGB30PMFromARGB32PM(uint *buffer, const uint *src, int count,
const QPixelLayout *, const QRgb *) const QVector<QRgb> *, QDitherInfo *)
{ {
for (int i = 0; i < count; ++i) for (int i = 0; i < count; ++i)
buffer[i] = qConvertArgb32ToA2rgb30<PixelOrder>(src[i]); buffer[i] = qConvertArgb32ToA2rgb30<PixelOrder>(src[i]);
@ -715,7 +715,7 @@ static const uint *QT_FASTCALL convertA2RGB30PMFromARGB32PM(uint *buffer, const
template<QtPixelOrder PixelOrder> template<QtPixelOrder PixelOrder>
static const uint *QT_FASTCALL convertRGB30FromRGB32(uint *buffer, const uint *src, int count, static const uint *QT_FASTCALL convertRGB30FromRGB32(uint *buffer, const uint *src, int count,
const QPixelLayout *, const QRgb *) const QVector<QRgb> *, QDitherInfo *)
{ {
for (int i = 0; i < count; ++i) for (int i = 0; i < count; ++i)
buffer[i] = qConvertRgb32ToRgb30<PixelOrder>(src[i]); buffer[i] = qConvertRgb32ToRgb30<PixelOrder>(src[i]);
@ -724,7 +724,7 @@ static const uint *QT_FASTCALL convertRGB30FromRGB32(uint *buffer, const uint *s
template<QtPixelOrder PixelOrder> template<QtPixelOrder PixelOrder>
static const uint *QT_FASTCALL convertRGB30FromARGB32PM(uint *buffer, const uint *src, int count, static const uint *QT_FASTCALL convertRGB30FromARGB32PM(uint *buffer, const uint *src, int count,
const QPixelLayout *, const QRgb *) const QVector<QRgb> *, QDitherInfo *)
{ {
for (int i = 0; i < count; ++i) for (int i = 0; i < count; ++i)
buffer[i] = qConvertRgb32ToRgb30<PixelOrder>(qUnpremultiply(src[i])); buffer[i] = qConvertRgb32ToRgb30<PixelOrder>(qUnpremultiply(src[i]));
@ -732,7 +732,7 @@ static const uint *QT_FASTCALL convertRGB30FromARGB32PM(uint *buffer, const uint
} }
static const uint *QT_FASTCALL convertAlpha8FromARGB32PM(uint *buffer, const uint *src, int count, static const uint *QT_FASTCALL convertAlpha8FromARGB32PM(uint *buffer, const uint *src, int count,
const QPixelLayout *, const QRgb *) const QVector<QRgb> *, QDitherInfo *)
{ {
for (int i = 0; i < count; ++i) for (int i = 0; i < count; ++i)
buffer[i] = qAlpha(src[i]); buffer[i] = qAlpha(src[i]);
@ -740,7 +740,7 @@ static const uint *QT_FASTCALL convertAlpha8FromARGB32PM(uint *buffer, const uin
} }
static const uint *QT_FASTCALL convertGrayscale8FromRGB32(uint *buffer, const uint *src, int count, static const uint *QT_FASTCALL convertGrayscale8FromRGB32(uint *buffer, const uint *src, int count,
const QPixelLayout *, const QRgb *) const QVector<QRgb> *, QDitherInfo *)
{ {
for (int i = 0; i < count; ++i) for (int i = 0; i < count; ++i)
buffer[i] = qGray(src[i]); buffer[i] = qGray(src[i]);
@ -748,7 +748,7 @@ static const uint *QT_FASTCALL convertGrayscale8FromRGB32(uint *buffer, const ui
} }
static const uint *QT_FASTCALL convertGrayscale8FromARGB32PM(uint *buffer, const uint *src, int count, static const uint *QT_FASTCALL convertGrayscale8FromARGB32PM(uint *buffer, const uint *src, int count,
const QPixelLayout *, const QRgb *) const QVector<QRgb> *, QDitherInfo *)
{ {
for (int i = 0; i < count; ++i) for (int i = 0; i < count; ++i)
buffer[i] = qGray(qUnpremultiply(src[i])); buffer[i] = qGray(qUnpremultiply(src[i]));
@ -1037,7 +1037,7 @@ static uint *QT_FASTCALL destFetch(uint *buffer, QRasterBuffer *rasterBuffer, in
{ {
const QPixelLayout *layout = &qPixelLayouts[rasterBuffer->format]; const QPixelLayout *layout = &qPixelLayouts[rasterBuffer->format];
const uint *ptr = qFetchPixels[layout->bpp](buffer, rasterBuffer->scanLine(y), x, length); const uint *ptr = qFetchPixels[layout->bpp](buffer, rasterBuffer->scanLine(y), x, length);
return const_cast<uint *>(layout->convertToARGB32PM(buffer, ptr, length, layout, 0)); return const_cast<uint *>(layout->convertToARGB32PM(buffer, ptr, length, 0, 0));
} }
static QRgba64 *QT_FASTCALL destFetch64(QRgba64 *buffer, QRasterBuffer *rasterBuffer, int x, int y, int length) static QRgba64 *QT_FASTCALL destFetch64(QRgba64 *buffer, QRasterBuffer *rasterBuffer, int x, int y, int length)
@ -1045,14 +1045,14 @@ static QRgba64 *QT_FASTCALL destFetch64(QRgba64 *buffer, QRasterBuffer *rasterBu
const QPixelLayout *layout = &qPixelLayouts[rasterBuffer->format]; const QPixelLayout *layout = &qPixelLayouts[rasterBuffer->format];
uint buffer32[buffer_size]; uint buffer32[buffer_size];
const uint *ptr = qFetchPixels[layout->bpp](buffer32, rasterBuffer->scanLine(y), x, length); const uint *ptr = qFetchPixels[layout->bpp](buffer32, rasterBuffer->scanLine(y), x, length);
return const_cast<QRgba64 *>(layout->convertToARGB64PM(buffer, ptr, length, layout, 0)); return const_cast<QRgba64 *>(layout->convertToARGB64PM(buffer, ptr, length, 0, 0));
} }
static QRgba64 *QT_FASTCALL destFetch64uint32(QRgba64 *buffer, QRasterBuffer *rasterBuffer, int x, int y, int length) static QRgba64 *QT_FASTCALL destFetch64uint32(QRgba64 *buffer, QRasterBuffer *rasterBuffer, int x, int y, int length)
{ {
const QPixelLayout *layout = &qPixelLayouts[rasterBuffer->format]; const QPixelLayout *layout = &qPixelLayouts[rasterBuffer->format];
const uint *src = ((const uint *)rasterBuffer->scanLine(y)) + x; const uint *src = ((const uint *)rasterBuffer->scanLine(y)) + x;
return const_cast<QRgba64 *>(layout->convertToARGB64PM(buffer, src, length, layout, 0)); return const_cast<QRgba64 *>(layout->convertToARGB64PM(buffer, src, length, 0, 0));
} }
static DestFetchProc destFetchProc[QImage::NImageFormats] = static DestFetchProc destFetchProc[QImage::NImageFormats] =
@ -1219,9 +1219,9 @@ static void QT_FASTCALL destStore(QRasterBuffer *rasterBuffer, int x, int y, con
int l = qMin(length, buffer_size); int l = qMin(length, buffer_size);
const uint *ptr = 0; const uint *ptr = 0;
if (!layout->premultiplied && !layout->alphaWidth) if (!layout->premultiplied && !layout->alphaWidth)
ptr = layout->convertFromRGB32(buf, buffer, l, layout, 0); ptr = layout->convertFromRGB32(buf, buffer, l, 0, 0);
else else
ptr = layout->convertFromARGB32PM(buf, buffer, l, layout, 0); ptr = layout->convertFromARGB32PM(buf, buffer, l, 0, 0);
store(dest, ptr, x, l); store(dest, ptr, x, l);
length -= l; length -= l;
buffer += l; buffer += l;
@ -1247,9 +1247,9 @@ static void QT_FASTCALL destStore64(QRasterBuffer *rasterBuffer, int x, int y, c
const uint *ptr = 0; const uint *ptr = 0;
convertFromRgb64(buf, buffer, l); convertFromRgb64(buf, buffer, l);
if (!layout->premultiplied && !layout->alphaWidth) if (!layout->premultiplied && !layout->alphaWidth)
ptr = layout->convertFromRGB32(buf, buf, l, layout, 0); ptr = layout->convertFromRGB32(buf, buf, l, 0, 0);
else else
ptr = layout->convertFromARGB32PM(buf, buf, l, layout, 0); ptr = layout->convertFromARGB32PM(buf, buf, l, 0, 0);
store(dest, ptr, x, l); store(dest, ptr, x, l);
length -= l; length -= l;
buffer += l; buffer += l;
@ -1436,8 +1436,7 @@ static const uint *QT_FASTCALL fetchUntransformed(uint *buffer, const Operator *
{ {
const QPixelLayout *layout = &qPixelLayouts[data->texture.format]; const QPixelLayout *layout = &qPixelLayouts[data->texture.format];
const uint *ptr = qFetchPixels[layout->bpp](buffer, data->texture.scanLine(y), x, length); const uint *ptr = qFetchPixels[layout->bpp](buffer, data->texture.scanLine(y), x, length);
const QRgb *clut = data->texture.colorTable ? data->texture.colorTable->constData() : 0; return layout->convertToARGB32PM(buffer, ptr, length, data->texture.colorTable, 0);
return layout->convertToARGB32PM(buffer, ptr, length, layout, clut);
} }
static const uint *QT_FASTCALL fetchUntransformedARGB32PM(uint *, const Operator *, static const uint *QT_FASTCALL fetchUntransformedARGB32PM(uint *, const Operator *,
@ -1465,14 +1464,13 @@ static const QRgba64 *QT_FASTCALL fetchUntransformed64(QRgba64 *buffer, const Op
const QSpanData *data, int y, int x, int length) const QSpanData *data, int y, int x, int length)
{ {
const QPixelLayout *layout = &qPixelLayouts[data->texture.format]; const QPixelLayout *layout = &qPixelLayouts[data->texture.format];
const QRgb *clut = data->texture.colorTable ? data->texture.colorTable->constData() : 0;
if (layout->bpp != QPixelLayout::BPP32) { if (layout->bpp != QPixelLayout::BPP32) {
uint buffer32[buffer_size]; uint buffer32[buffer_size];
const uint *ptr = qFetchPixels[layout->bpp](buffer32, data->texture.scanLine(y), x, length); const uint *ptr = qFetchPixels[layout->bpp](buffer32, data->texture.scanLine(y), x, length);
return layout->convertToARGB64PM(buffer, ptr, length, layout, clut); return layout->convertToARGB64PM(buffer, ptr, length, data->texture.colorTable, 0);
} else { } else {
const uint *src = (const uint *)data->texture.scanLine(y) + x; const uint *src = (const uint *)data->texture.scanLine(y) + x;
return layout->convertToARGB64PM(buffer, src, length, layout, clut); return layout->convertToARGB64PM(buffer, src, length, data->texture.colorTable, 0);
} }
} }
@ -1639,8 +1637,7 @@ static const uint *QT_FASTCALL fetchTransformed(uint *buffer, const Operator *,
++b; ++b;
} }
} }
const QRgb *clut = data->texture.colorTable ? data->texture.colorTable->constData() : 0; return layout->convertToARGB32PM(buffer, buffer, length, data->texture.colorTable, 0);
return layout->convertToARGB32PM(buffer, buffer, length, layout, clut);
} }
template<TextureBlendType blendType> /* either BlendTransformed or BlendTransformedTiled */ template<TextureBlendType blendType> /* either BlendTransformed or BlendTransformedTiled */
@ -1655,7 +1652,7 @@ static const QRgba64 *QT_FASTCALL fetchTransformed64(QRgba64 *buffer, const Oper
const QPixelLayout *layout = &qPixelLayouts[data->texture.format]; const QPixelLayout *layout = &qPixelLayouts[data->texture.format];
FetchPixelFunc fetch = qFetchPixel[layout->bpp]; FetchPixelFunc fetch = qFetchPixel[layout->bpp];
const QRgb *clut = data->texture.colorTable ? data->texture.colorTable->constData() : 0; const QVector<QRgb> *clut = data->texture.colorTable;
uint buffer32[buffer_size]; uint buffer32[buffer_size];
QRgba64 *b = buffer; QRgba64 *b = buffer;
@ -1672,7 +1669,7 @@ static const QRgba64 *QT_FASTCALL fetchTransformed64(QRgba64 *buffer, const Oper
int i = 0, j = 0; int i = 0, j = 0;
while (i < length) { while (i < length) {
if (j == buffer_size) { if (j == buffer_size) {
layout->convertToARGB64PM(b, buffer32, buffer_size, layout, clut); layout->convertToARGB64PM(b, buffer32, buffer_size, clut, 0);
b += buffer_size; b += buffer_size;
j = 0; j = 0;
} }
@ -1695,7 +1692,7 @@ static const QRgba64 *QT_FASTCALL fetchTransformed64(QRgba64 *buffer, const Oper
++i; ++j; ++i; ++j;
} }
if (j > 0) { if (j > 0) {
layout->convertToARGB64PM(b, buffer32, j, layout, clut); layout->convertToARGB64PM(b, buffer32, j, clut, 0);
b += j; b += j;
} }
} else { } else {
@ -1710,7 +1707,7 @@ static const QRgba64 *QT_FASTCALL fetchTransformed64(QRgba64 *buffer, const Oper
int i = 0, j = 0; int i = 0, j = 0;
while (i < length) { while (i < length) {
if (j == buffer_size) { if (j == buffer_size) {
layout->convertToARGB64PM(b, buffer32, buffer_size, layout, clut); layout->convertToARGB64PM(b, buffer32, buffer_size, clut, 0);
b += buffer_size; b += buffer_size;
j = 0; j = 0;
} }
@ -1741,7 +1738,7 @@ static const QRgba64 *QT_FASTCALL fetchTransformed64(QRgba64 *buffer, const Oper
++i; ++j; ++i; ++j;
} }
if (j > 0) { if (j > 0) {
layout->convertToARGB64PM(b, buffer32, j, layout, clut); layout->convertToARGB64PM(b, buffer32, j, clut, 0);
b += j; b += j;
} }
} }
@ -2423,7 +2420,7 @@ static const uint *QT_FASTCALL fetchTransformedBilinear(uint *buffer, const Oper
const QSpanData *data, int y, int x, int length) const QSpanData *data, int y, int x, int length)
{ {
const QPixelLayout *layout = &qPixelLayouts[data->texture.format]; const QPixelLayout *layout = &qPixelLayouts[data->texture.format];
const QRgb *clut = data->texture.colorTable ? data->texture.colorTable->constData() : 0; const QVector<QRgb> *clut = data->texture.colorTable;
int image_width = data->texture.width; int image_width = data->texture.width;
int image_height = data->texture.height; int image_height = data->texture.height;
@ -2479,9 +2476,9 @@ static const uint *QT_FASTCALL fetchTransformedBilinear(uint *buffer, const Oper
int len2 = qMin(x, count - len1); int len2 = qMin(x, count - len1);
ptr1 = fetch(buf1, s1, x, len1); ptr1 = fetch(buf1, s1, x, len1);
ptr1 = layout->convertToARGB32PM(buf1, ptr1, len1, layout, clut); ptr1 = layout->convertToARGB32PM(buf1, ptr1, len1, clut, 0);
ptr2 = fetch(buf2, s2, x, len1); ptr2 = fetch(buf2, s2, x, len1);
ptr2 = layout->convertToARGB32PM(buf2, ptr2, len1, layout, clut); ptr2 = layout->convertToARGB32PM(buf2, ptr2, len1, clut, 0);
for (int i = 0; i < len1; ++i) { for (int i = 0; i < len1; ++i) {
uint t = ptr1[i]; uint t = ptr1[i];
uint b = ptr2[i]; uint b = ptr2[i];
@ -2491,9 +2488,9 @@ static const uint *QT_FASTCALL fetchTransformedBilinear(uint *buffer, const Oper
if (len2) { if (len2) {
ptr1 = fetch(buf1 + len1, s1, 0, len2); ptr1 = fetch(buf1 + len1, s1, 0, len2);
ptr1 = layout->convertToARGB32PM(buf1 + len1, ptr1, len2, layout, clut); ptr1 = layout->convertToARGB32PM(buf1 + len1, ptr1, len2, clut, 0);
ptr2 = fetch(buf2 + len1, s2, 0, len2); ptr2 = fetch(buf2 + len1, s2, 0, len2);
ptr2 = layout->convertToARGB32PM(buf2 + len1, ptr2, len2, layout, clut); ptr2 = layout->convertToARGB32PM(buf2 + len1, ptr2, len2, clut, 0);
for (int i = 0; i < len2; ++i) { for (int i = 0; i < len2; ++i) {
uint t = ptr1[i]; uint t = ptr1[i];
uint b = ptr2[i]; uint b = ptr2[i];
@ -2512,9 +2509,9 @@ static const uint *QT_FASTCALL fetchTransformedBilinear(uint *buffer, const Oper
int leading = start - x; int leading = start - x;
ptr1 = fetch(buf1 + leading, s1, start, len); ptr1 = fetch(buf1 + leading, s1, start, len);
ptr1 = layout->convertToARGB32PM(buf1 + leading, ptr1, len, layout, clut); ptr1 = layout->convertToARGB32PM(buf1 + leading, ptr1, len, clut, 0);
ptr2 = fetch(buf2 + leading, s2, start, len); ptr2 = fetch(buf2 + leading, s2, start, len);
ptr2 = layout->convertToARGB32PM(buf2 + leading, ptr2, len, layout, clut); ptr2 = layout->convertToARGB32PM(buf2 + leading, ptr2, len, clut, 0);
for (int i = 0; i < len; ++i) { for (int i = 0; i < len; ++i) {
uint t = ptr1[i]; uint t = ptr1[i];
@ -2576,8 +2573,8 @@ static const uint *QT_FASTCALL fetchTransformedBilinear(uint *buffer, const Oper
fx += fdx; fx += fdx;
} }
layout->convertToARGB32PM(buf1, buf1, len * 2, layout, clut); layout->convertToARGB32PM(buf1, buf1, len * 2, clut, 0);
layout->convertToARGB32PM(buf2, buf2, len * 2, layout, clut); layout->convertToARGB32PM(buf2, buf2, len * 2, clut, 0);
if ((fdx < 0 && fdx > -(fixed_scale / 8)) || std::abs(data->m22) < (1./8.)) { // scale up more than 8x if ((fdx < 0 && fdx > -(fixed_scale / 8)) || std::abs(data->m22) < (1./8.)) { // scale up more than 8x
int disty = (fy & 0x0000ffff) >> 8; int disty = (fy & 0x0000ffff) >> 8;
@ -2638,8 +2635,8 @@ static const uint *QT_FASTCALL fetchTransformedBilinear(uint *buffer, const Oper
fx += fdx; fx += fdx;
fy += fdy; fy += fdy;
} }
layout->convertToARGB32PM(buf1, buf1, len * 2, layout, clut); layout->convertToARGB32PM(buf1, buf1, len * 2, clut, 0);
layout->convertToARGB32PM(buf2, buf2, len * 2, layout, clut); layout->convertToARGB32PM(buf2, buf2, len * 2, clut, 0);
if (std::abs(data->m11) > 8 || std::abs(data->m22) > 8) { if (std::abs(data->m11) > 8 || std::abs(data->m22) > 8) {
//if we are zooming more than 8 times, we use 8bit precision for the position. //if we are zooming more than 8 times, we use 8bit precision for the position.
@ -2730,8 +2727,8 @@ static const uint *QT_FASTCALL fetchTransformedBilinear(uint *buffer, const Oper
fw += fdw; fw += fdw;
} }
layout->convertToARGB32PM(buf1, buf1, len * 2, layout, clut); layout->convertToARGB32PM(buf1, buf1, len * 2, clut, 0);
layout->convertToARGB32PM(buf2, buf2, len * 2, layout, clut); layout->convertToARGB32PM(buf2, buf2, len * 2, clut, 0);
for (int i = 0; i < len; ++i) { for (int i = 0; i < len; ++i) {
int distx = distxs[i]; int distx = distxs[i];
@ -2752,7 +2749,7 @@ static const QRgba64 *QT_FASTCALL fetchTransformedBilinear64(QRgba64 *buffer, co
const QSpanData *data, int y, int x, int length) const QSpanData *data, int y, int x, int length)
{ {
const QPixelLayout *layout = &qPixelLayouts[data->texture.format]; const QPixelLayout *layout = &qPixelLayouts[data->texture.format];
const QRgb *clut = data->texture.colorTable ? data->texture.colorTable->constData() : 0; const QVector<QRgb> *clut = data->texture.colorTable;
int image_width = data->texture.width; int image_width = data->texture.width;
int image_height = data->texture.height; int image_height = data->texture.height;
@ -2863,9 +2860,9 @@ static const QRgba64 *QT_FASTCALL fetchTransformedBilinear64(QRgba64 *buffer, co
fx += fdx; fx += fdx;
} }
layout->convertToARGB64PM(buf1, sbuf1, len * 2, layout, clut); layout->convertToARGB64PM(buf1, sbuf1, len * 2, clut, 0);
if (disty) if (disty)
layout->convertToARGB64PM(buf2, sbuf2, len * 2, layout, clut); layout->convertToARGB64PM(buf2, sbuf2, len * 2, clut, 0);
for (int i = 0; i < len; ++i) { for (int i = 0; i < len; ++i) {
int distx = (fracX & 0x0000ffff); int distx = (fracX & 0x0000ffff);
@ -3001,8 +2998,8 @@ static const QRgba64 *QT_FASTCALL fetchTransformedBilinear64(QRgba64 *buffer, co
fx += fdx; fx += fdx;
fy += fdy; fy += fdy;
} }
layout->convertToARGB64PM(buf1, sbuf1, len * 2, layout, clut); layout->convertToARGB64PM(buf1, sbuf1, len * 2, clut, 0);
layout->convertToARGB64PM(buf2, sbuf2, len * 2, layout, clut); layout->convertToARGB64PM(buf2, sbuf2, len * 2, clut, 0);
for (int i = 0; i < len; ++i) { for (int i = 0; i < len; ++i) {
int distx = (fracX & 0x0000ffff); int distx = (fracX & 0x0000ffff);
@ -3073,8 +3070,8 @@ static const QRgba64 *QT_FASTCALL fetchTransformedBilinear64(QRgba64 *buffer, co
fw += fdw; fw += fdw;
} }
layout->convertToARGB64PM(buf1, sbuf1, len * 2, layout, clut); layout->convertToARGB64PM(buf1, sbuf1, len * 2, clut, 0);
layout->convertToARGB64PM(buf2, sbuf2, len * 2, layout, clut); layout->convertToARGB64PM(buf2, sbuf2, len * 2, clut, 0);
for (int i = 0; i < len; ++i) { for (int i = 0; i < len; ++i) {
int distx = distxs[i]; int distx = distxs[i];
@ -6321,7 +6318,7 @@ void qt_memfill32(quint32 *dest, quint32 color, int count)
#endif #endif
#ifdef QT_COMPILER_SUPPORTS_SSE4_1 #ifdef QT_COMPILER_SUPPORTS_SSE4_1
template<QtPixelOrder> const uint *QT_FASTCALL convertA2RGB30PMFromARGB32PM_sse4(uint *buffer, const uint *src, int count, const QPixelLayout *, const QRgb *); template<QtPixelOrder> const uint *QT_FASTCALL convertA2RGB30PMFromARGB32PM_sse4(uint *buffer, const uint *src, int count, const QVector<QRgb> *, QDitherInfo *);
#endif #endif
extern void qInitBlendFunctions(); extern void qInitBlendFunctions();
@ -6397,14 +6394,19 @@ static void qInitDrawhelperFunctions()
#if defined(QT_COMPILER_SUPPORTS_SSE4_1) #if defined(QT_COMPILER_SUPPORTS_SSE4_1)
if (qCpuHasFeature(SSE4_1)) { if (qCpuHasFeature(SSE4_1)) {
#if !defined(__SSE4_1__) #if !defined(__SSE4_1__)
extern const uint *QT_FASTCALL convertARGB32ToARGB32PM_sse4(uint *buffer, const uint *src, int count, const QPixelLayout *, const QRgb *); extern const uint *QT_FASTCALL convertARGB32ToARGB32PM_sse4(uint *buffer, const uint *src, int count,
extern const uint *QT_FASTCALL convertRGBA8888ToARGB32PM_sse4(uint *buffer, const uint *src, int count, const QPixelLayout *, const QRgb *); const QVector<QRgb> *, QDitherInfo *);
extern const uint *QT_FASTCALL convertRGBA8888ToARGB32PM_sse4(uint *buffer, const uint *src, int count,
const QVector<QRgb> *, QDitherInfo *);
qPixelLayouts[QImage::Format_ARGB32].convertToARGB32PM = convertARGB32ToARGB32PM_sse4; qPixelLayouts[QImage::Format_ARGB32].convertToARGB32PM = convertARGB32ToARGB32PM_sse4;
qPixelLayouts[QImage::Format_RGBA8888].convertToARGB32PM = convertRGBA8888ToARGB32PM_sse4; qPixelLayouts[QImage::Format_RGBA8888].convertToARGB32PM = convertRGBA8888ToARGB32PM_sse4;
#endif #endif
extern const uint *QT_FASTCALL convertARGB32FromARGB32PM_sse4(uint *buffer, const uint *src, int count, const QPixelLayout *, const QRgb *); extern const uint *QT_FASTCALL convertARGB32FromARGB32PM_sse4(uint *buffer, const uint *src, int count,
extern const uint *QT_FASTCALL convertRGBA8888FromARGB32PM_sse4(uint *buffer, const uint *src, int count, const QPixelLayout *, const QRgb *); const QVector<QRgb> *, QDitherInfo *);
extern const uint *QT_FASTCALL convertRGBXFromARGB32PM_sse4(uint *buffer, const uint *src, int count, const QPixelLayout *, const QRgb *); extern const uint *QT_FASTCALL convertRGBA8888FromARGB32PM_sse4(uint *buffer, const uint *src, int count,
const QVector<QRgb> *, QDitherInfo *);
extern const uint *QT_FASTCALL convertRGBXFromARGB32PM_sse4(uint *buffer, const uint *src, int count,
const QVector<QRgb> *, QDitherInfo *);
qPixelLayouts[QImage::Format_ARGB32].convertFromARGB32PM = convertARGB32FromARGB32PM_sse4; qPixelLayouts[QImage::Format_ARGB32].convertFromARGB32PM = convertARGB32FromARGB32PM_sse4;
qPixelLayouts[QImage::Format_RGBA8888].convertFromARGB32PM = convertRGBA8888FromARGB32PM_sse4; qPixelLayouts[QImage::Format_RGBA8888].convertFromARGB32PM = convertRGBA8888FromARGB32PM_sse4;
qPixelLayouts[QImage::Format_RGBX8888].convertFromARGB32PM = convertRGBXFromARGB32PM_sse4; qPixelLayouts[QImage::Format_RGBX8888].convertFromARGB32PM = convertRGBXFromARGB32PM_sse4;
@ -6415,8 +6417,10 @@ static void qInitDrawhelperFunctions()
#if defined(QT_COMPILER_SUPPORTS_AVX2) && !defined(__AVX2__) #if defined(QT_COMPILER_SUPPORTS_AVX2) && !defined(__AVX2__)
if (qCpuHasFeature(AVX2)) { if (qCpuHasFeature(AVX2)) {
extern const uint *QT_FASTCALL convertARGB32ToARGB32PM_avx2(uint *buffer, const uint *src, int count, const QPixelLayout *, const QRgb *); extern const uint *QT_FASTCALL convertARGB32ToARGB32PM_avx2(uint *buffer, const uint *src, int count,
extern const uint *QT_FASTCALL convertRGBA8888ToARGB32PM_avx2(uint *buffer, const uint *src, int count, const QPixelLayout *, const QRgb *); const QVector<QRgb> *, QDitherInfo *);
extern const uint *QT_FASTCALL convertRGBA8888ToARGB32PM_avx2(uint *buffer, const uint *src, int count,
const QVector<QRgb> *, QDitherInfo *);
qPixelLayouts[QImage::Format_ARGB32].convertToARGB32PM = convertARGB32ToARGB32PM_avx2; qPixelLayouts[QImage::Format_ARGB32].convertToARGB32PM = convertARGB32ToARGB32PM_avx2;
qPixelLayouts[QImage::Format_RGBA8888].convertToARGB32PM = convertRGBA8888ToARGB32PM_avx2; qPixelLayouts[QImage::Format_RGBA8888].convertToARGB32PM = convertRGBA8888ToARGB32PM_avx2;
} }

View File

@ -44,13 +44,13 @@
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
const uint *QT_FASTCALL convertARGB32ToARGB32PM_avx2(uint *buffer, const uint *src, int count, const uint *QT_FASTCALL convertARGB32ToARGB32PM_avx2(uint *buffer, const uint *src, int count,
const QPixelLayout *, const QRgb *) const QVector<QRgb> *, QDitherInfo *)
{ {
return qt_convertARGB32ToARGB32PM(buffer, src, count); return qt_convertARGB32ToARGB32PM(buffer, src, count);
} }
const uint *QT_FASTCALL convertRGBA8888ToARGB32PM_avx2(uint *buffer, const uint *src, int count, const uint *QT_FASTCALL convertRGBA8888ToARGB32PM_avx2(uint *buffer, const uint *src, int count,
const QPixelLayout *, const QRgb *) const QVector<QRgb> *, QDitherInfo *)
{ {
return qt_convertRGBA8888ToARGB32PM(buffer, src, count); return qt_convertRGBA8888ToARGB32PM(buffer, src, count);
} }

View File

@ -1171,11 +1171,12 @@ inline int comp_func_Plus_one_pixel(uint d, const uint s)
#undef MIX #undef MIX
#undef AMIX #undef AMIX
struct QPixelLayout; struct QDitherInfo;
typedef const uint *(QT_FASTCALL *ConvertFunc)(uint *buffer, const uint *src, int count, typedef const uint *(QT_FASTCALL *ConvertFunc)(uint *buffer, const uint *src, int count,
const QPixelLayout *layout, const QRgb *clut); const QVector<QRgb> *clut, QDitherInfo *dither);
typedef const QRgba64 *(QT_FASTCALL *ConvertFunc64)(QRgba64 *buffer, const uint *src, int count, typedef const QRgba64 *(QT_FASTCALL *ConvertFunc64)(QRgba64 *buffer, const uint *src, int count,
const QPixelLayout *layout, const QRgb *clut); const QVector<QRgb> *clut, QDitherInfo *dither);
struct QPixelLayout struct QPixelLayout
{ {

View File

@ -45,19 +45,19 @@
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
const uint *QT_FASTCALL convertARGB32ToARGB32PM_sse4(uint *buffer, const uint *src, int count, const uint *QT_FASTCALL convertARGB32ToARGB32PM_sse4(uint *buffer, const uint *src, int count,
const QPixelLayout *, const QRgb *) const QVector<QRgb> *, QDitherInfo *)
{ {
return qt_convertARGB32ToARGB32PM(buffer, src, count); return qt_convertARGB32ToARGB32PM(buffer, src, count);
} }
const uint *QT_FASTCALL convertRGBA8888ToARGB32PM_sse4(uint *buffer, const uint *src, int count, const uint *QT_FASTCALL convertRGBA8888ToARGB32PM_sse4(uint *buffer, const uint *src, int count,
const QPixelLayout *, const QRgb *) const QVector<QRgb> *, QDitherInfo *)
{ {
return qt_convertRGBA8888ToARGB32PM(buffer, src, count); return qt_convertRGBA8888ToARGB32PM(buffer, src, count);
} }
const uint *QT_FASTCALL convertARGB32FromARGB32PM_sse4(uint *buffer, const uint *src, int count, const uint *QT_FASTCALL convertARGB32FromARGB32PM_sse4(uint *buffer, const uint *src, int count,
const QPixelLayout *, const QRgb *) const QVector<QRgb> *, QDitherInfo *)
{ {
for (int i = 0; i < count; ++i) for (int i = 0; i < count; ++i)
buffer[i] = qUnpremultiply_sse4(src[i]); buffer[i] = qUnpremultiply_sse4(src[i]);
@ -65,7 +65,7 @@ const uint *QT_FASTCALL convertARGB32FromARGB32PM_sse4(uint *buffer, const uint
} }
const uint *QT_FASTCALL convertRGBA8888FromARGB32PM_sse4(uint *buffer, const uint *src, int count, const uint *QT_FASTCALL convertRGBA8888FromARGB32PM_sse4(uint *buffer, const uint *src, int count,
const QPixelLayout *, const QRgb *) const QVector<QRgb> *, QDitherInfo *)
{ {
for (int i = 0; i < count; ++i) for (int i = 0; i < count; ++i)
buffer[i] = ARGB2RGBA(qUnpremultiply_sse4(src[i])); buffer[i] = ARGB2RGBA(qUnpremultiply_sse4(src[i]));
@ -73,7 +73,7 @@ const uint *QT_FASTCALL convertRGBA8888FromARGB32PM_sse4(uint *buffer, const uin
} }
const uint *QT_FASTCALL convertRGBXFromARGB32PM_sse4(uint *buffer, const uint *src, int count, const uint *QT_FASTCALL convertRGBXFromARGB32PM_sse4(uint *buffer, const uint *src, int count,
const QPixelLayout *, const QRgb *) const QVector<QRgb> *, QDitherInfo *)
{ {
for (int i = 0; i < count; ++i) for (int i = 0; i < count; ++i)
buffer[i] = ARGB2RGBA(0xff000000 | qUnpremultiply_sse4(src[i])); buffer[i] = ARGB2RGBA(0xff000000 | qUnpremultiply_sse4(src[i]));
@ -82,7 +82,7 @@ const uint *QT_FASTCALL convertRGBXFromARGB32PM_sse4(uint *buffer, const uint *s
template<QtPixelOrder PixelOrder> template<QtPixelOrder PixelOrder>
const uint *QT_FASTCALL convertA2RGB30PMFromARGB32PM_sse4(uint *buffer, const uint *src, int count, const uint *QT_FASTCALL convertA2RGB30PMFromARGB32PM_sse4(uint *buffer, const uint *src, int count,
const QPixelLayout *, const QRgb *) const QVector<QRgb> *, QDitherInfo *)
{ {
for (int i = 0; i < count; ++i) for (int i = 0; i < count; ++i)
buffer[i] = qConvertArgb32ToA2rgb30_sse4<PixelOrder>(src[i]); buffer[i] = qConvertArgb32ToA2rgb30_sse4<PixelOrder>(src[i]);
@ -91,10 +91,10 @@ const uint *QT_FASTCALL convertA2RGB30PMFromARGB32PM_sse4(uint *buffer, const ui
template template
const uint *QT_FASTCALL convertA2RGB30PMFromARGB32PM_sse4<PixelOrderBGR>(uint *buffer, const uint *src, int count, const uint *QT_FASTCALL convertA2RGB30PMFromARGB32PM_sse4<PixelOrderBGR>(uint *buffer, const uint *src, int count,
const QPixelLayout *, const QRgb *); const QVector<QRgb> *, QDitherInfo *);
template template
const uint *QT_FASTCALL convertA2RGB30PMFromARGB32PM_sse4<PixelOrderRGB>(uint *buffer, const uint *src, int count, const uint *QT_FASTCALL convertA2RGB30PMFromARGB32PM_sse4<PixelOrderRGB>(uint *buffer, const uint *src, int count,
const QPixelLayout *, const QRgb *); const QVector<QRgb> *, QDitherInfo *);
QT_END_NAMESPACE QT_END_NAMESPACE