diff options
author | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2020-07-27 11:22:01 +0200 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2020-07-28 08:39:42 +0200 |
commit | f26147b49396345e4b0afdc48c8ee16d8ddc5fd1 (patch) | |
tree | c735c9655feea08bb8d99794c51d44ff2fb578a0 /src/gui/painting/qdrawhelper_p.h | |
parent | 59e3073b1cb944128b7533dd85be13074ab07b72 (diff) |
Replace Q_ALWAYS_INLINE with static inline
Static inline on functions serves the same purpose of keeping non-
inlined instances from different binaries from being mixed, and has the
benefit of being available across compilers.
Change-Id: I12467f6d887471d8fd70ff4623c473c2a5a45664
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/gui/painting/qdrawhelper_p.h')
-rw-r--r-- | src/gui/painting/qdrawhelper_p.h | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/src/gui/painting/qdrawhelper_p.h b/src/gui/painting/qdrawhelper_p.h index 30d0aab855..99a3534545 100644 --- a/src/gui/painting/qdrawhelper_p.h +++ b/src/gui/painting/qdrawhelper_p.h @@ -605,7 +605,7 @@ public: } }; -static Q_ALWAYS_INLINE uint INTERPOLATE_PIXEL_255(uint x, uint a, uint y, uint b) { +static 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; @@ -619,7 +619,7 @@ static Q_ALWAYS_INLINE uint INTERPOLATE_PIXEL_255(uint x, uint a, uint y, uint b #if Q_PROCESSOR_WORDSIZE == 8 // 64-bit versions -static Q_ALWAYS_INLINE uint INTERPOLATE_PIXEL_256(uint x, uint a, uint y, uint b) { +static 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; @@ -627,7 +627,7 @@ static Q_ALWAYS_INLINE uint INTERPOLATE_PIXEL_256(uint x, uint a, uint y, uint b return (uint(t)) | (uint(t >> 24)); } -static Q_ALWAYS_INLINE uint BYTE_MUL(uint x, uint a) { +static 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; @@ -636,7 +636,7 @@ static Q_ALWAYS_INLINE uint BYTE_MUL(uint x, uint a) { #else // 32-bit versions -static Q_ALWAYS_INLINE uint INTERPOLATE_PIXEL_256(uint x, uint a, uint y, uint b) { +static 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; @@ -647,7 +647,7 @@ static Q_ALWAYS_INLINE uint INTERPOLATE_PIXEL_256(uint x, uint a, uint y, uint b return x; } -static Q_ALWAYS_INLINE uint BYTE_MUL(uint x, uint a) { +static inline uint BYTE_MUL(uint x, uint a) { uint t = (x & 0xff00ff) * a; t = (t + ((t >> 8) & 0xff00ff) + 0x800080) >> 8; t &= 0xff00ff; @@ -660,7 +660,7 @@ static Q_ALWAYS_INLINE uint BYTE_MUL(uint x, uint a) { } #endif -static Q_ALWAYS_INLINE void blend_pixel(quint32 &dst, const quint32 src) +static inline void blend_pixel(quint32 &dst, const quint32 src) { if (src >= 0xff000000) dst = src; @@ -668,7 +668,7 @@ static Q_ALWAYS_INLINE void blend_pixel(quint32 &dst, const quint32 src) dst = src + BYTE_MUL(dst, qAlpha(~src)); } -static Q_ALWAYS_INLINE void blend_pixel(quint32 &dst, const quint32 src, const int const_alpha) +static inline void blend_pixel(quint32 &dst, const quint32 src, const int const_alpha) { if (const_alpha == 255) return blend_pixel(dst, src); @@ -679,7 +679,7 @@ static Q_ALWAYS_INLINE void blend_pixel(quint32 &dst, const quint32 src, const i } #if defined(__SSE2__) -static Q_ALWAYS_INLINE uint interpolate_4_pixels_sse2(__m128i vt, __m128i vb, uint distx, uint disty) +static inline uint Q_DECL_VECTORCALL interpolate_4_pixels_sse2(__m128i vt, __m128i vb, uint distx, uint disty) { // First interpolate top and bottom pixels in parallel. vt = _mm_unpacklo_epi8(vt, _mm_setzero_si128()); @@ -720,7 +720,7 @@ static inline uint interpolate_4_pixels(const uint t[], const uint b[], uint dis static constexpr inline bool hasFastInterpolate4() { return true; } #elif defined(__ARM_NEON__) -static Q_ALWAYS_INLINE uint interpolate_4_pixels_neon(uint32x2_t vt32, uint32x2_t vb32, uint distx, uint disty) +static inline uint interpolate_4_pixels_neon(uint32x2_t vt32, uint32x2_t vb32, uint distx, uint disty) { uint16x8_t vt16 = vmovl_u8(vreinterpret_u8_u32(vt32)); uint16x8_t vb16 = vmovl_u8(vreinterpret_u8_u32(vb32)); @@ -844,24 +844,24 @@ static inline QRgba64 interpolate_4_pixels_rgb64(const QRgba64 t[], const QRgba6 } #endif // __SSE2__ -static Q_ALWAYS_INLINE uint BYTE_MUL_RGB16(uint x, uint a) { +static 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; } -static Q_ALWAYS_INLINE uint BYTE_MUL_RGB16_32(uint x, uint a) { +static 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; } // qt_div_255 is a fast rounded division by 255 using an approximation that is accurate for all positive 16-bit integers -static Q_DECL_CONSTEXPR Q_ALWAYS_INLINE int qt_div_255(int x) { return (x + (x>>8) + 0x80) >> 8; } -static Q_DECL_CONSTEXPR Q_ALWAYS_INLINE uint qt_div_257_floor(uint x) { return (x - (x >> 8)) >> 8; } -static Q_DECL_CONSTEXPR Q_ALWAYS_INLINE uint qt_div_257(uint x) { return qt_div_257_floor(x + 128); } -static Q_DECL_CONSTEXPR Q_ALWAYS_INLINE uint qt_div_65535(uint x) { return (x + (x>>16) + 0x8000U) >> 16; } +static Q_DECL_CONSTEXPR inline int qt_div_255(int x) { return (x + (x>>8) + 0x80) >> 8; } +static Q_DECL_CONSTEXPR inline uint qt_div_257_floor(uint x) { return (x - (x >> 8)) >> 8; } +static Q_DECL_CONSTEXPR inline uint qt_div_257(uint x) { return qt_div_257_floor(x + 128); } +static Q_DECL_CONSTEXPR inline uint qt_div_65535(uint x) { return (x + (x>>16) + 0x8000U) >> 16; } template <class T> inline void qt_memfill_template(T *dest, T color, qsizetype count) { |