summaryrefslogtreecommitdiffstats
path: root/src/gui/painting/qdrawhelper_p.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/painting/qdrawhelper_p.h')
-rw-r--r--src/gui/painting/qdrawhelper_p.h42
1 files changed, 23 insertions, 19 deletions
diff --git a/src/gui/painting/qdrawhelper_p.h b/src/gui/painting/qdrawhelper_p.h
index 258f130efc..5d9867012f 100644
--- a/src/gui/painting/qdrawhelper_p.h
+++ b/src/gui/painting/qdrawhelper_p.h
@@ -70,15 +70,19 @@ QT_BEGIN_NAMESPACE
#if defined(Q_CC_RVCT)
// RVCT doesn't like static template functions
# define Q_STATIC_TEMPLATE_FUNCTION
-# define Q_STATIC_INLINE_FUNCTION static __forceinline
+# define Q_ALWAYS_INLINE __forceinline
# define Q_DECL_RESTRICT
#elif defined(Q_CC_GNU)
-# define Q_STATIC_TEMPLATE_FUNCTION static __attribute__((always_inline))
-# define Q_STATIC_INLINE_FUNCTION static inline __attribute__((always_inline))
+# define Q_STATIC_TEMPLATE_FUNCTION static
+# define Q_ALWAYS_INLINE inline __attribute__((always_inline))
# define Q_DECL_RESTRICT __restrict__
+#elif defined(Q_CC_MSVC)
+# define Q_STATIC_TEMPLATE_FUNCTION static
+# define Q_ALWAYS_INLINE __forceinline
+# define Q_DECL_RESTRICT __restrict
#else
# define Q_STATIC_TEMPLATE_FUNCTION static
-# define Q_STATIC_INLINE_FUNCTION static inline
+# define Q_ALWAYS_INLINE inline
# define Q_DECL_RESTRICT
#endif
@@ -382,13 +386,14 @@ static inline qreal qRadialDeterminant(qreal a, qreal b, qreal c)
return (b * b) - (4 * a * c);
}
-template <class RadialFetchFunc>
+extern void (*qt_memfill32)(quint32 *dest, quint32 value, int count);
+
+template <class RadialFetchFunc> Q_STATIC_TEMPLATE_FUNCTION
const uint * QT_FASTCALL qt_fetch_radial_gradient_template(uint *buffer, const Operator *op, const QSpanData *data,
int y, int x, int length)
{
// avoid division by zero
if (qFuzzyIsNull(op->radial.a)) {
- extern void (*qt_memfill32)(quint32 *dest, quint32 value, int count);
qt_memfill32(buffer, 0, length);
return buffer;
}
@@ -562,7 +567,7 @@ public:
# pragma push
# pragma arm
#endif
-Q_STATIC_INLINE_FUNCTION uint INTERPOLATE_PIXEL_255(uint x, uint a, uint y, uint b) {
+static Q_ALWAYS_INLINE uint INTERPOLATE_PIXEL_255(uint x, uint a, uint y, uint b) {
uint t = (x & 0xff00ff) * a + (y & 0xff00ff) * b;
t = (t + ((t >> 8) & 0xff00ff) + 0x800080) >> 8;
t &= 0xff00ff;
@@ -579,7 +584,7 @@ Q_STATIC_INLINE_FUNCTION uint INTERPOLATE_PIXEL_255(uint x, uint a, uint y, uint
#if QT_POINTER_SIZE == 8 // 64-bit versions
-Q_STATIC_INLINE_FUNCTION uint INTERPOLATE_PIXEL_256(uint x, uint a, uint y, uint b) {
+static Q_ALWAYS_INLINE uint INTERPOLATE_PIXEL_256(uint x, uint a, uint y, uint b) {
quint64 t = (((quint64(x)) | ((quint64(x)) << 24)) & 0x00ff00ff00ff00ff) * a;
t += (((quint64(y)) | ((quint64(y)) << 24)) & 0x00ff00ff00ff00ff) * b;
t >>= 8;
@@ -587,14 +592,14 @@ Q_STATIC_INLINE_FUNCTION uint INTERPOLATE_PIXEL_256(uint x, uint a, uint y, uint
return (uint(t)) | (uint(t >> 24));
}
-Q_STATIC_INLINE_FUNCTION uint BYTE_MUL(uint x, uint a) {
+static Q_ALWAYS_INLINE uint BYTE_MUL(uint x, uint a) {
quint64 t = (((quint64(x)) | ((quint64(x)) << 24)) & 0x00ff00ff00ff00ff) * a;
t = (t + ((t >> 8) & 0xff00ff00ff00ff) + 0x80008000800080) >> 8;
t &= 0x00ff00ff00ff00ff;
return (uint(t)) | (uint(t >> 24));
}
-Q_STATIC_INLINE_FUNCTION uint PREMUL(uint x) {
+static Q_ALWAYS_INLINE uint PREMUL(uint x) {
uint a = x >> 24;
quint64 t = (((quint64(x)) | ((quint64(x)) << 24)) & 0x00ff00ff00ff00ff) * a;
t = (t + ((t >> 8) & 0xff00ff00ff00ff) + 0x80008000800080) >> 8;
@@ -604,7 +609,7 @@ Q_STATIC_INLINE_FUNCTION uint PREMUL(uint x) {
#else // 32-bit versions
-Q_STATIC_INLINE_FUNCTION uint INTERPOLATE_PIXEL_256(uint x, uint a, uint y, uint b) {
+static Q_ALWAYS_INLINE uint INTERPOLATE_PIXEL_256(uint x, uint a, uint y, uint b) {
uint t = (x & 0xff00ff) * a + (y & 0xff00ff) * b;
t >>= 8;
t &= 0xff00ff;
@@ -619,7 +624,7 @@ Q_STATIC_INLINE_FUNCTION uint INTERPOLATE_PIXEL_256(uint x, uint a, uint y, uint
# pragma push
# pragma arm
#endif
-Q_STATIC_INLINE_FUNCTION uint BYTE_MUL(uint x, uint a) {
+static Q_ALWAYS_INLINE uint BYTE_MUL(uint x, uint a) {
uint t = (x & 0xff00ff) * a;
t = (t + ((t >> 8) & 0xff00ff) + 0x800080) >> 8;
t &= 0xff00ff;
@@ -634,7 +639,7 @@ Q_STATIC_INLINE_FUNCTION uint BYTE_MUL(uint x, uint a) {
# pragma pop
#endif
-Q_STATIC_INLINE_FUNCTION uint PREMUL(uint x) {
+static Q_ALWAYS_INLINE uint PREMUL(uint x) {
uint a = x >> 24;
uint t = (x & 0xff00ff) * a;
t = (t + ((t >> 8) & 0xff00ff) + 0x800080) >> 8;
@@ -649,14 +654,14 @@ Q_STATIC_INLINE_FUNCTION uint PREMUL(uint x) {
#endif
-Q_STATIC_INLINE_FUNCTION uint BYTE_MUL_RGB16(uint x, uint a) {
+static Q_ALWAYS_INLINE uint BYTE_MUL_RGB16(uint x, uint a) {
a += 1;
uint t = (((x & 0x07e0)*a) >> 8) & 0x07e0;
t |= (((x & 0xf81f)*(a>>2)) >> 6) & 0xf81f;
return t;
}
-Q_STATIC_INLINE_FUNCTION uint BYTE_MUL_RGB16_32(uint x, uint a) {
+static Q_ALWAYS_INLINE uint BYTE_MUL_RGB16_32(uint x, uint a) {
uint t = (((x & 0xf81f07e0) >> 5)*a) & 0xf81f07e0;
t |= (((x & 0x07e0f81f)*a) >> 5) & 0x07e0f81f;
return t;
@@ -687,12 +692,11 @@ inline quint24::operator uint() const
return data[2] | (data[1] << 8) | (data[0] << 16);
}
-template <class T>
+template <class T> Q_STATIC_TEMPLATE_FUNCTION
void qt_memfill(T *dest, T value, int count);
template<> inline void qt_memfill(quint32 *dest, quint32 color, int count)
{
- extern void (*qt_memfill32)(quint32 *dest, quint32 value, int count);
qt_memfill32(dest, color, count);
}
@@ -728,7 +732,7 @@ inline void qt_memfill(T *dest, T value, int count)
}
}
-template <class T>
+template <class T> Q_STATIC_TEMPLATE_FUNCTION
inline void qt_rectfill(T *dest, T value,
int x, int y, int width, int height, int stride)
{
@@ -794,7 +798,7 @@ do { \
# pragma push
# pragma arm
#endif
-Q_STATIC_INLINE_FUNCTION int qt_div_255(int x) { return (x + (x>>8) + 0x80) >> 8; }
+static Q_ALWAYS_INLINE int qt_div_255(int x) { return (x + (x>>8) + 0x80) >> 8; }
#if defined(Q_CC_RVCT)
# pragma pop
#endif