| Absolute File Name: | /home/qt/qt5_coco/qt5/qtbase/src/gui/painting/qdrawhelper_sse2.cpp |
| Source code | Switch to Preprocessed file |
| Line | Source | Count | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | /**************************************************************************** | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2 | ** | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3 | ** Copyright (C) 2015 The Qt Company Ltd. | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4 | ** Contact: http://www.qt.io/licensing/ | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 5 | ** | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 6 | ** This file is part of the QtGui module of the Qt Toolkit. | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 7 | ** | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 8 | ** $QT_BEGIN_LICENSE:LGPL21$ | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 9 | ** Commercial License Usage | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | ** Licensees holding valid commercial Qt licenses may use this file in | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 11 | ** accordance with the commercial license agreement provided with the | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | ** Software or, alternatively, in accordance with the terms contained in | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | ** a written agreement between you and The Qt Company. For licensing terms | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | ** and conditions see http://www.qt.io/terms-conditions. For further | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | ** information use the contact form at http://www.qt.io/contact-us. | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | ** | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | ** GNU Lesser General Public License Usage | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | ** Alternatively, this file may be used under the terms of the GNU Lesser | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | ** General Public License version 2.1 or version 3 as published by the Free | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | ** Software Foundation and appearing in the file LICENSE.LGPLv21 and | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | ** LICENSE.LGPLv3 included in the packaging of this file. Please review the | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | ** following information to ensure the GNU Lesser General Public License | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | ** | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | ** As a special exception, The Qt Company gives you certain additional | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | ** rights. These rights are described in The Qt Company LGPL Exception | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | ** | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | ** $QT_END_LICENSE$ | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | ** | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | ****************************************************************************/ | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | #include <private/qdrawhelper_x86_p.h> | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | #ifdef QT_COMPILER_SUPPORTS_SSE2 | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | #include <private/qdrawingprimitive_sse2_p.h> | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | #include <private/qpaintengine_raster_p.h> | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | QT_BEGIN_NAMESPACE | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | #ifndef QDRAWHELPER_AVX | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | // in AVX mode, we'll use the SSSE3 code | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 45 | void qt_blend_argb32_on_argb32_sse2(uchar *destPixels, int dbpl, | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | const uchar *srcPixels, int sbpl, | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 47 | int w, int h, | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 48 | int const_alpha) | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 49 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 50 | const quint32 *src = (const quint32 *) srcPixels; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 51 | quint32 *dst = (quint32 *) destPixels; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 52 | if (const_alpha == 256) {
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 53 | const __m128i alphaMask = _mm_set1_epi32(0xff000000); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 54 | const __m128i nullVector = _mm_set1_epi32(0); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 55 | const __m128i half = _mm_set1_epi16(0x80); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 56 | const __m128i one = _mm_set1_epi16(0xff); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 57 | const __m128i colorMask = _mm_set1_epi32(0x00ff00ff); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 58 | for (int y = 0; y < h; ++y) {
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 59 | BLEND_SOURCE_OVER_ARGB32_SSE2(dst, src, w, nullVector, half, one, colorMask, alphaMask); never executed: dst[x] = s;never executed: dst[x] = s + BYTE_MUL(dst[x], qAlpha(~s));never executed: end of blocknever executed: end of blocknever executed: end of blocknever executed: end of blocknever executed: dst[x] = s;never executed: dst[x] = s + BYTE_MUL(dst[x], qAlpha(~s));never executed: end of block
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60 | dst = (quint32 *)(((uchar *) dst) + dbpl); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 61 | src = (const quint32 *)(((const uchar *) src) + sbpl); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 62 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 63 | } else if (const_alpha != 0) { never executed: end of block
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 64 | // dest = (s + d * sia) * ca + d * cia | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 65 | // = s * ca + d * (sia * ca + cia) | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 66 | // = s * ca + d * (1 - sa*ca) | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 67 | const_alpha = (const_alpha * 255) >> 8; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 68 | const __m128i nullVector = _mm_set1_epi32(0); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 69 | const __m128i half = _mm_set1_epi16(0x80); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 70 | const __m128i one = _mm_set1_epi16(0xff); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 71 | const __m128i colorMask = _mm_set1_epi32(0x00ff00ff); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 72 | const __m128i constAlphaVector = _mm_set1_epi16(const_alpha); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 73 | for (int y = 0; y < h; ++y) {
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 74 | BLEND_SOURCE_OVER_ARGB32_WITH_CONST_ALPHA_SSE2(dst, src, w, nullVector, half, one, colorMask, constAlphaVector) never executed: end of blocknever executed: end of blocknever executed: end of blocknever executed: end of blocknever executed: end of blocknever executed: end of block
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 75 | dst = (quint32 *)(((uchar *) dst) + dbpl); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 76 | src = (const quint32 *)(((const uchar *) src) + sbpl); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 77 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 78 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 79 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 80 | #endif | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 81 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 82 | // qblendfunctions.cpp | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 83 | void qt_blend_rgb32_on_rgb32(uchar *destPixels, int dbpl, | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 84 | const uchar *srcPixels, int sbpl, | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 85 | int w, int h, | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 86 | int const_alpha); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 87 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 88 | void qt_blend_rgb32_on_rgb32_sse2(uchar *destPixels, int dbpl, | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 89 | const uchar *srcPixels, int sbpl, | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 90 | int w, int h, | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 91 | int const_alpha) | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 92 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 93 | const quint32 *src = (const quint32 *) srcPixels; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 94 | quint32 *dst = (quint32 *) destPixels; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 95 | if (const_alpha != 256) {
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 96 | if (const_alpha != 0) {
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 97 | const __m128i nullVector = _mm_set1_epi32(0); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 98 | const __m128i half = _mm_set1_epi16(0x80); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 99 | const __m128i colorMask = _mm_set1_epi32(0x00ff00ff); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 100 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 101 | const_alpha = (const_alpha * 255) >> 8; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 102 | int one_minus_const_alpha = 255 - const_alpha; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 103 | const __m128i constAlphaVector = _mm_set1_epi16(const_alpha); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 104 | const __m128i oneMinusConstAlpha = _mm_set1_epi16(one_minus_const_alpha); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 105 | for (int y = 0; y < h; ++y) {
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 106 | int x = 0; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 107 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 108 | // First, align dest to 16 bytes: | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 109 | ALIGNMENT_PROLOGUE_16BYTES(dst, x, w) {
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 110 | dst[x] = INTERPOLATE_PIXEL_255(src[x], const_alpha, dst[x], one_minus_const_alpha); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 111 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 112 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 113 | for (; x < w-3; x += 4) {
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 114 | __m128i srcVector = _mm_loadu_si128((const __m128i *)&src[x]); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 115 | if (_mm_movemask_epi8(_mm_cmpeq_epi32(srcVector, nullVector)) != 0xffff) {
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 116 | const __m128i dstVector = _mm_load_si128((__m128i *)&dst[x]); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 117 | __m128i result; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 118 | INTERPOLATE_PIXEL_255_SSE2(result, srcVector, dstVector, constAlphaVector, oneMinusConstAlpha, colorMask, half); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 119 | _mm_store_si128((__m128i *)&dst[x], result); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 120 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 121 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 122 | for (; x<w; ++x) {
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 123 | dst[x] = INTERPOLATE_PIXEL_255(src[x], const_alpha, dst[x], one_minus_const_alpha); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 124 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 125 | dst = (quint32 *)(((uchar *) dst) + dbpl); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 126 | src = (const quint32 *)(((const uchar *) src) + sbpl); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 127 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 128 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 129 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 130 | qt_blend_rgb32_on_rgb32(destPixels, dbpl, srcPixels, sbpl, w, h, const_alpha); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 131 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 132 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 133 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 134 | void QT_FASTCALL comp_func_SourceOver_sse2(uint *destPixels, const uint *srcPixels, int length, uint const_alpha) | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 135 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 136 | Q_ASSERT(const_alpha < 256); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 137 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 138 | const quint32 *src = (const quint32 *) srcPixels; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 139 | quint32 *dst = (quint32 *) destPixels; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 140 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 141 | const __m128i nullVector = _mm_set1_epi32(0); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 142 | const __m128i half = _mm_set1_epi16(0x80); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 143 | const __m128i one = _mm_set1_epi16(0xff); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 144 | const __m128i colorMask = _mm_set1_epi32(0x00ff00ff); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 145 | if (const_alpha == 255) {
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 146 | const __m128i alphaMask = _mm_set1_epi32(0xff000000); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 147 | BLEND_SOURCE_OVER_ARGB32_SSE2(dst, src, length, nullVector, half, one, colorMask, alphaMask); never executed: dst[x] = s;never executed: dst[x] = s + BYTE_MUL(dst[x], qAlpha(~s));never executed: end of blocknever executed: end of blocknever executed: end of blocknever executed: end of blocknever executed: dst[x] = s;never executed: dst[x] = s + BYTE_MUL(dst[x], qAlpha(~s));never executed: end of block
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 148 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 149 | const __m128i constAlphaVector = _mm_set1_epi16(const_alpha); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 150 | BLEND_SOURCE_OVER_ARGB32_WITH_CONST_ALPHA_SSE2(dst, src, length, nullVector, half, one, colorMask, constAlphaVector); never executed: end of blocknever executed: end of blocknever executed: end of blocknever executed: end of blocknever executed: end of blocknever executed: end of block
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 151 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 152 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 153 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 154 | void QT_FASTCALL comp_func_Plus_sse2(uint *dst, const uint *src, int length, uint const_alpha) | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 155 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 156 | int x = 0; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 157 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 158 | if (const_alpha == 255) {
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 159 | // 1) Prologue: align destination on 16 bytes | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 160 | ALIGNMENT_PROLOGUE_16BYTES(dst, x, length)
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 161 | dst[x] = comp_func_Plus_one_pixel(dst[x], src[x]); never executed: dst[x] = comp_func_Plus_one_pixel(dst[x], src[x]); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 162 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 163 | // 2) composition with SSE2 | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 164 | for (; x < length - 3; x += 4) {
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 165 | const __m128i srcVector = _mm_loadu_si128((const __m128i *)&src[x]); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 166 | const __m128i dstVector = _mm_load_si128((__m128i *)&dst[x]); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 167 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 168 | const __m128i result = _mm_adds_epu8(srcVector, dstVector); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 169 | _mm_store_si128((__m128i *)&dst[x], result); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 170 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 171 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 172 | // 3) Epilogue: | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 173 | for (; x < length; ++x)
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 174 | dst[x] = comp_func_Plus_one_pixel(dst[x], src[x]); never executed: dst[x] = comp_func_Plus_one_pixel(dst[x], src[x]); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 175 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 176 | const int one_minus_const_alpha = 255 - const_alpha; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 177 | const __m128i constAlphaVector = _mm_set1_epi16(const_alpha); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 178 | const __m128i oneMinusConstAlpha = _mm_set1_epi16(one_minus_const_alpha); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 179 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 180 | // 1) Prologue: align destination on 16 bytes | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 181 | ALIGNMENT_PROLOGUE_16BYTES(dst, x, length)
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 182 | dst[x] = comp_func_Plus_one_pixel_const_alpha(dst[x], src[x], const_alpha, one_minus_const_alpha); never executed: dst[x] = comp_func_Plus_one_pixel_const_alpha(dst[x], src[x], const_alpha, one_minus_const_alpha); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 183 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 184 | const __m128i half = _mm_set1_epi16(0x80); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 185 | const __m128i colorMask = _mm_set1_epi32(0x00ff00ff); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 186 | // 2) composition with SSE2 | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 187 | for (; x < length - 3; x += 4) {
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 188 | const __m128i srcVector = _mm_loadu_si128((const __m128i *)&src[x]); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 189 | const __m128i dstVector = _mm_load_si128((__m128i *)&dst[x]); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 190 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 191 | __m128i result = _mm_adds_epu8(srcVector, dstVector); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 192 | INTERPOLATE_PIXEL_255_SSE2(result, result, dstVector, constAlphaVector, oneMinusConstAlpha, colorMask, half) | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 193 | _mm_store_si128((__m128i *)&dst[x], result); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 194 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 195 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 196 | // 3) Epilogue: | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 197 | for (; x < length; ++x)
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 198 | dst[x] = comp_func_Plus_one_pixel_const_alpha(dst[x], src[x], const_alpha, one_minus_const_alpha); never executed: dst[x] = comp_func_Plus_one_pixel_const_alpha(dst[x], src[x], const_alpha, one_minus_const_alpha); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 199 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 200 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 201 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 202 | void QT_FASTCALL comp_func_Source_sse2(uint *dst, const uint *src, int length, uint const_alpha) | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 203 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 204 | if (const_alpha == 255) {
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 205 | ::memcpy(dst, src, length * sizeof(uint)); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 206 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 207 | const int ialpha = 255 - const_alpha; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 208 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 209 | int x = 0; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 210 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 211 | // 1) prologue, align on 16 bytes | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 212 | ALIGNMENT_PROLOGUE_16BYTES(dst, x, length)
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 213 | dst[x] = INTERPOLATE_PIXEL_255(src[x], const_alpha, dst[x], ialpha); never executed: dst[x] = INTERPOLATE_PIXEL_255(src[x], const_alpha, dst[x], ialpha); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 214 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 215 | // 2) interpolate pixels with SSE2 | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 216 | const __m128i half = _mm_set1_epi16(0x80); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 217 | const __m128i colorMask = _mm_set1_epi32(0x00ff00ff); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 218 | const __m128i constAlphaVector = _mm_set1_epi16(const_alpha); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 219 | const __m128i oneMinusConstAlpha = _mm_set1_epi16(ialpha); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 220 | for (; x < length - 3; x += 4) {
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 221 | const __m128i srcVector = _mm_loadu_si128((const __m128i *)&src[x]); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 222 | __m128i dstVector = _mm_load_si128((__m128i *)&dst[x]); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 223 | INTERPOLATE_PIXEL_255_SSE2(dstVector, srcVector, dstVector, constAlphaVector, oneMinusConstAlpha, colorMask, half) | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 224 | _mm_store_si128((__m128i *)&dst[x], dstVector); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 225 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 226 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 227 | // 3) Epilogue | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 228 | for (; x < length; ++x)
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 229 | dst[x] = INTERPOLATE_PIXEL_255(src[x], const_alpha, dst[x], ialpha); never executed: dst[x] = INTERPOLATE_PIXEL_255(src[x], const_alpha, dst[x], ialpha); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 230 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 231 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 232 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 233 | void qt_memfill32(quint32 *dest, quint32 value, int count) | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 234 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 235 | if (count < 7) {
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 236 | switch (count) { | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 237 | case 6: *dest++ = value; never executed: case 6: | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 238 | case 5: *dest++ = value; code before this statement never executed: case 5:never executed: case 5: | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 239 | case 4: *dest++ = value; code before this statement never executed: case 4:never executed: case 4: | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 240 | case 3: *dest++ = value; code before this statement never executed: case 3:never executed: case 3: | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 241 | case 2: *dest++ = value; code before this statement never executed: case 2:never executed: case 2: | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 242 | case 1: *dest = value; code before this statement never executed: case 1:never executed: case 1: | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 243 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 244 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 245 | }; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 246 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 247 | const int align = (quintptr)(dest) & 0xf; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 248 | switch (align) { | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 249 | case 4: *dest++ = value; --count; never executed: case 4: | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 250 | case 8: *dest++ = value; --count; code before this statement never executed: case 8:never executed: case 8: | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 251 | case 12: *dest++ = value; --count; code before this statement never executed: case 12:never executed: case 12: | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 252 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 253 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 254 | const int rest = count & 0x3; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 255 | if (rest) {
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 256 | switch (rest) { | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 257 | case 3: dest[count - 3] = value; never executed: case 3: | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 258 | case 2: dest[count - 2] = value; code before this statement never executed: case 2:never executed: case 2: | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 259 | case 1: dest[count - 1] = value; code before this statement never executed: case 1:never executed: case 1: | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 260 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 261 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 262 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 263 | int count128 = count / 4; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 264 | __m128i *dst128 = reinterpret_cast<__m128i*>(dest); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 265 | __m128i *end128 = dst128 + count128; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 266 | const __m128i value128 = _mm_set_epi32(value, value, value, value); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 267 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 268 | while (dst128 + 3 < end128) {
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 269 | _mm_stream_si128(dst128 + 0, value128); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 270 | _mm_stream_si128(dst128 + 1, value128); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 271 | _mm_stream_si128(dst128 + 2, value128); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 272 | _mm_stream_si128(dst128 + 3, value128); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 273 | dst128 += 4; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 274 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 275 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 276 | switch (count128 & 0x3) { | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 277 | case 3: _mm_stream_si128(dst128++, value128); never executed: case 3: | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 278 | case 2: _mm_stream_si128(dst128++, value128); code before this statement never executed: case 2:never executed: case 2: | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 279 | case 1: _mm_stream_si128(dst128++, value128); code before this statement never executed: case 1:never executed: case 1: | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 280 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 281 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 282 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 283 | void QT_FASTCALL comp_func_solid_SourceOver_sse2(uint *destPixels, int length, uint color, uint const_alpha) | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 284 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 285 | if ((const_alpha & qAlpha(color)) == 255) {
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 286 | qt_memfill32(destPixels, color, length); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 287 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 288 | if (const_alpha != 255)
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 289 | color = BYTE_MUL(color, const_alpha); never executed: color = BYTE_MUL(color, const_alpha); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 290 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 291 | const quint32 minusAlphaOfColor = qAlpha(~color); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 292 | int x = 0; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 293 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 294 | quint32 *dst = (quint32 *) destPixels; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 295 | const __m128i colorVector = _mm_set1_epi32(color); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 296 | const __m128i colorMask = _mm_set1_epi32(0x00ff00ff); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 297 | const __m128i half = _mm_set1_epi16(0x80); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 298 | const __m128i minusAlphaOfColorVector = _mm_set1_epi16(minusAlphaOfColor); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 299 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 300 | ALIGNMENT_PROLOGUE_16BYTES(dst, x, length)
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 301 | destPixels[x] = color + BYTE_MUL(destPixels[x], minusAlphaOfColor); never executed: destPixels[x] = color + BYTE_MUL(destPixels[x], minusAlphaOfColor); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 302 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 303 | for (; x < length-3; x += 4) {
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 304 | __m128i dstVector = _mm_load_si128((__m128i *)&dst[x]); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 305 | BYTE_MUL_SSE2(dstVector, dstVector, minusAlphaOfColorVector, colorMask, half); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 306 | dstVector = _mm_add_epi8(colorVector, dstVector); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 307 | _mm_store_si128((__m128i *)&dst[x], dstVector); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 308 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 309 | for (;x < length; ++x)
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 310 | destPixels[x] = color + BYTE_MUL(destPixels[x], minusAlphaOfColor); never executed: destPixels[x] = color + BYTE_MUL(destPixels[x], minusAlphaOfColor); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 311 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 312 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 313 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 314 | void qt_memfill16(quint16 *dest, quint16 value, int count) | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 315 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 316 | if (count < 3) {
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 317 | switch (count) { | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 318 | case 2: *dest++ = value; never executed: case 2: | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 319 | case 1: *dest = value; code before this statement never executed: case 1:never executed: case 1: | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 320 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 321 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 322 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 323 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 324 | const int align = (quintptr)(dest) & 0x3; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 325 | switch (align) { | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 326 | case 2: *dest++ = value; --count; never executed: case 2: | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 327 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 328 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 329 | const quint32 value32 = (value << 16) | value; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 330 | qt_memfill32(reinterpret_cast<quint32*>(dest), value32, count / 2); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 331 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 332 | if (count & 0x1)
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 333 | dest[count - 1] = value; never executed: dest[count - 1] = value; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 334 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 335 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 336 | void qt_bitmapblit32_sse2_base(QRasterBuffer *rasterBuffer, int x, int y, | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 337 | quint32 color, | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 338 | const uchar *src, int width, int height, int stride) | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 339 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 340 | quint32 *dest = reinterpret_cast<quint32*>(rasterBuffer->scanLine(y)) + x; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 341 | const int destStride = rasterBuffer->bytesPerLine() / sizeof(quint32); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 342 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 343 | const __m128i c128 = _mm_set1_epi32(color); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 344 | const __m128i maskmask1 = _mm_set_epi32(0x10101010, 0x20202020, | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 345 | 0x40404040, 0x80808080); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 346 | const __m128i maskadd1 = _mm_set_epi32(0x70707070, 0x60606060, | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 347 | 0x40404040, 0x00000000); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 348 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 349 | if (width > 4) {
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 350 | const __m128i maskmask2 = _mm_set_epi32(0x01010101, 0x02020202, | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 351 | 0x04040404, 0x08080808); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 352 | const __m128i maskadd2 = _mm_set_epi32(0x7f7f7f7f, 0x7e7e7e7e, | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 353 | 0x7c7c7c7c, 0x78787878); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 354 | while (height--) {
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 355 | for (int x = 0; x < width; x += 8) {
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 356 | const quint8 s = src[x >> 3]; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 357 | if (!s)
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 358 | continue; never executed: continue; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 359 | __m128i mask1 = _mm_set1_epi8(s); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 360 | __m128i mask2 = mask1; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 361 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 362 | mask1 = _mm_and_si128(mask1, maskmask1); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 363 | mask1 = _mm_add_epi8(mask1, maskadd1); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 364 | _mm_maskmoveu_si128(c128, mask1, (char*)(dest + x)); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 365 | mask2 = _mm_and_si128(mask2, maskmask2); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 366 | mask2 = _mm_add_epi8(mask2, maskadd2); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 367 | _mm_maskmoveu_si128(c128, mask2, (char*)(dest + x + 4)); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 368 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 369 | dest += destStride; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 370 | src += stride; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 371 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 372 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 373 | while (height--) {
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 374 | const quint8 s = *src; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 375 | if (s) {
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 376 | __m128i mask1 = _mm_set1_epi8(s); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 377 | mask1 = _mm_and_si128(mask1, maskmask1); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 378 | mask1 = _mm_add_epi8(mask1, maskadd1); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 379 | _mm_maskmoveu_si128(c128, mask1, (char*)(dest)); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 380 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 381 | dest += destStride; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 382 | src += stride; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 383 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 384 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 385 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 386 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 387 | void qt_bitmapblit32_sse2(QRasterBuffer *rasterBuffer, int x, int y, | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 388 | const QRgba64 &color, | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 389 | const uchar *src, int width, int height, int stride) | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 390 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 391 | qt_bitmapblit32_sse2_base(rasterBuffer, x, y, color.toArgb32(), src, width, height, stride); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 392 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 393 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 394 | void qt_bitmapblit8888_sse2(QRasterBuffer *rasterBuffer, int x, int y, | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 395 | const QRgba64 &color, | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 396 | const uchar *src, int width, int height, int stride) | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 397 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 398 | qt_bitmapblit32_sse2_base(rasterBuffer, x, y, ARGB2RGBA(color.toArgb32()), src, width, height, stride); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 399 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 400 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 401 | void qt_bitmapblit16_sse2(QRasterBuffer *rasterBuffer, int x, int y, | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 402 | const QRgba64 &color, | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 403 | const uchar *src, int width, int height, int stride) | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 404 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 405 | const quint16 c = qConvertRgb32To16(color.toArgb32()); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 406 | quint16 *dest = reinterpret_cast<quint16*>(rasterBuffer->scanLine(y)) + x; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 407 | const int destStride = rasterBuffer->bytesPerLine() / sizeof(quint16); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 408 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 409 | const __m128i c128 = _mm_set1_epi16(c); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 410 | QT_WARNING_DISABLE_MSVC(4309) // truncation of constant value | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 411 | const __m128i maskmask = _mm_set_epi16(0x0101, 0x0202, 0x0404, 0x0808, | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 412 | 0x1010, 0x2020, 0x4040, 0x8080); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 413 | const __m128i maskadd = _mm_set_epi16(0x7f7f, 0x7e7e, 0x7c7c, 0x7878, | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 414 | 0x7070, 0x6060, 0x4040, 0x0000); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 415 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 416 | while (height--) {
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 417 | for (int x = 0; x < width; x += 8) {
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 418 | const quint8 s = src[x >> 3]; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 419 | if (!s)
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 420 | continue; never executed: continue; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 421 | __m128i mask = _mm_set1_epi8(s); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 422 | mask = _mm_and_si128(mask, maskmask); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 423 | mask = _mm_add_epi8(mask, maskadd); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 424 | _mm_maskmoveu_si128(c128, mask, (char*)(dest + x)); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 425 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 426 | dest += destStride; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 427 | src += stride; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 428 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 429 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 430 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 431 | class QSimdSse2 | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 432 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 433 | public: | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 434 | typedef __m128i Int32x4; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 435 | typedef __m128 Float32x4; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 436 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 437 | union Vect_buffer_i { Int32x4 v; int i[4]; }; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 438 | union Vect_buffer_f { Float32x4 v; float f[4]; }; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 439 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 440 | static inline Float32x4 v_dup(float x) { return _mm_set1_ps(x); } never executed: return _mm_set1_ps(x); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 441 | static inline Float32x4 v_dup(double x) { return _mm_set1_ps(x); } never executed: return _mm_set1_ps(x); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 442 | static inline Int32x4 v_dup(int x) { return _mm_set1_epi32(x); } never executed: return _mm_set1_epi32(x); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 443 | static inline Int32x4 v_dup(uint x) { return _mm_set1_epi32(x); } never executed: return _mm_set1_epi32(x); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 444 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 445 | static inline Float32x4 v_add(Float32x4 a, Float32x4 b) { return _mm_add_ps(a, b); } never executed: return _mm_add_ps(a, b); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 446 | static inline Int32x4 v_add(Int32x4 a, Int32x4 b) { return _mm_add_epi32(a, b); } never executed: return _mm_add_epi32(a, b); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 447 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 448 | static inline Float32x4 v_max(Float32x4 a, Float32x4 b) { return _mm_max_ps(a, b); } never executed: return _mm_max_ps(a, b); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 449 | static inline Float32x4 v_min(Float32x4 a, Float32x4 b) { return _mm_min_ps(a, b); } never executed: return _mm_min_ps(a, b); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 450 | static inline Int32x4 v_min_16(Int32x4 a, Int32x4 b) { return _mm_min_epi16(a, b); } never executed: return _mm_min_epi16(a, b); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 451 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 452 | static inline Int32x4 v_and(Int32x4 a, Int32x4 b) { return _mm_and_si128(a, b); } never executed: return _mm_and_si128(a, b); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 453 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 454 | static inline Float32x4 v_sub(Float32x4 a, Float32x4 b) { return _mm_sub_ps(a, b); } never executed: return _mm_sub_ps(a, b); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 455 | static inline Int32x4 v_sub(Int32x4 a, Int32x4 b) { return _mm_sub_epi32(a, b); } never executed: return _mm_sub_epi32(a, b); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 456 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 457 | static inline Float32x4 v_mul(Float32x4 a, Float32x4 b) { return _mm_mul_ps(a, b); } never executed: return _mm_mul_ps(a, b); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 458 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 459 | static inline Float32x4 v_sqrt(Float32x4 x) { return _mm_sqrt_ps(x); } never executed: return _mm_sqrt_ps(x); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 460 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 461 | static inline Int32x4 v_toInt(Float32x4 x) { return _mm_cvttps_epi32(x); } never executed: return _mm_cvttps_epi32(x); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 462 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 463 | static inline Int32x4 v_greaterOrEqual(Float32x4 a, Float32x4 b) { return _mm_castps_si128(_mm_cmpgt_ps(a, b)); } never executed: return _mm_castps_si128(_mm_cmpgt_ps(a, b)); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 464 | }; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 465 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 466 | const uint * QT_FASTCALL qt_fetch_radial_gradient_sse2(uint *buffer, const Operator *op, const QSpanData *data, | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 467 | int y, int x, int length) | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 468 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 469 | return qt_fetch_radial_gradient_template<QRadialFetchSimd<QSimdSse2>,uint>(buffer, op, data, y, x, length); never executed: return qt_fetch_radial_gradient_template<QRadialFetchSimd<QSimdSse2>,uint>(buffer, op, data, y, x, length); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 470 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 471 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 472 | void qt_scale_image_argb32_on_argb32_sse2(uchar *destPixels, int dbpl, | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 473 | const uchar *srcPixels, int sbpl, int srch, | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 474 | const QRectF &targetRect, | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 475 | const QRectF &sourceRect, | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 476 | const QRect &clip, | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 477 | int const_alpha) | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 478 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 479 | if (const_alpha != 256) {
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 480 | // from qblendfunctions.cpp | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 481 | extern void qt_scale_image_argb32_on_argb32(uchar *destPixels, int dbpl, | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 482 | const uchar *srcPixels, int sbpl, int srch, | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 483 | const QRectF &targetRect, | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 484 | const QRectF &sourceRect, | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 485 | const QRect &clip, | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 486 | int const_alpha); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 487 | return qt_scale_image_argb32_on_argb32(destPixels, dbpl, srcPixels, sbpl, srch, targetRect, sourceRect, clip, const_alpha); never executed: return qt_scale_image_argb32_on_argb32(destPixels, dbpl, srcPixels, sbpl, srch, targetRect, sourceRect, clip, const_alpha); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 488 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 489 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 490 | qreal sx = targetRect.width() / (qreal) sourceRect.width(); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 491 | qreal sy = targetRect.height() / (qreal) sourceRect.height(); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 492 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 493 | int ix = 0x00010000 / sx; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 494 | int iy = 0x00010000 / sy; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 495 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 496 | int cx1 = clip.x(); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 497 | int cx2 = clip.x() + clip.width(); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 498 | int cy1 = clip.top(); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 499 | int cy2 = clip.y() + clip.height(); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 500 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 501 | int tx1 = qRound(targetRect.left()); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 502 | int tx2 = qRound(targetRect.right()); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 503 | int ty1 = qRound(targetRect.top()); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 504 | int ty2 = qRound(targetRect.bottom()); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 505 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 506 | if (tx2 < tx1)
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 507 | qSwap(tx2, tx1); never executed: qSwap(tx2, tx1); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 508 | if (ty2 < ty1)
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 509 | qSwap(ty2, ty1); never executed: qSwap(ty2, ty1); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 510 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 511 | if (tx1 < cx1)
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 512 | tx1 = cx1; never executed: tx1 = cx1; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 513 | if (tx2 >= cx2)
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 514 | tx2 = cx2; never executed: tx2 = cx2; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 515 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 516 | if (tx1 >= tx2)
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 517 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 518 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 519 | if (ty1 < cy1)
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 520 | ty1 = cy1; never executed: ty1 = cy1; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 521 | if (ty2 >= cy2)
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 522 | ty2 = cy2; never executed: ty2 = cy2; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 523 | if (ty1 >= ty2)
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 524 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 525 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 526 | int h = ty2 - ty1; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 527 | int w = tx2 - tx1; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 528 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 529 | quint32 basex; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 530 | quint32 srcy; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 531 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 532 | if (sx < 0) {
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 533 | int dstx = qFloor((tx1 + qreal(0.5) - targetRect.right()) * ix) + 1; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 534 | basex = quint32(sourceRect.right() * 65536) + dstx; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 535 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 536 | int dstx = qCeil((tx1 + qreal(0.5) - targetRect.left()) * ix) - 1; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 537 | basex = quint32(sourceRect.left() * 65536) + dstx; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 538 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 539 | if (sy < 0) {
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 540 | int dsty = qFloor((ty1 + qreal(0.5) - targetRect.bottom()) * iy) + 1; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 541 | srcy = quint32(sourceRect.bottom() * 65536) + dsty; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 542 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 543 | int dsty = qCeil((ty1 + qreal(0.5) - targetRect.top()) * iy) - 1; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 544 | srcy = quint32(sourceRect.top() * 65536) + dsty; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 545 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 546 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 547 | quint32 *dst = ((quint32 *) (destPixels + ty1 * dbpl)) + tx1; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 548 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 549 | const __m128i nullVector = _mm_set1_epi32(0); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 550 | const __m128i half = _mm_set1_epi16(0x80); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 551 | const __m128i one = _mm_set1_epi16(0xff); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 552 | const __m128i colorMask = _mm_set1_epi32(0x00ff00ff); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 553 | const __m128i alphaMask = _mm_set1_epi32(0xff000000); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 554 | const __m128i ixVector = _mm_set1_epi32(4*ix); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 555 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 556 | // this bounds check here is required as floating point rounding above might in some cases lead to | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 557 | // w/h values that are one pixel too large, falling outside of the valid image area. | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 558 | int yend = (srcy + iy * (h - 1)) >> 16; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 559 | if (yend < 0 || yend >= srch)
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 560 | --h; never executed: --h; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 561 | int xend = (basex + ix * (w - 1)) >> 16; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 562 | if (xend < 0 || xend >= (int)(sbpl/sizeof(quint32)))
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 563 | --w; never executed: --w; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 564 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 565 | while (h--) {
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 566 | const uint *src = (const quint32 *) (srcPixels + (srcy >> 16) * sbpl); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 567 | int srcx = basex; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 568 | int x = 0; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 569 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 570 | ALIGNMENT_PROLOGUE_16BYTES(dst, x, w) {
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 571 | uint s = src[srcx >> 16]; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 572 | dst[x] = s + BYTE_MUL(dst[x], qAlpha(~s)); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 573 | srcx += ix; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 574 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 575 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 576 | __m128i srcxVector = _mm_set_epi32(srcx, srcx + ix, srcx + ix + ix, srcx + ix + ix + ix); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 577 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 578 | for (; x<w - 3; x += 4) {
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 579 | union Vect_buffer { __m128i vect; quint32 i[4]; }; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 580 | Vect_buffer addr; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 581 | addr.vect = _mm_srli_epi32(srcxVector, 16); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 582 | srcxVector = _mm_add_epi32(srcxVector, ixVector); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 583 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 584 | const __m128i srcVector = _mm_set_epi32(src[addr.i[0]], src[addr.i[1]], src[addr.i[2]], src[addr.i[3]]); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 585 | BLEND_SOURCE_OVER_ARGB32_SSE2_helper(dst, srcVector, nullVector, half, one, colorMask, alphaMask); never executed: end of blocknever executed: end of block
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 586 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 587 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 588 | for (; x<w; x++) {
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 589 | uint s = src[(basex + x*ix) >> 16]; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 590 | dst[x] = s + BYTE_MUL(dst[x], qAlpha(~s)); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 591 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 592 | dst = (quint32 *)(((uchar *) dst) + dbpl); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 593 | srcy += iy; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 594 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 595 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 596 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 597 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 598 | QT_END_NAMESPACE | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 599 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 600 | #endif // QT_COMPILER_SUPPORTS_SSE2 | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Source code | Switch to Preprocessed file |