summaryrefslogtreecommitdiffstats
path: root/src/gui/painting/qdrawhelper.cpp
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@intel.com>2018-11-05 13:12:16 -0800
committerThiago Macieira <thiago.macieira@intel.com>2018-11-11 06:06:22 +0000
commit185f9e0758cd7ee649f42b5c788fdfff6031d83c (patch)
tree115d240f41bf26d44988c07bdfefaf7968d5a58b /src/gui/painting/qdrawhelper.cpp
parent58437fb125f60c11ba8e97c914fa8db8c89c7373 (diff)
Merge the qt_memfill{,_template} functions
We had two copies of the Duff's Device implementation, one in the .cpp and one in the header. One of the two implementations had a protection against zero counts, the other didn't. So move the .cpp implementation to the header and use it in the functions that were declared there. Fixes: QTBUG-16104 Patch-By: Allan Sandfeld Jensen <allan.jensen@qt.io> Change-Id: Iba4b5c183776497d8ee1fffd156456cc3502946e Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Diffstat (limited to 'src/gui/painting/qdrawhelper.cpp')
-rw-r--r--src/gui/painting/qdrawhelper.cpp43
1 files changed, 4 insertions, 39 deletions
diff --git a/src/gui/painting/qdrawhelper.cpp b/src/gui/painting/qdrawhelper.cpp
index c0320f5a70..fdf867ec40 100644
--- a/src/gui/painting/qdrawhelper.cpp
+++ b/src/gui/painting/qdrawhelper.cpp
@@ -6244,36 +6244,13 @@ DrawHelper qDrawHelper[QImage::NImageFormats] =
},
};
-#if defined(Q_CC_MSVC) && !defined(_MIPS_)
-template <class T>
-inline void qt_memfill_template(T *dest, T color, int count)
-{
- while (count--)
- *dest++ = color;
-}
-
-#else
-
-template <class T>
-inline void qt_memfill_template(T *dest, T color, int count)
+void qt_memfill64(quint64 *dest, quint64 color, int count)
{
- int n = (count + 7) / 8;
- switch (count & 0x07)
- {
- case 0: do { *dest++ = color; Q_FALLTHROUGH();
- case 7: *dest++ = color; Q_FALLTHROUGH();
- case 6: *dest++ = color; Q_FALLTHROUGH();
- case 5: *dest++ = color; Q_FALLTHROUGH();
- case 4: *dest++ = color; Q_FALLTHROUGH();
- case 3: *dest++ = color; Q_FALLTHROUGH();
- case 2: *dest++ = color; Q_FALLTHROUGH();
- case 1: *dest++ = color;
- } while (--n > 0);
- }
+ qt_memfill_template<quint64>(dest, color, count);
}
-template <>
-inline void qt_memfill_template(quint16 *dest, quint16 value, int count)
+#if !defined(__SSE2__)
+void qt_memfill16(quint16 *dest, quint16 value, int count)
{
if (count < 3) {
switch (count) {
@@ -6294,18 +6271,6 @@ inline void qt_memfill_template(quint16 *dest, quint16 value, int count)
dest[count - 1] = value;
}
#endif
-
-void qt_memfill64(quint64 *dest, quint64 color, int count)
-{
- qt_memfill_template<quint64>(dest, color, count);
-}
-
-#if !defined(__SSE2__)
-void qt_memfill16(quint16 *dest, quint16 color, int count)
-{
- qt_memfill_template<quint16>(dest, color, count);
-}
-#endif
#if !defined(__SSE2__) && !defined(__ARM_NEON__) && !defined(__MIPS_DSP__)
void qt_memfill32(quint32 *dest, quint32 color, int count)
{