summaryrefslogtreecommitdiffstats
path: root/tests/auto/gui/painting/qcolor/tst_qcolor.cpp
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@theqtcompany.com>2015-04-22 19:22:26 +0000
committerAllan Sandfeld Jensen <allan.jensen@theqtcompany.com>2015-04-23 09:25:28 +0000
commit63d5a42b59149bfdebc9a5a123e7115a813bcaa4 (patch)
tree5a9118f4468e816c3efc2bdfeffaad17c649b03f /tests/auto/gui/painting/qcolor/tst_qcolor.cpp
parent6535912add3444544c9403e5ecb2b8910ec6e2f5 (diff)
Revert "Remove separate SSE4 unpremultiply function"
Could causedSSE4 instructions to be used on non SSE4 machines in cases when qUnpremultiplywas not inlined. This reverts commit 964ccc58534aac436529007000d1c38d76c88834. Change-Id: Ic676ade8f75129e8d37c4d96cbfb2bdb5b794919 Task-number: QTBUG-45741 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'tests/auto/gui/painting/qcolor/tst_qcolor.cpp')
-rw-r--r--tests/auto/gui/painting/qcolor/tst_qcolor.cpp19
1 files changed, 19 insertions, 0 deletions
diff --git a/tests/auto/gui/painting/qcolor/tst_qcolor.cpp b/tests/auto/gui/painting/qcolor/tst_qcolor.cpp
index c34b1639cc..4fafbf9827 100644
--- a/tests/auto/gui/painting/qcolor/tst_qcolor.cpp
+++ b/tests/auto/gui/painting/qcolor/tst_qcolor.cpp
@@ -38,6 +38,7 @@
#include <qcolor.h>
#include <qdebug.h>
+#include <private/qdrawingprimitive_sse2_p.h>
class tst_QColor : public QObject
{
@@ -103,6 +104,7 @@ private slots:
void achromaticHslHue();
void premultiply();
+ void unpremultiply_sse4();
#ifdef Q_DEAD_CODE_FROM_QT4_X11
void setallowX11ColorNames();
@@ -1445,5 +1447,22 @@ void tst_QColor::premultiply()
}
}
+void tst_QColor::unpremultiply_sse4()
+{
+ // Tests that qUnpremultiply_sse4 returns the same as qUnpremultiply.
+#if QT_COMPILER_SUPPORTS_HERE(SSE4_1)
+ if (qCpuHasFeature(SSE4_1)) {
+ for (uint a = 0; a < 256; a++) {
+ for (uint c = 0; c <= a; c++) {
+ QRgb p = qRgba(c, a-c, c, a);
+ QCOMPARE(qUnpremultiply(p), qUnpremultiply_sse4(p));
+ }
+ }
+ return;
+ }
+#endif
+ QSKIP("SSE4 not supported on this CPU.");
+}
+
QTEST_MAIN(tst_QColor)
#include "tst_qcolor.moc"