summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/gui/image/qimage.cpp4
-rw-r--r--src/gui/image/qimage_sse2.cpp2
-rw-r--r--tests/benchmarks/gui/image/qpixmap/tst_qpixmap.cpp64
3 files changed, 66 insertions, 4 deletions
diff --git a/src/gui/image/qimage.cpp b/src/gui/image/qimage.cpp
index 88a0366..e5930ac 100644
--- a/src/gui/image/qimage.cpp
+++ b/src/gui/image/qimage.cpp
@@ -3735,8 +3735,8 @@ void qInitImageConversions()
#ifdef QT_HAVE_SSE2
if (features & SSE2) {
- extern bool convert_ARGB_to_ARGB_PM_inplace_SSE2(QImageData *data, Qt::ImageConversionFlags);
- inplace_converter_map[QImage::Format_ARGB32][QImage::Format_ARGB32_Premultiplied] = convert_ARGB_to_ARGB_PM_inplace_SSE2;
+ extern bool convert_ARGB_to_ARGB_PM_inplace_sse2(QImageData *data, Qt::ImageConversionFlags);
+ inplace_converter_map[QImage::Format_ARGB32][QImage::Format_ARGB32_Premultiplied] = convert_ARGB_to_ARGB_PM_inplace_sse2;
}
#endif
}
diff --git a/src/gui/image/qimage_sse2.cpp b/src/gui/image/qimage_sse2.cpp
index e2b89b9..82d49a6 100644
--- a/src/gui/image/qimage_sse2.cpp
+++ b/src/gui/image/qimage_sse2.cpp
@@ -49,7 +49,7 @@
QT_BEGIN_NAMESPACE
-bool convert_ARGB_to_ARGB_PM_inplace_SSE2(QImageData *data, Qt::ImageConversionFlags)
+bool convert_ARGB_to_ARGB_PM_inplace_sse2(QImageData *data, Qt::ImageConversionFlags)
{
Q_ASSERT(data->format == QImage::Format_ARGB32);
diff --git a/tests/benchmarks/gui/image/qpixmap/tst_qpixmap.cpp b/tests/benchmarks/gui/image/qpixmap/tst_qpixmap.cpp
index 8e9de4a..27e5025 100644
--- a/tests/benchmarks/gui/image/qpixmap/tst_qpixmap.cpp
+++ b/tests/benchmarks/gui/image/qpixmap/tst_qpixmap.cpp
@@ -40,9 +40,12 @@
****************************************************************************/
#include <qtest.h>
-#include <QPixmap>
#include <QBitmap>
+#include <QDir>
+#include <QImage>
+#include <QImageReader>
#include <QPainter>
+#include <QPixmap>
#include <private/qpixmap_raster_p.h>
class tst_QPixmap : public QObject
@@ -62,6 +65,9 @@ private slots:
void transformed();
void mask_data();
void mask();
+
+ void fromImageReader_data();
+ void fromImageReader();
};
Q_DECLARE_METATYPE(QImage::Format)
@@ -248,6 +254,62 @@ void tst_QPixmap::mask()
}
}
+void tst_QPixmap::fromImageReader_data()
+{
+ const QString tempDir = QDir::tempPath();
+ QTest::addColumn<QString>("filename");
+
+ QImage image(2000, 2000, QImage::Format_ARGB32);
+ image.fill(0);
+ {
+ // Generate an image with opaque and transparent pixels
+ // with an interesting distribution.
+ QPainter painter(&image);
+
+ QRadialGradient radialGrad(QPointF(1000, 1000), 1000);
+ radialGrad.setColorAt(0, QColor(255, 0, 0, 255));
+ radialGrad.setColorAt(0.5, QColor(0, 255, 0, 255));
+ radialGrad.setColorAt(0.9, QColor(0, 0, 255, 100));
+ radialGrad.setColorAt(1, QColor(0, 0, 0, 0));
+
+ painter.fillRect(image.rect(), radialGrad);
+ }
+ image.save("test.png");
+
+ // RGB32
+ const QString rgb32Path = tempDir + QString::fromLatin1("/rgb32.jpg");
+ image.save(rgb32Path);
+ QTest::newRow("gradient RGB32") << rgb32Path;
+
+ // ARGB32
+ const QString argb32Path = tempDir + QString::fromLatin1("/argb32.png");
+ image.save(argb32Path);
+ QTest::newRow("gradient ARGB32") << argb32Path;
+
+ // Indexed 8
+ const QString indexed8Path = tempDir + QString::fromLatin1("/indexed8.gif");
+ image.save(indexed8Path);
+ QTest::newRow("gradient indexed8") << indexed8Path;
+
+}
+
+void tst_QPixmap::fromImageReader()
+{
+ QFETCH(QString, filename);
+ // warmup
+ {
+ QImageReader imageReader(filename);
+ QPixmap::fromImageReader(&imageReader);
+ }
+
+ QBENCHMARK {
+ QImageReader imageReader(filename);
+ QPixmap::fromImageReader(&imageReader);
+ }
+ QFile::remove(filename);
+}
+
+
QTEST_MAIN(tst_QPixmap)
#include "tst_qpixmap.moc"