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.h123
1 files changed, 35 insertions, 88 deletions
diff --git a/src/gui/painting/qdrawhelper_p.h b/src/gui/painting/qdrawhelper_p.h
index fb08261205..e9a1e48e5f 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
@@ -149,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;
@@ -162,10 +158,11 @@ 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, 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);
@@ -222,11 +219,6 @@ struct Operator
class QRasterPaintEngine;
-struct QSolidData
-{
- QRgba64 color;
-};
-
struct QLinearGradientData
{
struct {
@@ -331,8 +323,8 @@ struct QSpanData
int fast_matrix : 1;
bool bilinear;
QImage *tempImage;
+ QRgba64 solidColor;
union {
- QSolidData solid;
QGradientData gradient;
QTextureData texture;
};
@@ -887,57 +879,58 @@ inline quint24::operator uint() const
return data[2] | (data[1] << 8) | (data[0] << 16);
}
-template <class T> Q_STATIC_TEMPLATE_FUNCTION
-void qt_memfill(T *dest, T value, int count);
+template <class T> inline void qt_memfill_template(T *dest, T color, qsizetype 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 <class T> 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);
}
-template <class T>
-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 <class T> Q_STATIC_TEMPLATE_FUNCTION
+template <class T> static
inline void qt_rectfill(T *dest, T value,
int x, int y, int width, int height, qsizetype stride)
{
char *d = reinterpret_cast<char*>(dest + x) + y * stride;
if (uint(stride) == (width * sizeof(T))) {
- qt_memfill(reinterpret_cast<T*>(d), value, width * height);
+ qt_memfill(reinterpret_cast<T*>(d), value, qsizetype(width) * height);
} else {
for (int j = 0; j < height; ++j) {
dest = reinterpret_cast<T*>(d);
@@ -947,52 +940,6 @@ inline void qt_rectfill(T *dest, T value,
}
}
-#define QT_MEMFILL_UINT(dest, length, color) \
- qt_memfill<quint32>(dest, color, length);
-
-#define QT_MEMFILL_USHORT(dest, length, color) \
- qt_memfill<quint16>(dest, color, length);
-
-#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 */ \
- 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)