diff options
author | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2018-08-21 10:41:17 +0200 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2018-08-21 13:31:44 +0000 |
commit | 07eda676e45f6c3c7237581c3f4a9e39695697ab (patch) | |
tree | 75d8f65d4df911d86208ce96e9fddb282573e69f /src/gui | |
parent | cf0ea18ac41c71418e84840d4933b126f0bf6b0a (diff) |
Fix big-endian build
Declare rbSwap<QImage::Format_RGBA8888>, so we don't end up in a
fallback definition not used by little-endian.
Task-number: QTBUG-69951
Change-Id: I8512bba76da7d59a27593d37c70283d881c3e8fc
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/painting/qdrawhelper.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/gui/painting/qdrawhelper.cpp b/src/gui/painting/qdrawhelper.cpp index b1424b5b0a..4b68c22e95 100644 --- a/src/gui/painting/qdrawhelper.cpp +++ b/src/gui/painting/qdrawhelper.cpp @@ -640,6 +640,19 @@ void QT_FASTCALL rbSwap<QImage::Format_RGBA8888>(uchar *d, const uchar *s, int c { return rbSwap_rgb32(d, s, count); } +#else +template<> +void QT_FASTCALL rbSwap<QImage::Format_RGBA8888>(uchar *d, const uchar *s, int count) +{ + const uint *src = reinterpret_cast<const uint *>(s); + uint *dest = reinterpret_cast<uint *>(d); + for (int i = 0; i < count; ++i) { + const uint c = src[i]; + const uint rb = c & 0xff00ff00; + const uint ga = c & 0x00ff00ff; + dest[i] = ga | (rb << 16) | (rb >> 16); + } +} #endif static void QT_FASTCALL rbSwap_rgb30(uchar *d, const uchar *s, int count) |