diff options
author | John Brooks <special@dereferenced.net> | 2010-07-05 19:17:49 (GMT) |
---|---|---|
committer | Benjamin Poulain <benjamin.poulain@nokia.com> | 2010-07-07 09:57:10 (GMT) |
commit | dad8e33546a209820da1f3d07a0e331e001bc23e (patch) | |
tree | 4312cf786a880196e9658df45ee7b1826fbbaa1f /src/gui/image/qimage.cpp | |
parent | 93bcbe213e947843184a75f4b237c8dff45ca866 (diff) | |
download | Qt-dad8e33546a209820da1f3d07a0e331e001bc23e.zip Qt-dad8e33546a209820da1f3d07a0e331e001bc23e.tar.gz Qt-dad8e33546a209820da1f3d07a0e331e001bc23e.tar.bz2 |
SSE2 implementation of convert_ARGB_to_ARGB_PM_inplace for QImage
Merge-request: 725
Reviewed-by: Benjamin Poulain <benjamin.poulain@nokia.com>
Diffstat (limited to 'src/gui/image/qimage.cpp')
-rw-r--r-- | src/gui/image/qimage.cpp | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/src/gui/image/qimage.cpp b/src/gui/image/qimage.cpp index 79f266d..88a0366 100644 --- a/src/gui/image/qimage.cpp +++ b/src/gui/image/qimage.cpp @@ -58,6 +58,7 @@ #include <private/qmemrotate_p.h> #include <private/qpixmapdata_p.h> #include <private/qimagescale_p.h> +#include <private/qsimd_p.h> #include <qhash.h> @@ -209,7 +210,7 @@ QImageData * QImageData::create(const QSize &size, QImage::Format format, int nu break; } - const int bytes_per_line = ((width * depth + 31) >> 5) << 2; // bytes per scanline (must be multiple of 8) + const int bytes_per_line = ((width * depth + 31) >> 5) << 2; // bytes per scanline (must be multiple of 4) // sanity check for potential overflows if (INT_MAX/depth < width @@ -3630,7 +3631,7 @@ static const Image_Converter converter_map[QImage::NImageFormats][QImage::NImage } // Format_ARGB4444_Premultiplied }; -static const InPlace_Image_Converter inplace_converter_map[QImage::NImageFormats][QImage::NImageFormats] = +static InPlace_Image_Converter inplace_converter_map[QImage::NImageFormats][QImage::NImageFormats] = { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 @@ -3727,6 +3728,19 @@ static const InPlace_Image_Converter inplace_converter_map[QImage::NImageFormats } // Format_ARGB4444_Premultiplied }; +void qInitImageConversions() +{ + const uint features = qDetectCPUFeatures(); + Q_UNUSED(features); + +#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; + } +#endif +} + /*! Returns a copy of the image in the given \a format. |