From fe999230ec4385c181f7824a0eaeb3b5c1d020c4 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Fri, 2 Nov 2018 14:04:06 -0700 Subject: Remove unnecessary Q_STATIC_TEMPLATE_FUNCTION macro It expands to the same thing in all three branches. Change-Id: I343f2beed55440a7ac0bfffd15636a8bfd8fd21c Reviewed-by: Allan Sandfeld Jensen --- src/gui/painting/qdrawhelper_p.h | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'src/gui/painting/qdrawhelper_p.h') diff --git a/src/gui/painting/qdrawhelper_p.h b/src/gui/painting/qdrawhelper_p.h index fb08261205..b1d4b3a9b0 100644 --- a/src/gui/painting/qdrawhelper_p.h +++ b/src/gui/painting/qdrawhelper_p.h @@ -69,13 +69,10 @@ QT_BEGIN_NAMESPACE #if defined(Q_CC_GNU) -# define Q_STATIC_TEMPLATE_FUNCTION static # define Q_DECL_RESTRICT __restrict__ #elif defined(Q_CC_MSVC) -# define Q_STATIC_TEMPLATE_FUNCTION static # define Q_DECL_RESTRICT __restrict #else -# define Q_STATIC_TEMPLATE_FUNCTION static # define Q_DECL_RESTRICT #endif @@ -887,7 +884,7 @@ inline quint24::operator uint() const return data[2] | (data[1] << 8) | (data[0] << 16); } -template Q_STATIC_TEMPLATE_FUNCTION +template static void qt_memfill(T *dest, T value, int count); template<> inline void qt_memfill(quint64 *dest, quint64 color, int count) @@ -931,7 +928,7 @@ inline void qt_memfill(T *dest, T value, int count) } } -template Q_STATIC_TEMPLATE_FUNCTION +template static inline void qt_rectfill(T *dest, T value, int x, int y, int width, int height, qsizetype stride) { -- cgit v1.2.3 From b514c82e1d6629d213d705da09169954f453c454 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Fri, 2 Nov 2018 14:14:09 -0700 Subject: Remove QT_MEMFILL_xxx macros They were just calling a function, may as well just call said function directly. Change-Id: I343f2beed55440a7ac0bfffd15636b183c1a420f Reviewed-by: Allan Sandfeld Jensen --- src/gui/painting/qdrawhelper_p.h | 6 ------ 1 file changed, 6 deletions(-) (limited to 'src/gui/painting/qdrawhelper_p.h') diff --git a/src/gui/painting/qdrawhelper_p.h b/src/gui/painting/qdrawhelper_p.h index b1d4b3a9b0..06dc64549b 100644 --- a/src/gui/painting/qdrawhelper_p.h +++ b/src/gui/painting/qdrawhelper_p.h @@ -944,12 +944,6 @@ inline void qt_rectfill(T *dest, T value, } } -#define QT_MEMFILL_UINT(dest, length, color) \ - qt_memfill(dest, color, length); - -#define QT_MEMFILL_USHORT(dest, length, color) \ - qt_memfill(dest, color, length); - #define QT_MEMCPY_REV_UINT(dest, src, length) \ do { \ /* Duff's device */ \ -- cgit v1.2.3 From 87d6a631b76bb9c0a803e25a1efed017578c66c4 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Mon, 5 Nov 2018 12:51:46 -0800 Subject: Remove unused QT_MEMCPY_REV_UINT macro It's not used anywhere. Patch-By: Allan Sandfeld Jensen Change-Id: Iba4b5c183776497d8ee1fffd1564559d6502a6f5 Reviewed-by: Allan Sandfeld Jensen --- src/gui/painting/qdrawhelper_p.h | 20 -------------------- 1 file changed, 20 deletions(-) (limited to 'src/gui/painting/qdrawhelper_p.h') diff --git a/src/gui/painting/qdrawhelper_p.h b/src/gui/painting/qdrawhelper_p.h index 06dc64549b..509fa044f8 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_REV_UINT(dest, src, length) \ -do { \ - /* Duff's device */ \ - uint *_d = (uint*)(dest) + length; \ - const uint *_s = (uint*)(src) + length; \ - 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) - #define QT_MEMCPY_USHORT(dest, src, length) \ do { \ /* Duff's device */ \ -- cgit v1.2.3 From 2b8b878f5a33e067c22d8387f8a3e14c5ea51114 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Mon, 5 Nov 2018 12:53:28 -0800 Subject: 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 Reviewed-by: Allan Sandfeld Jensen --- src/gui/painting/qdrawhelper_p.h | 20 -------------------- 1 file changed, 20 deletions(-) (limited to 'src/gui/painting/qdrawhelper_p.h') 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) -- cgit v1.2.3 From 185f9e0758cd7ee649f42b5c788fdfff6031d83c Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Mon, 5 Nov 2018 13:12:16 -0800 Subject: 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 Change-Id: Iba4b5c183776497d8ee1fffd156456cc3502946e Reviewed-by: Allan Sandfeld Jensen --- src/gui/painting/qdrawhelper_p.h | 47 ++++++++++++++++++++-------------------- 1 file changed, 24 insertions(+), 23 deletions(-) (limited to 'src/gui/painting/qdrawhelper_p.h') diff --git a/src/gui/painting/qdrawhelper_p.h b/src/gui/painting/qdrawhelper_p.h index 23520ad64b..68003ac321 100644 --- a/src/gui/painting/qdrawhelper_p.h +++ b/src/gui/painting/qdrawhelper_p.h @@ -884,8 +884,30 @@ inline quint24::operator uint() const return data[2] | (data[1] << 8) | (data[0] << 16); } -template static -void qt_memfill(T *dest, T value, int count); +template inline void qt_memfill_template(T *dest, T color, int count) +{ + if (!count) + return; + + qsizetype 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); + } +} + +template inline void qt_memfill(T *dest, T value, int count) +{ + qt_memfill_template(dest, value, count); +} template<> inline void qt_memfill(quint64 *dest, quint64 color, int count) { @@ -907,27 +929,6 @@ template<> inline void qt_memfill(quint8 *dest, quint8 color, int count) memset(dest, color, count); } -template -inline void qt_memfill(T *dest, T value, int count) -{ - if (!count) - return; - - int n = (count + 7) / 8; - switch (count & 0x07) - { - case 0: do { *dest++ = value; Q_FALLTHROUGH(); - case 7: *dest++ = value; Q_FALLTHROUGH(); - case 6: *dest++ = value; Q_FALLTHROUGH(); - case 5: *dest++ = value; Q_FALLTHROUGH(); - case 4: *dest++ = value; Q_FALLTHROUGH(); - case 3: *dest++ = value; Q_FALLTHROUGH(); - case 2: *dest++ = value; Q_FALLTHROUGH(); - case 1: *dest++ = value; - } while (--n > 0); - } -} - template static inline void qt_rectfill(T *dest, T value, int x, int y, int width, int height, qsizetype stride) -- cgit v1.2.3 From 1e2bf51d3e5d891db3c1383e6567d1c77dfc8973 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Fri, 2 Nov 2018 14:44:13 -0700 Subject: Use qsizetype for qt_memfill functions Just in case the image is larger than 2 GB (512 megapixels). Change-Id: I343f2beed55440a7ac0bfffd15636cbc68dfa13d Reviewed-by: Allan Sandfeld Jensen --- src/gui/painting/qdrawhelper_p.h | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'src/gui/painting/qdrawhelper_p.h') diff --git a/src/gui/painting/qdrawhelper_p.h b/src/gui/painting/qdrawhelper_p.h index 68003ac321..a2cf36f20e 100644 --- a/src/gui/painting/qdrawhelper_p.h +++ b/src/gui/painting/qdrawhelper_p.h @@ -160,9 +160,9 @@ extern SrcOverTransformFunc qTransformFunctions[QImage::NImageFormats][QImage::N extern DrawHelper qDrawHelper[QImage::NImageFormats]; void qBlendTexture(int count, const QSpan *spans, void *userData); -extern void qt_memfill64(quint64 *dest, quint64 value, int count); -extern void qt_memfill32(quint32 *dest, quint32 value, int count); -extern void qt_memfill16(quint16 *dest, quint16 value, int count); +extern void qt_memfill64(quint64 *dest, quint64 value, qsizetype count); +extern void qt_memfill32(quint32 *dest, quint32 value, qsizetype count); +extern void qt_memfill16(quint16 *dest, quint16 value, qsizetype count); typedef void (QT_FASTCALL *CompositionFunction)(uint *Q_DECL_RESTRICT dest, const uint *Q_DECL_RESTRICT src, int length, uint const_alpha); typedef void (QT_FASTCALL *CompositionFunction64)(QRgba64 *Q_DECL_RESTRICT dest, const QRgba64 *Q_DECL_RESTRICT src, int length, uint const_alpha); @@ -884,7 +884,7 @@ inline quint24::operator uint() const return data[2] | (data[1] << 8) | (data[0] << 16); } -template inline void qt_memfill_template(T *dest, T color, int count) +template inline void qt_memfill_template(T *dest, T color, qsizetype count) { if (!count) return; @@ -904,27 +904,27 @@ template inline void qt_memfill_template(T *dest, T color, int count) } } -template inline void qt_memfill(T *dest, T value, int count) +template inline void qt_memfill(T *dest, T value, qsizetype count) { qt_memfill_template(dest, value, count); } -template<> inline void qt_memfill(quint64 *dest, quint64 color, int count) +template<> inline void qt_memfill(quint64 *dest, quint64 color, qsizetype count) { qt_memfill64(dest, color, count); } -template<> inline void qt_memfill(quint32 *dest, quint32 color, int count) +template<> inline void qt_memfill(quint32 *dest, quint32 color, qsizetype count) { qt_memfill32(dest, color, count); } -template<> inline void qt_memfill(quint16 *dest, quint16 color, int count) +template<> inline void qt_memfill(quint16 *dest, quint16 color, qsizetype count) { qt_memfill16(dest, color, count); } -template<> inline void qt_memfill(quint8 *dest, quint8 color, int count) +template<> inline void qt_memfill(quint8 *dest, quint8 color, qsizetype count) { memset(dest, color, count); } @@ -935,7 +935,7 @@ inline void qt_rectfill(T *dest, T value, { char *d = reinterpret_cast(dest + x) + y * stride; if (uint(stride) == (width * sizeof(T))) { - qt_memfill(reinterpret_cast(d), value, width * height); + qt_memfill(reinterpret_cast(d), value, qsizetype(width) * height); } else { for (int j = 0; j < height; ++j) { dest = reinterpret_cast(d); -- cgit v1.2.3 From 5725809fe717f525f47dbe4165b9801c9437b152 Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Tue, 13 Nov 2018 13:21:25 +0100 Subject: Cleanup gradient blending Moving it to a separate routine like blendTexture, so DrawHelper only has solid color routines, and generalizing the vertical gradient optimization. Change-Id: I54bd59eba7e95247b9a365a3738d02c4f8cc2631 Reviewed-by: Eirik Aavitsland --- src/gui/painting/qdrawhelper_p.h | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) (limited to 'src/gui/painting/qdrawhelper_p.h') diff --git a/src/gui/painting/qdrawhelper_p.h b/src/gui/painting/qdrawhelper_p.h index a2cf36f20e..e9a1e48e5f 100644 --- a/src/gui/painting/qdrawhelper_p.h +++ b/src/gui/painting/qdrawhelper_p.h @@ -146,7 +146,6 @@ typedef void (*MemRotateFunc)(const uchar *srcPixels, int w, int h, int sbpl, uc struct DrawHelper { ProcessSpans blendColor; - ProcessSpans blendGradient; BitmapBlitFunc bitmapBlit; AlphamapBlitFunc alphamapBlit; AlphaRGBBlitFunc alphaRGBBlit; @@ -159,6 +158,7 @@ extern SrcOverTransformFunc qTransformFunctions[QImage::NImageFormats][QImage::N extern DrawHelper qDrawHelper[QImage::NImageFormats]; +void qBlendGradient(int count, const QSpan *spans, void *userData); void qBlendTexture(int count, const QSpan *spans, void *userData); extern void qt_memfill64(quint64 *dest, quint64 value, qsizetype count); extern void qt_memfill32(quint32 *dest, quint32 value, qsizetype count); @@ -219,11 +219,6 @@ struct Operator class QRasterPaintEngine; -struct QSolidData -{ - QRgba64 color; -}; - struct QLinearGradientData { struct { @@ -328,8 +323,8 @@ struct QSpanData int fast_matrix : 1; bool bilinear; QImage *tempImage; + QRgba64 solidColor; union { - QSolidData solid; QGradientData gradient; QTextureData texture; }; -- cgit v1.2.3 From a440aada72f2ee78c5e27d70ecc79c0071673446 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Fri, 2 Nov 2018 15:35:43 -0700 Subject: Add SSE2 qt_memfill64 Implemented by merging with the qt_memfill32 implementation in a non-inlining function. Change-Id: I343f2beed55440a7ac0bfffd15636f8ba995a2bd Reviewed-by: Allan Sandfeld Jensen --- src/gui/painting/qdrawhelper_p.h | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src/gui/painting/qdrawhelper_p.h') diff --git a/src/gui/painting/qdrawhelper_p.h b/src/gui/painting/qdrawhelper_p.h index e9a1e48e5f..8a26d884a5 100644 --- a/src/gui/painting/qdrawhelper_p.h +++ b/src/gui/painting/qdrawhelper_p.h @@ -70,10 +70,17 @@ QT_BEGIN_NAMESPACE #if defined(Q_CC_GNU) # define Q_DECL_RESTRICT __restrict__ +# if defined(Q_PROCESSOR_X86_32) && defined(Q_CC_GNU) && !defined(Q_CC_CLANG) && !defined(Q_CC_INTEL) +# define Q_DECL_VECTORCALL __attribute__((sseregparm,regparm(3))) +# else +# define Q_DECL_VECTORCALL +# endif #elif defined(Q_CC_MSVC) # define Q_DECL_RESTRICT __restrict +# define Q_DECL_VECTORCALL __vectorcall #else # define Q_DECL_RESTRICT +# define Q_DECL_VECTORCALL #endif static const uint AMASK = 0xff000000; -- cgit v1.2.3 From 40894d1a60d357bc46364ae038ede0159f32261b Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Fri, 2 Nov 2018 19:38:29 -0700 Subject: Add AVX2 versions of qt_memfill32 and qt_memfill64 The implementation is almost the same 4-way-unrolled loop, but because of the wider registers, we fill 128 bytes per loop. Unlike the SSE2 implementation, the AVX2 version uses unaligned stores and won't try to align in the prologue, matching glibc's __memset_avx2 (also unaligned). Change-Id: Iba4b5c183776497d8ee1fffd15637ccb2a7b83bc Reviewed-by: Allan Sandfeld Jensen --- src/gui/painting/qdrawhelper_p.h | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/gui/painting/qdrawhelper_p.h') diff --git a/src/gui/painting/qdrawhelper_p.h b/src/gui/painting/qdrawhelper_p.h index 8a26d884a5..219734c430 100644 --- a/src/gui/painting/qdrawhelper_p.h +++ b/src/gui/painting/qdrawhelper_p.h @@ -167,8 +167,13 @@ extern DrawHelper qDrawHelper[QImage::NImageFormats]; void qBlendGradient(int count, const QSpan *spans, void *userData); void qBlendTexture(int count, const QSpan *spans, void *userData); +#ifdef __SSE2__ +extern void (*qt_memfill64)(quint64 *dest, quint64 value, qsizetype count); +extern void (*qt_memfill32)(quint32 *dest, quint32 value, qsizetype count); +#else extern void qt_memfill64(quint64 *dest, quint64 value, qsizetype count); extern void qt_memfill32(quint32 *dest, quint32 value, qsizetype count); +#endif extern void qt_memfill16(quint16 *dest, quint16 value, qsizetype count); typedef void (QT_FASTCALL *CompositionFunction)(uint *Q_DECL_RESTRICT dest, const uint *Q_DECL_RESTRICT src, int length, uint const_alpha); -- cgit v1.2.3 From 33177b0456f50a1f3eae7a37b4ecc897aaf7125e Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Wed, 14 Nov 2018 14:17:38 +0100 Subject: Add a qt_memfill24 implementation This function gets called from qt_rectfill_quint24, which is used by the RGB666, ARGB6666_Premultiplied, ARGB8555_Premultiplied, and RGB888 formats. Together-with: Thiago Macieira Change-Id: Iba4b5c183776497d8ee1fffd1564585fdee835c2 Reviewed-by: Thiago Macieira --- src/gui/painting/qdrawhelper_p.h | 41 +++++++++++++++++++++------------------- 1 file changed, 22 insertions(+), 19 deletions(-) (limited to 'src/gui/painting/qdrawhelper_p.h') diff --git a/src/gui/painting/qdrawhelper_p.h b/src/gui/painting/qdrawhelper_p.h index 219734c430..4dcfbc813b 100644 --- a/src/gui/painting/qdrawhelper_p.h +++ b/src/gui/painting/qdrawhelper_p.h @@ -165,6 +165,22 @@ extern SrcOverTransformFunc qTransformFunctions[QImage::NImageFormats][QImage::N extern DrawHelper qDrawHelper[QImage::NImageFormats]; +struct quint24 { + quint24() = default; + quint24(uint value) + { + data[0] = uchar(value >> 16); + data[1] = uchar(value >> 8); + data[2] = uchar(value); + } + operator uint() const + { + return data[2] | (data[1] << 8) | (data[0] << 16); + } + + uchar data[3]; +}; + void qBlendGradient(int count, const QSpan *spans, void *userData); void qBlendTexture(int count, const QSpan *spans, void *userData); #ifdef __SSE2__ @@ -174,6 +190,7 @@ extern void (*qt_memfill32)(quint32 *dest, quint32 value, qsizetype count); extern void qt_memfill64(quint64 *dest, quint64 value, qsizetype count); extern void qt_memfill32(quint32 *dest, quint32 value, qsizetype count); #endif +extern void qt_memfill24(quint24 *dest, quint24 value, qsizetype count); extern void qt_memfill16(quint16 *dest, quint16 value, qsizetype count); typedef void (QT_FASTCALL *CompositionFunction)(uint *Q_DECL_RESTRICT dest, const uint *Q_DECL_RESTRICT src, int length, uint const_alpha); @@ -872,25 +889,6 @@ static Q_ALWAYS_INLINE uint qAlphaRgb30(uint c) return a; } -struct quint24 { - quint24() = default; - quint24(uint value); - operator uint() const; - uchar data[3]; -}; - -inline quint24::quint24(uint value) -{ - data[0] = uchar(value >> 16); - data[1] = uchar(value >> 8); - data[2] = uchar(value); -} - -inline quint24::operator uint() const -{ - return data[2] | (data[1] << 8) | (data[0] << 16); -} - template inline void qt_memfill_template(T *dest, T color, qsizetype count) { if (!count) @@ -926,6 +924,11 @@ template<> inline void qt_memfill(quint32 *dest, quint32 color, qsizetype count) qt_memfill32(dest, color, count); } +template<> inline void qt_memfill(quint24 *dest, quint24 color, qsizetype count) +{ + qt_memfill24(dest, color, count); +} + template<> inline void qt_memfill(quint16 *dest, quint16 color, qsizetype count) { qt_memfill16(dest, color, count); -- cgit v1.2.3 From fc2ec95587c431b1916ec5590b7ef634be96c985 Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Tue, 20 Nov 2018 10:04:28 +0100 Subject: Add Grayscale16 Image Format [ChangeLog][QtGui][QImage] Added support for 16-bit grayscale format. Together-with: Aaron Linville Task-number: QTBUG-41176 Change-Id: I5fe4f54a55ebe1413aa71b882c19627fe22362ac Reviewed-by: Nick D'Ademo Reviewed-by: Lars Knoll --- src/gui/painting/qdrawhelper_p.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/gui/painting/qdrawhelper_p.h') diff --git a/src/gui/painting/qdrawhelper_p.h b/src/gui/painting/qdrawhelper_p.h index 4dcfbc813b..37108949d6 100644 --- a/src/gui/painting/qdrawhelper_p.h +++ b/src/gui/painting/qdrawhelper_p.h @@ -879,6 +879,8 @@ static Q_ALWAYS_INLINE uint BYTE_MUL_RGB16_32(uint x, uint a) { // 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_ALWAYS_INLINE uint qAlphaRgb30(uint c) -- cgit v1.2.3 From 41e7b71c410b77a81d09d3cc2e169ffd7975b4d2 Mon Sep 17 00:00:00 2001 From: Kevin Funk Date: Tue, 12 Mar 2019 11:46:26 +0100 Subject: More nullptr usage in headers Diff generated by running clang-tidy's modernize-use-nullptr checker on the CMake-based Qt version. Skipping src/3rdparty, examples/, tests/ Change-Id: Ib182074e2e2fd52f63093f73b3e2e4c0cb7af188 Reviewed-by: Friedemann Kleint Reviewed-by: Simon Hausmann --- src/gui/painting/qdrawhelper_p.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/gui/painting/qdrawhelper_p.h') diff --git a/src/gui/painting/qdrawhelper_p.h b/src/gui/painting/qdrawhelper_p.h index 37108949d6..1e99a34842 100644 --- a/src/gui/painting/qdrawhelper_p.h +++ b/src/gui/painting/qdrawhelper_p.h @@ -328,7 +328,7 @@ struct QTextureData struct QSpanData { - QSpanData() : tempImage(0) {} + QSpanData() : tempImage(nullptr) {} ~QSpanData() { delete tempImage; } QRasterBuffer *rasterBuffer; -- cgit v1.2.3 From 0bee05f4c1036e2852de88f068e4f92926c4efa7 Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Mon, 1 Apr 2019 13:17:24 +0200 Subject: Make the 64 bit raster backend an optional feature Can be used to make smaller binaries, and possibly speed up ARGB32 rendering on some platforms. Change-Id: I7647b197ba7a6582187cc9736b7e0d752bd5bee5 Reviewed-by: Lars Knoll --- src/gui/painting/qdrawhelper_p.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/gui/painting/qdrawhelper_p.h') diff --git a/src/gui/painting/qdrawhelper_p.h b/src/gui/painting/qdrawhelper_p.h index 1e99a34842..9c5d525722 100644 --- a/src/gui/painting/qdrawhelper_p.h +++ b/src/gui/painting/qdrawhelper_p.h @@ -296,7 +296,9 @@ struct QGradientData #define GRADIENT_STOPTABLE_SIZE 1024 #define GRADIENT_STOPTABLE_SIZE_SHIFT 10 +#if QT_CONFIG(raster_64bit) const QRgba64 *colorTable64; //[GRADIENT_STOPTABLE_SIZE]; +#endif const QRgb *colorTable32; //[GRADIENT_STOPTABLE_SIZE]; uint alphaColor : 1; @@ -402,11 +404,13 @@ static inline uint qt_gradient_pixel(const QGradientData *data, qreal pos) return data->colorTable32[qt_gradient_clamp(data, ipos)]; } +#if QT_CONFIG(raster_64bit) static inline const QRgba64& qt_gradient_pixel64(const QGradientData *data, qreal pos) { int ipos = int(pos * (GRADIENT_STOPTABLE_SIZE - 1) + qreal(0.5)); return data->colorTable64[qt_gradient_clamp(data, ipos)]; } +#endif static inline qreal qRadialDeterminant(qreal a, qreal b, qreal c) { -- cgit v1.2.3