summaryrefslogtreecommitdiffstats
path: root/src/gui/painting
diff options
context:
space:
mode:
authorUlf Hermann <ulf.hermann@qt.io>2023-01-11 08:40:33 +0100
committerUlf Hermann <ulf.hermann@qt.io>2023-01-12 20:54:22 +0100
commit9615e7f9e538af4ad212f4f71d1364c64b18542d (patch)
tree487751f9339812ab8ae4b0bdf79d218127ce5cb6 /src/gui/painting
parenta48bbbaa50860507d7b738d2095adf794eb552d5 (diff)
Gui: Always declare qt_memfill{32|64} as function pointers on x86
Having the declaration of a function depend on compiler flags is a fundamentally bad idea since you can compile different compilation units that all include the header with different flags. This leads to undefined symbols. Pick-to: 6.5 Fixes: QTBUG-109159 Change-Id: I0aede280988e4f10c42d5b1824ad9c96a1e10854 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io> Reviewed-by: Liang Qi <liang.qi@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/gui/painting')
-rw-r--r--src/gui/painting/qdrawhelper.cpp16
-rw-r--r--src/gui/painting/qdrawhelper_p.h2
2 files changed, 10 insertions, 8 deletions
diff --git a/src/gui/painting/qdrawhelper.cpp b/src/gui/painting/qdrawhelper.cpp
index 91d8c424d1..46f75add1b 100644
--- a/src/gui/painting/qdrawhelper.cpp
+++ b/src/gui/painting/qdrawhelper.cpp
@@ -6230,7 +6230,7 @@ DrawHelper qDrawHelper[QImage::NImageFormats] =
},
};
-#if !defined(__SSE2__)
+#if !defined(Q_PROCESSOR_X86)
void qt_memfill64(quint64 *dest, quint64 color, qsizetype count)
{
qt_memfill_template<quint64>(dest, color, count);
@@ -6297,16 +6297,15 @@ void qt_memfill16(quint16 *dest, quint16 value, qsizetype count)
qt_memfill32(reinterpret_cast<quint32*>(dest), value32, count / 2);
}
-#if !defined(__SSE2__) && !defined(__ARM_NEON__) && !defined(__MIPS_DSP__)
+#if defined(Q_PROCESSOR_X86)
+void (*qt_memfill32)(quint32 *dest, quint32 value, qsizetype count) = nullptr;
+void (*qt_memfill64)(quint64 *dest, quint64 value, qsizetype count) = nullptr;
+#elif !defined(__ARM_NEON__) && !defined(__MIPS_DSP__)
void qt_memfill32(quint32 *dest, quint32 color, qsizetype count)
{
qt_memfill_template<quint32>(dest, color, count);
}
#endif
-#ifdef __SSE2__
-decltype(qt_memfill32_sse2) *qt_memfill32 = nullptr;
-decltype(qt_memfill64_sse2) *qt_memfill64 = nullptr;
-#endif
#ifdef QT_COMPILER_SUPPORTS_SSE4_1
template<QtPixelOrder> void QT_FASTCALL storeA2RGB30PMFromARGB32PM_sse4(uchar *dest, const uint *src, int index, int count, const QList<QRgb> *, QDitherInfo *);
@@ -6319,7 +6318,10 @@ static void qInitDrawhelperFunctions()
// Set up basic blend function tables.
qInitBlendFunctions();
-#ifdef __SSE2__
+#if defined(Q_PROCESSOR_X86) && !defined(__SSE2__)
+ qt_memfill32 = qt_memfill_template<quint32>;
+ qt_memfill64 = qt_memfill_template<quint64>;
+#elif defined(__SSE2__)
# ifndef __AVX2__
qt_memfill32 = qt_memfill32_sse2;
qt_memfill64 = qt_memfill64_sse2;
diff --git a/src/gui/painting/qdrawhelper_p.h b/src/gui/painting/qdrawhelper_p.h
index 7d2bea3a44..85b073bfde 100644
--- a/src/gui/painting/qdrawhelper_p.h
+++ b/src/gui/painting/qdrawhelper_p.h
@@ -142,7 +142,7 @@ struct quint24 {
void qBlendGradient(int count, const QT_FT_Span *spans, void *userData);
void qBlendTexture(int count, const QT_FT_Span *spans, void *userData);
-#ifdef __SSE2__
+#ifdef Q_PROCESSOR_X86
extern void (*qt_memfill64)(quint64 *dest, quint64 value, qsizetype count);
extern void (*qt_memfill32)(quint32 *dest, quint32 value, qsizetype count);
#else