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 <allan.jensen@qt.io>
This commit is contained in:
Thiago Macieira 2018-11-02 14:44:13 -07:00
parent 185f9e0758
commit 1e2bf51d3e
8 changed files with 21 additions and 21 deletions

View File

@ -6244,13 +6244,13 @@ DrawHelper qDrawHelper[QImage::NImageFormats] =
}, },
}; };
void qt_memfill64(quint64 *dest, quint64 color, int count) void qt_memfill64(quint64 *dest, quint64 color, qsizetype count)
{ {
qt_memfill_template<quint64>(dest, color, count); qt_memfill_template<quint64>(dest, color, count);
} }
#if !defined(__SSE2__) #if !defined(__SSE2__)
void qt_memfill16(quint16 *dest, quint16 value, int count) void qt_memfill16(quint16 *dest, quint16 value, qsizetype count)
{ {
if (count < 3) { if (count < 3) {
switch (count) { switch (count) {
@ -6272,7 +6272,7 @@ void qt_memfill16(quint16 *dest, quint16 value, int count)
} }
#endif #endif
#if !defined(__SSE2__) && !defined(__ARM_NEON__) && !defined(__MIPS_DSP__) #if !defined(__SSE2__) && !defined(__ARM_NEON__) && !defined(__MIPS_DSP__)
void qt_memfill32(quint32 *dest, quint32 color, int count) void qt_memfill32(quint32 *dest, quint32 color, qsizetype count)
{ {
qt_memfill_template<quint32>(dest, color, count); qt_memfill_template<quint32>(dest, color, count);
} }

View File

@ -43,7 +43,7 @@
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
void qt_memfill32(quint32 *dest, quint32 color, int count) void qt_memfill32(quint32 *dest, quint32 color, qsizetype count)
{ {
qt_memfill32_asm_mips_dsp(dest, color, count); qt_memfill32_asm_mips_dsp(dest, color, count);
} }

View File

@ -57,7 +57,7 @@ QT_BEGIN_NAMESPACE
#if defined(QT_COMPILER_SUPPORTS_MIPS_DSP) #if defined(QT_COMPILER_SUPPORTS_MIPS_DSP)
extern "C" void qt_memfill32_asm_mips_dsp(quint32 *dest, quint32 value, int count); extern "C" void qt_memfill32_asm_mips_dsp(quint32 *dest, quint32 value, qsizetype count);
extern "C" void comp_func_SourceOver_asm_mips_dsp(uint *dest, const uint *src, int length, uint const_alpha); extern "C" void comp_func_SourceOver_asm_mips_dsp(uint *dest, const uint *src, int length, uint const_alpha);

View File

@ -47,7 +47,7 @@
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
void qt_memfill32(quint32 *dest, quint32 value, int count) void qt_memfill32(quint32 *dest, quint32 value, qsizetype count)
{ {
const int epilogueSize = count % 16; const int epilogueSize = count % 16;
#if !defined(Q_PROCESSOR_ARM_64) #if !defined(Q_PROCESSOR_ARM_64)

View File

@ -123,7 +123,7 @@ void qt_transform_image_rgb16_on_rgb16_neon(uchar *destPixels, int dbpl,
const QTransform &targetRectTransform, const QTransform &targetRectTransform,
int const_alpha); int const_alpha);
void qt_memfill32_neon(quint32 *dest, quint32 value, int count); void qt_memfill32_neon(quint32 *dest, quint32 value, qsizetype count);
void qt_memrotate90_16_neon(const uchar *srcPixels, int w, int h, int sbpl, uchar *destPixels, int dbpl); void qt_memrotate90_16_neon(const uchar *srcPixels, int w, int h, int sbpl, uchar *destPixels, int dbpl);
void qt_memrotate270_16_neon(const uchar *srcPixels, int w, int h, int sbpl, uchar *destPixels, int dbpl); void qt_memrotate270_16_neon(const uchar *srcPixels, int w, int h, int sbpl, uchar *destPixels, int dbpl);

View File

@ -160,9 +160,9 @@ extern SrcOverTransformFunc qTransformFunctions[QImage::NImageFormats][QImage::N
extern DrawHelper qDrawHelper[QImage::NImageFormats]; extern DrawHelper qDrawHelper[QImage::NImageFormats];
void qBlendTexture(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_memfill64(quint64 *dest, quint64 value, qsizetype count);
extern void qt_memfill32(quint32 *dest, quint32 value, int count); extern void qt_memfill32(quint32 *dest, quint32 value, qsizetype count);
extern void qt_memfill16(quint16 *dest, quint16 value, int 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 *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); 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); return data[2] | (data[1] << 8) | (data[0] << 16);
} }
template <class T> inline void qt_memfill_template(T *dest, T color, int count) template <class T> inline void qt_memfill_template(T *dest, T color, qsizetype count)
{ {
if (!count) if (!count)
return; return;
@ -904,27 +904,27 @@ template <class T> inline void qt_memfill_template(T *dest, T color, int count)
} }
} }
template <class T> inline void qt_memfill(T *dest, T value, int count) template <class T> inline void qt_memfill(T *dest, T value, qsizetype count)
{ {
qt_memfill_template(dest, value, 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); 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); 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); 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); memset(dest, color, count);
} }
@ -935,7 +935,7 @@ inline void qt_rectfill(T *dest, T value,
{ {
char *d = reinterpret_cast<char*>(dest + x) + y * stride; char *d = reinterpret_cast<char*>(dest + x) + y * stride;
if (uint(stride) == (width * sizeof(T))) { 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 { } else {
for (int j = 0; j < height; ++j) { for (int j = 0; j < height; ++j) {
dest = reinterpret_cast<T*>(d); dest = reinterpret_cast<T*>(d);

View File

@ -233,7 +233,7 @@ void QT_FASTCALL comp_func_Source_sse2(uint *dst, const uint *src, int length, u
} }
} }
void qt_memfill32(quint32 *dest, quint32 value, int count) void qt_memfill32(quint32 *dest, quint32 value, qsizetype count)
{ {
if (count < 7) { if (count < 7) {
switch (count) { switch (count) {
@ -314,7 +314,7 @@ void QT_FASTCALL comp_func_solid_SourceOver_sse2(uint *destPixels, int length, u
} }
} }
void qt_memfill16(quint16 *dest, quint16 value, int count) void qt_memfill16(quint16 *dest, quint16 value, qsizetype count)
{ {
if (count < 3) { if (count < 3) {
switch (count) { switch (count) {

View File

@ -57,8 +57,8 @@
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
#ifdef __SSE2__ #ifdef __SSE2__
void qt_memfill32(quint32 *dest, quint32 value, int count); void qt_memfill32(quint32 *dest, quint32 value, qsizetype count);
void qt_memfill16(quint16 *dest, quint16 value, int count); void qt_memfill16(quint16 *dest, quint16 value, qsizetype count);
void qt_bitmapblit32_sse2(QRasterBuffer *rasterBuffer, int x, int y, void qt_bitmapblit32_sse2(QRasterBuffer *rasterBuffer, int x, int y,
const QRgba64 &color, const QRgba64 &color,
const uchar *src, int width, int height, int stride); const uchar *src, int width, int height, int stride);