42 #ifndef QDRAWHELPER_MMX_P_H 43 #define QDRAWHELPER_MMX_P_H 56 #include <private/qdrawhelper_p.h> 57 #include <private/qdrawhelper_x86_p.h> 58 #include <private/qpaintengine_raster_p.h> 64 #define C_FF const m64 mmx_0x00ff = _mm_set1_pi16(0xff) 65 #define C_80 const m64 mmx_0x0080 = _mm_set1_pi16(0x80) 66 #define C_00 const m64 mmx_0x0000 = _mm_setzero_si64() 69 # pragma warning(disable: 4799) // No EMMS at end of function 79 x = _mm_unpackhi_pi16(x, x);
80 x = _mm_unpackhi_pi16(x, x);
85 return _mm_xor_si64(x, mmx_0x00ff);
89 return _mm_adds_pu16 (a, b);
93 const m64 &mmx_0x0080)
95 m64 res = _mm_mullo_pi16(a, b);
96 res = _mm_adds_pu16(res, mmx_0x0080);
97 res = _mm_adds_pu16(res, _mm_srli_pi16 (res, 8));
98 return _mm_srli_pi16(res, 8);
102 const m64 &y,
const m64 &b)
104 m64 res = _mm_adds_pu16(_mm_mullo_pi16(x, a), _mm_mullo_pi16(y, b));
105 return _mm_srli_pi16(res, 8);
109 const m64 &y,
const m64 &b,
110 const m64 &mmx_0x0080)
112 m64 res = _mm_adds_pu16(_mm_mullo_pi16(x, a), _mm_mullo_pi16(y, b));
113 res = _mm_adds_pu16(res, mmx_0x0080);
114 res = _mm_adds_pu16(res, _mm_srli_pi16 (res, 8));
115 return _mm_srli_pi16(res, 8);
124 return _mm_unpacklo_pi8(_mm_cvtsi32_si64(x), mmx_0x0000);
129 return _mm_set1_pi32(x);
133 return _mm_cvtsi64_si32(_mm_packs_pu16(x, mmx_0x0000));
137 #define negate(x) _negate(x, mmx_0x00ff) 138 #define byte_mul(a, b) _byte_mul(a, b, mmx_0x0080) 139 #define interpolate_pixel_255(x, a, y, b) _interpolate_pixel_255(x, a, y, b, mmx_0x0080) 140 #define premul(x) _premul(x, mmx_0x0080) 141 #define load(x) _load(x, mmx_0x0000) 142 #define load_alpha(x) _load_alpha(x, mmx_0x0000) 143 #define store(x) _store(x, mmx_0x0000) 149 #define comp_func_Clear_impl(dest, length, const_alpha)\ 151 if (const_alpha == 255) {\ 152 qt_memfill(static_cast<quint32*>(dest), quint32(0), length);\ 155 m64 ia = MM::negate(MM::load_alpha(const_alpha));\ 156 for (int i = 0; i < length; ++i) {\ 157 dest[i] = MM::store(MM::byte_mul(MM::load(dest[i]), ia));\ 182 if (const_alpha == 255) {
189 for (
int i = 0; i < length; ++i) {
199 if (const_alpha == 255) {
200 ::memcpy(dest, src, length *
sizeof(
uint));
205 for (
int i = 0; i < length; ++i)
221 if ((const_alpha &
qAlpha(src)) == 255) {
226 if (const_alpha != 255) {
231 for (
int i = 0; i < length; ++i)
241 if (const_alpha == 255) {
242 for (
int i = 0; i < length; ++i) {
243 const uint alphaMaskedSource = 0xff000000 & src[i];
244 if (alphaMaskedSource == 0)
246 if (alphaMaskedSource == 0xff000000) {
256 for (
int i = 0; i < length; ++i) {
257 if ((0xff000000 & src[i]) == 0)
277 if (const_alpha != 255)
280 for (
int i = 0; i < length; ++i) {
292 if (const_alpha == 255) {
293 for (
int i = 0; i < length; ++i) {
300 for (
int i = 0; i < length; ++i) {
318 if (const_alpha == 255) {
320 for (
int i = 0; i < length; ++i) {
330 for (
int i = 0; i < length; ++i) {
342 if (const_alpha == 255) {
343 for (
int i = 0; i < length; ++i) {
350 for (
int i = 0; i < length; ++i) {
370 if (const_alpha != 255) {
377 for (
int i = 0; i < length; ++i)
386 if (const_alpha == 255) {
387 for (
int i = 0; i < length; ++i) {
394 for (
int i = 0; i < length; ++i) {
414 if (const_alpha == 255) {
415 for (
int i = 0; i < length; ++i) {
423 for (
int i = 0; i < length; ++i) {
435 if (const_alpha == 255) {
436 for (
int i = 0; i < length; ++i) {
443 for (
int i = 0; i < length; ++i) {
462 if (const_alpha != 255) {
467 for (
int i = 0; i < length; ++i)
476 if (const_alpha == 255) {
477 for (
int i = 0; i < length; ++i) {
484 for (
int i = 0; i < length; ++i) {
506 if (const_alpha != 255) {
511 for (
int i = 0; i < length; ++i) {
522 if (const_alpha == 255) {
523 for (
int i = 0; i < length; ++i) {
531 for (
int i = 0; i < length; ++i) {
552 m64 a = MM::alpha(s);
553 if (const_alpha != 255) {
559 for (
int i = 0; i < length; ++i) {
570 if (const_alpha == 255) {
571 for (
int i = 0; i < length; ++i) {
579 for (
int i = 0; i < length; ++i) {
583 m64 a = MM::alpha(s);
603 if (const_alpha != 255) {
608 for (
int i = 0; i < length; ++i) {
620 if (const_alpha == 255) {
621 for (
int i = 0; i < length; ++i) {
629 for (
int i = 0; i < length; ++i) {
653 const int length64 = length / 2;
655 __m64 *dst64 =
reinterpret_cast<__m64*
>(dest);
656 const __m64 color64 = _mm_set_pi32(color, color);
658 int n = (length64 + 3) / 4;
659 switch (length64 & 0x3) {
660 case 0:
do { *dst64 = _mm_or_si64(*dst64, color64); ++dst64;
661 case 3: *dst64 = _mm_or_si64(*dst64, color64); ++dst64;
662 case 2: *dst64 = _mm_or_si64(*dst64, color64); ++dst64;
663 case 1: *dst64 = _mm_or_si64(*dst64, color64); ++dst64;
669 dest[length - 1] |= color;
690 const int length64 = length / 2;
692 __m64 *dst64 =
reinterpret_cast<__m64*
>(dest);
693 const __m64 color64 = _mm_set_pi32(color, color);
695 int n = (length64 + 3) / 4;
696 switch (length64 & 0x3) {
697 case 0:
do { *dst64 = _mm_and_si64(*dst64, color64); ++dst64;
698 case 3: *dst64 = _mm_and_si64(*dst64, color64); ++dst64;
699 case 2: *dst64 = _mm_and_si64(*dst64, color64); ++dst64;
700 case 1: *dst64 = _mm_and_si64(*dst64, color64); ++dst64;
706 dest[length - 1] &= color;
727 const int length64 = length / 2;
729 __m64 *dst64 =
reinterpret_cast<__m64*
>(dest);
730 const __m64 color64 = _mm_set_pi32(color, color);
732 int n = (length64 + 3) / 4;
733 switch (length64 & 0x3) {
734 case 0:
do { *dst64 = _mm_xor_si64(*dst64, color64); ++dst64;
735 case 3: *dst64 = _mm_xor_si64(*dst64, color64); ++dst64;
736 case 2: *dst64 = _mm_xor_si64(*dst64, color64); ++dst64;
737 case 1: *dst64 = _mm_xor_si64(*dst64, color64); ++dst64;
743 dest[length - 1] ^= color;
759 *dest = (color & ~(*dest)) | 0xff000000;
764 const int length64 = length / 2;
766 __m64 *dst64 =
reinterpret_cast<__m64*
>(dest);
767 const __m64 color64 = _mm_set_pi32(color, color);
768 const m64 mmx_0xff000000 = _mm_set1_pi32(0xff000000);
769 __m64 tmp1, tmp2, tmp3, tmp4;
771 int n = (length64 + 3) / 4;
772 switch (length64 & 0x3) {
773 case 0:
do { tmp1 = _mm_andnot_si64(*dst64, color64);
774 *dst64++ = _mm_or_si64(tmp1, mmx_0xff000000);
775 case 3: tmp2 = _mm_andnot_si64(*dst64, color64);
776 *dst64++ = _mm_or_si64(tmp2, mmx_0xff000000);
777 case 2: tmp3 = _mm_andnot_si64(*dst64, color64);
778 *dst64++ = _mm_or_si64(tmp3, mmx_0xff000000);
779 case 1: tmp4 = _mm_andnot_si64(*dst64, color64);
780 *dst64++ = _mm_or_si64(tmp4, mmx_0xff000000);
786 dest[length - 1] = (color & ~(dest[length - 1])) | 0xff000000;
798 rasterop_solid_SourceAndNotDestination<MM>(dest, length,
799 ~color, const_alpha);
809 color = ~color | 0xff000000;
811 *dest = color | ~(*dest);
822 rasterop_solid_SourceXorDestination<MM>(dest, length, ~color, const_alpha);
839 rasterop_solid_SourceAndDestination<MM>(dest, length,
840 ~color, const_alpha);
863 for (
int i = 0; i < spans->
len; ++i)
882 static inline void end() {
883 #if !defined(Q_OS_WINCE) || defined(_X86_) 888 #endif // QT_HAVE_MMX 892 #endif // QDRAWHELPER_MMX_P_H static m64 add(const m64 &a, const m64 &b)
static void QT_FASTCALL comp_func_solid_SourceOut(uint *dest, int length, uint src, uint const_alpha)
static void QT_FASTCALL comp_func_XOR(uint *dest, const uint *src, int length, uint const_alpha)
static void QT_FASTCALL comp_func_solid_SourceIn(uint *dest, int length, uint src, uint const_alpha)
QIntegerForSizeof< void * >::Unsigned quintptr
#define QT_END_NAMESPACE
This macro expands to.
static void QT_FASTCALL rasterop_solid_SourceOrDestination(uint *dest, int length, uint color, uint const_alpha)
static void QT_FASTCALL comp_func_solid_SourceAtop(uint *dest, int length, uint src, uint const_alpha)
Q_GUI_EXPORT_INLINE int qAlpha(QRgb rgb)
static void QT_FASTCALL rasterop_solid_NotSource(uint *dest, int length, uint color, uint const_alpha)
static void QT_FASTCALL comp_func_DestinationOver(uint *dest, const uint *src, int length, uint const_alpha)
static void QT_FASTCALL rasterop_solid_NotSourceAndDestination(uint *dest, int length, uint color, uint const_alpha)
static void QT_FASTCALL comp_func_SourceOver(uint *dest, const uint *src, int length, uint const_alpha)
long ASN1_INTEGER_get ASN1_INTEGER * a
static m64 _interpolate_pixel_255(const m64 &x, const m64 &a, const m64 &y, const m64 &b, const m64 &mmx_0x0080)
static void QT_FASTCALL comp_func_SourceIn(uint *dest, const uint *src, int length, uint const_alpha)
static void QT_FASTCALL comp_func_solid_DestinationAtop(uint *dest, int length, uint src, uint const_alpha)
static m64 _load_alpha(uint x, const m64 &)
static void QT_FASTCALL comp_func_DestinationIn(uint *dest, const uint *src, int length, uint const_alpha)
QPainter::CompositionMode compositionMode
static m64 _byte_mul(const m64 &a, const m64 &b, const m64 &mmx_0x0080)
static void qt_blend_color_argb_x86(int count, const QSpan *spans, void *userData, CompositionFunctionSolid *solidFunc)
static void QT_FASTCALL comp_func_Source(uint *dest, const uint *src, int length, uint const_alpha)
#define QT_BEGIN_NAMESPACE
This macro expands to.
static m64 interpolate_pixel_256(const m64 &x, const m64 &a, const m64 &y, const m64 &b)
static void QT_FASTCALL comp_func_solid_DestinationOver(uint *dest, int length, uint src, uint const_alpha)
static void QT_FASTCALL comp_func_solid_Source(uint *dest, int length, uint src, uint const_alpha)
static void QT_FASTCALL comp_func_SourceAtop(uint *dest, const uint *src, int length, uint const_alpha)
static m64 _negate(const m64 &x, const m64 &mmx_0x00ff)
static uint _store(const m64 &x, const m64 &mmx_0x0000)
static m64 _premul(m64 x, const m64 &mmx_0x0080)
static const char * data(const QByteArray &arr)
static void QT_FASTCALL rasterop_solid_NotSourceXorDestination(uint *dest, int length, uint color, uint const_alpha)
static void QT_FASTCALL rasterop_solid_SourceAndDestination(uint *dest, int length, uint color, uint const_alpha)
static void QT_FASTCALL comp_func_solid_DestinationOut(uint *dest, int length, uint src, uint const_alpha)
#define interpolate_pixel_255(x, a, y, b)
static void QT_FASTCALL comp_func_solid_Clear(uint *dest, int length, uint, uint const_alpha)
static void QT_FASTCALL comp_func_Clear(uint *dest, const uint *, int length, uint const_alpha)
static void QT_FASTCALL comp_func_DestinationOut(uint *dest, const uint *src, int length, uint const_alpha)
QRasterBuffer * rasterBuffer
static void QT_FASTCALL comp_func_solid_XOR(uint *dest, int length, uint src, uint const_alpha)
static void QT_FASTCALL rasterop_solid_SourceAndNotDestination(uint *dest, int length, uint color, uint const_alpha)
if(void) toggleToolbarShown
static void QT_FASTCALL comp_func_solid_SourceOver(uint *dest, int length, uint src, uint const_alpha)
void(QT_FASTCALL * CompositionFunctionSolid)(uint *dest, int length, uint color, uint const_alpha)
#define comp_func_Clear_impl(dest, length, const_alpha)
static void QT_FASTCALL rasterop_solid_NotSourceAndNotDestination(uint *dest, int length, uint color, uint const_alpha)
static m64 _load(uint x, const m64 &mmx_0x0000)
static const KeyPair *const end
static void QT_FASTCALL comp_func_solid_DestinationIn(uint *dest, int length, uint src, uint const_alpha)
#define Q_UNUSED(x)
Indicates to the compiler that the parameter with the specified name is not used in the body of a fun...
static void QT_FASTCALL comp_func_SourceOut(uint *dest, const uint *src, int length, uint const_alpha)
static void QT_FASTCALL rasterop_solid_NotSourceOrNotDestination(uint *dest, int length, uint color, uint const_alpha)
static void QT_FASTCALL comp_func_DestinationAtop(uint *dest, const uint *src, int length, uint const_alpha)
void qt_memfill(T *dest, T value, int count)
static void QT_FASTCALL rasterop_solid_SourceXorDestination(uint *dest, int length, uint color, uint const_alpha)