Fix grayscale painting regression in 64-bit raster engine

A new define for better vectorized compositioning had a mistake that
caused some sources to be converted to grayscale when composited.

Added two 10 bit per channel formats to the lancelot test to catch
regressions in the future.

Change-Id: I1c468e6b93d68185e517fc0d44c6c927f9f7135f
Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
This commit is contained in:
Allan Sandfeld Jensen 2016-08-03 13:27:38 +02:00 committed by Allan Sandfeld Jensen
parent 8ce18a52f2
commit a9a61d7e0b
3 changed files with 44 additions and 3 deletions

View File

@ -89,11 +89,15 @@ QT_BEGIN_NAMESPACE
#if defined __SSE2__
# define LOAD(ptr) _mm_loadl_epi64(reinterpret_cast<const __m128i *>(ptr))
# define CONVERT(value) _mm_shufflelo_epi16(_mm_cvtsi32_si128(value), _MM_SHUFFLE(0, 0, 0, 0))
#ifdef Q_PROCESSOR_X86_64
# define CONVERT(value) _mm_cvtsi64_si128(value)
#else
# define CONVERT(value) LOAD(&value)
#endif
# define STORE(ptr, value) _mm_storel_epi64(reinterpret_cast<__m128i *>(ptr), value)
# define ADD(p, q) _mm_add_epi32(p, q)
# define ALPHA(c) _mm_shufflelo_epi16(c, _MM_SHUFFLE(3, 3, 3, 3))
# define CONST(n) CONVERT(n)
# define CONST(n) _mm_shufflelo_epi16(_mm_cvtsi32_si128(n), _MM_SHUFFLE(0, 0, 0, 0))
# define INVALPHA(c) _mm_sub_epi32(CONST(65535), ALPHA(c))
#elif defined __ARM_NEON__
# define LOAD(ptr) vreinterpret_u16_u64(vld1_u64(reinterpret_cast<const uint64_t *>(ptr)))

View File

@ -165,7 +165,16 @@ const char *PaintCommands::imageFormatTable[] = {
"Format_ARGB8555_Premultiplied",
"Format_RGB888",
"Format_RGB444",
"Format_ARGB4444_Premultiplied"
"Format_ARGB4444_Premultiplied",
"Format_RGBX8888",
"Format_RGBA8888",
"Format_RGBA8888_Premultiplied",
"Format_BGR30",
"Format_A2BGR30_Premultiplied",
"Format_RGB30",
"Format_A2RGB30_Premultiplied",
"Alpha8",
"Grayscale8",
};
int PaintCommands::translateEnum(const char *table[], const QString &pattern, int limit)

View File

@ -71,6 +71,10 @@ private slots:
void testRasterRGB32();
void testRasterRGB16_data();
void testRasterRGB16();
void testRasterA2RGB30PM_data();
void testRasterA2RGB30PM();
void testRasterBGR30_data();
void testRasterBGR30();
#ifndef QT_NO_OPENGL
void testOpenGL_data();
@ -150,6 +154,30 @@ void tst_Lancelot::testRasterRGB16()
}
void tst_Lancelot::testRasterA2RGB30PM_data()
{
setupTestSuite();
}
void tst_Lancelot::testRasterA2RGB30PM()
{
runTestSuite(Raster, QImage::Format_A2RGB30_Premultiplied);
}
void tst_Lancelot::testRasterBGR30_data()
{
setupTestSuite();
}
void tst_Lancelot::testRasterBGR30()
{
runTestSuite(Raster, QImage::Format_BGR30);
}
#ifndef QT_NO_OPENGL
bool tst_Lancelot::checkSystemGLSupport()
{