From 29d2aad30a47009e5b756a608dc9366900caf71f Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Thu, 29 Dec 2011 16:36:46 -0200 Subject: [PATCH] Use the C99 keyword "restrict" in compilers that support it MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit This allows the compiler to produce better / smaller code due to not being required to deal with two pointers possibly aliasing each other. This also enables vectorisation where otherwise the compiler wouldn't be able to do. Change-Id: Ie7db3a54a1ba22f87ac5283d5c43905707957549 Reviewed-by: Samuel Rødal --- src/gui/painting/qdrawhelper.cpp | 115 +++++++++++++++++++-------------------- src/gui/painting/qdrawhelper_p.h | 5 +- 2 files changed, 61 insertions(+), 59 deletions(-) diff --git a/src/gui/painting/qdrawhelper.cpp b/src/gui/painting/qdrawhelper.cpp index 919a19e..de331a3 100644 --- a/src/gui/painting/qdrawhelper.cpp +++ b/src/gui/painting/qdrawhelper.cpp @@ -68,7 +68,6 @@ QT_BEGIN_NAMESPACE - #define MASK(src, a) src = BYTE_MUL(src, a) /* @@ -316,7 +315,7 @@ FetchPixelFunc qFetchPixel[QPixelLayout::BPPCount] = { static uint * QT_FASTCALL destFetchMono(uint *buffer, QRasterBuffer *rasterBuffer, int x, int y, int length) { - uchar *data = (uchar *)rasterBuffer->scanLine(y); + uchar *Q_DECL_RESTRICT data = (uchar *)rasterBuffer->scanLine(y); uint *start = buffer; const uint *end = buffer + length; while (buffer < end) { @@ -329,7 +328,7 @@ static uint * QT_FASTCALL destFetchMono(uint *buffer, QRasterBuffer *rasterBuffe static uint * QT_FASTCALL destFetchMonoLsb(uint *buffer, QRasterBuffer *rasterBuffer, int x, int y, int length) { - uchar *data = (uchar *)rasterBuffer->scanLine(y); + uchar *Q_DECL_RESTRICT data = (uchar *)rasterBuffer->scanLine(y); uint *start = buffer; const uint *end = buffer + length; while (buffer < end) { @@ -347,7 +346,7 @@ static uint * QT_FASTCALL destFetchARGB32P(uint *, QRasterBuffer *rasterBuffer, static uint * QT_FASTCALL destFetchRGB16(uint *buffer, QRasterBuffer *rasterBuffer, int x, int y, int length) { - const ushort *data = (const ushort *)rasterBuffer->scanLine(y) + x; + const ushort *Q_DECL_RESTRICT data = (const ushort *)rasterBuffer->scanLine(y) + x; for (int i = 0; i < length; ++i) buffer[i] = qConvertRgb16To32(data[i]); return buffer; @@ -418,7 +417,7 @@ static inline QRgb findNearestColor(QRgb color, QRasterBuffer *rbuf) static void QT_FASTCALL destStoreMono(QRasterBuffer *rasterBuffer, int x, int y, const uint *buffer, int length) { - uchar *data = (uchar *)rasterBuffer->scanLine(y); + uchar *Q_DECL_RESTRICT data = (uchar *)rasterBuffer->scanLine(y); if (rasterBuffer->monoDestinationWithClut) { for (int i = 0; i < length; ++i) { if (buffer[i] == rasterBuffer->destColor0) { @@ -445,7 +444,7 @@ static void QT_FASTCALL destStoreMono(QRasterBuffer *rasterBuffer, int x, int y, static void QT_FASTCALL destStoreMonoLsb(QRasterBuffer *rasterBuffer, int x, int y, const uint *buffer, int length) { - uchar *data = (uchar *)rasterBuffer->scanLine(y); + uchar *Q_DECL_RESTRICT data = (uchar *)rasterBuffer->scanLine(y); if (rasterBuffer->monoDestinationWithClut) { for (int i = 0; i < length; ++i) { if (buffer[i] == rasterBuffer->destColor0) { @@ -2039,7 +2038,7 @@ void QT_FASTCALL comp_func_solid_Source(uint *dest, int length, uint color, uint } } -void QT_FASTCALL comp_func_Source(uint *dest, const uint *src, int length, uint const_alpha) +void QT_FASTCALL comp_func_Source(uint *Q_DECL_RESTRICT dest, const uint *Q_DECL_RESTRICT src, int length, uint const_alpha) { if (const_alpha == 255) { ::memcpy(dest, src, length * sizeof(uint)); @@ -2082,7 +2081,7 @@ void QT_FASTCALL comp_func_solid_SourceOver(uint *dest, int length, uint color, } } -void QT_FASTCALL comp_func_SourceOver(uint *dest, const uint *src, int length, uint const_alpha) +void QT_FASTCALL comp_func_SourceOver(uint *Q_DECL_RESTRICT dest, const uint *Q_DECL_RESTRICT src, int length, uint const_alpha) { PRELOAD_INIT2(dest, src) if (const_alpha == 255) { @@ -2120,7 +2119,7 @@ void QT_FASTCALL comp_func_solid_DestinationOver(uint *dest, int length, uint co } } -void QT_FASTCALL comp_func_DestinationOver(uint *dest, const uint *src, int length, uint const_alpha) +void QT_FASTCALL comp_func_DestinationOver(uint *Q_DECL_RESTRICT dest, const uint *Q_DECL_RESTRICT src, int length, uint const_alpha) { PRELOAD_INIT2(dest, src) if (const_alpha == 255) { @@ -2162,7 +2161,7 @@ void QT_FASTCALL comp_func_solid_SourceIn(uint *dest, int length, uint color, ui } } -void QT_FASTCALL comp_func_SourceIn(uint *dest, const uint *src, int length, uint const_alpha) +void QT_FASTCALL comp_func_SourceIn(uint *Q_DECL_RESTRICT dest, const uint *Q_DECL_RESTRICT src, int length, uint const_alpha) { PRELOAD_INIT2(dest, src) if (const_alpha == 255) { @@ -2199,7 +2198,7 @@ void QT_FASTCALL comp_func_solid_DestinationIn(uint *dest, int length, uint colo } } -void QT_FASTCALL comp_func_DestinationIn(uint *dest, const uint *src, int length, uint const_alpha) +void QT_FASTCALL comp_func_DestinationIn(uint *Q_DECL_RESTRICT dest, const uint *Q_DECL_RESTRICT src, int length, uint const_alpha) { PRELOAD_INIT2(dest, src) if (const_alpha == 255) { @@ -2241,7 +2240,7 @@ void QT_FASTCALL comp_func_solid_SourceOut(uint *dest, int length, uint color, u } } -void QT_FASTCALL comp_func_SourceOut(uint *dest, const uint *src, int length, uint const_alpha) +void QT_FASTCALL comp_func_SourceOut(uint *Q_DECL_RESTRICT dest, const uint *Q_DECL_RESTRICT src, int length, uint const_alpha) { PRELOAD_INIT2(dest, src) if (const_alpha == 255) { @@ -2277,7 +2276,7 @@ void QT_FASTCALL comp_func_solid_DestinationOut(uint *dest, int length, uint col } } -void QT_FASTCALL comp_func_DestinationOut(uint *dest, const uint *src, int length, uint const_alpha) +void QT_FASTCALL comp_func_DestinationOut(uint *Q_DECL_RESTRICT dest, const uint *Q_DECL_RESTRICT src, int length, uint const_alpha) { PRELOAD_INIT2(dest, src) if (const_alpha == 255) { @@ -2314,7 +2313,7 @@ void QT_FASTCALL comp_func_solid_SourceAtop(uint *dest, int length, uint color, } } -void QT_FASTCALL comp_func_SourceAtop(uint *dest, const uint *src, int length, uint const_alpha) +void QT_FASTCALL comp_func_SourceAtop(uint *Q_DECL_RESTRICT dest, const uint *Q_DECL_RESTRICT src, int length, uint const_alpha) { PRELOAD_INIT2(dest, src) if (const_alpha == 255) { @@ -2354,7 +2353,7 @@ void QT_FASTCALL comp_func_solid_DestinationAtop(uint *dest, int length, uint co } } -void QT_FASTCALL comp_func_DestinationAtop(uint *dest, const uint *src, int length, uint const_alpha) +void QT_FASTCALL comp_func_DestinationAtop(uint *Q_DECL_RESTRICT dest, const uint *Q_DECL_RESTRICT src, int length, uint const_alpha) { PRELOAD_INIT2(dest, src) if (const_alpha == 255) { @@ -2396,7 +2395,7 @@ void QT_FASTCALL comp_func_solid_XOR(uint *dest, int length, uint color, uint co } } -void QT_FASTCALL comp_func_XOR(uint *dest, const uint *src, int length, uint const_alpha) +void QT_FASTCALL comp_func_XOR(uint *Q_DECL_RESTRICT dest, const uint *Q_DECL_RESTRICT src, int length, uint const_alpha) { PRELOAD_INIT2(dest, src) if (const_alpha == 255) { @@ -2472,7 +2471,7 @@ void QT_FASTCALL comp_func_solid_Plus(uint *dest, int length, uint color, uint c } template -Q_STATIC_TEMPLATE_FUNCTION inline void comp_func_Plus_impl(uint *dest, const uint *src, int length, const T &coverage) +Q_STATIC_TEMPLATE_FUNCTION inline void comp_func_Plus_impl(uint *Q_DECL_RESTRICT dest, const uint *Q_DECL_RESTRICT src, int length, const T &coverage) { PRELOAD_INIT2(dest, src) for (int i = 0; i < length; ++i) { @@ -2486,7 +2485,7 @@ Q_STATIC_TEMPLATE_FUNCTION inline void comp_func_Plus_impl(uint *dest, const uin } } -void QT_FASTCALL comp_func_Plus(uint *dest, const uint *src, int length, uint const_alpha) +void QT_FASTCALL comp_func_Plus(uint *Q_DECL_RESTRICT dest, const uint *Q_DECL_RESTRICT src, int length, uint const_alpha) { if (const_alpha == 255) comp_func_Plus_impl(dest, src, length, QFullCoverage()); @@ -2536,7 +2535,7 @@ void QT_FASTCALL comp_func_solid_Multiply(uint *dest, int length, uint color, ui } template -Q_STATIC_TEMPLATE_FUNCTION inline void comp_func_Multiply_impl(uint *dest, const uint *src, int length, const T &coverage) +Q_STATIC_TEMPLATE_FUNCTION inline void comp_func_Multiply_impl(uint *Q_DECL_RESTRICT dest, const uint *Q_DECL_RESTRICT src, int length, const T &coverage) { PRELOAD_INIT2(dest, src) for (int i = 0; i < length; ++i) { @@ -2558,7 +2557,7 @@ Q_STATIC_TEMPLATE_FUNCTION inline void comp_func_Multiply_impl(uint *dest, const } } -void QT_FASTCALL comp_func_Multiply(uint *dest, const uint *src, int length, uint const_alpha) +void QT_FASTCALL comp_func_Multiply(uint *Q_DECL_RESTRICT dest, const uint *Q_DECL_RESTRICT src, int length, uint const_alpha) { if (const_alpha == 255) comp_func_Multiply_impl(dest, src, length, QFullCoverage()); @@ -2604,7 +2603,7 @@ void QT_FASTCALL comp_func_solid_Screen(uint *dest, int length, uint color, uint } template -Q_STATIC_TEMPLATE_FUNCTION inline void comp_func_Screen_impl(uint *dest, const uint *src, int length, const T &coverage) +Q_STATIC_TEMPLATE_FUNCTION inline void comp_func_Screen_impl(uint *Q_DECL_RESTRICT dest, const uint *Q_DECL_RESTRICT src, int length, const T &coverage) { PRELOAD_INIT2(dest, src) for (int i = 0; i < length; ++i) { @@ -2683,7 +2682,7 @@ void QT_FASTCALL comp_func_solid_Overlay(uint *dest, int length, uint color, uin } template -Q_STATIC_TEMPLATE_FUNCTION inline void comp_func_Overlay_impl(uint *dest, const uint *src, int length, const T &coverage) +Q_STATIC_TEMPLATE_FUNCTION inline void comp_func_Overlay_impl(uint *Q_DECL_RESTRICT dest, const uint *Q_DECL_RESTRICT src, int length, const T &coverage) { PRELOAD_INIT2(dest, src) for (int i = 0; i < length; ++i) { @@ -2705,7 +2704,7 @@ Q_STATIC_TEMPLATE_FUNCTION inline void comp_func_Overlay_impl(uint *dest, const } } -void QT_FASTCALL comp_func_Overlay(uint *dest, const uint *src, int length, uint const_alpha) +void QT_FASTCALL comp_func_Overlay(uint *Q_DECL_RESTRICT dest, const uint *Q_DECL_RESTRICT src, int length, uint const_alpha) { if (const_alpha == 255) comp_func_Overlay_impl(dest, src, length, QFullCoverage()); @@ -2756,7 +2755,7 @@ void QT_FASTCALL comp_func_solid_Darken(uint *dest, int length, uint color, uint } template -Q_STATIC_TEMPLATE_FUNCTION inline void comp_func_Darken_impl(uint *dest, const uint *src, int length, const T &coverage) +Q_STATIC_TEMPLATE_FUNCTION inline void comp_func_Darken_impl(uint *Q_DECL_RESTRICT dest, const uint *Q_DECL_RESTRICT src, int length, const T &coverage) { PRELOAD_INIT2(dest, src) for (int i = 0; i < length; ++i) { @@ -2778,7 +2777,7 @@ Q_STATIC_TEMPLATE_FUNCTION inline void comp_func_Darken_impl(uint *dest, const u } } -void QT_FASTCALL comp_func_Darken(uint *dest, const uint *src, int length, uint const_alpha) +void QT_FASTCALL comp_func_Darken(uint *Q_DECL_RESTRICT dest, const uint *Q_DECL_RESTRICT src, int length, uint const_alpha) { if (const_alpha == 255) comp_func_Darken_impl(dest, src, length, QFullCoverage()); @@ -2829,7 +2828,7 @@ void QT_FASTCALL comp_func_solid_Lighten(uint *dest, int length, uint color, uin } template -Q_STATIC_TEMPLATE_FUNCTION inline void comp_func_Lighten_impl(uint *dest, const uint *src, int length, const T &coverage) +Q_STATIC_TEMPLATE_FUNCTION inline void comp_func_Lighten_impl(uint *Q_DECL_RESTRICT dest, const uint *Q_DECL_RESTRICT src, int length, const T &coverage) { PRELOAD_INIT2(dest, src) for (int i = 0; i < length; ++i) { @@ -2851,7 +2850,7 @@ Q_STATIC_TEMPLATE_FUNCTION inline void comp_func_Lighten_impl(uint *dest, const } } -void QT_FASTCALL comp_func_Lighten(uint *dest, const uint *src, int length, uint const_alpha) +void QT_FASTCALL comp_func_Lighten(uint *Q_DECL_RESTRICT dest, const uint *Q_DECL_RESTRICT src, int length, uint const_alpha) { if (const_alpha == 255) comp_func_Lighten_impl(dest, src, length, QFullCoverage()); @@ -2912,7 +2911,7 @@ void QT_FASTCALL comp_func_solid_ColorDodge(uint *dest, int length, uint color, } template -Q_STATIC_TEMPLATE_FUNCTION inline void comp_func_ColorDodge_impl(uint *dest, const uint *src, int length, const T &coverage) +Q_STATIC_TEMPLATE_FUNCTION inline void comp_func_ColorDodge_impl(uint *Q_DECL_RESTRICT dest, const uint *Q_DECL_RESTRICT src, int length, const T &coverage) { PRELOAD_INIT2(dest, src) for (int i = 0; i < length; ++i) { @@ -2934,7 +2933,7 @@ Q_STATIC_TEMPLATE_FUNCTION inline void comp_func_ColorDodge_impl(uint *dest, con } } -void QT_FASTCALL comp_func_ColorDodge(uint *dest, const uint *src, int length, uint const_alpha) +void QT_FASTCALL comp_func_ColorDodge(uint *Q_DECL_RESTRICT dest, const uint *Q_DECL_RESTRICT src, int length, uint const_alpha) { if (const_alpha == 255) comp_func_ColorDodge_impl(dest, src, length, QFullCoverage()); @@ -2995,7 +2994,7 @@ void QT_FASTCALL comp_func_solid_ColorBurn(uint *dest, int length, uint color, u } template -Q_STATIC_TEMPLATE_FUNCTION inline void comp_func_ColorBurn_impl(uint *dest, const uint *src, int length, const T &coverage) +Q_STATIC_TEMPLATE_FUNCTION inline void comp_func_ColorBurn_impl(uint *Q_DECL_RESTRICT dest, const uint *Q_DECL_RESTRICT src, int length, const T &coverage) { PRELOAD_INIT2(dest, src) for (int i = 0; i < length; ++i) { @@ -3017,7 +3016,7 @@ Q_STATIC_TEMPLATE_FUNCTION inline void comp_func_ColorBurn_impl(uint *dest, cons } } -void QT_FASTCALL comp_func_ColorBurn(uint *dest, const uint *src, int length, uint const_alpha) +void QT_FASTCALL comp_func_ColorBurn(uint *Q_DECL_RESTRICT dest, const uint *Q_DECL_RESTRICT src, int length, uint const_alpha) { if (const_alpha == 255) comp_func_ColorBurn_impl(dest, src, length, QFullCoverage()); @@ -3075,7 +3074,7 @@ void QT_FASTCALL comp_func_solid_HardLight(uint *dest, int length, uint color, u } template -Q_STATIC_TEMPLATE_FUNCTION inline void comp_func_HardLight_impl(uint *dest, const uint *src, int length, const T &coverage) +Q_STATIC_TEMPLATE_FUNCTION inline void comp_func_HardLight_impl(uint *Q_DECL_RESTRICT dest, const uint *Q_DECL_RESTRICT src, int length, const T &coverage) { PRELOAD_INIT2(dest, src) for (int i = 0; i < length; ++i) { @@ -3097,7 +3096,7 @@ Q_STATIC_TEMPLATE_FUNCTION inline void comp_func_HardLight_impl(uint *dest, cons } } -void QT_FASTCALL comp_func_HardLight(uint *dest, const uint *src, int length, uint const_alpha) +void QT_FASTCALL comp_func_HardLight(uint *Q_DECL_RESTRICT dest, const uint *Q_DECL_RESTRICT src, int length, uint const_alpha) { if (const_alpha == 255) comp_func_HardLight_impl(dest, src, length, QFullCoverage()); @@ -3166,7 +3165,7 @@ void QT_FASTCALL comp_func_solid_SoftLight(uint *dest, int length, uint color, u } template -Q_STATIC_TEMPLATE_FUNCTION inline void comp_func_SoftLight_impl(uint *dest, const uint *src, int length, const T &coverage) +Q_STATIC_TEMPLATE_FUNCTION inline void comp_func_SoftLight_impl(uint *Q_DECL_RESTRICT dest, const uint *Q_DECL_RESTRICT src, int length, const T &coverage) { PRELOAD_INIT2(dest, src) for (int i = 0; i < length; ++i) { @@ -3188,7 +3187,7 @@ Q_STATIC_TEMPLATE_FUNCTION inline void comp_func_SoftLight_impl(uint *dest, cons } } -void QT_FASTCALL comp_func_SoftLight(uint *dest, const uint *src, int length, uint const_alpha) +void QT_FASTCALL comp_func_SoftLight(uint *Q_DECL_RESTRICT dest, const uint *Q_DECL_RESTRICT src, int length, uint const_alpha) { if (const_alpha == 255) comp_func_SoftLight_impl(dest, src, length, QFullCoverage()); @@ -3239,7 +3238,7 @@ void QT_FASTCALL comp_func_solid_Difference(uint *dest, int length, uint color, } template -Q_STATIC_TEMPLATE_FUNCTION inline void comp_func_Difference_impl(uint *dest, const uint *src, int length, const T &coverage) +Q_STATIC_TEMPLATE_FUNCTION inline void comp_func_Difference_impl(uint *Q_DECL_RESTRICT dest, const uint *Q_DECL_RESTRICT src, int length, const T &coverage) { PRELOAD_INIT2(dest, src) for (int i = 0; i < length; ++i) { @@ -3261,7 +3260,7 @@ Q_STATIC_TEMPLATE_FUNCTION inline void comp_func_Difference_impl(uint *dest, con } } -void QT_FASTCALL comp_func_Difference(uint *dest, const uint *src, int length, uint const_alpha) +void QT_FASTCALL comp_func_Difference(uint *Q_DECL_RESTRICT dest, const uint *Q_DECL_RESTRICT src, int length, uint const_alpha) { if (const_alpha == 255) comp_func_Difference_impl(dest, src, length, QFullCoverage()); @@ -3306,7 +3305,7 @@ void QT_FASTCALL comp_func_solid_Exclusion(uint *dest, int length, uint color, u } template -Q_STATIC_TEMPLATE_FUNCTION inline void comp_func_Exclusion_impl(uint *dest, const uint *src, int length, const T &coverage) +Q_STATIC_TEMPLATE_FUNCTION inline void comp_func_Exclusion_impl(uint *Q_DECL_RESTRICT dest, const uint *Q_DECL_RESTRICT src, int length, const T &coverage) { PRELOAD_INIT2(dest, src) for (int i = 0; i < length; ++i) { @@ -3328,7 +3327,7 @@ Q_STATIC_TEMPLATE_FUNCTION inline void comp_func_Exclusion_impl(uint *dest, cons } } -void QT_FASTCALL comp_func_Exclusion(uint *dest, const uint *src, int length, uint const_alpha) +void QT_FASTCALL comp_func_Exclusion(uint *Q_DECL_RESTRICT dest, const uint *Q_DECL_RESTRICT src, int length, uint const_alpha) { if (const_alpha == 255) comp_func_Exclusion_impl(dest, src, length, QFullCoverage()); @@ -3351,8 +3350,8 @@ void QT_FASTCALL rasterop_solid_SourceOrDestination(uint *dest, *dest++ |= color; } -void QT_FASTCALL rasterop_SourceOrDestination(uint *dest, - const uint *src, +void QT_FASTCALL rasterop_SourceOrDestination(uint *Q_DECL_RESTRICT dest, + const uint *Q_DECL_RESTRICT src, int length, uint const_alpha) { @@ -3372,8 +3371,8 @@ void QT_FASTCALL rasterop_solid_SourceAndDestination(uint *dest, *dest++ &= color; } -void QT_FASTCALL rasterop_SourceAndDestination(uint *dest, - const uint *src, +void QT_FASTCALL rasterop_SourceAndDestination(uint *Q_DECL_RESTRICT dest, + const uint *Q_DECL_RESTRICT src, int length, uint const_alpha) { @@ -3395,8 +3394,8 @@ void QT_FASTCALL rasterop_solid_SourceXorDestination(uint *dest, *dest++ ^= color; } -void QT_FASTCALL rasterop_SourceXorDestination(uint *dest, - const uint *src, +void QT_FASTCALL rasterop_SourceXorDestination(uint *Q_DECL_RESTRICT dest, + const uint *Q_DECL_RESTRICT src, int length, uint const_alpha) { @@ -3420,8 +3419,8 @@ void QT_FASTCALL rasterop_solid_NotSourceAndNotDestination(uint *dest, } } -void QT_FASTCALL rasterop_NotSourceAndNotDestination(uint *dest, - const uint *src, +void QT_FASTCALL rasterop_NotSourceAndNotDestination(uint *Q_DECL_RESTRICT dest, + const uint *Q_DECL_RESTRICT src, int length, uint const_alpha) { @@ -3445,8 +3444,8 @@ void QT_FASTCALL rasterop_solid_NotSourceOrNotDestination(uint *dest, } } -void QT_FASTCALL rasterop_NotSourceOrNotDestination(uint *dest, - const uint *src, +void QT_FASTCALL rasterop_NotSourceOrNotDestination(uint *Q_DECL_RESTRICT dest, + const uint *Q_DECL_RESTRICT src, int length, uint const_alpha) { @@ -3470,8 +3469,8 @@ void QT_FASTCALL rasterop_solid_NotSourceXorDestination(uint *dest, } } -void QT_FASTCALL rasterop_NotSourceXorDestination(uint *dest, - const uint *src, +void QT_FASTCALL rasterop_NotSourceXorDestination(uint *Q_DECL_RESTRICT dest, + const uint *Q_DECL_RESTRICT src, int length, uint const_alpha) { @@ -3489,7 +3488,7 @@ void QT_FASTCALL rasterop_solid_NotSource(uint *dest, int length, qt_memfill(dest, ~color | 0xff000000, length); } -void QT_FASTCALL rasterop_NotSource(uint *dest, const uint *src, +void QT_FASTCALL rasterop_NotSource(uint *Q_DECL_RESTRICT dest, const uint *Q_DECL_RESTRICT src, int length, uint const_alpha) { Q_UNUSED(const_alpha); @@ -3510,8 +3509,8 @@ void QT_FASTCALL rasterop_solid_NotSourceAndDestination(uint *dest, } } -void QT_FASTCALL rasterop_NotSourceAndDestination(uint *dest, - const uint *src, +void QT_FASTCALL rasterop_NotSourceAndDestination(uint *Q_DECL_RESTRICT dest, + const uint *Q_DECL_RESTRICT src, int length, uint const_alpha) { @@ -3534,8 +3533,8 @@ void QT_FASTCALL rasterop_solid_SourceAndNotDestination(uint *dest, } } -void QT_FASTCALL rasterop_SourceAndNotDestination(uint *dest, - const uint *src, +void QT_FASTCALL rasterop_SourceAndNotDestination(uint *Q_DECL_RESTRICT dest, + const uint *Q_DECL_RESTRICT src, int length, uint const_alpha) { @@ -4049,8 +4048,8 @@ static inline quint32 interpolate_pixel_rgb16x2_255(quint32 x, quint8 a, return t; } -static inline void blend_sourceOver_rgb16_rgb16(quint16 *dest, - const quint16 *src, +static inline void blend_sourceOver_rgb16_rgb16(quint16 *Q_DECL_RESTRICT dest, + const quint16 *Q_DECL_RESTRICT src, int length, const quint8 alpha, const quint8 ialpha) diff --git a/src/gui/painting/qdrawhelper_p.h b/src/gui/painting/qdrawhelper_p.h index 8d67e69..f502533 100644 --- a/src/gui/painting/qdrawhelper_p.h +++ b/src/gui/painting/qdrawhelper_p.h @@ -71,12 +71,15 @@ QT_BEGIN_NAMESPACE // RVCT doesn't like static template functions # define Q_STATIC_TEMPLATE_FUNCTION # define Q_STATIC_INLINE_FUNCTION static __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_DECL_RESTRICT __restrict__ #else # define Q_STATIC_TEMPLATE_FUNCTION static # define Q_STATIC_INLINE_FUNCTION static inline +# define Q_DECL_RESTRICT #endif static const uint AMASK = 0xff000000; @@ -165,7 +168,7 @@ extern DrawHelper qDrawHelper[QImage::NImageFormats]; void qBlendTexture(int count, const QSpan *spans, void *userData); -typedef void (QT_FASTCALL *CompositionFunction)(uint *dest, const uint *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 *CompositionFunctionSolid)(uint *dest, int length, uint color, uint const_alpha); struct LinearGradientValues -- 2.7.4