diff options
author | Liang Qi <liang.qi@qt.io> | 2016-06-13 09:01:02 +0200 |
---|---|---|
committer | Liang Qi <liang.qi@qt.io> | 2016-06-13 12:46:46 +0200 |
commit | 511790fd1af1e2886a0e2e8dd4308099705cd815 (patch) | |
tree | b42aee537a6103cd064f9f41ae2889b09b79fd23 /src/gui/image/qimage.cpp | |
parent | 1542d8881fc5ccbc5918cd4acbe4091ebbd24508 (diff) | |
parent | cbe332405aa22257d432f1797b325f5e57007c20 (diff) |
Merge remote-tracking branch 'origin/5.7' into dev
Conflicts:
config_help.txt
configure
mkspecs/features/uikit/sdk.prf
src/corelib/global/qhooks.cpp
src/corelib/io/qfilesystemwatcher.cpp
src/corelib/io/qlockfile_unix.cpp
src/corelib/tools/qalgorithms.h
src/gui/kernel/qwindowsysteminterface.h
src/gui/text/qtextdocument_p.cpp
src/network/access/access.pri
src/network/access/qnetworkaccessmanager.cpp
src/network/access/qnetworkreplynsurlconnectionimpl.mm
src/src.pro
src/testlib/qtestcase.cpp
src/widgets/kernel/qwidgetbackingstore_p.h
src/widgets/styles/qwindowscestyle.cpp
src/widgets/styles/qwindowsmobilestyle.cpp
tests/auto/corelib/io/qdiriterator/qdiriterator.pro
tests/auto/corelib/io/qfileinfo/qfileinfo.pro
tests/auto/gui/kernel/qwindow/BLACKLIST
tests/auto/widgets/dialogs/qfilesystemmodel/tst_qfilesystemmodel.cpp
tools/configure/configureapp.cpp
Change-Id: Ibf7fb9c8cf263a810ade82f821345d0725c57c67
Diffstat (limited to 'src/gui/image/qimage.cpp')
-rw-r--r-- | src/gui/image/qimage.cpp | 55 |
1 files changed, 34 insertions, 21 deletions
diff --git a/src/gui/image/qimage.cpp b/src/gui/image/qimage.cpp index 3238d83729..3a31af8645 100644 --- a/src/gui/image/qimage.cpp +++ b/src/gui/image/qimage.cpp @@ -176,6 +176,9 @@ QImageData::~QImageData() data = 0; } +#if defined(_M_ARM) +#pragma optimize("", off) +#endif bool QImageData::checkForAlphaPixels() const { @@ -193,74 +196,81 @@ bool QImageData::checkForAlphaPixels() const break; case QImage::Format_ARGB32: case QImage::Format_ARGB32_Premultiplied: { - uchar *bits = data; + const uchar *bits = data; for (int y=0; y<height && !has_alpha_pixels; ++y) { + uint alphaAnd = 0xff000000; for (int x=0; x<width; ++x) - has_alpha_pixels |= (((uint *)bits)[x] & 0xff000000) != 0xff000000; + alphaAnd &= reinterpret_cast<const uint*>(bits)[x]; + has_alpha_pixels = (alphaAnd != 0xff000000); bits += bytes_per_line; } } break; case QImage::Format_RGBA8888: case QImage::Format_RGBA8888_Premultiplied: { - uchar *bits = data; + const uchar *bits = data; for (int y=0; y<height && !has_alpha_pixels; ++y) { + uchar alphaAnd = 0xff; for (int x=0; x<width; ++x) - has_alpha_pixels |= bits[x*4+3] != 0xff; + alphaAnd &= bits[x * 4+ 3]; + has_alpha_pixels = (alphaAnd != 0xff); bits += bytes_per_line; } } break; case QImage::Format_A2BGR30_Premultiplied: case QImage::Format_A2RGB30_Premultiplied: { - uchar *bits = data; + const uchar *bits = data; for (int y=0; y<height && !has_alpha_pixels; ++y) { + uint alphaAnd = 0xc0000000; for (int x=0; x<width; ++x) - has_alpha_pixels |= (((uint *)bits)[x] & 0xc0000000) != 0xc0000000; + alphaAnd &= reinterpret_cast<const uint*>(bits)[x]; + has_alpha_pixels = (alphaAnd != 0xc0000000); bits += bytes_per_line; } } break; case QImage::Format_ARGB8555_Premultiplied: case QImage::Format_ARGB8565_Premultiplied: { - uchar *bits = data; - uchar *end_bits = data + bytes_per_line; + const uchar *bits = data; + const uchar *end_bits = data + bytes_per_line; for (int y=0; y<height && !has_alpha_pixels; ++y) { + uchar alphaAnd = 0xff; while (bits < end_bits) { - has_alpha_pixels |= bits[0] != 0; + alphaAnd &= bits[0]; bits += 3; } + has_alpha_pixels = (alphaAnd != 0xff); bits = end_bits; end_bits += bytes_per_line; } } break; case QImage::Format_ARGB6666_Premultiplied: { - uchar *bits = data; - uchar *end_bits = data + bytes_per_line; + const uchar *bits = data; + const uchar *end_bits = data + bytes_per_line; for (int y=0; y<height && !has_alpha_pixels; ++y) { + uchar alphaAnd = 0xfc; while (bits < end_bits) { - has_alpha_pixels |= (bits[0] & 0xfc) != 0; + alphaAnd &= bits[0]; bits += 3; } + has_alpha_pixels = (alphaAnd != 0xfc); bits = end_bits; end_bits += bytes_per_line; } } break; case QImage::Format_ARGB4444_Premultiplied: { - uchar *bits = data; - uchar *end_bits = data + bytes_per_line; - + const uchar *bits = data; for (int y=0; y<height && !has_alpha_pixels; ++y) { - while (bits < end_bits) { - has_alpha_pixels |= (bits[0] & 0xf0) != 0; - bits += 2; - } - bits = end_bits; - end_bits += bytes_per_line; + ushort alphaAnd = 0xf000; + for (int x=0; x<width; ++x) + alphaAnd &= reinterpret_cast<const ushort*>(bits)[x]; + has_alpha_pixels = (alphaAnd != 0xf000); + bits += bytes_per_line; } } break; @@ -283,6 +293,9 @@ bool QImageData::checkForAlphaPixels() const return has_alpha_pixels; } +#if defined(_M_ARM) +#pragma optimize("", on) +#endif /*! \class QImage |