diff options
author | Allan Sandfeld Jensen <allan.jensen@digia.com> | 2014-05-26 12:07:18 +0200 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@digia.com> | 2014-07-04 14:03:46 +0200 |
commit | 3acd4b546ded7523f65d60cee6f3809113a91a16 (patch) | |
tree | ac526a90c4b39229ea5ec4c80b779ca8a4b66c24 /tests/auto/gui/image | |
parent | 715b41ce48c9dd78eec3223606e9ca5193cf5bad (diff) |
QImage support for RGB30 formats
Adds basic support for 10-bit per color channel formats to QImage
and the XCB plugin. This will make it possible to paint to and from
these formats, but only at 8-bit per color channel accuracy.
This also fixes Qt5 applications on X11 with native 30bit depth.
[ChangeLog][QtGui][QImage] Added support for 10-bit per color channel image formats.
Task-number: QTBUG-25998
Change-Id: I93ccd3c74bfbb0bd94b352476e5fe58a94119e1f
Reviewed-by: Gunnar Sletta <gunnar.sletta@jollamobile.com>
Diffstat (limited to 'tests/auto/gui/image')
-rw-r--r-- | tests/auto/gui/image/qimage/tst_qimage.cpp | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/tests/auto/gui/image/qimage/tst_qimage.cpp b/tests/auto/gui/image/qimage/tst_qimage.cpp index 0a4456e22a..e2135ad6f0 100644 --- a/tests/auto/gui/image/qimage/tst_qimage.cpp +++ b/tests/auto/gui/image/qimage/tst_qimage.cpp @@ -766,6 +766,13 @@ void tst_QImage::convertToFormat_data() << int(QImage::Format_ARGB32_Premultiplied) << 0x7f7f7f7fu; QTest::newRow("semiblack rgba8888 -> argb pm") << int(QImage::Format_RGBA8888) << 0x7f000000u << int(QImage::Format_ARGB32_Premultiplied) << 0x7f000000u; + + QTest::newRow("red rgb30 -> argb32") << int(QImage::Format_RGB30) << 0xffff0000 + << int(QImage::Format_ARGB32) << 0xffff0000; + QTest::newRow("green rgb30 -> argb32") << int(QImage::Format_RGB30) << 0xff00ff00 + << int(QImage::Format_ARGB32) << 0xff00ff00; + QTest::newRow("blue rgb30 -> argb32") << int(QImage::Format_RGB30) << 0xff0000ff + << int(QImage::Format_ARGB32) << 0xff0000ff; } @@ -1218,6 +1225,18 @@ void tst_QImage::setPixel_data() QTest::newRow("RGBA8888 blue") << int(QImage::Format_RGBA8888) << 0xff0000ffu << 0xffff0000u; #endif + QTest::newRow("A2BGR30_Premultiplied red") << int(QImage::Format_A2BGR30_Premultiplied) + << 0xffff0000u << 0xc00003ffu; + QTest::newRow("A2BGR30_Premultiplied green") << int(QImage::Format_A2BGR30_Premultiplied) + << 0xff00ff00u << 0xc00ffc00u; + QTest::newRow("A2BGR30_Premultiplied blue") << int(QImage::Format_A2BGR30_Premultiplied) + << 0xff0000ffu << 0xfff00000u; + QTest::newRow("RGB30 red") << int(QImage::Format_RGB30) + << 0xffff0000u << 0xfff00000u; + QTest::newRow("RGB30 green") << int(QImage::Format_RGB30) + << 0xff00ff00u << 0xc00ffc00u; + QTest::newRow("RGB30 blue") << int(QImage::Format_RGB30) + << 0xff0000ffu << 0xc00003ffu; } void tst_QImage::setPixel() @@ -1244,6 +1263,8 @@ void tst_QImage::setPixel() case int(QImage::Format_RGBX8888): case int(QImage::Format_RGBA8888): case int(QImage::Format_RGBA8888_Premultiplied): + case int(QImage::Format_A2BGR30_Premultiplied): + case int(QImage::Format_RGB30): { for (int y = 0; y < h; ++y) { const quint32 *row = (const quint32*)(img.scanLine(y)); @@ -1963,6 +1984,8 @@ void tst_QImage::fillColor_data() "ARGB4444pm", "RGBx8888", "RGBA8888pm", + "BGR30", + "A2RGB30pm", 0 }; @@ -1982,6 +2005,8 @@ void tst_QImage::fillColor_data() QImage::Format_ARGB4444_Premultiplied, QImage::Format_RGBX8888, QImage::Format_RGBA8888_Premultiplied, + QImage::Format_BGR30, + QImage::Format_A2RGB30_Premultiplied, }; for (int i=0; names[i] != 0; ++i) { @@ -2000,6 +2025,7 @@ void tst_QImage::fillColor_data() QTest::newRow("ARGB32, transparent") << QImage::Format_ARGB32 << Qt::transparent << 0x00000000u; QTest::newRow("ARGB32pm, transparent") << QImage::Format_ARGB32_Premultiplied << Qt::transparent << 0x00000000u; QTest::newRow("RGBA8888pm, transparent") << QImage::Format_RGBA8888_Premultiplied << Qt::transparent << 0x00000000u; + QTest::newRow("A2RGB30pm, transparent") << QImage::Format_A2RGB30_Premultiplied << Qt::transparent << 0x00000000u; } void tst_QImage::fillColor() @@ -2116,6 +2142,8 @@ void tst_QImage::rgbSwapped_data() QTest::newRow("Format_RGB444") << QImage::Format_RGB444; QTest::newRow("Format_RGBX8888") << QImage::Format_RGBX8888; QTest::newRow("Format_RGBA8888_Premultiplied") << QImage::Format_RGBA8888_Premultiplied; + QTest::newRow("Format_A2BGR30_Premultiplied") << QImage::Format_A2BGR30_Premultiplied; + QTest::newRow("Format_RGB30") << QImage::Format_RGB30; } void tst_QImage::rgbSwapped() @@ -2184,6 +2212,8 @@ void tst_QImage::mirrored_data() QTest::newRow("Format_RGB444, vertical") << QImage::Format_RGB444 << true << false << 16 << 16; QTest::newRow("Format_RGBX8888, vertical") << QImage::Format_RGBX8888 << true << false << 16 << 16; QTest::newRow("Format_RGBA8888_Premultiplied, vertical") << QImage::Format_RGBA8888_Premultiplied << true << false << 16 << 16; + QTest::newRow("Format_A2BGR30_Premultiplied, vertical") << QImage::Format_A2BGR30_Premultiplied << true << false << 16 << 16; + QTest::newRow("Format_RGB30, vertical") << QImage::Format_RGB30 << true << false << 16 << 16; QTest::newRow("Format_Indexed8, vertical") << QImage::Format_Indexed8 << true << false << 16 << 16; QTest::newRow("Format_Mono, vertical") << QImage::Format_Mono << true << false << 16 << 16; QTest::newRow("Format_MonoLSB, vertical") << QImage::Format_MonoLSB << true << false << 16 << 16; @@ -2283,6 +2313,7 @@ void tst_QImage::inplaceRgbSwapped_data() QTest::newRow("Format_ARGB32_Premultiplied") << QImage::Format_ARGB32_Premultiplied; QTest::newRow("Format_RGBA8888") << QImage::Format_RGBA8888; + QTest::newRow("Format_A2RGB30_Premultiplied") << QImage::Format_A2RGB30_Premultiplied; QTest::newRow("Format_RGB888") << QImage::Format_RGB888; QTest::newRow("Format_RGB16") << QImage::Format_RGB16; QTest::newRow("Format_Indexed8") << QImage::Format_Indexed8; |