diff options
author | Liang Qi <liang.qi@theqtcompany.com> | 2015-04-27 21:36:32 +0200 |
---|---|---|
committer | Liang Qi <liang.qi@theqtcompany.com> | 2015-04-27 21:36:32 +0200 |
commit | 1c8451bdbbd6ca909dfc5b96a24be909810522fc (patch) | |
tree | 9cc69a4794e23f7224d75fc2323fc70e294a9454 /src/gui/image | |
parent | 7ebec0fa848de299d4cdee06ccc611ee46494fbf (diff) | |
parent | 0635b1a69dd666f5eed4b096895bd80b1a9420ff (diff) |
Merge remote-tracking branch 'origin/5.5' into dev
Conflicts:
src/tools/qdoc/tree.cpp
tests/auto/gui/painting/qcolor/tst_qcolor.cpp
Change-Id: Iaa78f601a63191fa643aabf853520f913f2f0fdc
Diffstat (limited to 'src/gui/image')
-rw-r--r-- | src/gui/image/qimage.cpp | 12 | ||||
-rw-r--r-- | src/gui/image/qimage_conversions.cpp | 6 | ||||
-rw-r--r-- | src/gui/image/qimage_sse4.cpp | 3 |
3 files changed, 15 insertions, 6 deletions
diff --git a/src/gui/image/qimage.cpp b/src/gui/image/qimage.cpp index cac3d268c5..8373a5556b 100644 --- a/src/gui/image/qimage.cpp +++ b/src/gui/image/qimage.cpp @@ -2924,14 +2924,22 @@ template<class T> inline void do_mirror_data(QImageData *dst, QImageData *src, if (dst == src) { // When mirroring in-place, stop in the middle for one of the directions, since we // are swapping the bytes instead of merely copying. - const int srcXEnd = dstX0 ? w / 2 : w; - const int srcYEnd = !dstX0 && dstY0 ? h / 2 : h; + const int srcXEnd = (dstX0 && !dstY0) ? w / 2 : w; + const int srcYEnd = dstY0 ? h / 2 : h; for (int srcY = 0, dstY = dstY0; srcY < srcYEnd; ++srcY, dstY += dstYIncr) { T *srcPtr = (T *) (src->data + srcY * src->bytes_per_line); T *dstPtr = (T *) (dst->data + dstY * dst->bytes_per_line); for (int srcX = 0, dstX = dstX0; srcX < srcXEnd; ++srcX, dstX += dstXIncr) std::swap(srcPtr[srcX], dstPtr[dstX]); } + // If mirroring both ways, the middle line needs to be mirrored horizontally only. + if (dstX0 && dstY0 && (h & 1)) { + int srcY = h / 2; + int srcXEnd2 = w / 2; + T *srcPtr = (T *) (src->data + srcY * src->bytes_per_line); + for (int srcX = 0, dstX = dstX0; srcX < srcXEnd2; ++srcX, dstX += dstXIncr) + std::swap(srcPtr[srcX], srcPtr[dstX]); + } } else { for (int srcY = 0, dstY = dstY0; srcY < h; ++srcY, dstY += dstYIncr) { T *srcPtr = (T *) (src->data + srcY * src->bytes_per_line); diff --git a/src/gui/image/qimage_conversions.cpp b/src/gui/image/qimage_conversions.cpp index 8cb886e09b..28e3a48689 100644 --- a/src/gui/image/qimage_conversions.cpp +++ b/src/gui/image/qimage_conversions.cpp @@ -117,7 +117,7 @@ static const uint *QT_FASTCALL convertRGB32ToARGB32PM(uint *buffer, const uint * return buffer; } -#if defined(QT_COMPILER_SUPPORTS_SSE4_1) && !defined(__SSE4_1__) +#ifdef QT_COMPILER_SUPPORTS_SSE4_1 extern const uint *QT_FASTCALL convertRGB32FromARGB32PM_sse4(uint *buffer, const uint *src, int count, const QPixelLayout *, const QRgb *); #endif @@ -144,7 +144,7 @@ void convert_generic(QImageData *dest, const QImageData *src, Qt::ImageConversio if (src->format == QImage::Format_RGB32) convertToARGB32PM = convertRGB32ToARGB32PM; if (dest->format == QImage::Format_RGB32) { -#if defined(QT_COMPILER_SUPPORTS_SSE4_1) && !defined(__SSE4_1__) +#ifdef QT_COMPILER_SUPPORTS_SSE4_1 if (qCpuHasFeature(SSE4_1)) convertFromARGB32PM = convertRGB32FromARGB32PM_sse4; else @@ -193,7 +193,7 @@ bool convert_generic_inplace(QImageData *data, QImage::Format dst_format, Qt::Im if (data->format == QImage::Format_RGB32) convertToARGB32PM = convertRGB32ToARGB32PM; if (dst_format == QImage::Format_RGB32) { -#if defined(QT_COMPILER_SUPPORTS_SSE4_1) && !defined(__SSE4_1__) +#ifdef QT_COMPILER_SUPPORTS_SSE4_1 if (qCpuHasFeature(SSE4_1)) convertFromARGB32PM = convertRGB32FromARGB32PM_sse4; else diff --git a/src/gui/image/qimage_sse4.cpp b/src/gui/image/qimage_sse4.cpp index fb63f5bff9..5fad4f572a 100644 --- a/src/gui/image/qimage_sse4.cpp +++ b/src/gui/image/qimage_sse4.cpp @@ -33,6 +33,7 @@ #include <qimage.h> #include <private/qdrawhelper_p.h> +#include <private/qdrawingprimitive_sse2_p.h> #include <private/qimage_p.h> #include <private/qsimd_p.h> @@ -44,7 +45,7 @@ const uint *QT_FASTCALL convertRGB32FromARGB32PM_sse4(uint *buffer, const uint * const QPixelLayout *, const QRgb *) { for (int i = 0; i < count; ++i) - buffer[i] = 0xff000000 | qUnpremultiply(src[i]); + buffer[i] = 0xff000000 | qUnpremultiply_sse4(src[i]); return buffer; } |