Correct inplace conversion methods from RGBA8888 formats

The methods for inplace conversion from RGBA to ARGB was misplaced by
one step causing conversion to RGB16 to get an invalid method.

Change-Id: I3b2b4cffe993705c48613eec7d9b7c6213f57fc2
Reviewed-by: Gunnar Sletta <gunnar@sletta.org>
This commit is contained in:
Allan Sandfeld Jensen 2015-02-02 11:37:41 +01:00
parent 1b329bfc79
commit 5bd41b850f
2 changed files with 8 additions and 5 deletions

View File

@ -2520,7 +2520,7 @@ InPlace_Image_Converter qimage_inplace_converter_map[QImage::NImageFormats][QIma
0,
0,
0,
0,
convert_RGBA_to_ARGB_inplace,
convert_RGBA_to_ARGB_inplace,
convert_RGBA_to_ARGB_inplace,
0,
@ -2543,7 +2543,6 @@ InPlace_Image_Converter qimage_inplace_converter_map[QImage::NImageFormats][QIma
0,
0,
0,
0,
convert_RGBA_to_ARGB_inplace,
convert_RGBA_to_ARGB_PM_inplace,
0,
@ -2557,6 +2556,7 @@ InPlace_Image_Converter qimage_inplace_converter_map[QImage::NImageFormats][QIma
0,
0,
0,
0,
0, 0, 0, 0
}, // Format_RGBA8888
{
@ -2566,7 +2566,6 @@ InPlace_Image_Converter qimage_inplace_converter_map[QImage::NImageFormats][QIma
0,
0,
0,
0,
convert_RGBA_to_ARGB_inplace,
0,
0,
@ -2579,6 +2578,7 @@ InPlace_Image_Converter qimage_inplace_converter_map[QImage::NImageFormats][QIma
0,
0,
0,
0,
0, 0, 0, 0
}, // Format_RGBA8888_Premultiplied
{

View File

@ -2462,6 +2462,8 @@ void tst_QImage::inplaceConversion_data()
QTest::newRow("Format_RGB666 -> Format_RGB888") << QImage::Format_RGB666 << QImage::Format_RGB888;
QTest::newRow("Format_ARGB8565_Premultiplied, Format_ARGB8555_Premultiplied") << QImage::Format_ARGB8565_Premultiplied << QImage::Format_ARGB8555_Premultiplied;
QTest::newRow("Format_ARGB4444_Premultiplied, Format_RGB444") << QImage::Format_ARGB4444_Premultiplied << QImage::Format_RGB444;
QTest::newRow("Format_RGBA8888 -> RGB16") << QImage::Format_RGBA8888 << QImage::Format_RGB16;
QTest::newRow("Format_RGBA8888_Premultiplied -> RGB16") << QImage::Format_RGBA8888_Premultiplied << QImage::Format_RGB16;
}
void tst_QImage::inplaceConversion()
@ -2480,6 +2482,7 @@ void tst_QImage::inplaceConversion()
const uchar* originalPtr = image.constScanLine(0);
QImage imageConverted = std::move(image).convertToFormat(dest_format);
QCOMPARE(imageConverted.format(), dest_format);
for (int i = 0; i < imageConverted.height(); ++i) {
for (int j = 0; j < imageConverted.width(); ++j) {
QRgb convertedColor = imageConverted.pixel(j,i);
@ -2487,8 +2490,8 @@ void tst_QImage::inplaceConversion()
QCOMPARE(qGreen(convertedColor) & 0xF0, i * 16);
}
}
QCOMPARE(imageConverted.constScanLine(0), originalPtr);
if (image.depth() == imageConverted.depth())
QCOMPARE(imageConverted.constScanLine(0), originalPtr);
#endif
}