From 07eda676e45f6c3c7237581c3f4a9e39695697ab Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Tue, 21 Aug 2018 10:41:17 +0200 Subject: [PATCH] Fix big-endian build Declare rbSwap, 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 --- src/gui/painting/qdrawhelper.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) 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(uchar *d, const uchar *s, int c { return rbSwap_rgb32(d, s, count); } +#else +template<> +void QT_FASTCALL rbSwap(uchar *d, const uchar *s, int count) +{ + const uint *src = reinterpret_cast(s); + uint *dest = reinterpret_cast(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)