diff options
author | Thiago Macieira <thiago.macieira@intel.com> | 2018-11-05 12:53:28 -0800 |
---|---|---|
committer | Thiago Macieira <thiago.macieira@intel.com> | 2018-11-08 15:26:57 +0000 |
commit | 2b8b878f5a33e067c22d8387f8a3e14c5ea51114 (patch) | |
tree | ff04739f14dc266886045a5e97742c1569596418 | |
parent | 87d6a631b76bb9c0a803e25a1efed017578c66c4 (diff) |
Remove QT_MEMCPY_USHORT macro and just use memcpy
Compilers can optimize memcpy, so don't try to be too smart.
Change-Id: Iba4b5c183776497d8ee1fffd156455b50de65182
Patch-By: Allan Sandfeld Jensen <allan.jensen@qt.io>
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
-rw-r--r-- | src/gui/painting/qblendfunctions.cpp | 18 | ||||
-rw-r--r-- | src/gui/painting/qdrawhelper_p.h | 20 |
2 files changed, 5 insertions, 33 deletions
diff --git a/src/gui/painting/qblendfunctions.cpp b/src/gui/painting/qblendfunctions.cpp index 2dd5144e40..348eceb47f 100644 --- a/src/gui/painting/qblendfunctions.cpp +++ b/src/gui/painting/qblendfunctions.cpp @@ -187,19 +187,11 @@ void qt_blend_rgb16_on_rgb16(uchar *dst, int dbpl, #endif if (const_alpha == 256) { - if (w <= 64) { - while (h--) { - QT_MEMCPY_USHORT(dst, src, w); - dst += dbpl; - src += sbpl; - } - } else { - int length = w << 1; - while (h--) { - memcpy(dst, src, length); - dst += dbpl; - src += sbpl; - } + int length = w << 1; + while (h--) { + memcpy(dst, src, length); + dst += dbpl; + src += sbpl; } } else if (const_alpha != 0) { quint16 *d = (quint16 *) dst; diff --git a/src/gui/painting/qdrawhelper_p.h b/src/gui/painting/qdrawhelper_p.h index 509fa044f8..23520ad64b 100644 --- a/src/gui/painting/qdrawhelper_p.h +++ b/src/gui/painting/qdrawhelper_p.h @@ -944,26 +944,6 @@ inline void qt_rectfill(T *dest, T value, } } -#define QT_MEMCPY_USHORT(dest, src, length) \ -do { \ - /* Duff's device */ \ - ushort *_d = (ushort*)(dest); \ - const ushort *_s = (const ushort*)(src); \ - int n = ((length) + 7) / 8; \ - switch ((length) & 0x07) \ - { \ - case 0: do { *_d++ = *_s++; Q_FALLTHROUGH(); \ - case 7: *_d++ = *_s++; Q_FALLTHROUGH(); \ - case 6: *_d++ = *_s++; Q_FALLTHROUGH(); \ - case 5: *_d++ = *_s++; Q_FALLTHROUGH(); \ - case 4: *_d++ = *_s++; Q_FALLTHROUGH(); \ - case 3: *_d++ = *_s++; Q_FALLTHROUGH(); \ - case 2: *_d++ = *_s++; Q_FALLTHROUGH(); \ - case 1: *_d++ = *_s++; \ - } while (--n > 0); \ - } \ -} while (false) - inline ushort qConvertRgb32To16(uint c) { return (((c) >> 3) & 0x001f) |