src/gui/painting/qdrawingprimitive_sse2_p.h
changeset 37 758a864f9613
parent 33 3e2da88830cd
equal deleted inserted replaced
36:ef0373b55136 37:758a864f9613
   141 // with shortcuts if fully opaque or fully transparent.
   141 // with shortcuts if fully opaque or fully transparent.
   142 #define BLEND_SOURCE_OVER_ARGB32_SSE2(dst, src, length, nullVector, half, one, colorMask, alphaMask) { \
   142 #define BLEND_SOURCE_OVER_ARGB32_SSE2(dst, src, length, nullVector, half, one, colorMask, alphaMask) { \
   143     int x = 0; \
   143     int x = 0; \
   144 \
   144 \
   145     /* First, get dst aligned. */ \
   145     /* First, get dst aligned. */ \
   146     const int offsetToAlignOn16Bytes = (4 - ((reinterpret_cast<quintptr>(dst) >> 2) & 0x3)) & 0x3;\
   146     ALIGNMENT_PROLOGUE_16BYTES(dst, x, length) { \
   147     const int prologLength = qMin(length, offsetToAlignOn16Bytes);\
       
   148     for (; x < prologLength; ++x) { \
       
   149         uint s = src[x]; \
   147         uint s = src[x]; \
   150         if (s >= 0xff000000) \
   148         if (s >= 0xff000000) \
   151             dst[x] = s; \
   149             dst[x] = s; \
   152         else if (s != 0) \
   150         else if (s != 0) \
   153             dst[x] = s + BYTE_MUL(dst[x], qAlpha(~s)); \
   151             dst[x] = s + BYTE_MUL(dst[x], qAlpha(~s)); \
   200 //      = s * ca + d * (1 - sa*ca)
   198 //      = s * ca + d * (1 - sa*ca)
   201 #define BLEND_SOURCE_OVER_ARGB32_WITH_CONST_ALPHA_SSE2(dst, src, length, nullVector, half, one, colorMask, constAlphaVector) \
   199 #define BLEND_SOURCE_OVER_ARGB32_WITH_CONST_ALPHA_SSE2(dst, src, length, nullVector, half, one, colorMask, constAlphaVector) \
   202 { \
   200 { \
   203     int x = 0; \
   201     int x = 0; \
   204 \
   202 \
   205     const int offsetToAlignOn16Bytes = (4 - ((reinterpret_cast<quintptr>(dst) >> 2) & 0x3)) & 0x3;\
   203     ALIGNMENT_PROLOGUE_16BYTES(dst, x, length) { \
   206     const int prologLength = qMin(length, offsetToAlignOn16Bytes);\
       
   207     for (; x < prologLength; ++x) { \
       
   208         quint32 s = src[x]; \
   204         quint32 s = src[x]; \
   209         if (s != 0) { \
   205         if (s != 0) { \
   210             s = BYTE_MUL(s, const_alpha); \
   206             s = BYTE_MUL(s, const_alpha); \
   211             dst[x] = s + BYTE_MUL(dst[x], qAlpha(~s)); \
   207             dst[x] = s + BYTE_MUL(dst[x], qAlpha(~s)); \
   212         } \
   208         } \