| Absolute File Name: | /home/qt/qt5_coco/qt5/qtbase/src/gui/painting/qdrawhelper.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 <qglobal.h> | - | ||||||||||||||||||
| 35 | - | |||||||||||||||||||
| 36 | #include <qstylehints.h> | - | ||||||||||||||||||
| 37 | #include <qguiapplication.h> | - | ||||||||||||||||||
| 38 | #include <qatomic.h> | - | ||||||||||||||||||
| 39 | #include <private/qdrawhelper_p.h> | - | ||||||||||||||||||
| 40 | #include <private/qpaintengine_raster_p.h> | - | ||||||||||||||||||
| 41 | #include <private/qpainter_p.h> | - | ||||||||||||||||||
| 42 | #include <private/qdrawhelper_x86_p.h> | - | ||||||||||||||||||
| 43 | #include <private/qdrawingprimitive_sse2_p.h> | - | ||||||||||||||||||
| 44 | #include <private/qdrawhelper_neon_p.h> | - | ||||||||||||||||||
| 45 | #if defined(QT_COMPILER_SUPPORTS_MIPS_DSP) || defined(QT_COMPILER_SUPPORTS_MIPS_DSPR2) | - | ||||||||||||||||||
| 46 | #include <private/qdrawhelper_mips_dsp_p.h> | - | ||||||||||||||||||
| 47 | #endif | - | ||||||||||||||||||
| 48 | #include <private/qguiapplication_p.h> | - | ||||||||||||||||||
| 49 | #include <private/qrgba64_p.h> | - | ||||||||||||||||||
| 50 | #include <qmath.h> | - | ||||||||||||||||||
| 51 | - | |||||||||||||||||||
| 52 | QT_BEGIN_NAMESPACE | - | ||||||||||||||||||
| 53 | - | |||||||||||||||||||
| 54 | #define MASK(src, a) src = BYTE_MUL(src, a) | - | ||||||||||||||||||
| 55 | - | |||||||||||||||||||
| 56 | /* | - | ||||||||||||||||||
| 57 | constants and structures | - | ||||||||||||||||||
| 58 | */ | - | ||||||||||||||||||
| 59 | - | |||||||||||||||||||
| 60 | enum { | - | ||||||||||||||||||
| 61 | fixed_scale = 1 << 16, | - | ||||||||||||||||||
| 62 | half_point = 1 << 15 | - | ||||||||||||||||||
| 63 | }; | - | ||||||||||||||||||
| 64 | - | |||||||||||||||||||
| 65 | // must be multiple of 4 for easier SIMD implementations | - | ||||||||||||||||||
| 66 | static const int buffer_size = 2048; | - | ||||||||||||||||||
| 67 | - | |||||||||||||||||||
| 68 | template<QImage::Format> Q_DECL_CONSTEXPR uint redWidth(); | - | ||||||||||||||||||
| 69 | template<QImage::Format> Q_DECL_CONSTEXPR uint redShift(); | - | ||||||||||||||||||
| 70 | template<QImage::Format> Q_DECL_CONSTEXPR uint greenWidth(); | - | ||||||||||||||||||
| 71 | template<QImage::Format> Q_DECL_CONSTEXPR uint greenShift(); | - | ||||||||||||||||||
| 72 | template<QImage::Format> Q_DECL_CONSTEXPR uint blueWidth(); | - | ||||||||||||||||||
| 73 | template<QImage::Format> Q_DECL_CONSTEXPR uint blueShift(); | - | ||||||||||||||||||
| 74 | template<QImage::Format> Q_DECL_CONSTEXPR uint alphaWidth(); | - | ||||||||||||||||||
| 75 | template<QImage::Format> Q_DECL_CONSTEXPR uint alphaShift(); | - | ||||||||||||||||||
| 76 | - | |||||||||||||||||||
| 77 | template<> Q_DECL_CONSTEXPR uint redWidth<QImage::Format_RGB16>() { return 5; } | - | ||||||||||||||||||
| 78 | template<> Q_DECL_CONSTEXPR uint redWidth<QImage::Format_RGB444>() { return 4; } | - | ||||||||||||||||||
| 79 | template<> Q_DECL_CONSTEXPR uint redWidth<QImage::Format_RGB555>() { return 5; } | - | ||||||||||||||||||
| 80 | template<> Q_DECL_CONSTEXPR uint redWidth<QImage::Format_RGB666>() { return 6; } | - | ||||||||||||||||||
| 81 | template<> Q_DECL_CONSTEXPR uint redWidth<QImage::Format_RGB888>() { return 8; } | - | ||||||||||||||||||
| 82 | template<> Q_DECL_CONSTEXPR uint redWidth<QImage::Format_ARGB4444_Premultiplied>() { return 4; } | - | ||||||||||||||||||
| 83 | template<> Q_DECL_CONSTEXPR uint redWidth<QImage::Format_ARGB8555_Premultiplied>() { return 5; } | - | ||||||||||||||||||
| 84 | template<> Q_DECL_CONSTEXPR uint redWidth<QImage::Format_ARGB8565_Premultiplied>() { return 5; } | - | ||||||||||||||||||
| 85 | template<> Q_DECL_CONSTEXPR uint redWidth<QImage::Format_ARGB6666_Premultiplied>() { return 6; } | - | ||||||||||||||||||
| 86 | template<> Q_DECL_CONSTEXPR uint redShift<QImage::Format_RGB16>() { return 11; } | - | ||||||||||||||||||
| 87 | template<> Q_DECL_CONSTEXPR uint redShift<QImage::Format_RGB444>() { return 8; } | - | ||||||||||||||||||
| 88 | template<> Q_DECL_CONSTEXPR uint redShift<QImage::Format_RGB555>() { return 10; } | - | ||||||||||||||||||
| 89 | template<> Q_DECL_CONSTEXPR uint redShift<QImage::Format_RGB666>() { return 12; } | - | ||||||||||||||||||
| 90 | template<> Q_DECL_CONSTEXPR uint redShift<QImage::Format_RGB888>() { return 16; } | - | ||||||||||||||||||
| 91 | template<> Q_DECL_CONSTEXPR uint redShift<QImage::Format_ARGB4444_Premultiplied>() { return 8; } | - | ||||||||||||||||||
| 92 | template<> Q_DECL_CONSTEXPR uint redShift<QImage::Format_ARGB8555_Premultiplied>() { return 18; } | - | ||||||||||||||||||
| 93 | template<> Q_DECL_CONSTEXPR uint redShift<QImage::Format_ARGB8565_Premultiplied>() { return 19; } | - | ||||||||||||||||||
| 94 | template<> Q_DECL_CONSTEXPR uint redShift<QImage::Format_ARGB6666_Premultiplied>() { return 12; } | - | ||||||||||||||||||
| 95 | template<> Q_DECL_CONSTEXPR uint greenWidth<QImage::Format_RGB16>() { return 6; } | - | ||||||||||||||||||
| 96 | template<> Q_DECL_CONSTEXPR uint greenWidth<QImage::Format_RGB444>() { return 4; } | - | ||||||||||||||||||
| 97 | template<> Q_DECL_CONSTEXPR uint greenWidth<QImage::Format_RGB555>() { return 5; } | - | ||||||||||||||||||
| 98 | template<> Q_DECL_CONSTEXPR uint greenWidth<QImage::Format_RGB666>() { return 6; } | - | ||||||||||||||||||
| 99 | template<> Q_DECL_CONSTEXPR uint greenWidth<QImage::Format_RGB888>() { return 8; } | - | ||||||||||||||||||
| 100 | template<> Q_DECL_CONSTEXPR uint greenWidth<QImage::Format_ARGB4444_Premultiplied>() { return 4; } | - | ||||||||||||||||||
| 101 | template<> Q_DECL_CONSTEXPR uint greenWidth<QImage::Format_ARGB8555_Premultiplied>() { return 5; } | - | ||||||||||||||||||
| 102 | template<> Q_DECL_CONSTEXPR uint greenWidth<QImage::Format_ARGB8565_Premultiplied>() { return 6; } | - | ||||||||||||||||||
| 103 | template<> Q_DECL_CONSTEXPR uint greenWidth<QImage::Format_ARGB6666_Premultiplied>() { return 6; } | - | ||||||||||||||||||
| 104 | template<> Q_DECL_CONSTEXPR uint greenShift<QImage::Format_RGB16>() { return 5; } | - | ||||||||||||||||||
| 105 | template<> Q_DECL_CONSTEXPR uint greenShift<QImage::Format_RGB444>() { return 4; } | - | ||||||||||||||||||
| 106 | template<> Q_DECL_CONSTEXPR uint greenShift<QImage::Format_RGB555>() { return 5; } | - | ||||||||||||||||||
| 107 | template<> Q_DECL_CONSTEXPR uint greenShift<QImage::Format_RGB666>() { return 6; } | - | ||||||||||||||||||
| 108 | template<> Q_DECL_CONSTEXPR uint greenShift<QImage::Format_RGB888>() { return 8; } | - | ||||||||||||||||||
| 109 | template<> Q_DECL_CONSTEXPR uint greenShift<QImage::Format_ARGB4444_Premultiplied>() { return 4; } | - | ||||||||||||||||||
| 110 | template<> Q_DECL_CONSTEXPR uint greenShift<QImage::Format_ARGB8555_Premultiplied>() { return 13; } | - | ||||||||||||||||||
| 111 | template<> Q_DECL_CONSTEXPR uint greenShift<QImage::Format_ARGB8565_Premultiplied>() { return 13; } | - | ||||||||||||||||||
| 112 | template<> Q_DECL_CONSTEXPR uint greenShift<QImage::Format_ARGB6666_Premultiplied>() { return 6; } | - | ||||||||||||||||||
| 113 | template<> Q_DECL_CONSTEXPR uint blueWidth<QImage::Format_RGB16>() { return 5; } | - | ||||||||||||||||||
| 114 | template<> Q_DECL_CONSTEXPR uint blueWidth<QImage::Format_RGB444>() { return 4; } | - | ||||||||||||||||||
| 115 | template<> Q_DECL_CONSTEXPR uint blueWidth<QImage::Format_RGB555>() { return 5; } | - | ||||||||||||||||||
| 116 | template<> Q_DECL_CONSTEXPR uint blueWidth<QImage::Format_RGB666>() { return 6; } | - | ||||||||||||||||||
| 117 | template<> Q_DECL_CONSTEXPR uint blueWidth<QImage::Format_RGB888>() { return 8; } | - | ||||||||||||||||||
| 118 | template<> Q_DECL_CONSTEXPR uint blueWidth<QImage::Format_ARGB4444_Premultiplied>() { return 4; } | - | ||||||||||||||||||
| 119 | template<> Q_DECL_CONSTEXPR uint blueWidth<QImage::Format_ARGB8555_Premultiplied>() { return 5; } | - | ||||||||||||||||||
| 120 | template<> Q_DECL_CONSTEXPR uint blueWidth<QImage::Format_ARGB8565_Premultiplied>() { return 5; } | - | ||||||||||||||||||
| 121 | template<> Q_DECL_CONSTEXPR uint blueWidth<QImage::Format_ARGB6666_Premultiplied>() { return 6; } | - | ||||||||||||||||||
| 122 | template<> Q_DECL_CONSTEXPR uint blueShift<QImage::Format_RGB16>() { return 0; } | - | ||||||||||||||||||
| 123 | template<> Q_DECL_CONSTEXPR uint blueShift<QImage::Format_RGB444>() { return 0; } | - | ||||||||||||||||||
| 124 | template<> Q_DECL_CONSTEXPR uint blueShift<QImage::Format_RGB555>() { return 0; } | - | ||||||||||||||||||
| 125 | template<> Q_DECL_CONSTEXPR uint blueShift<QImage::Format_RGB666>() { return 0; } | - | ||||||||||||||||||
| 126 | template<> Q_DECL_CONSTEXPR uint blueShift<QImage::Format_RGB888>() { return 0; } | - | ||||||||||||||||||
| 127 | template<> Q_DECL_CONSTEXPR uint blueShift<QImage::Format_ARGB4444_Premultiplied>() { return 0; } | - | ||||||||||||||||||
| 128 | template<> Q_DECL_CONSTEXPR uint blueShift<QImage::Format_ARGB8555_Premultiplied>() { return 8; } | - | ||||||||||||||||||
| 129 | template<> Q_DECL_CONSTEXPR uint blueShift<QImage::Format_ARGB8565_Premultiplied>() { return 8; } | - | ||||||||||||||||||
| 130 | template<> Q_DECL_CONSTEXPR uint blueShift<QImage::Format_ARGB6666_Premultiplied>() { return 0; } | - | ||||||||||||||||||
| 131 | template<> Q_DECL_CONSTEXPR uint alphaWidth<QImage::Format_ARGB4444_Premultiplied>() { return 4; } | - | ||||||||||||||||||
| 132 | template<> Q_DECL_CONSTEXPR uint alphaWidth<QImage::Format_ARGB8555_Premultiplied>() { return 8; } | - | ||||||||||||||||||
| 133 | template<> Q_DECL_CONSTEXPR uint alphaWidth<QImage::Format_ARGB8565_Premultiplied>() { return 8; } | - | ||||||||||||||||||
| 134 | template<> Q_DECL_CONSTEXPR uint alphaWidth<QImage::Format_ARGB6666_Premultiplied>() { return 6; } | - | ||||||||||||||||||
| 135 | template<> Q_DECL_CONSTEXPR uint alphaShift<QImage::Format_ARGB4444_Premultiplied>() { return 12; } | - | ||||||||||||||||||
| 136 | template<> Q_DECL_CONSTEXPR uint alphaShift<QImage::Format_ARGB8555_Premultiplied>() { return 0; } | - | ||||||||||||||||||
| 137 | template<> Q_DECL_CONSTEXPR uint alphaShift<QImage::Format_ARGB8565_Premultiplied>() { return 0; } | - | ||||||||||||||||||
| 138 | template<> Q_DECL_CONSTEXPR uint alphaShift<QImage::Format_ARGB6666_Premultiplied>() { return 18; } | - | ||||||||||||||||||
| 139 | - | |||||||||||||||||||
| 140 | template<QImage::Format> Q_DECL_CONSTEXPR QPixelLayout::BPP bitsPerPixel(); | - | ||||||||||||||||||
| 141 | template<> Q_DECL_CONSTEXPR QPixelLayout::BPP bitsPerPixel<QImage::Format_RGB16>() { return QPixelLayout::BPP16; } | - | ||||||||||||||||||
| 142 | template<> Q_DECL_CONSTEXPR QPixelLayout::BPP bitsPerPixel<QImage::Format_RGB444>() { return QPixelLayout::BPP16; } | - | ||||||||||||||||||
| 143 | template<> Q_DECL_CONSTEXPR QPixelLayout::BPP bitsPerPixel<QImage::Format_RGB555>() { return QPixelLayout::BPP16; } | - | ||||||||||||||||||
| 144 | template<> Q_DECL_CONSTEXPR QPixelLayout::BPP bitsPerPixel<QImage::Format_RGB666>() { return QPixelLayout::BPP24; } | - | ||||||||||||||||||
| 145 | template<> Q_DECL_CONSTEXPR QPixelLayout::BPP bitsPerPixel<QImage::Format_RGB888>() { return QPixelLayout::BPP24; } | - | ||||||||||||||||||
| 146 | template<> Q_DECL_CONSTEXPR QPixelLayout::BPP bitsPerPixel<QImage::Format_ARGB4444_Premultiplied>() { return QPixelLayout::BPP16; } | - | ||||||||||||||||||
| 147 | template<> Q_DECL_CONSTEXPR QPixelLayout::BPP bitsPerPixel<QImage::Format_ARGB8555_Premultiplied>() { return QPixelLayout::BPP24; } | - | ||||||||||||||||||
| 148 | template<> Q_DECL_CONSTEXPR QPixelLayout::BPP bitsPerPixel<QImage::Format_ARGB8565_Premultiplied>() { return QPixelLayout::BPP24; } | - | ||||||||||||||||||
| 149 | template<> Q_DECL_CONSTEXPR QPixelLayout::BPP bitsPerPixel<QImage::Format_ARGB6666_Premultiplied>() { return QPixelLayout::BPP24; } | - | ||||||||||||||||||
| 150 | - | |||||||||||||||||||
| 151 | - | |||||||||||||||||||
| 152 | template<QImage::Format Format> | - | ||||||||||||||||||
| 153 | static const uint *QT_FASTCALL convertToRGB32(uint *buffer, const uint *src, int count, | - | ||||||||||||||||||
| 154 | const QPixelLayout *, const QRgb *) | - | ||||||||||||||||||
| 155 | { | - | ||||||||||||||||||
| 156 | Q_CONSTEXPR uint redMask = ((1 << redWidth<Format>()) - 1); | - | ||||||||||||||||||
| 157 | Q_CONSTEXPR uint greenMask = ((1 << greenWidth<Format>()) - 1); | - | ||||||||||||||||||
| 158 | Q_CONSTEXPR uint blueMask = ((1 << blueWidth<Format>()) - 1); | - | ||||||||||||||||||
| 159 | - | |||||||||||||||||||
| 160 | Q_CONSTEXPR uchar redLeftShift = 8 - redWidth<Format>(); | - | ||||||||||||||||||
| 161 | Q_CONSTEXPR uchar greenLeftShift = 8 - greenWidth<Format>(); | - | ||||||||||||||||||
| 162 | Q_CONSTEXPR uchar blueLeftShift = 8 - blueWidth<Format>(); | - | ||||||||||||||||||
| 163 | - | |||||||||||||||||||
| 164 | Q_CONSTEXPR uchar redRightShift = 2 * redWidth<Format>() - 8; | - | ||||||||||||||||||
| 165 | Q_CONSTEXPR uchar greenRightShift = 2 * greenWidth<Format>() - 8; | - | ||||||||||||||||||
| 166 | Q_CONSTEXPR uchar blueRightShift = 2 * blueWidth<Format>() - 8; | - | ||||||||||||||||||
| 167 | - | |||||||||||||||||||
| 168 | for (int i = 0; i < count; ++i) {
| 0 | ||||||||||||||||||
| 169 | uint red = (src[i] >> redShift<Format>()) & redMask; | - | ||||||||||||||||||
| 170 | uint green = (src[i] >> greenShift<Format>()) & greenMask; | - | ||||||||||||||||||
| 171 | uint blue = (src[i] >> blueShift<Format>()) & blueMask; | - | ||||||||||||||||||
| 172 | - | |||||||||||||||||||
| 173 | red = ((red << redLeftShift) | (red >> redRightShift)) << 16; | - | ||||||||||||||||||
| 174 | green = ((green << greenLeftShift) | (green >> greenRightShift)) << 8; | - | ||||||||||||||||||
| 175 | blue = (blue << blueLeftShift) | (blue >> blueRightShift); | - | ||||||||||||||||||
| 176 | buffer[i] = 0xff000000 | red | green | blue; | - | ||||||||||||||||||
| 177 | } never executed: end of block | 0 | ||||||||||||||||||
| 178 | - | |||||||||||||||||||
| 179 | return buffer; never executed: return buffer; | 0 | ||||||||||||||||||
| 180 | } | - | ||||||||||||||||||
| 181 | - | |||||||||||||||||||
| 182 | template<QImage::Format Format> | - | ||||||||||||||||||
| 183 | static const QRgba64 *QT_FASTCALL convertToRGB64(QRgba64 *buffer, const uint *src, int count, | - | ||||||||||||||||||
| 184 | const QPixelLayout *, const QRgb *) | - | ||||||||||||||||||
| 185 | { | - | ||||||||||||||||||
| 186 | Q_CONSTEXPR uint redMask = ((1 << redWidth<Format>()) - 1); | - | ||||||||||||||||||
| 187 | Q_CONSTEXPR uint greenMask = ((1 << greenWidth<Format>()) - 1); | - | ||||||||||||||||||
| 188 | Q_CONSTEXPR uint blueMask = ((1 << blueWidth<Format>()) - 1); | - | ||||||||||||||||||
| 189 | - | |||||||||||||||||||
| 190 | Q_CONSTEXPR uchar redLeftShift = 8 - redWidth<Format>(); | - | ||||||||||||||||||
| 191 | Q_CONSTEXPR uchar greenLeftShift = 8 - greenWidth<Format>(); | - | ||||||||||||||||||
| 192 | Q_CONSTEXPR uchar blueLeftShift = 8 - blueWidth<Format>(); | - | ||||||||||||||||||
| 193 | - | |||||||||||||||||||
| 194 | Q_CONSTEXPR uchar redRightShift = 2 * redWidth<Format>() - 8; | - | ||||||||||||||||||
| 195 | Q_CONSTEXPR uchar greenRightShift = 2 * greenWidth<Format>() - 8; | - | ||||||||||||||||||
| 196 | Q_CONSTEXPR uchar blueRightShift = 2 * blueWidth<Format>() - 8; | - | ||||||||||||||||||
| 197 | - | |||||||||||||||||||
| 198 | for (int i = 0; i < count; ++i) {
| 0 | ||||||||||||||||||
| 199 | uint red = (src[i] >> redShift<Format>()) & redMask; | - | ||||||||||||||||||
| 200 | uint green = (src[i] >> greenShift<Format>()) & greenMask; | - | ||||||||||||||||||
| 201 | uint blue = (src[i] >> blueShift<Format>()) & blueMask; | - | ||||||||||||||||||
| 202 | - | |||||||||||||||||||
| 203 | red = ((red << redLeftShift) | (red >> redRightShift)); | - | ||||||||||||||||||
| 204 | green = ((green << greenLeftShift) | (green >> greenRightShift)); | - | ||||||||||||||||||
| 205 | blue = (blue << blueLeftShift) | (blue >> blueRightShift); | - | ||||||||||||||||||
| 206 | buffer[i] = QRgba64::fromRgba(red, green, blue, 255); | - | ||||||||||||||||||
| 207 | } never executed: end of block | 0 | ||||||||||||||||||
| 208 | - | |||||||||||||||||||
| 209 | return buffer; never executed: return buffer; | 0 | ||||||||||||||||||
| 210 | } | - | ||||||||||||||||||
| 211 | - | |||||||||||||||||||
| 212 | template<QImage::Format Format> | - | ||||||||||||||||||
| 213 | static const uint *QT_FASTCALL convertARGBPMToARGB32PM(uint *buffer, const uint *src, int count, | - | ||||||||||||||||||
| 214 | const QPixelLayout *, const QRgb *) | - | ||||||||||||||||||
| 215 | { | - | ||||||||||||||||||
| 216 | Q_CONSTEXPR uint alphaMask = ((1 << alphaWidth<Format>()) - 1); | - | ||||||||||||||||||
| 217 | Q_CONSTEXPR uint redMask = ((1 << redWidth<Format>()) - 1); | - | ||||||||||||||||||
| 218 | Q_CONSTEXPR uint greenMask = ((1 << greenWidth<Format>()) - 1); | - | ||||||||||||||||||
| 219 | Q_CONSTEXPR uint blueMask = ((1 << blueWidth<Format>()) - 1); | - | ||||||||||||||||||
| 220 | - | |||||||||||||||||||
| 221 | Q_CONSTEXPR uchar alphaLeftShift = 8 - alphaWidth<Format>(); | - | ||||||||||||||||||
| 222 | Q_CONSTEXPR uchar redLeftShift = 8 - redWidth<Format>(); | - | ||||||||||||||||||
| 223 | Q_CONSTEXPR uchar greenLeftShift = 8 - greenWidth<Format>(); | - | ||||||||||||||||||
| 224 | Q_CONSTEXPR uchar blueLeftShift = 8 - blueWidth<Format>(); | - | ||||||||||||||||||
| 225 | - | |||||||||||||||||||
| 226 | Q_CONSTEXPR uchar alphaRightShift = 2 * alphaWidth<Format>() - 8; | - | ||||||||||||||||||
| 227 | Q_CONSTEXPR uchar redRightShift = 2 * redWidth<Format>() - 8; | - | ||||||||||||||||||
| 228 | Q_CONSTEXPR uchar greenRightShift = 2 * greenWidth<Format>() - 8; | - | ||||||||||||||||||
| 229 | Q_CONSTEXPR uchar blueRightShift = 2 * blueWidth<Format>() - 8; | - | ||||||||||||||||||
| 230 | - | |||||||||||||||||||
| 231 | for (int i = 0; i < count; ++i) {
| 0 | ||||||||||||||||||
| 232 | uint alpha = (src[i] >> alphaShift<Format>()) & alphaMask; | - | ||||||||||||||||||
| 233 | uint red = (src[i] >> redShift<Format>()) & redMask; | - | ||||||||||||||||||
| 234 | uint green = (src[i] >> greenShift<Format>()) & greenMask; | - | ||||||||||||||||||
| 235 | uint blue = (src[i] >> blueShift<Format>()) & blueMask; | - | ||||||||||||||||||
| 236 | - | |||||||||||||||||||
| 237 | alpha = (alpha << alphaLeftShift) | (alpha >> alphaRightShift); | - | ||||||||||||||||||
| 238 | red = qMin(alpha, (red << redLeftShift) | (red >> redRightShift)); | - | ||||||||||||||||||
| 239 | green = qMin(alpha, (green << greenLeftShift) | (green >> greenRightShift)); | - | ||||||||||||||||||
| 240 | blue = qMin(alpha, (blue << blueLeftShift) | (blue >> blueRightShift)); | - | ||||||||||||||||||
| 241 | buffer[i] = (alpha << 24) | (red << 16) | (green << 8) | blue; | - | ||||||||||||||||||
| 242 | } never executed: end of block | 0 | ||||||||||||||||||
| 243 | - | |||||||||||||||||||
| 244 | return buffer; never executed: return buffer; | 0 | ||||||||||||||||||
| 245 | } | - | ||||||||||||||||||
| 246 | - | |||||||||||||||||||
| 247 | template<QImage::Format Format> | - | ||||||||||||||||||
| 248 | static const QRgba64 *QT_FASTCALL convertARGBPMToARGB64PM(QRgba64 *buffer, const uint *src, int count, | - | ||||||||||||||||||
| 249 | const QPixelLayout *, const QRgb *) | - | ||||||||||||||||||
| 250 | { | - | ||||||||||||||||||
| 251 | Q_CONSTEXPR uint alphaMask = ((1 << alphaWidth<Format>()) - 1); | - | ||||||||||||||||||
| 252 | Q_CONSTEXPR uint redMask = ((1 << redWidth<Format>()) - 1); | - | ||||||||||||||||||
| 253 | Q_CONSTEXPR uint greenMask = ((1 << greenWidth<Format>()) - 1); | - | ||||||||||||||||||
| 254 | Q_CONSTEXPR uint blueMask = ((1 << blueWidth<Format>()) - 1); | - | ||||||||||||||||||
| 255 | - | |||||||||||||||||||
| 256 | Q_CONSTEXPR uchar alphaLeftShift = 8 - alphaWidth<Format>(); | - | ||||||||||||||||||
| 257 | Q_CONSTEXPR uchar redLeftShift = 8 - redWidth<Format>(); | - | ||||||||||||||||||
| 258 | Q_CONSTEXPR uchar greenLeftShift = 8 - greenWidth<Format>(); | - | ||||||||||||||||||
| 259 | Q_CONSTEXPR uchar blueLeftShift = 8 - blueWidth<Format>(); | - | ||||||||||||||||||
| 260 | - | |||||||||||||||||||
| 261 | Q_CONSTEXPR uchar alphaRightShift = 2 * alphaWidth<Format>() - 8; | - | ||||||||||||||||||
| 262 | Q_CONSTEXPR uchar redRightShift = 2 * redWidth<Format>() - 8; | - | ||||||||||||||||||
| 263 | Q_CONSTEXPR uchar greenRightShift = 2 * greenWidth<Format>() - 8; | - | ||||||||||||||||||
| 264 | Q_CONSTEXPR uchar blueRightShift = 2 * blueWidth<Format>() - 8; | - | ||||||||||||||||||
| 265 | - | |||||||||||||||||||
| 266 | for (int i = 0; i < count; ++i) {
| 0 | ||||||||||||||||||
| 267 | uint alpha = (src[i] >> alphaShift<Format>()) & alphaMask; | - | ||||||||||||||||||
| 268 | uint red = (src[i] >> redShift<Format>()) & redMask; | - | ||||||||||||||||||
| 269 | uint green = (src[i] >> greenShift<Format>()) & greenMask; | - | ||||||||||||||||||
| 270 | uint blue = (src[i] >> blueShift<Format>()) & blueMask; | - | ||||||||||||||||||
| 271 | - | |||||||||||||||||||
| 272 | alpha = (alpha << alphaLeftShift) | (alpha >> alphaRightShift); | - | ||||||||||||||||||
| 273 | red = qMin(alpha, (red << redLeftShift) | (red >> redRightShift)); | - | ||||||||||||||||||
| 274 | green = qMin(alpha, (green << greenLeftShift) | (green >> greenRightShift)); | - | ||||||||||||||||||
| 275 | blue = qMin(alpha, (blue << blueLeftShift) | (blue >> blueRightShift)); | - | ||||||||||||||||||
| 276 | buffer[i] = QRgba64::fromRgba(red, green, blue, alpha); | - | ||||||||||||||||||
| 277 | } never executed: end of block | 0 | ||||||||||||||||||
| 278 | - | |||||||||||||||||||
| 279 | return buffer; never executed: return buffer; | 0 | ||||||||||||||||||
| 280 | } | - | ||||||||||||||||||
| 281 | - | |||||||||||||||||||
| 282 | template<QImage::Format Format> | - | ||||||||||||||||||
| 283 | static const uint *QT_FASTCALL convertRGBFromARGB32PM(uint *buffer, const uint *src, int count, | - | ||||||||||||||||||
| 284 | const QPixelLayout *, const QRgb *) | - | ||||||||||||||||||
| 285 | { | - | ||||||||||||||||||
| 286 | Q_CONSTEXPR uint redMask = ((1 << redWidth<Format>()) - 1); | - | ||||||||||||||||||
| 287 | Q_CONSTEXPR uint greenMask = ((1 << greenWidth<Format>()) - 1); | - | ||||||||||||||||||
| 288 | Q_CONSTEXPR uint blueMask = ((1 << blueWidth<Format>()) - 1); | - | ||||||||||||||||||
| 289 | - | |||||||||||||||||||
| 290 | Q_CONSTEXPR uchar redRightShift = 24 - redWidth<Format>(); | - | ||||||||||||||||||
| 291 | Q_CONSTEXPR uchar greenRightShift = 16 - greenWidth<Format>(); | - | ||||||||||||||||||
| 292 | Q_CONSTEXPR uchar blueRightShift = 8 - blueWidth<Format>(); | - | ||||||||||||||||||
| 293 | - | |||||||||||||||||||
| 294 | for (int i = 0; i < count; ++i) {
| 0 | ||||||||||||||||||
| 295 | const uint color = qUnpremultiply(src[i]); | - | ||||||||||||||||||
| 296 | const uint red = ((color >> redRightShift) & redMask) << redShift<Format>(); | - | ||||||||||||||||||
| 297 | const uint green = ((color >> greenRightShift) & greenMask) << greenShift<Format>(); | - | ||||||||||||||||||
| 298 | const uint blue = ((color >> blueRightShift) & blueMask) << blueShift<Format>(); | - | ||||||||||||||||||
| 299 | buffer[i] = red | green | blue; | - | ||||||||||||||||||
| 300 | } never executed: end of block | 0 | ||||||||||||||||||
| 301 | return buffer; never executed: return buffer; | 0 | ||||||||||||||||||
| 302 | } | - | ||||||||||||||||||
| 303 | - | |||||||||||||||||||
| 304 | template<QImage::Format Format> | - | ||||||||||||||||||
| 305 | static const uint *QT_FASTCALL convertRGBFromRGB32(uint *buffer, const uint *src, int count, | - | ||||||||||||||||||
| 306 | const QPixelLayout *, const QRgb *) | - | ||||||||||||||||||
| 307 | { | - | ||||||||||||||||||
| 308 | Q_CONSTEXPR uint redMask = ((1 << redWidth<Format>()) - 1); | - | ||||||||||||||||||
| 309 | Q_CONSTEXPR uint greenMask = ((1 << greenWidth<Format>()) - 1); | - | ||||||||||||||||||
| 310 | Q_CONSTEXPR uint blueMask = ((1 << blueWidth<Format>()) - 1); | - | ||||||||||||||||||
| 311 | - | |||||||||||||||||||
| 312 | Q_CONSTEXPR uchar redRightShift = 24 - redWidth<Format>(); | - | ||||||||||||||||||
| 313 | Q_CONSTEXPR uchar greenRightShift = 16 - greenWidth<Format>(); | - | ||||||||||||||||||
| 314 | Q_CONSTEXPR uchar blueRightShift = 8 - blueWidth<Format>(); | - | ||||||||||||||||||
| 315 | - | |||||||||||||||||||
| 316 | for (int i = 0; i < count; ++i) {
| 0 | ||||||||||||||||||
| 317 | const uint red = ((src[i] >> redRightShift) & redMask) << redShift<Format>(); | - | ||||||||||||||||||
| 318 | const uint green = ((src[i] >> greenRightShift) & greenMask) << greenShift<Format>(); | - | ||||||||||||||||||
| 319 | const uint blue = ((src[i] >> blueRightShift) & blueMask) << blueShift<Format>(); | - | ||||||||||||||||||
| 320 | buffer[i] = red | green | blue; | - | ||||||||||||||||||
| 321 | } never executed: end of block | 0 | ||||||||||||||||||
| 322 | return buffer; never executed: return buffer; | 0 | ||||||||||||||||||
| 323 | } | - | ||||||||||||||||||
| 324 | - | |||||||||||||||||||
| 325 | template<QImage::Format Format> | - | ||||||||||||||||||
| 326 | static const uint *QT_FASTCALL convertARGBPMFromRGB32(uint *buffer, const uint *src, int count, | - | ||||||||||||||||||
| 327 | const QPixelLayout *, const QRgb *) | - | ||||||||||||||||||
| 328 | { | - | ||||||||||||||||||
| 329 | Q_CONSTEXPR uint alphaMask = ((1 << alphaWidth<Format>()) - 1); | - | ||||||||||||||||||
| 330 | Q_CONSTEXPR uint redMask = ((1 << redWidth<Format>()) - 1); | - | ||||||||||||||||||
| 331 | Q_CONSTEXPR uint greenMask = ((1 << greenWidth<Format>()) - 1); | - | ||||||||||||||||||
| 332 | Q_CONSTEXPR uint blueMask = ((1 << blueWidth<Format>()) - 1); | - | ||||||||||||||||||
| 333 | - | |||||||||||||||||||
| 334 | Q_CONSTEXPR uchar redRightShift = 24 - redWidth<Format>(); | - | ||||||||||||||||||
| 335 | Q_CONSTEXPR uchar greenRightShift = 16 - greenWidth<Format>(); | - | ||||||||||||||||||
| 336 | Q_CONSTEXPR uchar blueRightShift = 8 - blueWidth<Format>(); | - | ||||||||||||||||||
| 337 | - | |||||||||||||||||||
| 338 | for (int i = 0; i < count; ++i) {
| 0 | ||||||||||||||||||
| 339 | Q_CONSTEXPR uint alpha = (0xff & alphaMask) << alphaShift<Format>(); | - | ||||||||||||||||||
| 340 | const uint red = ((src[i] >> redRightShift) & redMask) << redShift<Format>(); | - | ||||||||||||||||||
| 341 | const uint green = ((src[i] >> greenRightShift) & greenMask) << greenShift<Format>(); | - | ||||||||||||||||||
| 342 | const uint blue = ((src[i] >> blueRightShift) & blueMask) << blueShift<Format>(); | - | ||||||||||||||||||
| 343 | buffer[i] = alpha | red | green | blue; | - | ||||||||||||||||||
| 344 | } never executed: end of block | 0 | ||||||||||||||||||
| 345 | return buffer; never executed: return buffer; | 0 | ||||||||||||||||||
| 346 | } | - | ||||||||||||||||||
| 347 | - | |||||||||||||||||||
| 348 | template<QImage::Format Format> | - | ||||||||||||||||||
| 349 | static const uint *QT_FASTCALL convertARGBPMFromARGB32PM(uint *buffer, const uint *src, int count, | - | ||||||||||||||||||
| 350 | const QPixelLayout *, const QRgb *) | - | ||||||||||||||||||
| 351 | { | - | ||||||||||||||||||
| 352 | Q_CONSTEXPR uint alphaMask = ((1 << alphaWidth<Format>()) - 1); | - | ||||||||||||||||||
| 353 | Q_CONSTEXPR uint redMask = ((1 << redWidth<Format>()) - 1); | - | ||||||||||||||||||
| 354 | Q_CONSTEXPR uint greenMask = ((1 << greenWidth<Format>()) - 1); | - | ||||||||||||||||||
| 355 | Q_CONSTEXPR uint blueMask = ((1 << blueWidth<Format>()) - 1); | - | ||||||||||||||||||
| 356 | - | |||||||||||||||||||
| 357 | Q_CONSTEXPR uchar alphaRightShift = 32 - alphaWidth<Format>(); | - | ||||||||||||||||||
| 358 | Q_CONSTEXPR uchar redRightShift = 24 - redWidth<Format>(); | - | ||||||||||||||||||
| 359 | Q_CONSTEXPR uchar greenRightShift = 16 - greenWidth<Format>(); | - | ||||||||||||||||||
| 360 | Q_CONSTEXPR uchar blueRightShift = 8 - blueWidth<Format>(); | - | ||||||||||||||||||
| 361 | - | |||||||||||||||||||
| 362 | for (int i = 0; i < count; ++i) {
| 0 | ||||||||||||||||||
| 363 | const uint alpha = ((src[i] >> alphaRightShift) & alphaMask) << alphaShift<Format>(); | - | ||||||||||||||||||
| 364 | const uint red = ((src[i] >> redRightShift) & redMask) << redShift<Format>(); | - | ||||||||||||||||||
| 365 | const uint green = ((src[i] >> greenRightShift) & greenMask) << greenShift<Format>(); | - | ||||||||||||||||||
| 366 | const uint blue = ((src[i] >> blueRightShift) & blueMask) << blueShift<Format>(); | - | ||||||||||||||||||
| 367 | buffer[i] = alpha | red | green | blue; | - | ||||||||||||||||||
| 368 | } never executed: end of block | 0 | ||||||||||||||||||
| 369 | return buffer; never executed: return buffer; | 0 | ||||||||||||||||||
| 370 | } | - | ||||||||||||||||||
| 371 | - | |||||||||||||||||||
| 372 | #ifdef Q_COMPILER_CONSTEXPR | - | ||||||||||||||||||
| 373 | - | |||||||||||||||||||
| 374 | template<QImage::Format Format> Q_DECL_CONSTEXPR static inline QPixelLayout pixelLayoutRGB() | - | ||||||||||||||||||
| 375 | { | - | ||||||||||||||||||
| 376 | return QPixelLayout{ | - | ||||||||||||||||||
| 377 | uchar(redWidth<Format>()), uchar(redShift<Format>()), | - | ||||||||||||||||||
| 378 | uchar(greenWidth<Format>()), uchar(greenShift<Format>()), | - | ||||||||||||||||||
| 379 | uchar(blueWidth<Format>()), uchar(blueShift<Format>()), | - | ||||||||||||||||||
| 380 | 0, 0, | - | ||||||||||||||||||
| 381 | false, bitsPerPixel<Format>(), | - | ||||||||||||||||||
| 382 | convertToRGB32<Format>, | - | ||||||||||||||||||
| 383 | convertRGBFromARGB32PM<Format>, | - | ||||||||||||||||||
| 384 | convertRGBFromRGB32<Format>, | - | ||||||||||||||||||
| 385 | convertToRGB64<Format> | - | ||||||||||||||||||
| 386 | }; | - | ||||||||||||||||||
| 387 | } | - | ||||||||||||||||||
| 388 | - | |||||||||||||||||||
| 389 | template<QImage::Format Format> Q_DECL_CONSTEXPR static inline QPixelLayout pixelLayoutARGBPM() | - | ||||||||||||||||||
| 390 | { | - | ||||||||||||||||||
| 391 | return QPixelLayout{ | - | ||||||||||||||||||
| 392 | uchar(redWidth<Format>()), uchar(redShift<Format>()), | - | ||||||||||||||||||
| 393 | uchar(greenWidth<Format>()), uchar(greenShift<Format>()), | - | ||||||||||||||||||
| 394 | uchar(blueWidth<Format>()), uchar(blueShift<Format>()), | - | ||||||||||||||||||
| 395 | uchar(alphaWidth<Format>()), uchar(alphaShift<Format>()), | - | ||||||||||||||||||
| 396 | true, bitsPerPixel<Format>(), | - | ||||||||||||||||||
| 397 | convertARGBPMToARGB32PM<Format>, | - | ||||||||||||||||||
| 398 | convertARGBPMFromARGB32PM<Format>, | - | ||||||||||||||||||
| 399 | convertARGBPMFromRGB32<Format>, | - | ||||||||||||||||||
| 400 | convertARGBPMToARGB64PM<Format> | - | ||||||||||||||||||
| 401 | }; | - | ||||||||||||||||||
| 402 | } | - | ||||||||||||||||||
| 403 | - | |||||||||||||||||||
| 404 | #endif | - | ||||||||||||||||||
| 405 | - | |||||||||||||||||||
| 406 | // To convert in place, let 'dest' and 'src' be the same. | - | ||||||||||||||||||
| 407 | static const uint *QT_FASTCALL convertIndexedToARGB32PM(uint *buffer, const uint *src, int count, | - | ||||||||||||||||||
| 408 | const QPixelLayout *, const QRgb *clut) | - | ||||||||||||||||||
| 409 | { | - | ||||||||||||||||||
| 410 | for (int i = 0; i < count; ++i)
| 0 | ||||||||||||||||||
| 411 | buffer[i] = qPremultiply(clut[src[i]]); never executed: buffer[i] = qPremultiply(clut[src[i]]); | 0 | ||||||||||||||||||
| 412 | return buffer; never executed: return buffer; | 0 | ||||||||||||||||||
| 413 | } | - | ||||||||||||||||||
| 414 | - | |||||||||||||||||||
| 415 | static const QRgba64 *QT_FASTCALL convertIndexedToARGB64PM(QRgba64 *buffer, const uint *src, int count, | - | ||||||||||||||||||
| 416 | const QPixelLayout *, const QRgb *clut) | - | ||||||||||||||||||
| 417 | { | - | ||||||||||||||||||
| 418 | for (int i = 0; i < count; ++i)
| 0 | ||||||||||||||||||
| 419 | buffer[i] = QRgba64::fromArgb32(clut[src[i]]).premultiplied(); never executed: buffer[i] = QRgba64::fromArgb32(clut[src[i]]).premultiplied(); | 0 | ||||||||||||||||||
| 420 | return buffer; never executed: return buffer; | 0 | ||||||||||||||||||
| 421 | } | - | ||||||||||||||||||
| 422 | - | |||||||||||||||||||
| 423 | static const uint *QT_FASTCALL convertPassThrough(uint *, const uint *src, int, | - | ||||||||||||||||||
| 424 | const QPixelLayout *, const QRgb *) | - | ||||||||||||||||||
| 425 | { | - | ||||||||||||||||||
| 426 | return src; never executed: return src; | 0 | ||||||||||||||||||
| 427 | } | - | ||||||||||||||||||
| 428 | - | |||||||||||||||||||
| 429 | static const uint *QT_FASTCALL convertARGB32ToARGB32PM(uint *buffer, const uint *src, int count, | - | ||||||||||||||||||
| 430 | const QPixelLayout *, const QRgb *) | - | ||||||||||||||||||
| 431 | { | - | ||||||||||||||||||
| 432 | return qt_convertARGB32ToARGB32PM(buffer, src, count); never executed: return qt_convertARGB32ToARGB32PM(buffer, src, count); | 0 | ||||||||||||||||||
| 433 | } | - | ||||||||||||||||||
| 434 | - | |||||||||||||||||||
| 435 | static const uint *QT_FASTCALL convertRGBA8888PMToARGB32PM(uint *buffer, const uint *src, int count, | - | ||||||||||||||||||
| 436 | const QPixelLayout *, const QRgb *) | - | ||||||||||||||||||
| 437 | { | - | ||||||||||||||||||
| 438 | for (int i = 0; i < count; ++i)
| 0 | ||||||||||||||||||
| 439 | buffer[i] = RGBA2ARGB(src[i]); never executed: buffer[i] = RGBA2ARGB(src[i]); | 0 | ||||||||||||||||||
| 440 | return buffer; never executed: return buffer; | 0 | ||||||||||||||||||
| 441 | } | - | ||||||||||||||||||
| 442 | - | |||||||||||||||||||
| 443 | static const uint *QT_FASTCALL convertRGBA8888ToARGB32PM(uint *buffer, const uint *src, int count, | - | ||||||||||||||||||
| 444 | const QPixelLayout *, const QRgb *) | - | ||||||||||||||||||
| 445 | { | - | ||||||||||||||||||
| 446 | return qt_convertRGBA8888ToARGB32PM(buffer, src, count); never executed: return qt_convertRGBA8888ToARGB32PM(buffer, src, count); | 0 | ||||||||||||||||||
| 447 | } | - | ||||||||||||||||||
| 448 | - | |||||||||||||||||||
| 449 | static const uint *QT_FASTCALL convertAlpha8ToRGB32(uint *buffer, const uint *src, int count, | - | ||||||||||||||||||
| 450 | const QPixelLayout *, const QRgb *) | - | ||||||||||||||||||
| 451 | { | - | ||||||||||||||||||
| 452 | for (int i = 0; i < count; ++i)
| 0 | ||||||||||||||||||
| 453 | buffer[i] = qRgba(0, 0, 0, src[i]); never executed: buffer[i] = qRgba(0, 0, 0, src[i]); | 0 | ||||||||||||||||||
| 454 | return buffer; never executed: return buffer; | 0 | ||||||||||||||||||
| 455 | } | - | ||||||||||||||||||
| 456 | - | |||||||||||||||||||
| 457 | static const uint *QT_FASTCALL convertGrayscale8ToRGB32(uint *buffer, const uint *src, int count, | - | ||||||||||||||||||
| 458 | const QPixelLayout *, const QRgb *) | - | ||||||||||||||||||
| 459 | { | - | ||||||||||||||||||
| 460 | for (int i = 0; i < count; ++i)
| 0 | ||||||||||||||||||
| 461 | buffer[i] = qRgb(src[i], src[i], src[i]); never executed: buffer[i] = qRgb(src[i], src[i], src[i]); | 0 | ||||||||||||||||||
| 462 | return buffer; never executed: return buffer; | 0 | ||||||||||||||||||
| 463 | } | - | ||||||||||||||||||
| 464 | - | |||||||||||||||||||
| 465 | static const QRgba64 *QT_FASTCALL convertAlpha8ToRGB64(QRgba64 *buffer, const uint *src, int count, | - | ||||||||||||||||||
| 466 | const QPixelLayout *, const QRgb *) | - | ||||||||||||||||||
| 467 | { | - | ||||||||||||||||||
| 468 | for (int i = 0; i < count; ++i)
| 0 | ||||||||||||||||||
| 469 | buffer[i] = QRgba64::fromRgba(0, 0, 0, src[i]); never executed: buffer[i] = QRgba64::fromRgba(0, 0, 0, src[i]); | 0 | ||||||||||||||||||
| 470 | return buffer; never executed: return buffer; | 0 | ||||||||||||||||||
| 471 | } | - | ||||||||||||||||||
| 472 | - | |||||||||||||||||||
| 473 | static const QRgba64 *QT_FASTCALL convertGrayscale8ToRGB64(QRgba64 *buffer, const uint *src, int count, | - | ||||||||||||||||||
| 474 | const QPixelLayout *, const QRgb *) | - | ||||||||||||||||||
| 475 | { | - | ||||||||||||||||||
| 476 | for (int i = 0; i < count; ++i)
| 0 | ||||||||||||||||||
| 477 | buffer[i] = QRgba64::fromRgba(src[i], src[i], src[i], 255); never executed: buffer[i] = QRgba64::fromRgba(src[i], src[i], src[i], 255); | 0 | ||||||||||||||||||
| 478 | return buffer; never executed: return buffer; | 0 | ||||||||||||||||||
| 479 | } | - | ||||||||||||||||||
| 480 | - | |||||||||||||||||||
| 481 | static const uint *QT_FASTCALL convertARGB32FromARGB32PM(uint *buffer, const uint *src, int count, | - | ||||||||||||||||||
| 482 | const QPixelLayout *, const QRgb *) | - | ||||||||||||||||||
| 483 | { | - | ||||||||||||||||||
| 484 | for (int i = 0; i < count; ++i)
| 0 | ||||||||||||||||||
| 485 | buffer[i] = qUnpremultiply(src[i]); never executed: buffer[i] = qUnpremultiply(src[i]); | 0 | ||||||||||||||||||
| 486 | return buffer; never executed: return buffer; | 0 | ||||||||||||||||||
| 487 | } | - | ||||||||||||||||||
| 488 | - | |||||||||||||||||||
| 489 | static const uint *QT_FASTCALL convertRGBA8888PMFromARGB32PM(uint *buffer, const uint *src, int count, | - | ||||||||||||||||||
| 490 | const QPixelLayout *, const QRgb *) | - | ||||||||||||||||||
| 491 | { | - | ||||||||||||||||||
| 492 | for (int i = 0; i < count; ++i)
| 0 | ||||||||||||||||||
| 493 | buffer[i] = ARGB2RGBA(src[i]); never executed: buffer[i] = ARGB2RGBA(src[i]); | 0 | ||||||||||||||||||
| 494 | return buffer; never executed: return buffer; | 0 | ||||||||||||||||||
| 495 | } | - | ||||||||||||||||||
| 496 | - | |||||||||||||||||||
| 497 | #ifdef __SSE2__ | - | ||||||||||||||||||
| 498 | template<bool RGBA, bool maskAlpha> | - | ||||||||||||||||||
| 499 | static inline void qConvertARGB32PMToARGB64PM_sse2(QRgba64 *buffer, const uint *src, int count) | - | ||||||||||||||||||
| 500 | { | - | ||||||||||||||||||
| 501 | if (count <= 0)
| 0 | ||||||||||||||||||
| 502 | return; never executed: return; | 0 | ||||||||||||||||||
| 503 | - | |||||||||||||||||||
| 504 | const __m128i amask = _mm_set1_epi32(0xff000000); | - | ||||||||||||||||||
| 505 | int i = 0; | - | ||||||||||||||||||
| 506 | for (; ((uintptr_t)buffer & 0xf) && i < count; ++i) {
| 0 | ||||||||||||||||||
| 507 | uint s = *src++; | - | ||||||||||||||||||
| 508 | if (RGBA)
| 0 | ||||||||||||||||||
| 509 | s = RGBA2ARGB(s); never executed: s = RGBA2ARGB(s); | 0 | ||||||||||||||||||
| 510 | *buffer++ = QRgba64::fromArgb32(s); | - | ||||||||||||||||||
| 511 | } never executed: end of block | 0 | ||||||||||||||||||
| 512 | for (; i < count-3; i += 4) {
| 0 | ||||||||||||||||||
| 513 | __m128i vs = _mm_loadu_si128((const __m128i*)src); | - | ||||||||||||||||||
| 514 | if (maskAlpha)
| 0 | ||||||||||||||||||
| 515 | vs = _mm_or_si128(vs, amask); never executed: vs = _mm_or_si128(vs, amask); | 0 | ||||||||||||||||||
| 516 | src += 4; | - | ||||||||||||||||||
| 517 | __m128i v1 = _mm_unpacklo_epi8(vs, vs); | - | ||||||||||||||||||
| 518 | __m128i v2 = _mm_unpackhi_epi8(vs, vs); | - | ||||||||||||||||||
| 519 | if (!RGBA) {
| 0 | ||||||||||||||||||
| 520 | v1 = _mm_shufflelo_epi16(v1, _MM_SHUFFLE(3, 0, 1, 2)); | - | ||||||||||||||||||
| 521 | v2 = _mm_shufflelo_epi16(v2, _MM_SHUFFLE(3, 0, 1, 2)); | - | ||||||||||||||||||
| 522 | v1 = _mm_shufflehi_epi16(v1, _MM_SHUFFLE(3, 0, 1, 2)); | - | ||||||||||||||||||
| 523 | v2 = _mm_shufflehi_epi16(v2, _MM_SHUFFLE(3, 0, 1, 2)); | - | ||||||||||||||||||
| 524 | } never executed: end of block | 0 | ||||||||||||||||||
| 525 | _mm_store_si128((__m128i*)(buffer), v1); | - | ||||||||||||||||||
| 526 | buffer += 2; | - | ||||||||||||||||||
| 527 | _mm_store_si128((__m128i*)(buffer), v2); | - | ||||||||||||||||||
| 528 | buffer += 2; | - | ||||||||||||||||||
| 529 | } never executed: end of block | 0 | ||||||||||||||||||
| 530 | - | |||||||||||||||||||
| 531 | for (; i < count; ++i) {
| 0 | ||||||||||||||||||
| 532 | uint s = *src++; | - | ||||||||||||||||||
| 533 | if (RGBA)
| 0 | ||||||||||||||||||
| 534 | s = RGBA2ARGB(s); never executed: s = RGBA2ARGB(s); | 0 | ||||||||||||||||||
| 535 | *buffer++ = QRgba64::fromArgb32(s); | - | ||||||||||||||||||
| 536 | } never executed: end of block | 0 | ||||||||||||||||||
| 537 | } never executed: end of block | 0 | ||||||||||||||||||
| 538 | #endif | - | ||||||||||||||||||
| 539 | - | |||||||||||||||||||
| 540 | static const QRgba64 *QT_FASTCALL convertRGB32ToRGB64(QRgba64 *buffer, const uint *src, int count, | - | ||||||||||||||||||
| 541 | const QPixelLayout *, const QRgb *) | - | ||||||||||||||||||
| 542 | { | - | ||||||||||||||||||
| 543 | #ifdef __SSE2__ | - | ||||||||||||||||||
| 544 | qConvertARGB32PMToARGB64PM_sse2<false, true>(buffer, src, count); | - | ||||||||||||||||||
| 545 | #else | - | ||||||||||||||||||
| 546 | for (int i = 0; i < count; ++i) | - | ||||||||||||||||||
| 547 | buffer[i] = QRgba64::fromArgb32(0xff000000 | src[i]); | - | ||||||||||||||||||
| 548 | #endif | - | ||||||||||||||||||
| 549 | return buffer; never executed: return buffer; | 0 | ||||||||||||||||||
| 550 | } | - | ||||||||||||||||||
| 551 | - | |||||||||||||||||||
| 552 | static const QRgba64 *QT_FASTCALL convertARGB32ToARGB64PM(QRgba64 *buffer, const uint *src, int count, | - | ||||||||||||||||||
| 553 | const QPixelLayout *, const QRgb *) | - | ||||||||||||||||||
| 554 | { | - | ||||||||||||||||||
| 555 | #ifdef __SSE2__ | - | ||||||||||||||||||
| 556 | qConvertARGB32PMToARGB64PM_sse2<false, false>(buffer, src, count); | - | ||||||||||||||||||
| 557 | for (int i = 0; i < count; ++i)
| 0 | ||||||||||||||||||
| 558 | buffer[i] = buffer[i].premultiplied(); never executed: buffer[i] = buffer[i].premultiplied(); | 0 | ||||||||||||||||||
| 559 | #else | - | ||||||||||||||||||
| 560 | for (int i = 0; i < count; ++i) | - | ||||||||||||||||||
| 561 | buffer[i] = QRgba64::fromArgb32(src[i]).premultiplied(); | - | ||||||||||||||||||
| 562 | #endif | - | ||||||||||||||||||
| 563 | return buffer; never executed: return buffer; | 0 | ||||||||||||||||||
| 564 | } | - | ||||||||||||||||||
| 565 | - | |||||||||||||||||||
| 566 | static const QRgba64 *QT_FASTCALL convertARGB32PMToARGB64PM(QRgba64 *buffer, const uint *src, int count, | - | ||||||||||||||||||
| 567 | const QPixelLayout *, const QRgb *) | - | ||||||||||||||||||
| 568 | { | - | ||||||||||||||||||
| 569 | #ifdef __SSE2__ | - | ||||||||||||||||||
| 570 | qConvertARGB32PMToARGB64PM_sse2<false, false>(buffer, src, count); | - | ||||||||||||||||||
| 571 | #else | - | ||||||||||||||||||
| 572 | for (int i = 0; i < count; ++i) | - | ||||||||||||||||||
| 573 | buffer[i] = QRgba64::fromArgb32(src[i]); | - | ||||||||||||||||||
| 574 | #endif | - | ||||||||||||||||||
| 575 | return buffer; never executed: return buffer; | 0 | ||||||||||||||||||
| 576 | } | - | ||||||||||||||||||
| 577 | - | |||||||||||||||||||
| 578 | static const QRgba64 *QT_FASTCALL convertRGBA8888ToARGB64PM(QRgba64 *buffer, const uint *src, int count, | - | ||||||||||||||||||
| 579 | const QPixelLayout *, const QRgb *) | - | ||||||||||||||||||
| 580 | { | - | ||||||||||||||||||
| 581 | #ifdef __SSE2__ | - | ||||||||||||||||||
| 582 | qConvertARGB32PMToARGB64PM_sse2<true, false>(buffer, src, count); | - | ||||||||||||||||||
| 583 | for (int i = 0; i < count; ++i)
| 0 | ||||||||||||||||||
| 584 | buffer[i] = buffer[i].premultiplied(); never executed: buffer[i] = buffer[i].premultiplied(); | 0 | ||||||||||||||||||
| 585 | #else | - | ||||||||||||||||||
| 586 | for (int i = 0; i < count; ++i) | - | ||||||||||||||||||
| 587 | buffer[i] = QRgba64::fromArgb32(RGBA2ARGB(src[i])).premultiplied(); | - | ||||||||||||||||||
| 588 | #endif | - | ||||||||||||||||||
| 589 | return buffer; never executed: return buffer; | 0 | ||||||||||||||||||
| 590 | } | - | ||||||||||||||||||
| 591 | - | |||||||||||||||||||
| 592 | static const QRgba64 *QT_FASTCALL convertRGBA8888PMToARGB64PM(QRgba64 *buffer, const uint *src, int count, | - | ||||||||||||||||||
| 593 | const QPixelLayout *, const QRgb *) | - | ||||||||||||||||||
| 594 | { | - | ||||||||||||||||||
| 595 | #ifdef __SSE2__ | - | ||||||||||||||||||
| 596 | qConvertARGB32PMToARGB64PM_sse2<true, false>(buffer, src, count); | - | ||||||||||||||||||
| 597 | #else | - | ||||||||||||||||||
| 598 | for (int i = 0; i < count; ++i) | - | ||||||||||||||||||
| 599 | buffer[i] = QRgba64::fromArgb32(RGBA2ARGB(src[i])); | - | ||||||||||||||||||
| 600 | #endif | - | ||||||||||||||||||
| 601 | return buffer; never executed: return buffer; | 0 | ||||||||||||||||||
| 602 | } | - | ||||||||||||||||||
| 603 | - | |||||||||||||||||||
| 604 | static const uint *QT_FASTCALL convertRGBA8888FromARGB32PM(uint *buffer, const uint *src, int count, | - | ||||||||||||||||||
| 605 | const QPixelLayout *, const QRgb *) | - | ||||||||||||||||||
| 606 | { | - | ||||||||||||||||||
| 607 | for (int i = 0; i < count; ++i)
| 0 | ||||||||||||||||||
| 608 | buffer[i] = ARGB2RGBA(qUnpremultiply(src[i])); never executed: buffer[i] = ARGB2RGBA(qUnpremultiply(src[i])); | 0 | ||||||||||||||||||
| 609 | return buffer; never executed: return buffer; | 0 | ||||||||||||||||||
| 610 | } | - | ||||||||||||||||||
| 611 | - | |||||||||||||||||||
| 612 | static const uint *QT_FASTCALL convertRGBXFromRGB32(uint *buffer, const uint *src, int count, | - | ||||||||||||||||||
| 613 | const QPixelLayout *, const QRgb *) | - | ||||||||||||||||||
| 614 | { | - | ||||||||||||||||||
| 615 | for (int i = 0; i < count; ++i)
| 0 | ||||||||||||||||||
| 616 | buffer[i] = ARGB2RGBA(0xff000000 | src[i]); never executed: buffer[i] = ARGB2RGBA(0xff000000 | src[i]); | 0 | ||||||||||||||||||
| 617 | return buffer; never executed: return buffer; | 0 | ||||||||||||||||||
| 618 | } | - | ||||||||||||||||||
| 619 | - | |||||||||||||||||||
| 620 | static const uint *QT_FASTCALL convertRGBXFromARGB32PM(uint *buffer, const uint *src, int count, | - | ||||||||||||||||||
| 621 | const QPixelLayout *, const QRgb *) | - | ||||||||||||||||||
| 622 | { | - | ||||||||||||||||||
| 623 | for (int i = 0; i < count; ++i)
| 0 | ||||||||||||||||||
| 624 | buffer[i] = ARGB2RGBA(0xff000000 | qUnpremultiply(src[i])); never executed: buffer[i] = ARGB2RGBA(0xff000000 | qUnpremultiply(src[i])); | 0 | ||||||||||||||||||
| 625 | return buffer; never executed: return buffer; | 0 | ||||||||||||||||||
| 626 | } | - | ||||||||||||||||||
| 627 | - | |||||||||||||||||||
| 628 | template<QtPixelOrder PixelOrder> | - | ||||||||||||||||||
| 629 | static const uint *QT_FASTCALL convertA2RGB30PMToARGB32PM(uint *buffer, const uint *src, int count, | - | ||||||||||||||||||
| 630 | const QPixelLayout *, const QRgb *) | - | ||||||||||||||||||
| 631 | { | - | ||||||||||||||||||
| 632 | for (int i = 0; i < count; ++i)
| 0 | ||||||||||||||||||
| 633 | buffer[i] = qConvertA2rgb30ToArgb32<PixelOrder>(src[i]); never executed: buffer[i] = qConvertA2rgb30ToArgb32<PixelOrder>(src[i]); | 0 | ||||||||||||||||||
| 634 | return buffer; never executed: return buffer; | 0 | ||||||||||||||||||
| 635 | } | - | ||||||||||||||||||
| 636 | - | |||||||||||||||||||
| 637 | #ifdef __SSE2__ | - | ||||||||||||||||||
| 638 | template<QtPixelOrder PixelOrder> | - | ||||||||||||||||||
| 639 | static inline void qConvertA2RGB30PMToARGB64PM_sse2(QRgba64 *buffer, const uint *src, int count) | - | ||||||||||||||||||
| 640 | { | - | ||||||||||||||||||
| 641 | if (count <= 0)
| 0 | ||||||||||||||||||
| 642 | return; never executed: return; | 0 | ||||||||||||||||||
| 643 | - | |||||||||||||||||||
| 644 | const __m128i rmask = _mm_set1_epi32(0x3ff00000); | - | ||||||||||||||||||
| 645 | const __m128i gmask = _mm_set1_epi32(0x000ffc00); | - | ||||||||||||||||||
| 646 | const __m128i bmask = _mm_set1_epi32(0x000003ff); | - | ||||||||||||||||||
| 647 | const __m128i afactor = _mm_set1_epi16(0x5555); | - | ||||||||||||||||||
| 648 | int i = 0; | - | ||||||||||||||||||
| 649 | - | |||||||||||||||||||
| 650 | for (; ((uintptr_t)buffer & 0xf) && i < count; ++i)
| 0 | ||||||||||||||||||
| 651 | *buffer++ = qConvertA2rgb30ToRgb64<PixelOrder>(*src++); never executed: *buffer++ = qConvertA2rgb30ToRgb64<PixelOrder>(*src++); | 0 | ||||||||||||||||||
| 652 | - | |||||||||||||||||||
| 653 | for (; i < count-3; i += 4) {
| 0 | ||||||||||||||||||
| 654 | __m128i vs = _mm_loadu_si128((const __m128i*)src); | - | ||||||||||||||||||
| 655 | src += 4; | - | ||||||||||||||||||
| 656 | __m128i va = _mm_srli_epi32(vs, 30); | - | ||||||||||||||||||
| 657 | __m128i vr = _mm_and_si128(vs, rmask); | - | ||||||||||||||||||
| 658 | __m128i vb = _mm_and_si128(vs, bmask); | - | ||||||||||||||||||
| 659 | __m128i vg = _mm_and_si128(vs, gmask); | - | ||||||||||||||||||
| 660 | va = _mm_mullo_epi16(va, afactor); | - | ||||||||||||||||||
| 661 | vr = _mm_or_si128(_mm_srli_epi32(vr, 14), _mm_srli_epi32(vr, 24)); | - | ||||||||||||||||||
| 662 | vg = _mm_or_si128(_mm_srli_epi32(vg, 4), _mm_srli_epi32(vg, 14)); | - | ||||||||||||||||||
| 663 | vb = _mm_or_si128(_mm_slli_epi32(vb, 6), _mm_srli_epi32(vb, 4)); | - | ||||||||||||||||||
| 664 | __m128i vrb; | - | ||||||||||||||||||
| 665 | if (PixelOrder == PixelOrderRGB)
| 0 | ||||||||||||||||||
| 666 | vrb = _mm_or_si128(vr, _mm_slli_si128(vb, 2)); never executed: vrb = _mm_or_si128(vr, ((__m128i)__builtin_ia32_pslldqi128 ((__m128i)(vb), (int)(2) * 8))); | 0 | ||||||||||||||||||
| 667 | else | - | ||||||||||||||||||
| 668 | vrb = _mm_or_si128(vb, _mm_slli_si128(vr, 2)); never executed: vrb = _mm_or_si128(vb, ((__m128i)__builtin_ia32_pslldqi128 ((__m128i)(vr), (int)(2) * 8))); | 0 | ||||||||||||||||||
| 669 | __m128i vga = _mm_or_si128(vg, _mm_slli_si128(va, 2)); | - | ||||||||||||||||||
| 670 | _mm_store_si128((__m128i*)(buffer), _mm_unpacklo_epi16(vrb, vga)); | - | ||||||||||||||||||
| 671 | buffer += 2; | - | ||||||||||||||||||
| 672 | _mm_store_si128((__m128i*)(buffer), _mm_unpackhi_epi16(vrb, vga)); | - | ||||||||||||||||||
| 673 | buffer += 2; | - | ||||||||||||||||||
| 674 | } never executed: end of block | 0 | ||||||||||||||||||
| 675 | - | |||||||||||||||||||
| 676 | for (; i < count; ++i)
| 0 | ||||||||||||||||||
| 677 | *buffer++ = qConvertA2rgb30ToRgb64<PixelOrder>(*src++); never executed: *buffer++ = qConvertA2rgb30ToRgb64<PixelOrder>(*src++); | 0 | ||||||||||||||||||
| 678 | } never executed: end of block | 0 | ||||||||||||||||||
| 679 | #endif | - | ||||||||||||||||||
| 680 | - | |||||||||||||||||||
| 681 | template<QtPixelOrder PixelOrder> | - | ||||||||||||||||||
| 682 | static const QRgba64 *QT_FASTCALL convertA2RGB30PMToARGB64PM(QRgba64 *buffer, const uint *src, int count, | - | ||||||||||||||||||
| 683 | const QPixelLayout *, const QRgb *) | - | ||||||||||||||||||
| 684 | { | - | ||||||||||||||||||
| 685 | #ifdef __SSE2__ | - | ||||||||||||||||||
| 686 | qConvertA2RGB30PMToARGB64PM_sse2<PixelOrder>(buffer, src, count); | - | ||||||||||||||||||
| 687 | #else | - | ||||||||||||||||||
| 688 | for (int i = 0; i < count; ++i) | - | ||||||||||||||||||
| 689 | buffer[i] = qConvertA2rgb30ToRgb64<PixelOrder>(src[i]); | - | ||||||||||||||||||
| 690 | #endif | - | ||||||||||||||||||
| 691 | return buffer; never executed: return buffer; | 0 | ||||||||||||||||||
| 692 | } | - | ||||||||||||||||||
| 693 | - | |||||||||||||||||||
| 694 | template<QtPixelOrder PixelOrder> | - | ||||||||||||||||||
| 695 | static const uint *QT_FASTCALL convertA2RGB30PMFromARGB32PM(uint *buffer, const uint *src, int count, | - | ||||||||||||||||||
| 696 | const QPixelLayout *, const QRgb *) | - | ||||||||||||||||||
| 697 | { | - | ||||||||||||||||||
| 698 | for (int i = 0; i < count; ++i)
| 0 | ||||||||||||||||||
| 699 | buffer[i] = qConvertArgb32ToA2rgb30<PixelOrder>(src[i]); never executed: buffer[i] = qConvertArgb32ToA2rgb30<PixelOrder>(src[i]); | 0 | ||||||||||||||||||
| 700 | return buffer; never executed: return buffer; | 0 | ||||||||||||||||||
| 701 | } | - | ||||||||||||||||||
| 702 | - | |||||||||||||||||||
| 703 | template<QtPixelOrder PixelOrder> | - | ||||||||||||||||||
| 704 | static const uint *QT_FASTCALL convertRGB30FromRGB32(uint *buffer, const uint *src, int count, | - | ||||||||||||||||||
| 705 | const QPixelLayout *, const QRgb *) | - | ||||||||||||||||||
| 706 | { | - | ||||||||||||||||||
| 707 | for (int i = 0; i < count; ++i)
| 0 | ||||||||||||||||||
| 708 | buffer[i] = qConvertRgb32ToRgb30<PixelOrder>(src[i]); never executed: buffer[i] = qConvertRgb32ToRgb30<PixelOrder>(src[i]); | 0 | ||||||||||||||||||
| 709 | return buffer; never executed: return buffer; | 0 | ||||||||||||||||||
| 710 | } | - | ||||||||||||||||||
| 711 | - | |||||||||||||||||||
| 712 | template<QtPixelOrder PixelOrder> | - | ||||||||||||||||||
| 713 | static const uint *QT_FASTCALL convertRGB30FromARGB32PM(uint *buffer, const uint *src, int count, | - | ||||||||||||||||||
| 714 | const QPixelLayout *, const QRgb *) | - | ||||||||||||||||||
| 715 | { | - | ||||||||||||||||||
| 716 | for (int i = 0; i < count; ++i)
| 0 | ||||||||||||||||||
| 717 | buffer[i] = qConvertRgb32ToRgb30<PixelOrder>(qUnpremultiply(src[i])); never executed: buffer[i] = qConvertRgb32ToRgb30<PixelOrder>(qUnpremultiply(src[i])); | 0 | ||||||||||||||||||
| 718 | return buffer; never executed: return buffer; | 0 | ||||||||||||||||||
| 719 | } | - | ||||||||||||||||||
| 720 | - | |||||||||||||||||||
| 721 | static const uint *QT_FASTCALL convertAlpha8FromARGB32PM(uint *buffer, const uint *src, int count, | - | ||||||||||||||||||
| 722 | const QPixelLayout *, const QRgb *) | - | ||||||||||||||||||
| 723 | { | - | ||||||||||||||||||
| 724 | for (int i = 0; i < count; ++i)
| 0 | ||||||||||||||||||
| 725 | buffer[i] = qAlpha(src[i]); never executed: buffer[i] = qAlpha(src[i]); | 0 | ||||||||||||||||||
| 726 | return buffer; never executed: return buffer; | 0 | ||||||||||||||||||
| 727 | } | - | ||||||||||||||||||
| 728 | - | |||||||||||||||||||
| 729 | static const uint *QT_FASTCALL convertGrayscale8FromRGB32(uint *buffer, const uint *src, int count, | - | ||||||||||||||||||
| 730 | const QPixelLayout *, const QRgb *) | - | ||||||||||||||||||
| 731 | { | - | ||||||||||||||||||
| 732 | for (int i = 0; i < count; ++i)
| 0 | ||||||||||||||||||
| 733 | buffer[i] = qGray(src[i]); never executed: buffer[i] = qGray(src[i]); | 0 | ||||||||||||||||||
| 734 | return buffer; never executed: return buffer; | 0 | ||||||||||||||||||
| 735 | } | - | ||||||||||||||||||
| 736 | - | |||||||||||||||||||
| 737 | static const uint *QT_FASTCALL convertGrayscale8FromARGB32PM(uint *buffer, const uint *src, int count, | - | ||||||||||||||||||
| 738 | const QPixelLayout *, const QRgb *) | - | ||||||||||||||||||
| 739 | { | - | ||||||||||||||||||
| 740 | for (int i = 0; i < count; ++i)
| 0 | ||||||||||||||||||
| 741 | buffer[i] = qGray(qUnpremultiply(src[i])); never executed: buffer[i] = qGray(qUnpremultiply(src[i])); | 0 | ||||||||||||||||||
| 742 | return buffer; never executed: return buffer; | 0 | ||||||||||||||||||
| 743 | } | - | ||||||||||||||||||
| 744 | - | |||||||||||||||||||
| 745 | template <QPixelLayout::BPP bpp> static | - | ||||||||||||||||||
| 746 | uint QT_FASTCALL fetchPixel(const uchar *src, int index); | - | ||||||||||||||||||
| 747 | - | |||||||||||||||||||
| 748 | template <> | - | ||||||||||||||||||
| 749 | inline uint QT_FASTCALL fetchPixel<QPixelLayout::BPP1LSB>(const uchar *src, int index) | - | ||||||||||||||||||
| 750 | { | - | ||||||||||||||||||
| 751 | return (src[index >> 3] >> (index & 7)) & 1; never executed: return (src[index >> 3] >> (index & 7)) & 1; | 0 | ||||||||||||||||||
| 752 | } | - | ||||||||||||||||||
| 753 | - | |||||||||||||||||||
| 754 | template <> | - | ||||||||||||||||||
| 755 | inline uint QT_FASTCALL fetchPixel<QPixelLayout::BPP1MSB>(const uchar *src, int index) | - | ||||||||||||||||||
| 756 | { | - | ||||||||||||||||||
| 757 | return (src[index >> 3] >> (~index & 7)) & 1; never executed: return (src[index >> 3] >> (~index & 7)) & 1; | 0 | ||||||||||||||||||
| 758 | } | - | ||||||||||||||||||
| 759 | - | |||||||||||||||||||
| 760 | template <> | - | ||||||||||||||||||
| 761 | inline uint QT_FASTCALL fetchPixel<QPixelLayout::BPP8>(const uchar *src, int index) | - | ||||||||||||||||||
| 762 | { | - | ||||||||||||||||||
| 763 | return src[index]; never executed: return src[index]; | 0 | ||||||||||||||||||
| 764 | } | - | ||||||||||||||||||
| 765 | - | |||||||||||||||||||
| 766 | template <> | - | ||||||||||||||||||
| 767 | inline uint QT_FASTCALL fetchPixel<QPixelLayout::BPP16>(const uchar *src, int index) | - | ||||||||||||||||||
| 768 | { | - | ||||||||||||||||||
| 769 | return reinterpret_cast<const quint16 *>(src)[index]; never executed: return reinterpret_cast<const quint16 *>(src)[index]; | 0 | ||||||||||||||||||
| 770 | } | - | ||||||||||||||||||
| 771 | - | |||||||||||||||||||
| 772 | template <> | - | ||||||||||||||||||
| 773 | inline uint QT_FASTCALL fetchPixel<QPixelLayout::BPP24>(const uchar *src, int index) | - | ||||||||||||||||||
| 774 | { | - | ||||||||||||||||||
| 775 | return reinterpret_cast<const quint24 *>(src)[index]; never executed: return reinterpret_cast<const quint24 *>(src)[index]; | 0 | ||||||||||||||||||
| 776 | } | - | ||||||||||||||||||
| 777 | - | |||||||||||||||||||
| 778 | template <> | - | ||||||||||||||||||
| 779 | inline uint QT_FASTCALL fetchPixel<QPixelLayout::BPP32>(const uchar *src, int index) | - | ||||||||||||||||||
| 780 | { | - | ||||||||||||||||||
| 781 | return reinterpret_cast<const uint *>(src)[index]; never executed: return reinterpret_cast<const uint *>(src)[index]; | 0 | ||||||||||||||||||
| 782 | } | - | ||||||||||||||||||
| 783 | - | |||||||||||||||||||
| 784 | template <QPixelLayout::BPP bpp> | - | ||||||||||||||||||
| 785 | inline const uint *QT_FASTCALL fetchPixels(uint *buffer, const uchar *src, int index, int count) | - | ||||||||||||||||||
| 786 | { | - | ||||||||||||||||||
| 787 | for (int i = 0; i < count; ++i)
| 0 | ||||||||||||||||||
| 788 | buffer[i] = fetchPixel<bpp>(src, index + i); never executed: buffer[i] = fetchPixel<bpp>(src, index + i); | 0 | ||||||||||||||||||
| 789 | return buffer; never executed: return buffer; | 0 | ||||||||||||||||||
| 790 | } | - | ||||||||||||||||||
| 791 | - | |||||||||||||||||||
| 792 | template <> | - | ||||||||||||||||||
| 793 | inline const uint *QT_FASTCALL fetchPixels<QPixelLayout::BPP32>(uint *, const uchar *src, int index, int) | - | ||||||||||||||||||
| 794 | { | - | ||||||||||||||||||
| 795 | return reinterpret_cast<const uint *>(src) + index; never executed: return reinterpret_cast<const uint *>(src) + index; | 0 | ||||||||||||||||||
| 796 | } | - | ||||||||||||||||||
| 797 | - | |||||||||||||||||||
| 798 | template <QPixelLayout::BPP width> static | - | ||||||||||||||||||
| 799 | void QT_FASTCALL storePixel(uchar *dest, int index, uint pixel); | - | ||||||||||||||||||
| 800 | - | |||||||||||||||||||
| 801 | template <> | - | ||||||||||||||||||
| 802 | inline void QT_FASTCALL storePixel<QPixelLayout::BPP1LSB>(uchar *dest, int index, uint pixel) | - | ||||||||||||||||||
| 803 | { | - | ||||||||||||||||||
| 804 | if (pixel)
| 0 | ||||||||||||||||||
| 805 | dest[index >> 3] |= 1 << (index & 7); never executed: dest[index >> 3] |= 1 << (index & 7); | 0 | ||||||||||||||||||
| 806 | else | - | ||||||||||||||||||
| 807 | dest[index >> 3] &= ~(1 << (index & 7)); never executed: dest[index >> 3] &= ~(1 << (index & 7)); | 0 | ||||||||||||||||||
| 808 | } | - | ||||||||||||||||||
| 809 | - | |||||||||||||||||||
| 810 | template <> | - | ||||||||||||||||||
| 811 | inline void QT_FASTCALL storePixel<QPixelLayout::BPP1MSB>(uchar *dest, int index, uint pixel) | - | ||||||||||||||||||
| 812 | { | - | ||||||||||||||||||
| 813 | if (pixel)
| 0 | ||||||||||||||||||
| 814 | dest[index >> 3] |= 1 << (~index & 7); never executed: dest[index >> 3] |= 1 << (~index & 7); | 0 | ||||||||||||||||||
| 815 | else | - | ||||||||||||||||||
| 816 | dest[index >> 3] &= ~(1 << (~index & 7)); never executed: dest[index >> 3] &= ~(1 << (~index & 7)); | 0 | ||||||||||||||||||
| 817 | } | - | ||||||||||||||||||
| 818 | - | |||||||||||||||||||
| 819 | template <> | - | ||||||||||||||||||
| 820 | inline void QT_FASTCALL storePixel<QPixelLayout::BPP8>(uchar *dest, int index, uint pixel) | - | ||||||||||||||||||
| 821 | { | - | ||||||||||||||||||
| 822 | dest[index] = uchar(pixel); | - | ||||||||||||||||||
| 823 | } never executed: end of block | 0 | ||||||||||||||||||
| 824 | - | |||||||||||||||||||
| 825 | template <> | - | ||||||||||||||||||
| 826 | inline void QT_FASTCALL storePixel<QPixelLayout::BPP16>(uchar *dest, int index, uint pixel) | - | ||||||||||||||||||
| 827 | { | - | ||||||||||||||||||
| 828 | reinterpret_cast<quint16 *>(dest)[index] = quint16(pixel); | - | ||||||||||||||||||
| 829 | } never executed: end of block | 0 | ||||||||||||||||||
| 830 | - | |||||||||||||||||||
| 831 | template <> | - | ||||||||||||||||||
| 832 | inline void QT_FASTCALL storePixel<QPixelLayout::BPP24>(uchar *dest, int index, uint pixel) | - | ||||||||||||||||||
| 833 | { | - | ||||||||||||||||||
| 834 | reinterpret_cast<quint24 *>(dest)[index] = quint24(pixel); | - | ||||||||||||||||||
| 835 | } never executed: end of block | 0 | ||||||||||||||||||
| 836 | - | |||||||||||||||||||
| 837 | template <QPixelLayout::BPP width> | - | ||||||||||||||||||
| 838 | inline void QT_FASTCALL storePixels(uchar *dest, const uint *src, int index, int count) | - | ||||||||||||||||||
| 839 | { | - | ||||||||||||||||||
| 840 | for (int i = 0; i < count; ++i)
| 0 | ||||||||||||||||||
| 841 | storePixel<width>(dest, index + i, src[i]); never executed: storePixel<width>(dest, index + i, src[i]); | 0 | ||||||||||||||||||
| 842 | } never executed: end of block | 0 | ||||||||||||||||||
| 843 | - | |||||||||||||||||||
| 844 | template <> | - | ||||||||||||||||||
| 845 | inline void QT_FASTCALL storePixels<QPixelLayout::BPP32>(uchar *dest, const uint *src, int index, int count) | - | ||||||||||||||||||
| 846 | { | - | ||||||||||||||||||
| 847 | memcpy(reinterpret_cast<uint *>(dest) + index, src, count * sizeof(uint)); | - | ||||||||||||||||||
| 848 | } never executed: end of block | 0 | ||||||||||||||||||
| 849 | - | |||||||||||||||||||
| 850 | // Note: | - | ||||||||||||||||||
| 851 | // convertToArgb32() assumes that no color channel is less than 4 bits. | - | ||||||||||||||||||
| 852 | // convertFromArgb32() assumes that no color channel is more than 8 bits. | - | ||||||||||||||||||
| 853 | // QImage::rgbSwapped() assumes that the red and blue color channels have the same number of bits. | - | ||||||||||||||||||
| 854 | QPixelLayout qPixelLayouts[QImage::NImageFormats] = { | - | ||||||||||||||||||
| 855 | { 0, 0, 0, 0, 0, 0, 0, 0, false, QPixelLayout::BPPNone, 0, 0, 0, 0 }, // Format_Invalid | - | ||||||||||||||||||
| 856 | { 0, 0, 0, 0, 0, 0, 0, 0, false, QPixelLayout::BPP1MSB, convertIndexedToARGB32PM, 0, 0, convertIndexedToARGB64PM }, // Format_Mono | - | ||||||||||||||||||
| 857 | { 0, 0, 0, 0, 0, 0, 0, 0, false, QPixelLayout::BPP1LSB, convertIndexedToARGB32PM, 0, 0, convertIndexedToARGB64PM }, // Format_MonoLSB | - | ||||||||||||||||||
| 858 | { 0, 0, 0, 0, 0, 0, 0, 0, false, QPixelLayout::BPP8, convertIndexedToARGB32PM, 0, 0, convertIndexedToARGB64PM }, // Format_Indexed8 | - | ||||||||||||||||||
| 859 | // Technically using convertPassThrough to convert from ARGB32PM to RGB32 is wrong, | - | ||||||||||||||||||
| 860 | // but everywhere this generic conversion would be wrong is currently overloaded. | - | ||||||||||||||||||
| 861 | { 8, 16, 8, 8, 8, 0, 0, 0, false, QPixelLayout::BPP32, convertPassThrough, convertPassThrough, convertPassThrough, convertRGB32ToRGB64 }, // Format_RGB32 | - | ||||||||||||||||||
| 862 | { 8, 16, 8, 8, 8, 0, 8, 24, false, QPixelLayout::BPP32, convertARGB32ToARGB32PM, convertARGB32FromARGB32PM, convertPassThrough, convertARGB32ToARGB64PM }, // Format_ARGB32 | - | ||||||||||||||||||
| 863 | { 8, 16, 8, 8, 8, 0, 8, 24, true, QPixelLayout::BPP32, convertPassThrough, convertPassThrough, convertPassThrough, convertARGB32PMToARGB64PM }, // Format_ARGB32_Premultiplied | - | ||||||||||||||||||
| 864 | #ifdef Q_COMPILER_CONSTEXPR | - | ||||||||||||||||||
| 865 | pixelLayoutRGB<QImage::Format_RGB16>(), | - | ||||||||||||||||||
| 866 | pixelLayoutARGBPM<QImage::Format_ARGB8565_Premultiplied>(), | - | ||||||||||||||||||
| 867 | pixelLayoutRGB<QImage::Format_RGB666>(), | - | ||||||||||||||||||
| 868 | pixelLayoutARGBPM<QImage::Format_ARGB6666_Premultiplied>(), | - | ||||||||||||||||||
| 869 | pixelLayoutRGB<QImage::Format_RGB555>(), | - | ||||||||||||||||||
| 870 | pixelLayoutARGBPM<QImage::Format_ARGB8555_Premultiplied>(), | - | ||||||||||||||||||
| 871 | pixelLayoutRGB<QImage::Format_RGB888>(), | - | ||||||||||||||||||
| 872 | pixelLayoutRGB<QImage::Format_RGB444>(), | - | ||||||||||||||||||
| 873 | pixelLayoutARGBPM<QImage::Format_ARGB4444_Premultiplied>(), | - | ||||||||||||||||||
| 874 | #else | - | ||||||||||||||||||
| 875 | { 5, 11, 6, 5, 5, 0, 0, 0, false, QPixelLayout::BPP16, | - | ||||||||||||||||||
| 876 | convertToRGB32<QImage::Format_RGB16>, | - | ||||||||||||||||||
| 877 | convertRGBFromARGB32PM<QImage::Format_RGB16>, | - | ||||||||||||||||||
| 878 | convertRGBFromRGB32<QImage::Format_RGB16>, | - | ||||||||||||||||||
| 879 | convertToRGB64<QImage::Format_RGB16>, | - | ||||||||||||||||||
| 880 | }, | - | ||||||||||||||||||
| 881 | { 5, 19, 6, 13, 5, 8, 8, 0, true, QPixelLayout::BPP24, | - | ||||||||||||||||||
| 882 | convertARGBPMToARGB32PM<QImage::Format_ARGB8565_Premultiplied>, | - | ||||||||||||||||||
| 883 | convertARGBPMFromARGB32PM<QImage::Format_ARGB8565_Premultiplied>, | - | ||||||||||||||||||
| 884 | convertARGBPMFromRGB32<QImage::Format_ARGB8565_Premultiplied>, | - | ||||||||||||||||||
| 885 | convertARGBPMToARGB64PM<QImage::Format_ARGB8565_Premultiplied>, | - | ||||||||||||||||||
| 886 | }, | - | ||||||||||||||||||
| 887 | { 6, 12, 6, 6, 6, 0, 0, 0, false, QPixelLayout::BPP24, | - | ||||||||||||||||||
| 888 | convertToRGB32<QImage::Format_RGB666>, | - | ||||||||||||||||||
| 889 | convertRGBFromARGB32PM<QImage::Format_RGB666>, | - | ||||||||||||||||||
| 890 | convertRGBFromRGB32<QImage::Format_RGB666>, | - | ||||||||||||||||||
| 891 | convertToRGB64<QImage::Format_RGB666>, | - | ||||||||||||||||||
| 892 | }, | - | ||||||||||||||||||
| 893 | { 6, 12, 6, 6, 6, 0, 6, 18, true, QPixelLayout::BPP24, | - | ||||||||||||||||||
| 894 | convertARGBPMToARGB32PM<QImage::Format_ARGB6666_Premultiplied>, | - | ||||||||||||||||||
| 895 | convertARGBPMFromARGB32PM<QImage::Format_ARGB6666_Premultiplied>, | - | ||||||||||||||||||
| 896 | convertARGBPMFromRGB32<QImage::Format_ARGB6666_Premultiplied>, | - | ||||||||||||||||||
| 897 | convertARGBPMToARGB64PM<QImage::Format_ARGB6666_Premultiplied>, | - | ||||||||||||||||||
| 898 | }, | - | ||||||||||||||||||
| 899 | { 5, 10, 5, 5, 5, 0, 0, 0, false, QPixelLayout::BPP16, | - | ||||||||||||||||||
| 900 | convertToRGB32<QImage::Format_RGB555>, | - | ||||||||||||||||||
| 901 | convertRGBFromARGB32PM<QImage::Format_RGB555>, | - | ||||||||||||||||||
| 902 | convertRGBFromRGB32<QImage::Format_RGB555>, | - | ||||||||||||||||||
| 903 | convertToRGB64<QImage::Format_RGB555>, | - | ||||||||||||||||||
| 904 | }, | - | ||||||||||||||||||
| 905 | { 5, 18, 5, 13, 5, 8, 8, 0, true, QPixelLayout::BPP24, | - | ||||||||||||||||||
| 906 | convertARGBPMToARGB32PM<QImage::Format_ARGB8555_Premultiplied>, | - | ||||||||||||||||||
| 907 | convertARGBPMFromARGB32PM<QImage::Format_ARGB8555_Premultiplied>, | - | ||||||||||||||||||
| 908 | convertARGBPMFromRGB32<QImage::Format_ARGB8555_Premultiplied>, | - | ||||||||||||||||||
| 909 | convertARGBPMToARGB64PM<QImage::Format_ARGB8555_Premultiplied>, | - | ||||||||||||||||||
| 910 | }, | - | ||||||||||||||||||
| 911 | { 8, 16, 8, 8, 8, 0, 0, 0, false, QPixelLayout::BPP24, | - | ||||||||||||||||||
| 912 | convertToRGB32<QImage::Format_RGB888>, | - | ||||||||||||||||||
| 913 | convertRGBFromARGB32PM<QImage::Format_RGB888>, | - | ||||||||||||||||||
| 914 | convertRGBFromRGB32<QImage::Format_RGB888>, | - | ||||||||||||||||||
| 915 | convertToRGB64<QImage::Format_RGB888>, | - | ||||||||||||||||||
| 916 | }, | - | ||||||||||||||||||
| 917 | { 4, 8, 4, 4, 4, 0, 0, 0, false, QPixelLayout::BPP16, | - | ||||||||||||||||||
| 918 | convertToRGB32<QImage::Format_RGB444>, | - | ||||||||||||||||||
| 919 | convertRGBFromARGB32PM<QImage::Format_RGB444>, | - | ||||||||||||||||||
| 920 | convertRGBFromRGB32<QImage::Format_RGB444>, | - | ||||||||||||||||||
| 921 | convertToRGB64<QImage::Format_RGB444>, | - | ||||||||||||||||||
| 922 | }, | - | ||||||||||||||||||
| 923 | { 4, 8, 4, 4, 4, 0, 4, 12, true, QPixelLayout::BPP16, | - | ||||||||||||||||||
| 924 | convertARGBPMToARGB32PM<QImage::Format_ARGB4444_Premultiplied>, | - | ||||||||||||||||||
| 925 | convertARGBPMFromARGB32PM<QImage::Format_ARGB4444_Premultiplied>, | - | ||||||||||||||||||
| 926 | convertARGBPMFromRGB32<QImage::Format_ARGB4444_Premultiplied>, | - | ||||||||||||||||||
| 927 | convertARGBPMToARGB64PM<QImage::Format_ARGB4444_Premultiplied>, | - | ||||||||||||||||||
| 928 | }, | - | ||||||||||||||||||
| 929 | #endif | - | ||||||||||||||||||
| 930 | #if Q_BYTE_ORDER == Q_BIG_ENDIAN | - | ||||||||||||||||||
| 931 | { 8, 24, 8, 16, 8, 8, 0, 0, false, QPixelLayout::BPP32, convertRGBA8888PMToARGB32PM, convertRGBXFromARGB32PM, convertRGBXFromRGB32, convertRGBA8888PMToARGB64PM }, // Format_RGBX8888 | - | ||||||||||||||||||
| 932 | { 8, 24, 8, 16, 8, 8, 8, 0, false, QPixelLayout::BPP32, convertRGBA8888ToARGB32PM, convertRGBA8888FromARGB32PM, convertRGBXFromRGB32, convertRGBA8888ToARGB64PM }, // Format_RGBA8888 | - | ||||||||||||||||||
| 933 | { 8, 24, 8, 16, 8, 8, 8, 0, true, QPixelLayout::BPP32, convertRGBA8888PMToARGB32PM, convertRGBA8888PMFromARGB32PM, convertRGBXFromRGB32, convertRGBA8888PMToARGB64PM}, // Format_RGBA8888_Premultiplied | - | ||||||||||||||||||
| 934 | #else | - | ||||||||||||||||||
| 935 | { 8, 0, 8, 8, 8, 16, 0, 24, false, QPixelLayout::BPP32, convertRGBA8888PMToARGB32PM, convertRGBXFromARGB32PM, convertRGBXFromRGB32, convertRGBA8888PMToARGB64PM }, // Format_RGBX8888 | - | ||||||||||||||||||
| 936 | { 8, 0, 8, 8, 8, 16, 8, 24, false, QPixelLayout::BPP32, convertRGBA8888ToARGB32PM, convertRGBA8888FromARGB32PM, convertRGBXFromRGB32, convertRGBA8888ToARGB64PM }, // Format_RGBA8888 (ABGR32) | - | ||||||||||||||||||
| 937 | { 8, 0, 8, 8, 8, 16, 8, 24, true, QPixelLayout::BPP32, convertRGBA8888PMToARGB32PM, convertRGBA8888PMFromARGB32PM, convertRGBXFromRGB32, convertRGBA8888PMToARGB64PM }, // Format_RGBA8888_Premultiplied | - | ||||||||||||||||||
| 938 | #endif | - | ||||||||||||||||||
| 939 | { 10, 20, 10, 10, 10, 0, 0, 30, false, QPixelLayout::BPP32, convertA2RGB30PMToARGB32PM<PixelOrderBGR>, convertRGB30FromARGB32PM<PixelOrderBGR>, convertRGB30FromRGB32<PixelOrderBGR>, convertA2RGB30PMToARGB64PM<PixelOrderBGR> }, // Format_BGR30 | - | ||||||||||||||||||
| 940 | { 10, 20, 10, 10, 10, 0, 2, 30, true, QPixelLayout::BPP32, convertA2RGB30PMToARGB32PM<PixelOrderBGR>, convertA2RGB30PMFromARGB32PM<PixelOrderBGR>, convertRGB30FromRGB32<PixelOrderBGR>, convertA2RGB30PMToARGB64PM<PixelOrderBGR> }, // Format_A2BGR30_Premultiplied | - | ||||||||||||||||||
| 941 | { 10, 0, 10, 10, 10, 20, 0, 30, false, QPixelLayout::BPP32, convertA2RGB30PMToARGB32PM<PixelOrderRGB>, convertRGB30FromARGB32PM<PixelOrderRGB>, convertRGB30FromRGB32<PixelOrderRGB>, convertA2RGB30PMToARGB64PM<PixelOrderRGB> }, // Format_RGB30 | - | ||||||||||||||||||
| 942 | { 10, 0, 10, 10, 10, 20, 2, 30, true, QPixelLayout::BPP32, convertA2RGB30PMToARGB32PM<PixelOrderRGB>, convertA2RGB30PMFromARGB32PM<PixelOrderRGB>, convertRGB30FromRGB32<PixelOrderRGB>, convertA2RGB30PMToARGB64PM<PixelOrderRGB> }, // Format_A2RGB30_Premultiplied | - | ||||||||||||||||||
| 943 | { 0, 0, 0, 0, 0, 0, 8, 0, false, QPixelLayout::BPP8, convertAlpha8ToRGB32, convertAlpha8FromARGB32PM, 0, convertAlpha8ToRGB64 }, // Format_Alpha8 | - | ||||||||||||||||||
| 944 | { 0, 0, 0, 0, 0, 0, 0, 0, false, QPixelLayout::BPP8, convertGrayscale8ToRGB32, convertGrayscale8FromARGB32PM, convertGrayscale8FromRGB32, convertGrayscale8ToRGB64 } // Format_Grayscale8 | - | ||||||||||||||||||
| 945 | }; | - | ||||||||||||||||||
| 946 | - | |||||||||||||||||||
| 947 | const FetchPixelsFunc qFetchPixels[QPixelLayout::BPPCount] = { | - | ||||||||||||||||||
| 948 | 0, // BPPNone | - | ||||||||||||||||||
| 949 | fetchPixels<QPixelLayout::BPP1MSB>, // BPP1MSB | - | ||||||||||||||||||
| 950 | fetchPixels<QPixelLayout::BPP1LSB>, // BPP1LSB | - | ||||||||||||||||||
| 951 | fetchPixels<QPixelLayout::BPP8>, // BPP8 | - | ||||||||||||||||||
| 952 | fetchPixels<QPixelLayout::BPP16>, // BPP16 | - | ||||||||||||||||||
| 953 | fetchPixels<QPixelLayout::BPP24>, // BPP24 | - | ||||||||||||||||||
| 954 | fetchPixels<QPixelLayout::BPP32> // BPP32 | - | ||||||||||||||||||
| 955 | }; | - | ||||||||||||||||||
| 956 | - | |||||||||||||||||||
| 957 | const StorePixelsFunc qStorePixels[QPixelLayout::BPPCount] = { | - | ||||||||||||||||||
| 958 | 0, // BPPNone | - | ||||||||||||||||||
| 959 | storePixels<QPixelLayout::BPP1MSB>, // BPP1MSB | - | ||||||||||||||||||
| 960 | storePixels<QPixelLayout::BPP1LSB>, // BPP1LSB | - | ||||||||||||||||||
| 961 | storePixels<QPixelLayout::BPP8>, // BPP8 | - | ||||||||||||||||||
| 962 | storePixels<QPixelLayout::BPP16>, // BPP16 | - | ||||||||||||||||||
| 963 | storePixels<QPixelLayout::BPP24>, // BPP24 | - | ||||||||||||||||||
| 964 | storePixels<QPixelLayout::BPP32> // BPP32 | - | ||||||||||||||||||
| 965 | }; | - | ||||||||||||||||||
| 966 | - | |||||||||||||||||||
| 967 | typedef uint (QT_FASTCALL *FetchPixelFunc)(const uchar *src, int index); | - | ||||||||||||||||||
| 968 | - | |||||||||||||||||||
| 969 | static const FetchPixelFunc qFetchPixel[QPixelLayout::BPPCount] = { | - | ||||||||||||||||||
| 970 | 0, // BPPNone | - | ||||||||||||||||||
| 971 | fetchPixel<QPixelLayout::BPP1MSB>, // BPP1MSB | - | ||||||||||||||||||
| 972 | fetchPixel<QPixelLayout::BPP1LSB>, // BPP1LSB | - | ||||||||||||||||||
| 973 | fetchPixel<QPixelLayout::BPP8>, // BPP8 | - | ||||||||||||||||||
| 974 | fetchPixel<QPixelLayout::BPP16>, // BPP16 | - | ||||||||||||||||||
| 975 | fetchPixel<QPixelLayout::BPP24>, // BPP24 | - | ||||||||||||||||||
| 976 | fetchPixel<QPixelLayout::BPP32> // BPP32 | - | ||||||||||||||||||
| 977 | }; | - | ||||||||||||||||||
| 978 | - | |||||||||||||||||||
| 979 | /* | - | ||||||||||||||||||
| 980 | Destination fetch. This is simple as we don't have to do bounds checks or | - | ||||||||||||||||||
| 981 | transformations | - | ||||||||||||||||||
| 982 | */ | - | ||||||||||||||||||
| 983 | - | |||||||||||||||||||
| 984 | static uint * QT_FASTCALL destFetchMono(uint *buffer, QRasterBuffer *rasterBuffer, int x, int y, int length) | - | ||||||||||||||||||
| 985 | { | - | ||||||||||||||||||
| 986 | uchar *Q_DECL_RESTRICT data = (uchar *)rasterBuffer->scanLine(y); | - | ||||||||||||||||||
| 987 | uint *start = buffer; | - | ||||||||||||||||||
| 988 | const uint *end = buffer + length; | - | ||||||||||||||||||
| 989 | while (buffer < end) {
| 0 | ||||||||||||||||||
| 990 | *buffer = data[x>>3] & (0x80 >> (x & 7)) ? rasterBuffer->destColor1 : rasterBuffer->destColor0;
| 0 | ||||||||||||||||||
| 991 | ++buffer; | - | ||||||||||||||||||
| 992 | ++x; | - | ||||||||||||||||||
| 993 | } never executed: end of block | 0 | ||||||||||||||||||
| 994 | return start; never executed: return start; | 0 | ||||||||||||||||||
| 995 | } | - | ||||||||||||||||||
| 996 | - | |||||||||||||||||||
| 997 | static uint * QT_FASTCALL destFetchMonoLsb(uint *buffer, QRasterBuffer *rasterBuffer, int x, int y, int length) | - | ||||||||||||||||||
| 998 | { | - | ||||||||||||||||||
| 999 | uchar *Q_DECL_RESTRICT data = (uchar *)rasterBuffer->scanLine(y); | - | ||||||||||||||||||
| 1000 | uint *start = buffer; | - | ||||||||||||||||||
| 1001 | const uint *end = buffer + length; | - | ||||||||||||||||||
| 1002 | while (buffer < end) {
| 0 | ||||||||||||||||||
| 1003 | *buffer = data[x>>3] & (0x1 << (x & 7)) ? rasterBuffer->destColor1 : rasterBuffer->destColor0;
| 0 | ||||||||||||||||||
| 1004 | ++buffer; | - | ||||||||||||||||||
| 1005 | ++x; | - | ||||||||||||||||||
| 1006 | } never executed: end of block | 0 | ||||||||||||||||||
| 1007 | return start; never executed: return start; | 0 | ||||||||||||||||||
| 1008 | } | - | ||||||||||||||||||
| 1009 | - | |||||||||||||||||||
| 1010 | static uint * QT_FASTCALL destFetchARGB32P(uint *, QRasterBuffer *rasterBuffer, int x, int y, int) | - | ||||||||||||||||||
| 1011 | { | - | ||||||||||||||||||
| 1012 | return (uint *)rasterBuffer->scanLine(y) + x; never executed: return (uint *)rasterBuffer->scanLine(y) + x; | 0 | ||||||||||||||||||
| 1013 | } | - | ||||||||||||||||||
| 1014 | - | |||||||||||||||||||
| 1015 | static uint * QT_FASTCALL destFetchRGB16(uint *buffer, QRasterBuffer *rasterBuffer, int x, int y, int length) | - | ||||||||||||||||||
| 1016 | { | - | ||||||||||||||||||
| 1017 | const ushort *Q_DECL_RESTRICT data = (const ushort *)rasterBuffer->scanLine(y) + x; | - | ||||||||||||||||||
| 1018 | for (int i = 0; i < length; ++i)
| 0 | ||||||||||||||||||
| 1019 | buffer[i] = qConvertRgb16To32(data[i]); never executed: buffer[i] = qConvertRgb16To32(data[i]); | 0 | ||||||||||||||||||
| 1020 | return buffer; never executed: return buffer; | 0 | ||||||||||||||||||
| 1021 | } | - | ||||||||||||||||||
| 1022 | - | |||||||||||||||||||
| 1023 | static uint *QT_FASTCALL destFetch(uint *buffer, QRasterBuffer *rasterBuffer, int x, int y, int length) | - | ||||||||||||||||||
| 1024 | { | - | ||||||||||||||||||
| 1025 | const QPixelLayout *layout = &qPixelLayouts[rasterBuffer->format]; | - | ||||||||||||||||||
| 1026 | const uint *ptr = qFetchPixels[layout->bpp](buffer, rasterBuffer->scanLine(y), x, length); | - | ||||||||||||||||||
| 1027 | return const_cast<uint *>(layout->convertToARGB32PM(buffer, ptr, length, layout, 0)); never executed: return const_cast<uint *>(layout->convertToARGB32PM(buffer, ptr, length, layout, 0)); | 0 | ||||||||||||||||||
| 1028 | } | - | ||||||||||||||||||
| 1029 | - | |||||||||||||||||||
| 1030 | static QRgba64 *QT_FASTCALL destFetch64(QRgba64 *buffer, QRasterBuffer *rasterBuffer, int x, int y, int length) | - | ||||||||||||||||||
| 1031 | { | - | ||||||||||||||||||
| 1032 | const QPixelLayout *layout = &qPixelLayouts[rasterBuffer->format]; | - | ||||||||||||||||||
| 1033 | uint buffer32[buffer_size]; | - | ||||||||||||||||||
| 1034 | const uint *ptr = qFetchPixels[layout->bpp](buffer32, rasterBuffer->scanLine(y), x, length); | - | ||||||||||||||||||
| 1035 | return const_cast<QRgba64 *>(layout->convertToARGB64PM(buffer, ptr, length, layout, 0)); never executed: return const_cast<QRgba64 *>(layout->convertToARGB64PM(buffer, ptr, length, layout, 0)); | 0 | ||||||||||||||||||
| 1036 | } | - | ||||||||||||||||||
| 1037 | - | |||||||||||||||||||
| 1038 | static QRgba64 *QT_FASTCALL destFetch64uint32(QRgba64 *buffer, QRasterBuffer *rasterBuffer, int x, int y, int length) | - | ||||||||||||||||||
| 1039 | { | - | ||||||||||||||||||
| 1040 | const QPixelLayout *layout = &qPixelLayouts[rasterBuffer->format]; | - | ||||||||||||||||||
| 1041 | const uint *src = ((const uint *)rasterBuffer->scanLine(y)) + x; | - | ||||||||||||||||||
| 1042 | return const_cast<QRgba64 *>(layout->convertToARGB64PM(buffer, src, length, layout, 0)); never executed: return const_cast<QRgba64 *>(layout->convertToARGB64PM(buffer, src, length, layout, 0)); | 0 | ||||||||||||||||||
| 1043 | } | - | ||||||||||||||||||
| 1044 | - | |||||||||||||||||||
| 1045 | static DestFetchProc destFetchProc[QImage::NImageFormats] = | - | ||||||||||||||||||
| 1046 | { | - | ||||||||||||||||||
| 1047 | 0, // Format_Invalid | - | ||||||||||||||||||
| 1048 | destFetchMono, // Format_Mono, | - | ||||||||||||||||||
| 1049 | destFetchMonoLsb, // Format_MonoLSB | - | ||||||||||||||||||
| 1050 | 0, // Format_Indexed8 | - | ||||||||||||||||||
| 1051 | destFetchARGB32P, // Format_RGB32 | - | ||||||||||||||||||
| 1052 | destFetch, // Format_ARGB32, | - | ||||||||||||||||||
| 1053 | destFetchARGB32P, // Format_ARGB32_Premultiplied | - | ||||||||||||||||||
| 1054 | destFetchRGB16, // Format_RGB16 | - | ||||||||||||||||||
| 1055 | destFetch, // Format_ARGB8565_Premultiplied | - | ||||||||||||||||||
| 1056 | destFetch, // Format_RGB666 | - | ||||||||||||||||||
| 1057 | destFetch, // Format_ARGB6666_Premultiplied | - | ||||||||||||||||||
| 1058 | destFetch, // Format_RGB555 | - | ||||||||||||||||||
| 1059 | destFetch, // Format_ARGB8555_Premultiplied | - | ||||||||||||||||||
| 1060 | destFetch, // Format_RGB888 | - | ||||||||||||||||||
| 1061 | destFetch, // Format_RGB444 | - | ||||||||||||||||||
| 1062 | destFetch, // Format_ARGB4444_Premultiplied | - | ||||||||||||||||||
| 1063 | destFetch, // Format_RGBX8888 | - | ||||||||||||||||||
| 1064 | destFetch, // Format_RGBA8888 | - | ||||||||||||||||||
| 1065 | destFetch, // Format_RGBA8888_Premultiplied | - | ||||||||||||||||||
| 1066 | destFetch, // Format_BGR30 | - | ||||||||||||||||||
| 1067 | destFetch, // Format_A2BGR30_Premultiplied | - | ||||||||||||||||||
| 1068 | destFetch, // Format_RGB30 | - | ||||||||||||||||||
| 1069 | destFetch, // Format_A2RGB30_Premultiplied | - | ||||||||||||||||||
| 1070 | destFetch, // Format_Alpha8 | - | ||||||||||||||||||
| 1071 | destFetch, // Format_Grayscale8 | - | ||||||||||||||||||
| 1072 | }; | - | ||||||||||||||||||
| 1073 | - | |||||||||||||||||||
| 1074 | static DestFetchProc64 destFetchProc64[QImage::NImageFormats] = | - | ||||||||||||||||||
| 1075 | { | - | ||||||||||||||||||
| 1076 | 0, // Format_Invalid | - | ||||||||||||||||||
| 1077 | destFetch64, // Format_Mono, | - | ||||||||||||||||||
| 1078 | destFetch64, // Format_MonoLSB | - | ||||||||||||||||||
| 1079 | 0, // Format_Indexed8 | - | ||||||||||||||||||
| 1080 | destFetch64uint32, // Format_RGB32 | - | ||||||||||||||||||
| 1081 | destFetch64uint32, // Format_ARGB32, | - | ||||||||||||||||||
| 1082 | destFetch64uint32, // Format_ARGB32_Premultiplied | - | ||||||||||||||||||
| 1083 | destFetch64, // Format_RGB16 | - | ||||||||||||||||||
| 1084 | destFetch64, // Format_ARGB8565_Premultiplied | - | ||||||||||||||||||
| 1085 | destFetch64, // Format_RGB666 | - | ||||||||||||||||||
| 1086 | destFetch64, // Format_ARGB6666_Premultiplied | - | ||||||||||||||||||
| 1087 | destFetch64, // Format_RGB555 | - | ||||||||||||||||||
| 1088 | destFetch64, // Format_ARGB8555_Premultiplied | - | ||||||||||||||||||
| 1089 | destFetch64, // Format_RGB888 | - | ||||||||||||||||||
| 1090 | destFetch64, // Format_RGB444 | - | ||||||||||||||||||
| 1091 | destFetch64, // Format_ARGB4444_Premultiplied | - | ||||||||||||||||||
| 1092 | destFetch64uint32, // Format_RGBX8888 | - | ||||||||||||||||||
| 1093 | destFetch64uint32, // Format_RGBA8888 | - | ||||||||||||||||||
| 1094 | destFetch64uint32, // Format_RGBA8888_Premultiplied | - | ||||||||||||||||||
| 1095 | destFetch64uint32, // Format_BGR30 | - | ||||||||||||||||||
| 1096 | destFetch64uint32, // Format_A2BGR30_Premultiplied | - | ||||||||||||||||||
| 1097 | destFetch64uint32, // Format_RGB30 | - | ||||||||||||||||||
| 1098 | destFetch64uint32, // Format_A2RGB30_Premultiplied | - | ||||||||||||||||||
| 1099 | destFetch64, // Format_Alpha8 | - | ||||||||||||||||||
| 1100 | destFetch64, // Format_Grayscale8 | - | ||||||||||||||||||
| 1101 | }; | - | ||||||||||||||||||
| 1102 | - | |||||||||||||||||||
| 1103 | /* | - | ||||||||||||||||||
| 1104 | Returns the color in the mono destination color table | - | ||||||||||||||||||
| 1105 | that is the "nearest" to /color/. | - | ||||||||||||||||||
| 1106 | */ | - | ||||||||||||||||||
| 1107 | static inline QRgb findNearestColor(QRgb color, QRasterBuffer *rbuf) | - | ||||||||||||||||||
| 1108 | { | - | ||||||||||||||||||
| 1109 | QRgb color_0 = qPremultiply(rbuf->destColor0); | - | ||||||||||||||||||
| 1110 | QRgb color_1 = qPremultiply(rbuf->destColor1); | - | ||||||||||||||||||
| 1111 | color = qPremultiply(color); | - | ||||||||||||||||||
| 1112 | - | |||||||||||||||||||
| 1113 | int r = qRed(color); | - | ||||||||||||||||||
| 1114 | int g = qGreen(color); | - | ||||||||||||||||||
| 1115 | int b = qBlue(color); | - | ||||||||||||||||||
| 1116 | int rx, gx, bx; | - | ||||||||||||||||||
| 1117 | int dist_0, dist_1; | - | ||||||||||||||||||
| 1118 | - | |||||||||||||||||||
| 1119 | rx = r - qRed(color_0); | - | ||||||||||||||||||
| 1120 | gx = g - qGreen(color_0); | - | ||||||||||||||||||
| 1121 | bx = b - qBlue(color_0); | - | ||||||||||||||||||
| 1122 | dist_0 = rx*rx + gx*gx + bx*bx; | - | ||||||||||||||||||
| 1123 | - | |||||||||||||||||||
| 1124 | rx = r - qRed(color_1); | - | ||||||||||||||||||
| 1125 | gx = g - qGreen(color_1); | - | ||||||||||||||||||
| 1126 | bx = b - qBlue(color_1); | - | ||||||||||||||||||
| 1127 | dist_1 = rx*rx + gx*gx + bx*bx; | - | ||||||||||||||||||
| 1128 | - | |||||||||||||||||||
| 1129 | if (dist_0 < dist_1)
| 0 | ||||||||||||||||||
| 1130 | return color_0; never executed: return color_0; | 0 | ||||||||||||||||||
| 1131 | return color_1; never executed: return color_1; | 0 | ||||||||||||||||||
| 1132 | } | - | ||||||||||||||||||
| 1133 | - | |||||||||||||||||||
| 1134 | /* | - | ||||||||||||||||||
| 1135 | Destination store. | - | ||||||||||||||||||
| 1136 | */ | - | ||||||||||||||||||
| 1137 | - | |||||||||||||||||||
| 1138 | static void QT_FASTCALL destStoreMono(QRasterBuffer *rasterBuffer, int x, int y, const uint *buffer, int length) | - | ||||||||||||||||||
| 1139 | { | - | ||||||||||||||||||
| 1140 | uchar *Q_DECL_RESTRICT data = (uchar *)rasterBuffer->scanLine(y); | - | ||||||||||||||||||
| 1141 | if (rasterBuffer->monoDestinationWithClut) {
| 0 | ||||||||||||||||||
| 1142 | for (int i = 0; i < length; ++i) {
| 0 | ||||||||||||||||||
| 1143 | if (buffer[i] == rasterBuffer->destColor0) {
| 0 | ||||||||||||||||||
| 1144 | data[x >> 3] &= ~(0x80 >> (x & 7)); | - | ||||||||||||||||||
| 1145 | } else if (buffer[i] == rasterBuffer->destColor1) { never executed: end of block
| 0 | ||||||||||||||||||
| 1146 | data[x >> 3] |= 0x80 >> (x & 7); | - | ||||||||||||||||||
| 1147 | } else if (findNearestColor(buffer[i], rasterBuffer) == rasterBuffer->destColor0) { never executed: end of block
| 0 | ||||||||||||||||||
| 1148 | data[x >> 3] &= ~(0x80 >> (x & 7)); | - | ||||||||||||||||||
| 1149 | } else { never executed: end of block | 0 | ||||||||||||||||||
| 1150 | data[x >> 3] |= 0x80 >> (x & 7); | - | ||||||||||||||||||
| 1151 | } never executed: end of block | 0 | ||||||||||||||||||
| 1152 | ++x; | - | ||||||||||||||||||
| 1153 | } never executed: end of block | 0 | ||||||||||||||||||
| 1154 | } else { never executed: end of block | 0 | ||||||||||||||||||
| 1155 | for (int i = 0; i < length; ++i) {
| 0 | ||||||||||||||||||
| 1156 | if (qGray(buffer[i]) < int(qt_bayer_matrix[y & 15][x & 15]))
| 0 | ||||||||||||||||||
| 1157 | data[x >> 3] |= 0x80 >> (x & 7); never executed: data[x >> 3] |= 0x80 >> (x & 7); | 0 | ||||||||||||||||||
| 1158 | else | - | ||||||||||||||||||
| 1159 | data[x >> 3] &= ~(0x80 >> (x & 7)); never executed: data[x >> 3] &= ~(0x80 >> (x & 7)); | 0 | ||||||||||||||||||
| 1160 | ++x; | - | ||||||||||||||||||
| 1161 | } never executed: end of block | 0 | ||||||||||||||||||
| 1162 | } never executed: end of block | 0 | ||||||||||||||||||
| 1163 | } | - | ||||||||||||||||||
| 1164 | - | |||||||||||||||||||
| 1165 | static void QT_FASTCALL destStoreMonoLsb(QRasterBuffer *rasterBuffer, int x, int y, const uint *buffer, int length) | - | ||||||||||||||||||
| 1166 | { | - | ||||||||||||||||||
| 1167 | uchar *Q_DECL_RESTRICT data = (uchar *)rasterBuffer->scanLine(y); | - | ||||||||||||||||||
| 1168 | if (rasterBuffer->monoDestinationWithClut) {
| 0 | ||||||||||||||||||
| 1169 | for (int i = 0; i < length; ++i) {
| 0 | ||||||||||||||||||
| 1170 | if (buffer[i] == rasterBuffer->destColor0) {
| 0 | ||||||||||||||||||
| 1171 | data[x >> 3] &= ~(1 << (x & 7)); | - | ||||||||||||||||||
| 1172 | } else if (buffer[i] == rasterBuffer->destColor1) { never executed: end of block
| 0 | ||||||||||||||||||
| 1173 | data[x >> 3] |= 1 << (x & 7); | - | ||||||||||||||||||
| 1174 | } else if (findNearestColor(buffer[i], rasterBuffer) == rasterBuffer->destColor0) { never executed: end of block
| 0 | ||||||||||||||||||
| 1175 | data[x >> 3] &= ~(1 << (x & 7)); | - | ||||||||||||||||||
| 1176 | } else { never executed: end of block | 0 | ||||||||||||||||||
| 1177 | data[x >> 3] |= 1 << (x & 7); | - | ||||||||||||||||||
| 1178 | } never executed: end of block | 0 | ||||||||||||||||||
| 1179 | ++x; | - | ||||||||||||||||||
| 1180 | } never executed: end of block | 0 | ||||||||||||||||||
| 1181 | } else { never executed: end of block | 0 | ||||||||||||||||||
| 1182 | for (int i = 0; i < length; ++i) {
| 0 | ||||||||||||||||||
| 1183 | if (qGray(buffer[i]) < int(qt_bayer_matrix[y & 15][x & 15]))
| 0 | ||||||||||||||||||
| 1184 | data[x >> 3] |= 1 << (x & 7); never executed: data[x >> 3] |= 1 << (x & 7); | 0 | ||||||||||||||||||
| 1185 | else | - | ||||||||||||||||||
| 1186 | data[x >> 3] &= ~(1 << (x & 7)); never executed: data[x >> 3] &= ~(1 << (x & 7)); | 0 | ||||||||||||||||||
| 1187 | ++x; | - | ||||||||||||||||||
| 1188 | } never executed: end of block | 0 | ||||||||||||||||||
| 1189 | } never executed: end of block | 0 | ||||||||||||||||||
| 1190 | } | - | ||||||||||||||||||
| 1191 | - | |||||||||||||||||||
| 1192 | static void QT_FASTCALL destStoreRGB16(QRasterBuffer *rasterBuffer, int x, int y, const uint *buffer, int length) | - | ||||||||||||||||||
| 1193 | { | - | ||||||||||||||||||
| 1194 | quint16 *data = (quint16*)rasterBuffer->scanLine(y) + x; | - | ||||||||||||||||||
| 1195 | for (int i = 0; i < length; ++i)
| 0 | ||||||||||||||||||
| 1196 | data[i] = qConvertRgb32To16(buffer[i]); never executed: data[i] = qConvertRgb32To16(buffer[i]); | 0 | ||||||||||||||||||
| 1197 | } never executed: end of block | 0 | ||||||||||||||||||
| 1198 | - | |||||||||||||||||||
| 1199 | static void QT_FASTCALL destStore(QRasterBuffer *rasterBuffer, int x, int y, const uint *buffer, int length) | - | ||||||||||||||||||
| 1200 | { | - | ||||||||||||||||||
| 1201 | uint buf[buffer_size]; | - | ||||||||||||||||||
| 1202 | const QPixelLayout *layout = &qPixelLayouts[rasterBuffer->format]; | - | ||||||||||||||||||
| 1203 | StorePixelsFunc store = qStorePixels[layout->bpp]; | - | ||||||||||||||||||
| 1204 | uchar *dest = rasterBuffer->scanLine(y); | - | ||||||||||||||||||
| 1205 | while (length) {
| 0 | ||||||||||||||||||
| 1206 | int l = qMin(length, buffer_size); | - | ||||||||||||||||||
| 1207 | const uint *ptr = 0; | - | ||||||||||||||||||
| 1208 | if (!layout->premultiplied && !layout->alphaWidth)
| 0 | ||||||||||||||||||
| 1209 | ptr = layout->convertFromRGB32(buf, buffer, l, layout, 0); never executed: ptr = layout->convertFromRGB32(buf, buffer, l, layout, 0); | 0 | ||||||||||||||||||
| 1210 | else | - | ||||||||||||||||||
| 1211 | ptr = layout->convertFromARGB32PM(buf, buffer, l, layout, 0); never executed: ptr = layout->convertFromARGB32PM(buf, buffer, l, layout, 0); | 0 | ||||||||||||||||||
| 1212 | store(dest, ptr, x, l); | - | ||||||||||||||||||
| 1213 | length -= l; | - | ||||||||||||||||||
| 1214 | buffer += l; | - | ||||||||||||||||||
| 1215 | x += l; | - | ||||||||||||||||||
| 1216 | } never executed: end of block | 0 | ||||||||||||||||||
| 1217 | } never executed: end of block | 0 | ||||||||||||||||||
| 1218 | - | |||||||||||||||||||
| 1219 | static void QT_FASTCALL convertFromRgb64(uint *dest, const QRgba64 *src, int length) | - | ||||||||||||||||||
| 1220 | { | - | ||||||||||||||||||
| 1221 | for (int i = 0; i < length; ++i) {
| 0 | ||||||||||||||||||
| 1222 | dest[i] = src[i].toArgb32(); | - | ||||||||||||||||||
| 1223 | } never executed: end of block | 0 | ||||||||||||||||||
| 1224 | } never executed: end of block | 0 | ||||||||||||||||||
| 1225 | - | |||||||||||||||||||
| 1226 | static void QT_FASTCALL destStore64(QRasterBuffer *rasterBuffer, int x, int y, const QRgba64 *buffer, int length) | - | ||||||||||||||||||
| 1227 | { | - | ||||||||||||||||||
| 1228 | uint buf[buffer_size]; | - | ||||||||||||||||||
| 1229 | const QPixelLayout *layout = &qPixelLayouts[rasterBuffer->format]; | - | ||||||||||||||||||
| 1230 | StorePixelsFunc store = qStorePixels[layout->bpp]; | - | ||||||||||||||||||
| 1231 | uchar *dest = rasterBuffer->scanLine(y); | - | ||||||||||||||||||
| 1232 | while (length) {
| 0 | ||||||||||||||||||
| 1233 | int l = qMin(length, buffer_size); | - | ||||||||||||||||||
| 1234 | const uint *ptr = 0; | - | ||||||||||||||||||
| 1235 | convertFromRgb64(buf, buffer, l); | - | ||||||||||||||||||
| 1236 | if (!layout->premultiplied && !layout->alphaWidth)
| 0 | ||||||||||||||||||
| 1237 | ptr = layout->convertFromRGB32(buf, buf, l, layout, 0); never executed: ptr = layout->convertFromRGB32(buf, buf, l, layout, 0); | 0 | ||||||||||||||||||
| 1238 | else | - | ||||||||||||||||||
| 1239 | ptr = layout->convertFromARGB32PM(buf, buf, l, layout, 0); never executed: ptr = layout->convertFromARGB32PM(buf, buf, l, layout, 0); | 0 | ||||||||||||||||||
| 1240 | store(dest, ptr, x, l); | - | ||||||||||||||||||
| 1241 | length -= l; | - | ||||||||||||||||||
| 1242 | buffer += l; | - | ||||||||||||||||||
| 1243 | x += l; | - | ||||||||||||||||||
| 1244 | } never executed: end of block | 0 | ||||||||||||||||||
| 1245 | } never executed: end of block | 0 | ||||||||||||||||||
| 1246 | - | |||||||||||||||||||
| 1247 | #ifdef __SSE2__ | - | ||||||||||||||||||
| 1248 | template<QtPixelOrder PixelOrder> | - | ||||||||||||||||||
| 1249 | static inline void qConvertARGB64PMToA2RGB30PM_sse2(uint *dest, const QRgba64 *buffer, int count) | - | ||||||||||||||||||
| 1250 | { | - | ||||||||||||||||||
| 1251 | const __m128i gmask = _mm_set1_epi32(0x000ffc00); | - | ||||||||||||||||||
| 1252 | const __m128i cmask = _mm_set1_epi32(0x000003ff); | - | ||||||||||||||||||
| 1253 | int i = 0; | - | ||||||||||||||||||
| 1254 | __m128i vr, vg, vb, va; | - | ||||||||||||||||||
| 1255 | for (; i < count && (const uintptr_t)buffer & 0xF; ++i) {
| 0 | ||||||||||||||||||
| 1256 | *dest++ = qConvertRgb64ToRgb30<PixelOrder>(*buffer++); | - | ||||||||||||||||||
| 1257 | } never executed: end of block | 0 | ||||||||||||||||||
| 1258 | - | |||||||||||||||||||
| 1259 | for (; i < count-15; i += 16) {
| 0 | ||||||||||||||||||
| 1260 | // Repremultiplying is really expensive and hard to do in SIMD without AVX2, | - | ||||||||||||||||||
| 1261 | // so we try to avoid it by checking if it is needed 16 samples at a time. | - | ||||||||||||||||||
| 1262 | __m128i vOr = _mm_set1_epi32(0); | - | ||||||||||||||||||
| 1263 | __m128i vAnd = _mm_set1_epi32(0xffffffff); | - | ||||||||||||||||||
| 1264 | for (int j = 0; j < 16; j += 2) {
| 0 | ||||||||||||||||||
| 1265 | __m128i vs = _mm_load_si128((const __m128i*)(buffer + j)); | - | ||||||||||||||||||
| 1266 | vOr = _mm_or_si128(vOr, vs); | - | ||||||||||||||||||
| 1267 | vAnd = _mm_and_si128(vAnd, vs); | - | ||||||||||||||||||
| 1268 | } never executed: end of block | 0 | ||||||||||||||||||
| 1269 | const quint16 orAlpha = ((uint)_mm_extract_epi16(vOr, 3)) | ((uint)_mm_extract_epi16(vOr, 7)); | - | ||||||||||||||||||
| 1270 | const quint16 andAlpha = ((uint)_mm_extract_epi16(vAnd, 3)) & ((uint)_mm_extract_epi16(vAnd, 7)); | - | ||||||||||||||||||
| 1271 | - | |||||||||||||||||||
| 1272 | if (andAlpha == 0xffff) {
| 0 | ||||||||||||||||||
| 1273 | for (int j = 0; j < 16; j += 2) {
| 0 | ||||||||||||||||||
| 1274 | __m128i vs = _mm_load_si128((const __m128i*)buffer); | - | ||||||||||||||||||
| 1275 | buffer += 2; | - | ||||||||||||||||||
| 1276 | vr = _mm_srli_epi64(vs, 6); | - | ||||||||||||||||||
| 1277 | vg = _mm_srli_epi64(vs, 16 + 6 - 10); | - | ||||||||||||||||||
| 1278 | vb = _mm_srli_epi64(vs, 32 + 6); | - | ||||||||||||||||||
| 1279 | vr = _mm_and_si128(vr, cmask); | - | ||||||||||||||||||
| 1280 | vg = _mm_and_si128(vg, gmask); | - | ||||||||||||||||||
| 1281 | vb = _mm_and_si128(vb, cmask); | - | ||||||||||||||||||
| 1282 | va = _mm_srli_epi64(vs, 48 + 14); | - | ||||||||||||||||||
| 1283 | if (PixelOrder == PixelOrderRGB)
| 0 | ||||||||||||||||||
| 1284 | vr = _mm_slli_epi32(vr, 20); never executed: vr = _mm_slli_epi32(vr, 20); | 0 | ||||||||||||||||||
| 1285 | else | - | ||||||||||||||||||
| 1286 | vb = _mm_slli_epi32(vb, 20); never executed: vb = _mm_slli_epi32(vb, 20); | 0 | ||||||||||||||||||
| 1287 | va = _mm_slli_epi32(va, 30); | - | ||||||||||||||||||
| 1288 | __m128i vd = _mm_or_si128(_mm_or_si128(vr, vg), _mm_or_si128(vb, va)); | - | ||||||||||||||||||
| 1289 | vd = _mm_shuffle_epi32(vd, _MM_SHUFFLE(3, 1, 2, 0)); | - | ||||||||||||||||||
| 1290 | _mm_storel_epi64((__m128i*)dest, vd); | - | ||||||||||||||||||
| 1291 | dest += 2; | - | ||||||||||||||||||
| 1292 | } never executed: end of block | 0 | ||||||||||||||||||
| 1293 | } else if (orAlpha == 0) { never executed: end of block
| 0 | ||||||||||||||||||
| 1294 | for (int j = 0; j < 16; ++j) {
| 0 | ||||||||||||||||||
| 1295 | *dest++ = 0; | - | ||||||||||||||||||
| 1296 | buffer++; | - | ||||||||||||||||||
| 1297 | } never executed: end of block | 0 | ||||||||||||||||||
| 1298 | } else { never executed: end of block | 0 | ||||||||||||||||||
| 1299 | for (int j = 0; j < 16; ++j)
| 0 | ||||||||||||||||||
| 1300 | *dest++ = qConvertRgb64ToRgb30<PixelOrder>(*buffer++); never executed: *dest++ = qConvertRgb64ToRgb30<PixelOrder>(*buffer++); | 0 | ||||||||||||||||||
| 1301 | } never executed: end of block | 0 | ||||||||||||||||||
| 1302 | } | - | ||||||||||||||||||
| 1303 | - | |||||||||||||||||||
| 1304 | for (; i < count; ++i)
| 0 | ||||||||||||||||||
| 1305 | *dest++ = qConvertRgb64ToRgb30<PixelOrder>(*buffer++); never executed: *dest++ = qConvertRgb64ToRgb30<PixelOrder>(*buffer++); | 0 | ||||||||||||||||||
| 1306 | } never executed: end of block | 0 | ||||||||||||||||||
| 1307 | #endif | - | ||||||||||||||||||
| 1308 | - | |||||||||||||||||||
| 1309 | static void QT_FASTCALL destStore64ARGB32(QRasterBuffer *rasterBuffer, int x, int y, const QRgba64 *buffer, int length) | - | ||||||||||||||||||
| 1310 | { | - | ||||||||||||||||||
| 1311 | uint *dest = (uint*)rasterBuffer->scanLine(y) + x; | - | ||||||||||||||||||
| 1312 | for (int i = 0; i < length; ++i) {
| 0 | ||||||||||||||||||
| 1313 | dest[i] = buffer[i].unpremultiplied().toArgb32(); | - | ||||||||||||||||||
| 1314 | } never executed: end of block | 0 | ||||||||||||||||||
| 1315 | } never executed: end of block | 0 | ||||||||||||||||||
| 1316 | - | |||||||||||||||||||
| 1317 | static void QT_FASTCALL destStore64RGBA8888(QRasterBuffer *rasterBuffer, int x, int y, const QRgba64 *buffer, int length) | - | ||||||||||||||||||
| 1318 | { | - | ||||||||||||||||||
| 1319 | uint *dest = (uint*)rasterBuffer->scanLine(y) + x; | - | ||||||||||||||||||
| 1320 | for (int i = 0; i < length; ++i) {
| 0 | ||||||||||||||||||
| 1321 | dest[i] = ARGB2RGBA(buffer[i].unpremultiplied().toArgb32()); | - | ||||||||||||||||||
| 1322 | } never executed: end of block | 0 | ||||||||||||||||||
| 1323 | } never executed: end of block | 0 | ||||||||||||||||||
| 1324 | - | |||||||||||||||||||
| 1325 | template<QtPixelOrder PixelOrder> | - | ||||||||||||||||||
| 1326 | static void QT_FASTCALL destStore64RGB30(QRasterBuffer *rasterBuffer, int x, int y, const QRgba64 *buffer, int length) | - | ||||||||||||||||||
| 1327 | { | - | ||||||||||||||||||
| 1328 | uint *dest = (uint*)rasterBuffer->scanLine(y) + x; | - | ||||||||||||||||||
| 1329 | #ifdef __SSE2__ | - | ||||||||||||||||||
| 1330 | qConvertARGB64PMToA2RGB30PM_sse2<PixelOrder>(dest, buffer, length); | - | ||||||||||||||||||
| 1331 | #else | - | ||||||||||||||||||
| 1332 | for (int i = 0; i < length; ++i) { | - | ||||||||||||||||||
| 1333 | dest[i] = qConvertRgb64ToRgb30<PixelOrder>(buffer[i]); | - | ||||||||||||||||||
| 1334 | } | - | ||||||||||||||||||
| 1335 | #endif | - | ||||||||||||||||||
| 1336 | } never executed: end of block | 0 | ||||||||||||||||||
| 1337 | - | |||||||||||||||||||
| 1338 | static DestStoreProc destStoreProc[QImage::NImageFormats] = | - | ||||||||||||||||||
| 1339 | { | - | ||||||||||||||||||
| 1340 | 0, // Format_Invalid | - | ||||||||||||||||||
| 1341 | destStoreMono, // Format_Mono, | - | ||||||||||||||||||
| 1342 | destStoreMonoLsb, // Format_MonoLSB | - | ||||||||||||||||||
| 1343 | 0, // Format_Indexed8 | - | ||||||||||||||||||
| 1344 | 0, // Format_RGB32 | - | ||||||||||||||||||
| 1345 | destStore, // Format_ARGB32, | - | ||||||||||||||||||
| 1346 | 0, // Format_ARGB32_Premultiplied | - | ||||||||||||||||||
| 1347 | destStoreRGB16, // Format_RGB16 | - | ||||||||||||||||||
| 1348 | destStore, // Format_ARGB8565_Premultiplied | - | ||||||||||||||||||
| 1349 | destStore, // Format_RGB666 | - | ||||||||||||||||||
| 1350 | destStore, // Format_ARGB6666_Premultiplied | - | ||||||||||||||||||
| 1351 | destStore, // Format_RGB555 | - | ||||||||||||||||||
| 1352 | destStore, // Format_ARGB8555_Premultiplied | - | ||||||||||||||||||
| 1353 | destStore, // Format_RGB888 | - | ||||||||||||||||||
| 1354 | destStore, // Format_RGB444 | - | ||||||||||||||||||
| 1355 | destStore, // Format_ARGB4444_Premultiplied | - | ||||||||||||||||||
| 1356 | destStore, // Format_RGBX8888 | - | ||||||||||||||||||
| 1357 | destStore, // Format_RGBA8888 | - | ||||||||||||||||||
| 1358 | destStore, // Format_RGBA8888_Premultiplied | - | ||||||||||||||||||
| 1359 | destStore, // Format_BGR30 | - | ||||||||||||||||||
| 1360 | destStore, // Format_A2BGR30_Premultiplied | - | ||||||||||||||||||
| 1361 | destStore, // Format_RGB30 | - | ||||||||||||||||||
| 1362 | destStore, // Format_A2RGB30_Premultiplied | - | ||||||||||||||||||
| 1363 | destStore, // Format_Alpha8 | - | ||||||||||||||||||
| 1364 | destStore, // Format_Grayscale8 | - | ||||||||||||||||||
| 1365 | }; | - | ||||||||||||||||||
| 1366 | - | |||||||||||||||||||
| 1367 | static DestStoreProc64 destStoreProc64[QImage::NImageFormats] = | - | ||||||||||||||||||
| 1368 | { | - | ||||||||||||||||||
| 1369 | 0, // Format_Invalid | - | ||||||||||||||||||
| 1370 | destStore64, // Format_Mono, | - | ||||||||||||||||||
| 1371 | destStore64, // Format_MonoLSB | - | ||||||||||||||||||
| 1372 | 0, // Format_Indexed8 | - | ||||||||||||||||||
| 1373 | destStore64, // Format_RGB32 | - | ||||||||||||||||||
| 1374 | destStore64ARGB32, // Format_ARGB32, | - | ||||||||||||||||||
| 1375 | destStore64, // Format_ARGB32_Premultiplied | - | ||||||||||||||||||
| 1376 | destStore64, // Format_RGB16 | - | ||||||||||||||||||
| 1377 | destStore64, // Format_ARGB8565_Premultiplied | - | ||||||||||||||||||
| 1378 | destStore64, // Format_RGB666 | - | ||||||||||||||||||
| 1379 | destStore64, // Format_ARGB6666_Premultiplied | - | ||||||||||||||||||
| 1380 | destStore64, // Format_RGB555 | - | ||||||||||||||||||
| 1381 | destStore64, // Format_ARGB8555_Premultiplied | - | ||||||||||||||||||
| 1382 | destStore64, // Format_RGB888 | - | ||||||||||||||||||
| 1383 | destStore64, // Format_RGB444 | - | ||||||||||||||||||
| 1384 | destStore64, // Format_ARGB4444_Premultiplied | - | ||||||||||||||||||
| 1385 | destStore64, // Format_RGBX8888 | - | ||||||||||||||||||
| 1386 | destStore64RGBA8888, // Format_RGBA8888 | - | ||||||||||||||||||
| 1387 | destStore64, // Format_RGBA8888_Premultiplied | - | ||||||||||||||||||
| 1388 | destStore64RGB30<PixelOrderBGR>, // Format_BGR30 | - | ||||||||||||||||||
| 1389 | destStore64RGB30<PixelOrderBGR>, // Format_A2BGR30_Premultiplied | - | ||||||||||||||||||
| 1390 | destStore64RGB30<PixelOrderRGB>, // Format_RGB30 | - | ||||||||||||||||||
| 1391 | destStore64RGB30<PixelOrderRGB>, // Format_A2RGB30_Premultiplied | - | ||||||||||||||||||
| 1392 | destStore64, // Format_Alpha8 | - | ||||||||||||||||||
| 1393 | destStore64, // Format_Grayscale8 | - | ||||||||||||||||||
| 1394 | }; | - | ||||||||||||||||||
| 1395 | - | |||||||||||||||||||
| 1396 | /* | - | ||||||||||||||||||
| 1397 | Source fetches | - | ||||||||||||||||||
| 1398 | - | |||||||||||||||||||
| 1399 | This is a bit more complicated, as we need several fetch routines for every surface type | - | ||||||||||||||||||
| 1400 | - | |||||||||||||||||||
| 1401 | We need 5 fetch methods per surface type: | - | ||||||||||||||||||
| 1402 | untransformed | - | ||||||||||||||||||
| 1403 | transformed (tiled and not tiled) | - | ||||||||||||||||||
| 1404 | transformed bilinear (tiled and not tiled) | - | ||||||||||||||||||
| 1405 | - | |||||||||||||||||||
| 1406 | We don't need bounds checks for untransformed, but we need them for the other ones. | - | ||||||||||||||||||
| 1407 | - | |||||||||||||||||||
| 1408 | The generic implementation does pixel by pixel fetches | - | ||||||||||||||||||
| 1409 | */ | - | ||||||||||||||||||
| 1410 | - | |||||||||||||||||||
| 1411 | enum TextureBlendType { | - | ||||||||||||||||||
| 1412 | BlendUntransformed, | - | ||||||||||||||||||
| 1413 | BlendTiled, | - | ||||||||||||||||||
| 1414 | BlendTransformed, | - | ||||||||||||||||||
| 1415 | BlendTransformedTiled, | - | ||||||||||||||||||
| 1416 | BlendTransformedBilinear, | - | ||||||||||||||||||
| 1417 | BlendTransformedBilinearTiled, | - | ||||||||||||||||||
| 1418 | NBlendTypes | - | ||||||||||||||||||
| 1419 | }; | - | ||||||||||||||||||
| 1420 | - | |||||||||||||||||||
| 1421 | static const uint *QT_FASTCALL fetchUntransformed(uint *buffer, const Operator *, | - | ||||||||||||||||||
| 1422 | const QSpanData *data, int y, int x, int length) | - | ||||||||||||||||||
| 1423 | { | - | ||||||||||||||||||
| 1424 | const QPixelLayout *layout = &qPixelLayouts[data->texture.format]; | - | ||||||||||||||||||
| 1425 | const uint *ptr = qFetchPixels[layout->bpp](buffer, data->texture.scanLine(y), x, length); | - | ||||||||||||||||||
| 1426 | const QRgb *clut = data->texture.colorTable ? data->texture.colorTable->constData() : 0;
| 0 | ||||||||||||||||||
| 1427 | return layout->convertToARGB32PM(buffer, ptr, length, layout, clut); never executed: return layout->convertToARGB32PM(buffer, ptr, length, layout, clut); | 0 | ||||||||||||||||||
| 1428 | } | - | ||||||||||||||||||
| 1429 | - | |||||||||||||||||||
| 1430 | static const uint *QT_FASTCALL fetchUntransformedARGB32PM(uint *, const Operator *, | - | ||||||||||||||||||
| 1431 | const QSpanData *data, int y, int x, int) | - | ||||||||||||||||||
| 1432 | { | - | ||||||||||||||||||
| 1433 | const uchar *scanLine = data->texture.scanLine(y); | - | ||||||||||||||||||
| 1434 | return ((const uint *)scanLine) + x; never executed: return ((const uint *)scanLine) + x; | 0 | ||||||||||||||||||
| 1435 | } | - | ||||||||||||||||||
| 1436 | - | |||||||||||||||||||
| 1437 | static const uint *QT_FASTCALL fetchUntransformedRGB16(uint *buffer, const Operator *, | - | ||||||||||||||||||
| 1438 | const QSpanData *data, int y, int x, | - | ||||||||||||||||||
| 1439 | int length) | - | ||||||||||||||||||
| 1440 | { | - | ||||||||||||||||||
| 1441 | const quint16 *scanLine = (const quint16 *)data->texture.scanLine(y) + x; | - | ||||||||||||||||||
| 1442 | #ifdef QT_COMPILER_SUPPORTS_MIPS_DSPR2 | - | ||||||||||||||||||
| 1443 | qConvertRgb16To32_asm_mips_dspr2(buffer, scanLine, length); | - | ||||||||||||||||||
| 1444 | #else | - | ||||||||||||||||||
| 1445 | for (int i = 0; i < length; ++i)
| 0 | ||||||||||||||||||
| 1446 | buffer[i] = qConvertRgb16To32(scanLine[i]); never executed: buffer[i] = qConvertRgb16To32(scanLine[i]); | 0 | ||||||||||||||||||
| 1447 | #endif | - | ||||||||||||||||||
| 1448 | return buffer; never executed: return buffer; | 0 | ||||||||||||||||||
| 1449 | } | - | ||||||||||||||||||
| 1450 | - | |||||||||||||||||||
| 1451 | static const QRgba64 *QT_FASTCALL fetchUntransformed64(QRgba64 *buffer, const Operator *, | - | ||||||||||||||||||
| 1452 | const QSpanData *data, int y, int x, int length) | - | ||||||||||||||||||
| 1453 | { | - | ||||||||||||||||||
| 1454 | const QPixelLayout *layout = &qPixelLayouts[data->texture.format]; | - | ||||||||||||||||||
| 1455 | const QRgb *clut = data->texture.colorTable ? data->texture.colorTable->constData() : 0;
| 0 | ||||||||||||||||||
| 1456 | if (layout->bpp != QPixelLayout::BPP32) {
| 0 | ||||||||||||||||||
| 1457 | uint buffer32[buffer_size]; | - | ||||||||||||||||||
| 1458 | const uint *ptr = qFetchPixels[layout->bpp](buffer32, data->texture.scanLine(y), x, length); | - | ||||||||||||||||||
| 1459 | return layout->convertToARGB64PM(buffer, ptr, length, layout, clut); never executed: return layout->convertToARGB64PM(buffer, ptr, length, layout, clut); | 0 | ||||||||||||||||||
| 1460 | } else { | - | ||||||||||||||||||
| 1461 | const uint *src = (const uint *)data->texture.scanLine(y) + x; | - | ||||||||||||||||||
| 1462 | return layout->convertToARGB64PM(buffer, src, length, layout, clut); never executed: return layout->convertToARGB64PM(buffer, src, length, layout, clut); | 0 | ||||||||||||||||||
| 1463 | } | - | ||||||||||||||||||
| 1464 | } | - | ||||||||||||||||||
| 1465 | - | |||||||||||||||||||
| 1466 | // blendType is either BlendTransformed or BlendTransformedTiled | - | ||||||||||||||||||
| 1467 | template<TextureBlendType blendType> | - | ||||||||||||||||||
| 1468 | static const uint *QT_FASTCALL fetchTransformedARGB32PM(uint *buffer, const Operator *, const QSpanData *data, | - | ||||||||||||||||||
| 1469 | int y, int x, int length) | - | ||||||||||||||||||
| 1470 | { | - | ||||||||||||||||||
| 1471 | int image_width = data->texture.width; | - | ||||||||||||||||||
| 1472 | int image_height = data->texture.height; | - | ||||||||||||||||||
| 1473 | - | |||||||||||||||||||
| 1474 | const qreal cx = x + qreal(0.5); | - | ||||||||||||||||||
| 1475 | const qreal cy = y + qreal(0.5); | - | ||||||||||||||||||
| 1476 | - | |||||||||||||||||||
| 1477 | const uint *end = buffer + length; | - | ||||||||||||||||||
| 1478 | uint *b = buffer; | - | ||||||||||||||||||
| 1479 | if (data->fast_matrix) {
| 0 | ||||||||||||||||||
| 1480 | // The increment pr x in the scanline | - | ||||||||||||||||||
| 1481 | int fdx = (int)(data->m11 * fixed_scale); | - | ||||||||||||||||||
| 1482 | int fdy = (int)(data->m12 * fixed_scale); | - | ||||||||||||||||||
| 1483 | - | |||||||||||||||||||
| 1484 | int fx = int((data->m21 * cy | - | ||||||||||||||||||
| 1485 | + data->m11 * cx + data->dx) * fixed_scale); | - | ||||||||||||||||||
| 1486 | int fy = int((data->m22 * cy | - | ||||||||||||||||||
| 1487 | + data->m12 * cx + data->dy) * fixed_scale); | - | ||||||||||||||||||
| 1488 | - | |||||||||||||||||||
| 1489 | while (b < end) {
| 0 | ||||||||||||||||||
| 1490 | int px = fx >> 16; | - | ||||||||||||||||||
| 1491 | int py = fy >> 16; | - | ||||||||||||||||||
| 1492 | - | |||||||||||||||||||
| 1493 | if (blendType == BlendTransformedTiled) {
| 0 | ||||||||||||||||||
| 1494 | px %= image_width; | - | ||||||||||||||||||
| 1495 | py %= image_height; | - | ||||||||||||||||||
| 1496 | if (px < 0) px += image_width; never executed: px += image_width;
| 0 | ||||||||||||||||||
| 1497 | if (py < 0) py += image_height; never executed: py += image_height;
| 0 | ||||||||||||||||||
| 1498 | } else { never executed: end of block | 0 | ||||||||||||||||||
| 1499 | px = qBound(0, px, image_width - 1); | - | ||||||||||||||||||
| 1500 | py = qBound(0, py, image_height - 1); | - | ||||||||||||||||||
| 1501 | } never executed: end of block | 0 | ||||||||||||||||||
| 1502 | *b = reinterpret_cast<const uint *>(data->texture.scanLine(py))[px]; | - | ||||||||||||||||||
| 1503 | - | |||||||||||||||||||
| 1504 | fx += fdx; | - | ||||||||||||||||||
| 1505 | fy += fdy; | - | ||||||||||||||||||
| 1506 | ++b; | - | ||||||||||||||||||
| 1507 | } never executed: end of block | 0 | ||||||||||||||||||
| 1508 | } else { never executed: end of block | 0 | ||||||||||||||||||
| 1509 | const qreal fdx = data->m11; | - | ||||||||||||||||||
| 1510 | const qreal fdy = data->m12; | - | ||||||||||||||||||
| 1511 | const qreal fdw = data->m13; | - | ||||||||||||||||||
| 1512 | - | |||||||||||||||||||
| 1513 | qreal fx = data->m21 * cy + data->m11 * cx + data->dx; | - | ||||||||||||||||||
| 1514 | qreal fy = data->m22 * cy + data->m12 * cx + data->dy; | - | ||||||||||||||||||
| 1515 | qreal fw = data->m23 * cy + data->m13 * cx + data->m33; | - | ||||||||||||||||||
| 1516 | - | |||||||||||||||||||
| 1517 | while (b < end) {
| 0 | ||||||||||||||||||
| 1518 | const qreal iw = fw == 0 ? 1 : 1 / fw; | - | ||||||||||||||||||
| 1519 | const qreal tx = fx * iw; | - | ||||||||||||||||||
| 1520 | const qreal ty = fy * iw; | - | ||||||||||||||||||
| 1521 | int px = int(tx) - (tx < 0); | - | ||||||||||||||||||
| 1522 | int py = int(ty) - (ty < 0); | - | ||||||||||||||||||
| 1523 | - | |||||||||||||||||||
| 1524 | if (blendType == BlendTransformedTiled) {
| 0 | ||||||||||||||||||
| 1525 | px %= image_width; | - | ||||||||||||||||||
| 1526 | py %= image_height; | - | ||||||||||||||||||
| 1527 | if (px < 0) px += image_width; never executed: px += image_width;
| 0 | ||||||||||||||||||
| 1528 | if (py < 0) py += image_height; never executed: py += image_height;
| 0 | ||||||||||||||||||
| 1529 | } else { never executed: end of block | 0 | ||||||||||||||||||
| 1530 | px = qBound(0, px, image_width - 1); | - | ||||||||||||||||||
| 1531 | py = qBound(0, py, image_height - 1); | - | ||||||||||||||||||
| 1532 | } never executed: end of block | 0 | ||||||||||||||||||
| 1533 | *b = reinterpret_cast<const uint *>(data->texture.scanLine(py))[px]; | - | ||||||||||||||||||
| 1534 | - | |||||||||||||||||||
| 1535 | fx += fdx; | - | ||||||||||||||||||
| 1536 | fy += fdy; | - | ||||||||||||||||||
| 1537 | fw += fdw; | - | ||||||||||||||||||
| 1538 | //force increment to avoid /0 | - | ||||||||||||||||||
| 1539 | if (!fw) {
| 0 | ||||||||||||||||||
| 1540 | fw += fdw; | - | ||||||||||||||||||
| 1541 | } never executed: end of block | 0 | ||||||||||||||||||
| 1542 | ++b; | - | ||||||||||||||||||
| 1543 | } never executed: end of block | 0 | ||||||||||||||||||
| 1544 | } never executed: end of block | 0 | ||||||||||||||||||
| 1545 | return buffer; never executed: return buffer; | 0 | ||||||||||||||||||
| 1546 | } | - | ||||||||||||||||||
| 1547 | - | |||||||||||||||||||
| 1548 | template<TextureBlendType blendType> /* either BlendTransformed or BlendTransformedTiled */ | - | ||||||||||||||||||
| 1549 | static const uint *QT_FASTCALL fetchTransformed(uint *buffer, const Operator *, const QSpanData *data, | - | ||||||||||||||||||
| 1550 | int y, int x, int length) | - | ||||||||||||||||||
| 1551 | { | - | ||||||||||||||||||
| 1552 | int image_width = data->texture.width; | - | ||||||||||||||||||
| 1553 | int image_height = data->texture.height; | - | ||||||||||||||||||
| 1554 | - | |||||||||||||||||||
| 1555 | const qreal cx = x + qreal(0.5); | - | ||||||||||||||||||
| 1556 | const qreal cy = y + qreal(0.5); | - | ||||||||||||||||||
| 1557 | - | |||||||||||||||||||
| 1558 | const QPixelLayout *layout = &qPixelLayouts[data->texture.format]; | - | ||||||||||||||||||
| 1559 | FetchPixelFunc fetch = qFetchPixel[layout->bpp]; | - | ||||||||||||||||||
| 1560 | - | |||||||||||||||||||
| 1561 | const uint *end = buffer + length; | - | ||||||||||||||||||
| 1562 | uint *b = buffer; | - | ||||||||||||||||||
| 1563 | if (data->fast_matrix) {
| 0 | ||||||||||||||||||
| 1564 | // The increment pr x in the scanline | - | ||||||||||||||||||
| 1565 | int fdx = (int)(data->m11 * fixed_scale); | - | ||||||||||||||||||
| 1566 | int fdy = (int)(data->m12 * fixed_scale); | - | ||||||||||||||||||
| 1567 | - | |||||||||||||||||||
| 1568 | int fx = int((data->m21 * cy | - | ||||||||||||||||||
| 1569 | + data->m11 * cx + data->dx) * fixed_scale); | - | ||||||||||||||||||
| 1570 | int fy = int((data->m22 * cy | - | ||||||||||||||||||
| 1571 | + data->m12 * cx + data->dy) * fixed_scale); | - | ||||||||||||||||||
| 1572 | - | |||||||||||||||||||
| 1573 | while (b < end) {
| 0 | ||||||||||||||||||
| 1574 | int px = fx >> 16; | - | ||||||||||||||||||
| 1575 | int py = fy >> 16; | - | ||||||||||||||||||
| 1576 | - | |||||||||||||||||||
| 1577 | if (blendType == BlendTransformedTiled) {
| 0 | ||||||||||||||||||
| 1578 | px %= image_width; | - | ||||||||||||||||||
| 1579 | py %= image_height; | - | ||||||||||||||||||
| 1580 | if (px < 0) px += image_width; never executed: px += image_width;
| 0 | ||||||||||||||||||
| 1581 | if (py < 0) py += image_height; never executed: py += image_height;
| 0 | ||||||||||||||||||
| 1582 | } else { never executed: end of block | 0 | ||||||||||||||||||
| 1583 | px = qBound(0, px, image_width - 1); | - | ||||||||||||||||||
| 1584 | py = qBound(0, py, image_height - 1); | - | ||||||||||||||||||
| 1585 | } never executed: end of block | 0 | ||||||||||||||||||
| 1586 | *b = fetch(data->texture.scanLine(py), px); | - | ||||||||||||||||||
| 1587 | - | |||||||||||||||||||
| 1588 | fx += fdx; | - | ||||||||||||||||||
| 1589 | fy += fdy; | - | ||||||||||||||||||
| 1590 | ++b; | - | ||||||||||||||||||
| 1591 | } never executed: end of block | 0 | ||||||||||||||||||
| 1592 | } else { never executed: end of block | 0 | ||||||||||||||||||
| 1593 | const qreal fdx = data->m11; | - | ||||||||||||||||||
| 1594 | const qreal fdy = data->m12; | - | ||||||||||||||||||
| 1595 | const qreal fdw = data->m13; | - | ||||||||||||||||||
| 1596 | - | |||||||||||||||||||
| 1597 | qreal fx = data->m21 * cy + data->m11 * cx + data->dx; | - | ||||||||||||||||||
| 1598 | qreal fy = data->m22 * cy + data->m12 * cx + data->dy; | - | ||||||||||||||||||
| 1599 | qreal fw = data->m23 * cy + data->m13 * cx + data->m33; | - | ||||||||||||||||||
| 1600 | - | |||||||||||||||||||
| 1601 | while (b < end) {
| 0 | ||||||||||||||||||
| 1602 | const qreal iw = fw == 0 ? 1 : 1 / fw; | - | ||||||||||||||||||
| 1603 | const qreal tx = fx * iw; | - | ||||||||||||||||||
| 1604 | const qreal ty = fy * iw; | - | ||||||||||||||||||
| 1605 | int px = int(tx) - (tx < 0); | - | ||||||||||||||||||
| 1606 | int py = int(ty) - (ty < 0); | - | ||||||||||||||||||
| 1607 | - | |||||||||||||||||||
| 1608 | if (blendType == BlendTransformedTiled) {
| 0 | ||||||||||||||||||
| 1609 | px %= image_width; | - | ||||||||||||||||||
| 1610 | py %= image_height; | - | ||||||||||||||||||
| 1611 | if (px < 0) px += image_width; never executed: px += image_width;
| 0 | ||||||||||||||||||
| 1612 | if (py < 0) py += image_height; never executed: py += image_height;
| 0 | ||||||||||||||||||
| 1613 | } else { never executed: end of block | 0 | ||||||||||||||||||
| 1614 | px = qBound(0, px, image_width - 1); | - | ||||||||||||||||||
| 1615 | py = qBound(0, py, image_height - 1); | - | ||||||||||||||||||
| 1616 | } never executed: end of block | 0 | ||||||||||||||||||
| 1617 | *b = fetch(data->texture.scanLine(py), px); | - | ||||||||||||||||||
| 1618 | - | |||||||||||||||||||
| 1619 | fx += fdx; | - | ||||||||||||||||||
| 1620 | fy += fdy; | - | ||||||||||||||||||
| 1621 | fw += fdw; | - | ||||||||||||||||||
| 1622 | //force increment to avoid /0 | - | ||||||||||||||||||
| 1623 | if (!fw) {
| 0 | ||||||||||||||||||
| 1624 | fw += fdw; | - | ||||||||||||||||||
| 1625 | } never executed: end of block | 0 | ||||||||||||||||||
| 1626 | ++b; | - | ||||||||||||||||||
| 1627 | } never executed: end of block | 0 | ||||||||||||||||||
| 1628 | } never executed: end of block | 0 | ||||||||||||||||||
| 1629 | const QRgb *clut = data->texture.colorTable ? data->texture.colorTable->constData() : 0; | - | ||||||||||||||||||
| 1630 | return layout->convertToARGB32PM(buffer, buffer, length, layout, clut); never executed: return layout->convertToARGB32PM(buffer, buffer, length, layout, clut); | 0 | ||||||||||||||||||
| 1631 | } | - | ||||||||||||||||||
| 1632 | - | |||||||||||||||||||
| 1633 | template<TextureBlendType blendType> /* either BlendTransformed or BlendTransformedTiled */ | - | ||||||||||||||||||
| 1634 | static const QRgba64 *QT_FASTCALL fetchTransformed64(QRgba64 *buffer, const Operator *, const QSpanData *data, | - | ||||||||||||||||||
| 1635 | int y, int x, int length) | - | ||||||||||||||||||
| 1636 | { | - | ||||||||||||||||||
| 1637 | int image_width = data->texture.width; | - | ||||||||||||||||||
| 1638 | int image_height = data->texture.height; | - | ||||||||||||||||||
| 1639 | - | |||||||||||||||||||
| 1640 | const qreal cx = x + qreal(0.5); | - | ||||||||||||||||||
| 1641 | const qreal cy = y + qreal(0.5); | - | ||||||||||||||||||
| 1642 | - | |||||||||||||||||||
| 1643 | const QPixelLayout *layout = &qPixelLayouts[data->texture.format]; | - | ||||||||||||||||||
| 1644 | FetchPixelFunc fetch = qFetchPixel[layout->bpp]; | - | ||||||||||||||||||
| 1645 | const QRgb *clut = data->texture.colorTable ? data->texture.colorTable->constData() : 0; | - | ||||||||||||||||||
| 1646 | - | |||||||||||||||||||
| 1647 | uint buffer32[buffer_size]; | - | ||||||||||||||||||
| 1648 | QRgba64 *b = buffer; | - | ||||||||||||||||||
| 1649 | if (data->fast_matrix) {
| 0 | ||||||||||||||||||
| 1650 | // The increment pr x in the scanline | - | ||||||||||||||||||
| 1651 | int fdx = (int)(data->m11 * fixed_scale); | - | ||||||||||||||||||
| 1652 | int fdy = (int)(data->m12 * fixed_scale); | - | ||||||||||||||||||
| 1653 | - | |||||||||||||||||||
| 1654 | int fx = int((data->m21 * cy | - | ||||||||||||||||||
| 1655 | + data->m11 * cx + data->dx) * fixed_scale); | - | ||||||||||||||||||
| 1656 | int fy = int((data->m22 * cy | - | ||||||||||||||||||
| 1657 | + data->m12 * cx + data->dy) * fixed_scale); | - | ||||||||||||||||||
| 1658 | - | |||||||||||||||||||
| 1659 | int i = 0, j = 0; | - | ||||||||||||||||||
| 1660 | while (i < length) {
| 0 | ||||||||||||||||||
| 1661 | if (j == buffer_size) {
| 0 | ||||||||||||||||||
| 1662 | layout->convertToARGB64PM(b, buffer32, buffer_size, layout, clut); | - | ||||||||||||||||||
| 1663 | b += buffer_size; | - | ||||||||||||||||||
| 1664 | j = 0; | - | ||||||||||||||||||
| 1665 | } never executed: end of block | 0 | ||||||||||||||||||
| 1666 | int px = fx >> 16; | - | ||||||||||||||||||
| 1667 | int py = fy >> 16; | - | ||||||||||||||||||
| 1668 | - | |||||||||||||||||||
| 1669 | if (blendType == BlendTransformedTiled) {
| 0 | ||||||||||||||||||
| 1670 | px %= image_width; | - | ||||||||||||||||||
| 1671 | py %= image_height; | - | ||||||||||||||||||
| 1672 | if (px < 0) px += image_width; never executed: px += image_width;
| 0 | ||||||||||||||||||
| 1673 | if (py < 0) py += image_height; never executed: py += image_height;
| 0 | ||||||||||||||||||
| 1674 | } else { never executed: end of block | 0 | ||||||||||||||||||
| 1675 | px = qBound(0, px, image_width - 1); | - | ||||||||||||||||||
| 1676 | py = qBound(0, py, image_height - 1); | - | ||||||||||||||||||
| 1677 | } never executed: end of block | 0 | ||||||||||||||||||
| 1678 | buffer32[j] = fetch(data->texture.scanLine(py), px); | - | ||||||||||||||||||
| 1679 | - | |||||||||||||||||||
| 1680 | fx += fdx; | - | ||||||||||||||||||
| 1681 | fy += fdy; | - | ||||||||||||||||||
| 1682 | ++i; ++j; | - | ||||||||||||||||||
| 1683 | } never executed: end of block | 0 | ||||||||||||||||||
| 1684 | if (j > 0) {
| 0 | ||||||||||||||||||
| 1685 | layout->convertToARGB64PM(b, buffer32, j, layout, clut); | - | ||||||||||||||||||
| 1686 | b += j; | - | ||||||||||||||||||
| 1687 | } never executed: end of block | 0 | ||||||||||||||||||
| 1688 | } else { never executed: end of block | 0 | ||||||||||||||||||
| 1689 | const qreal fdx = data->m11; | - | ||||||||||||||||||
| 1690 | const qreal fdy = data->m12; | - | ||||||||||||||||||
| 1691 | const qreal fdw = data->m13; | - | ||||||||||||||||||
| 1692 | - | |||||||||||||||||||
| 1693 | qreal fx = data->m21 * cy + data->m11 * cx + data->dx; | - | ||||||||||||||||||
| 1694 | qreal fy = data->m22 * cy + data->m12 * cx + data->dy; | - | ||||||||||||||||||
| 1695 | qreal fw = data->m23 * cy + data->m13 * cx + data->m33; | - | ||||||||||||||||||
| 1696 | - | |||||||||||||||||||
| 1697 | int i = 0, j = 0; | - | ||||||||||||||||||
| 1698 | while (i < length) {
| 0 | ||||||||||||||||||
| 1699 | if (j == buffer_size) {
| 0 | ||||||||||||||||||
| 1700 | layout->convertToARGB64PM(b, buffer32, buffer_size, layout, clut); | - | ||||||||||||||||||
| 1701 | b += buffer_size; | - | ||||||||||||||||||
| 1702 | j = 0; | - | ||||||||||||||||||
| 1703 | } never executed: end of block | 0 | ||||||||||||||||||
| 1704 | const qreal iw = fw == 0 ? 1 : 1 / fw; | - | ||||||||||||||||||
| 1705 | const qreal tx = fx * iw; | - | ||||||||||||||||||
| 1706 | const qreal ty = fy * iw; | - | ||||||||||||||||||
| 1707 | int px = int(tx) - (tx < 0); | - | ||||||||||||||||||
| 1708 | int py = int(ty) - (ty < 0); | - | ||||||||||||||||||
| 1709 | - | |||||||||||||||||||
| 1710 | if (blendType == BlendTransformedTiled) {
| 0 | ||||||||||||||||||
| 1711 | px %= image_width; | - | ||||||||||||||||||
| 1712 | py %= image_height; | - | ||||||||||||||||||
| 1713 | if (px < 0) px += image_width; never executed: px += image_width;
| 0 | ||||||||||||||||||
| 1714 | if (py < 0) py += image_height; never executed: py += image_height;
| 0 | ||||||||||||||||||
| 1715 | } else { never executed: end of block | 0 | ||||||||||||||||||
| 1716 | px = qBound(0, px, image_width - 1); | - | ||||||||||||||||||
| 1717 | py = qBound(0, py, image_height - 1); | - | ||||||||||||||||||
| 1718 | } never executed: end of block | 0 | ||||||||||||||||||
| 1719 | buffer32[j] = fetch(data->texture.scanLine(py), px); | - | ||||||||||||||||||
| 1720 | - | |||||||||||||||||||
| 1721 | fx += fdx; | - | ||||||||||||||||||
| 1722 | fy += fdy; | - | ||||||||||||||||||
| 1723 | fw += fdw; | - | ||||||||||||||||||
| 1724 | //force increment to avoid /0 | - | ||||||||||||||||||
| 1725 | if (!fw) {
| 0 | ||||||||||||||||||
| 1726 | fw += fdw; | - | ||||||||||||||||||
| 1727 | } never executed: end of block | 0 | ||||||||||||||||||
| 1728 | ++i; ++j; | - | ||||||||||||||||||
| 1729 | } never executed: end of block | 0 | ||||||||||||||||||
| 1730 | if (j > 0) {
| 0 | ||||||||||||||||||
| 1731 | layout->convertToARGB64PM(b, buffer32, j, layout, clut); | - | ||||||||||||||||||
| 1732 | b += j; | - | ||||||||||||||||||
| 1733 | } never executed: end of block | 0 | ||||||||||||||||||
| 1734 | } never executed: end of block | 0 | ||||||||||||||||||
| 1735 | return buffer; never executed: return buffer; | 0 | ||||||||||||||||||
| 1736 | } | - | ||||||||||||||||||
| 1737 | - | |||||||||||||||||||
| 1738 | /** \internal | - | ||||||||||||||||||
| 1739 | interpolate 4 argb pixels with the distx and disty factor. | - | ||||||||||||||||||
| 1740 | distx and disty bust be between 0 and 16 | - | ||||||||||||||||||
| 1741 | */ | - | ||||||||||||||||||
| 1742 | static inline uint interpolate_4_pixels_16(uint tl, uint tr, uint bl, uint br, int distx, int disty) | - | ||||||||||||||||||
| 1743 | { | - | ||||||||||||||||||
| 1744 | uint distxy = distx * disty; | - | ||||||||||||||||||
| 1745 | //idistx * disty = (16-distx) * disty = 16*disty - distxy | - | ||||||||||||||||||
| 1746 | //idistx * idisty = (16-distx) * (16-disty) = 16*16 - 16*distx -16*disty + distxy | - | ||||||||||||||||||
| 1747 | uint tlrb = (tl & 0x00ff00ff) * (16*16 - 16*distx - 16*disty + distxy); | - | ||||||||||||||||||
| 1748 | uint tlag = ((tl & 0xff00ff00) >> 8) * (16*16 - 16*distx - 16*disty + distxy); | - | ||||||||||||||||||
| 1749 | uint trrb = ((tr & 0x00ff00ff) * (distx*16 - distxy)); | - | ||||||||||||||||||
| 1750 | uint trag = (((tr & 0xff00ff00) >> 8) * (distx*16 - distxy)); | - | ||||||||||||||||||
| 1751 | uint blrb = ((bl & 0x00ff00ff) * (disty*16 - distxy)); | - | ||||||||||||||||||
| 1752 | uint blag = (((bl & 0xff00ff00) >> 8) * (disty*16 - distxy)); | - | ||||||||||||||||||
| 1753 | uint brrb = ((br & 0x00ff00ff) * (distxy)); | - | ||||||||||||||||||
| 1754 | uint brag = (((br & 0xff00ff00) >> 8) * (distxy)); | - | ||||||||||||||||||
| 1755 | return (((tlrb + trrb + blrb + brrb) >> 8) & 0x00ff00ff) | ((tlag + trag + blag + brag) & 0xff00ff00); never executed: return (((tlrb + trrb + blrb + brrb) >> 8) & 0x00ff00ff) | ((tlag + trag + blag + brag) & 0xff00ff00); | 0 | ||||||||||||||||||
| 1756 | } | - | ||||||||||||||||||
| 1757 | - | |||||||||||||||||||
| 1758 | #if defined(__SSE2__) | - | ||||||||||||||||||
| 1759 | #define interpolate_4_pixels_16_sse2(tl, tr, bl, br, distx, disty, colorMask, v_256, b) \ | - | ||||||||||||||||||
| 1760 | { \ | - | ||||||||||||||||||
| 1761 | const __m128i dxdy = _mm_mullo_epi16 (distx, disty); \ | - | ||||||||||||||||||
| 1762 | const __m128i distx_ = _mm_slli_epi16(distx, 4); \ | - | ||||||||||||||||||
| 1763 | const __m128i disty_ = _mm_slli_epi16(disty, 4); \ | - | ||||||||||||||||||
| 1764 | const __m128i idxidy = _mm_add_epi16(dxdy, _mm_sub_epi16(v_256, _mm_add_epi16(distx_, disty_))); \ | - | ||||||||||||||||||
| 1765 | const __m128i dxidy = _mm_sub_epi16(distx_, dxdy); \ | - | ||||||||||||||||||
| 1766 | const __m128i idxdy = _mm_sub_epi16(disty_, dxdy); \ | - | ||||||||||||||||||
| 1767 | \ | - | ||||||||||||||||||
| 1768 | __m128i tlAG = _mm_srli_epi16(tl, 8); \ | - | ||||||||||||||||||
| 1769 | __m128i tlRB = _mm_and_si128(tl, colorMask); \ | - | ||||||||||||||||||
| 1770 | __m128i trAG = _mm_srli_epi16(tr, 8); \ | - | ||||||||||||||||||
| 1771 | __m128i trRB = _mm_and_si128(tr, colorMask); \ | - | ||||||||||||||||||
| 1772 | __m128i blAG = _mm_srli_epi16(bl, 8); \ | - | ||||||||||||||||||
| 1773 | __m128i blRB = _mm_and_si128(bl, colorMask); \ | - | ||||||||||||||||||
| 1774 | __m128i brAG = _mm_srli_epi16(br, 8); \ | - | ||||||||||||||||||
| 1775 | __m128i brRB = _mm_and_si128(br, colorMask); \ | - | ||||||||||||||||||
| 1776 | \ | - | ||||||||||||||||||
| 1777 | tlAG = _mm_mullo_epi16(tlAG, idxidy); \ | - | ||||||||||||||||||
| 1778 | tlRB = _mm_mullo_epi16(tlRB, idxidy); \ | - | ||||||||||||||||||
| 1779 | trAG = _mm_mullo_epi16(trAG, dxidy); \ | - | ||||||||||||||||||
| 1780 | trRB = _mm_mullo_epi16(trRB, dxidy); \ | - | ||||||||||||||||||
| 1781 | blAG = _mm_mullo_epi16(blAG, idxdy); \ | - | ||||||||||||||||||
| 1782 | blRB = _mm_mullo_epi16(blRB, idxdy); \ | - | ||||||||||||||||||
| 1783 | brAG = _mm_mullo_epi16(brAG, dxdy); \ | - | ||||||||||||||||||
| 1784 | brRB = _mm_mullo_epi16(brRB, dxdy); \ | - | ||||||||||||||||||
| 1785 | \ | - | ||||||||||||||||||
| 1786 | /* Add the values, and shift to only keep 8 significant bits per colors */ \ | - | ||||||||||||||||||
| 1787 | __m128i rAG =_mm_add_epi16(_mm_add_epi16(tlAG, trAG), _mm_add_epi16(blAG, brAG)); \ | - | ||||||||||||||||||
| 1788 | __m128i rRB =_mm_add_epi16(_mm_add_epi16(tlRB, trRB), _mm_add_epi16(blRB, brRB)); \ | - | ||||||||||||||||||
| 1789 | rAG = _mm_andnot_si128(colorMask, rAG); \ | - | ||||||||||||||||||
| 1790 | rRB = _mm_srli_epi16(rRB, 8); \ | - | ||||||||||||||||||
| 1791 | _mm_storeu_si128((__m128i*)(b), _mm_or_si128(rAG, rRB)); \ | - | ||||||||||||||||||
| 1792 | } | - | ||||||||||||||||||
| 1793 | #endif | - | ||||||||||||||||||
| 1794 | - | |||||||||||||||||||
| 1795 | #if defined(__ARM_NEON__) | - | ||||||||||||||||||
| 1796 | #define interpolate_4_pixels_16_neon(tl, tr, bl, br, distx, disty, disty_, colorMask, invColorMask, v_256, b) \ | - | ||||||||||||||||||
| 1797 | { \ | - | ||||||||||||||||||
| 1798 | const int16x8_t dxdy = vmulq_s16(distx, disty); \ | - | ||||||||||||||||||
| 1799 | const int16x8_t distx_ = vshlq_n_s16(distx, 4); \ | - | ||||||||||||||||||
| 1800 | const int16x8_t idxidy = vaddq_s16(dxdy, vsubq_s16(v_256, vaddq_s16(distx_, disty_))); \ | - | ||||||||||||||||||
| 1801 | const int16x8_t dxidy = vsubq_s16(distx_, dxdy); \ | - | ||||||||||||||||||
| 1802 | const int16x8_t idxdy = vsubq_s16(disty_, dxdy); \ | - | ||||||||||||||||||
| 1803 | \ | - | ||||||||||||||||||
| 1804 | int16x8_t tlAG = vreinterpretq_s16_u16(vshrq_n_u16(vreinterpretq_u16_s16(tl), 8)); \ | - | ||||||||||||||||||
| 1805 | int16x8_t tlRB = vandq_s16(tl, colorMask); \ | - | ||||||||||||||||||
| 1806 | int16x8_t trAG = vreinterpretq_s16_u16(vshrq_n_u16(vreinterpretq_u16_s16(tr), 8)); \ | - | ||||||||||||||||||
| 1807 | int16x8_t trRB = vandq_s16(tr, colorMask); \ | - | ||||||||||||||||||
| 1808 | int16x8_t blAG = vreinterpretq_s16_u16(vshrq_n_u16(vreinterpretq_u16_s16(bl), 8)); \ | - | ||||||||||||||||||
| 1809 | int16x8_t blRB = vandq_s16(bl, colorMask); \ | - | ||||||||||||||||||
| 1810 | int16x8_t brAG = vreinterpretq_s16_u16(vshrq_n_u16(vreinterpretq_u16_s16(br), 8)); \ | - | ||||||||||||||||||
| 1811 | int16x8_t brRB = vandq_s16(br, colorMask); \ | - | ||||||||||||||||||
| 1812 | \ | - | ||||||||||||||||||
| 1813 | int16x8_t rAG = vmulq_s16(tlAG, idxidy); \ | - | ||||||||||||||||||
| 1814 | int16x8_t rRB = vmulq_s16(tlRB, idxidy); \ | - | ||||||||||||||||||
| 1815 | rAG = vmlaq_s16(rAG, trAG, dxidy); \ | - | ||||||||||||||||||
| 1816 | rRB = vmlaq_s16(rRB, trRB, dxidy); \ | - | ||||||||||||||||||
| 1817 | rAG = vmlaq_s16(rAG, blAG, idxdy); \ | - | ||||||||||||||||||
| 1818 | rRB = vmlaq_s16(rRB, blRB, idxdy); \ | - | ||||||||||||||||||
| 1819 | rAG = vmlaq_s16(rAG, brAG, dxdy); \ | - | ||||||||||||||||||
| 1820 | rRB = vmlaq_s16(rRB, brRB, dxdy); \ | - | ||||||||||||||||||
| 1821 | \ | - | ||||||||||||||||||
| 1822 | rAG = vandq_s16(invColorMask, rAG); \ | - | ||||||||||||||||||
| 1823 | rRB = vreinterpretq_s16_u16(vshrq_n_u16(vreinterpretq_u16_s16(rRB), 8)); \ | - | ||||||||||||||||||
| 1824 | vst1q_s16((int16_t*)(b), vorrq_s16(rAG, rRB)); \ | - | ||||||||||||||||||
| 1825 | } | - | ||||||||||||||||||
| 1826 | #endif | - | ||||||||||||||||||
| 1827 | - | |||||||||||||||||||
| 1828 | #if defined(__SSE2__) | - | ||||||||||||||||||
| 1829 | static inline QRgba64 interpolate_4_pixels_rgb64(QRgba64 t[], QRgba64 b[], uint distx, uint disty) | - | ||||||||||||||||||
| 1830 | { | - | ||||||||||||||||||
| 1831 | const __m128i vdistx = _mm_shufflelo_epi16(_mm_cvtsi32_si128(distx), _MM_SHUFFLE(0, 0, 0, 0)); | - | ||||||||||||||||||
| 1832 | const __m128i vidistx = _mm_shufflelo_epi16(_mm_cvtsi32_si128(0x10000 - distx), _MM_SHUFFLE(0, 0, 0, 0)); | - | ||||||||||||||||||
| 1833 | - | |||||||||||||||||||
| 1834 | __m128i vt = _mm_loadu_si128((const __m128i*)t); | - | ||||||||||||||||||
| 1835 | if (disty) {
| 0 | ||||||||||||||||||
| 1836 | __m128i vb = _mm_loadu_si128((const __m128i*)b); | - | ||||||||||||||||||
| 1837 | vt = _mm_mulhi_epu16(vt, _mm_set1_epi16(0x10000 - disty)); | - | ||||||||||||||||||
| 1838 | vb = _mm_mulhi_epu16(vb, _mm_set1_epi16(disty)); | - | ||||||||||||||||||
| 1839 | vt = _mm_add_epi16(vt, vb); | - | ||||||||||||||||||
| 1840 | } never executed: end of block | 0 | ||||||||||||||||||
| 1841 | vt = _mm_mulhi_epu16(vt, _mm_unpacklo_epi64(vidistx, vdistx)); | - | ||||||||||||||||||
| 1842 | vt = _mm_add_epi16(vt, _mm_srli_si128(vt, 8)); | - | ||||||||||||||||||
| 1843 | #ifdef Q_PROCESSOR_X86_64 | - | ||||||||||||||||||
| 1844 | return QRgba64::fromRgba64(_mm_cvtsi128_si64(vt)); never executed: return QRgba64::fromRgba64(_mm_cvtsi128_si64(vt)); | 0 | ||||||||||||||||||
| 1845 | #else | - | ||||||||||||||||||
| 1846 | QRgba64 out; | - | ||||||||||||||||||
| 1847 | _mm_storel_epi64((__m128i*)&out, vt); | - | ||||||||||||||||||
| 1848 | return out; | - | ||||||||||||||||||
| 1849 | #endif | - | ||||||||||||||||||
| 1850 | } | - | ||||||||||||||||||
| 1851 | #else | - | ||||||||||||||||||
| 1852 | static inline QRgba64 interpolate_4_pixels_rgb64(QRgba64 t[], QRgba64 b[], uint distx, uint disty) | - | ||||||||||||||||||
| 1853 | { | - | ||||||||||||||||||
| 1854 | const uint dx = distx>>8; | - | ||||||||||||||||||
| 1855 | const uint dy = disty>>8; | - | ||||||||||||||||||
| 1856 | const uint idx = 256 - dx; | - | ||||||||||||||||||
| 1857 | const uint idy = 256 - dy; | - | ||||||||||||||||||
| 1858 | QRgba64 xtop = interpolate256(t[0], idx, t[1], dx); | - | ||||||||||||||||||
| 1859 | QRgba64 xbot = interpolate256(b[0], idx, b[1], dx); | - | ||||||||||||||||||
| 1860 | return interpolate256(xtop, idy, xbot, dy); | - | ||||||||||||||||||
| 1861 | } | - | ||||||||||||||||||
| 1862 | #endif | - | ||||||||||||||||||
| 1863 | - | |||||||||||||||||||
| 1864 | template<TextureBlendType blendType> | - | ||||||||||||||||||
| 1865 | void fetchTransformedBilinear_pixelBounds(int max, int l1, int l2, int &v1, int &v2); | - | ||||||||||||||||||
| 1866 | - | |||||||||||||||||||
| 1867 | template<> | - | ||||||||||||||||||
| 1868 | inline void fetchTransformedBilinear_pixelBounds<BlendTransformedBilinearTiled>(int max, int, int, int &v1, int &v2) | - | ||||||||||||||||||
| 1869 | { | - | ||||||||||||||||||
| 1870 | v1 %= max; | - | ||||||||||||||||||
| 1871 | if (v1 < 0)
| 0 | ||||||||||||||||||
| 1872 | v1 += max; never executed: v1 += max; | 0 | ||||||||||||||||||
| 1873 | v2 = v1 + 1; | - | ||||||||||||||||||
| 1874 | if (v2 == max)
| 0 | ||||||||||||||||||
| 1875 | v2 = 0; never executed: v2 = 0; | 0 | ||||||||||||||||||
| 1876 | Q_ASSERT(v1 >= 0 && v1 < max); | - | ||||||||||||||||||
| 1877 | Q_ASSERT(v2 >= 0 && v2 < max); | - | ||||||||||||||||||
| 1878 | } never executed: end of block | 0 | ||||||||||||||||||
| 1879 | - | |||||||||||||||||||
| 1880 | template<> | - | ||||||||||||||||||
| 1881 | inline void fetchTransformedBilinear_pixelBounds<BlendTransformedBilinear>(int, int l1, int l2, int &v1, int &v2) | - | ||||||||||||||||||
| 1882 | { | - | ||||||||||||||||||
| 1883 | if (v1 < l1)
| 0 | ||||||||||||||||||
| 1884 | v2 = v1 = l1; never executed: v2 = v1 = l1; | 0 | ||||||||||||||||||
| 1885 | else if (v1 >= l2)
| 0 | ||||||||||||||||||
| 1886 | v2 = v1 = l2; never executed: v2 = v1 = l2; | 0 | ||||||||||||||||||
| 1887 | else | - | ||||||||||||||||||
| 1888 | v2 = v1 + 1; never executed: v2 = v1 + 1; | 0 | ||||||||||||||||||
| 1889 | Q_ASSERT(v1 >= l1 && v1 <= l2); | - | ||||||||||||||||||
| 1890 | Q_ASSERT(v2 >= l1 && v2 <= l2); | - | ||||||||||||||||||
| 1891 | } never executed: end of block | 0 | ||||||||||||||||||
| 1892 | - | |||||||||||||||||||
| 1893 | template<TextureBlendType blendType> /* blendType = BlendTransformedBilinear or BlendTransformedBilinearTiled */ | - | ||||||||||||||||||
| 1894 | static const uint * QT_FASTCALL fetchTransformedBilinearARGB32PM(uint *buffer, const Operator *, | - | ||||||||||||||||||
| 1895 | const QSpanData *data, int y, int x, | - | ||||||||||||||||||
| 1896 | int length) | - | ||||||||||||||||||
| 1897 | { | - | ||||||||||||||||||
| 1898 | int image_width = data->texture.width; | - | ||||||||||||||||||
| 1899 | int image_height = data->texture.height; | - | ||||||||||||||||||
| 1900 | - | |||||||||||||||||||
| 1901 | int image_x1 = data->texture.x1; | - | ||||||||||||||||||
| 1902 | int image_y1 = data->texture.y1; | - | ||||||||||||||||||
| 1903 | int image_x2 = data->texture.x2 - 1; | - | ||||||||||||||||||
| 1904 | int image_y2 = data->texture.y2 - 1; | - | ||||||||||||||||||
| 1905 | - | |||||||||||||||||||
| 1906 | const qreal cx = x + qreal(0.5); | - | ||||||||||||||||||
| 1907 | const qreal cy = y + qreal(0.5); | - | ||||||||||||||||||
| 1908 | - | |||||||||||||||||||
| 1909 | uint *end = buffer + length; | - | ||||||||||||||||||
| 1910 | uint *b = buffer; | - | ||||||||||||||||||
| 1911 | if (data->fast_matrix) {
| 0 | ||||||||||||||||||
| 1912 | // The increment pr x in the scanline | - | ||||||||||||||||||
| 1913 | int fdx = (int)(data->m11 * fixed_scale); | - | ||||||||||||||||||
| 1914 | int fdy = (int)(data->m12 * fixed_scale); | - | ||||||||||||||||||
| 1915 | - | |||||||||||||||||||
| 1916 | int fx = int((data->m21 * cy | - | ||||||||||||||||||
| 1917 | + data->m11 * cx + data->dx) * fixed_scale); | - | ||||||||||||||||||
| 1918 | int fy = int((data->m22 * cy | - | ||||||||||||||||||
| 1919 | + data->m12 * cx + data->dy) * fixed_scale); | - | ||||||||||||||||||
| 1920 | - | |||||||||||||||||||
| 1921 | fx -= half_point; | - | ||||||||||||||||||
| 1922 | fy -= half_point; | - | ||||||||||||||||||
| 1923 | - | |||||||||||||||||||
| 1924 | if (fdy == 0) { //simple scale, no rotation
| 0 | ||||||||||||||||||
| 1925 | int y1 = (fy >> 16); | - | ||||||||||||||||||
| 1926 | int y2; | - | ||||||||||||||||||
| 1927 | fetchTransformedBilinear_pixelBounds<blendType>(image_height, image_y1, image_y2, y1, y2); | - | ||||||||||||||||||
| 1928 | const uint *s1 = (const uint *)data->texture.scanLine(y1); | - | ||||||||||||||||||
| 1929 | const uint *s2 = (const uint *)data->texture.scanLine(y2); | - | ||||||||||||||||||
| 1930 | - | |||||||||||||||||||
| 1931 | if (fdx <= fixed_scale && fdx > 0) { // scale up on X
| 0 | ||||||||||||||||||
| 1932 | int disty = (fy & 0x0000ffff) >> 8; | - | ||||||||||||||||||
| 1933 | int idisty = 256 - disty; | - | ||||||||||||||||||
| 1934 | int x = fx >> 16; | - | ||||||||||||||||||
| 1935 | - | |||||||||||||||||||
| 1936 | // The idea is first to do the interpolation between the row s1 and the row s2 | - | ||||||||||||||||||
| 1937 | // into an intermediate buffer, then we interpolate between two pixel of this buffer. | - | ||||||||||||||||||
| 1938 | - | |||||||||||||||||||
| 1939 | // intermediate_buffer[0] is a buffer of red-blue component of the pixel, in the form 0x00RR00BB | - | ||||||||||||||||||
| 1940 | // intermediate_buffer[1] is the alpha-green component of the pixel, in the form 0x00AA00GG | - | ||||||||||||||||||
| 1941 | // +1 for the last pixel to interpolate with, and +1 for rounding errors. | - | ||||||||||||||||||
| 1942 | quint32 intermediate_buffer[2][buffer_size + 2]; | - | ||||||||||||||||||
| 1943 | // count is the size used in the intermediate_buffer. | - | ||||||||||||||||||
| 1944 | int count = (qint64(length) * fdx + fixed_scale - 1) / fixed_scale + 2; | - | ||||||||||||||||||
| 1945 | Q_ASSERT(count <= buffer_size + 2); //length is supposed to be <= buffer_size and data->m11 < 1 in this case | - | ||||||||||||||||||
| 1946 | int f = 0; | - | ||||||||||||||||||
| 1947 | int lim = count; | - | ||||||||||||||||||
| 1948 | if (blendType == BlendTransformedBilinearTiled) {
| 0 | ||||||||||||||||||
| 1949 | x %= image_width; | - | ||||||||||||||||||
| 1950 | if (x < 0) x += image_width; never executed: x += image_width;
| 0 | ||||||||||||||||||
| 1951 | } else { never executed: end of block | 0 | ||||||||||||||||||
| 1952 | lim = qMin(count, image_x2-x+1); | - | ||||||||||||||||||
| 1953 | if (x < image_x1) {
| 0 | ||||||||||||||||||
| 1954 | Q_ASSERT(x <= image_x2); | - | ||||||||||||||||||
| 1955 | uint t = s1[image_x1]; | - | ||||||||||||||||||
| 1956 | uint b = s2[image_x1]; | - | ||||||||||||||||||
| 1957 | quint32 rb = (((t & 0xff00ff) * idisty + (b & 0xff00ff) * disty) >> 8) & 0xff00ff; | - | ||||||||||||||||||
| 1958 | quint32 ag = ((((t>>8) & 0xff00ff) * idisty + ((b>>8) & 0xff00ff) * disty) >> 8) & 0xff00ff; | - | ||||||||||||||||||
| 1959 | do { | - | ||||||||||||||||||
| 1960 | intermediate_buffer[0][f] = rb; | - | ||||||||||||||||||
| 1961 | intermediate_buffer[1][f] = ag; | - | ||||||||||||||||||
| 1962 | f++; | - | ||||||||||||||||||
| 1963 | x++; | - | ||||||||||||||||||
| 1964 | } while (x < image_x1 && f < lim); never executed: end of block
| 0 | ||||||||||||||||||
| 1965 | } never executed: end of block | 0 | ||||||||||||||||||
| 1966 | } never executed: end of block | 0 | ||||||||||||||||||
| 1967 | - | |||||||||||||||||||
| 1968 | if (blendType != BlendTransformedBilinearTiled) {
| 0 | ||||||||||||||||||
| 1969 | #if defined(__SSE2__) | - | ||||||||||||||||||
| 1970 | const __m128i disty_ = _mm_set1_epi16(disty); | - | ||||||||||||||||||
| 1971 | const __m128i idisty_ = _mm_set1_epi16(idisty); | - | ||||||||||||||||||
| 1972 | const __m128i colorMask = _mm_set1_epi32(0x00ff00ff); | - | ||||||||||||||||||
| 1973 | - | |||||||||||||||||||
| 1974 | lim -= 3; | - | ||||||||||||||||||
| 1975 | for (; f < lim; x += 4, f += 4) {
| 0 | ||||||||||||||||||
| 1976 | // Load 4 pixels from s1, and split the alpha-green and red-blue component | - | ||||||||||||||||||
| 1977 | __m128i top = _mm_loadu_si128((const __m128i*)((const uint *)(s1)+x)); | - | ||||||||||||||||||
| 1978 | __m128i topAG = _mm_srli_epi16(top, 8); | - | ||||||||||||||||||
| 1979 | __m128i topRB = _mm_and_si128(top, colorMask); | - | ||||||||||||||||||
| 1980 | // Multiplies each colour component by idisty | - | ||||||||||||||||||
| 1981 | topAG = _mm_mullo_epi16 (topAG, idisty_); | - | ||||||||||||||||||
| 1982 | topRB = _mm_mullo_epi16 (topRB, idisty_); | - | ||||||||||||||||||
| 1983 | - | |||||||||||||||||||
| 1984 | // Same for the s2 vector | - | ||||||||||||||||||
| 1985 | __m128i bottom = _mm_loadu_si128((const __m128i*)((const uint *)(s2)+x)); | - | ||||||||||||||||||
| 1986 | __m128i bottomAG = _mm_srli_epi16(bottom, 8); | - | ||||||||||||||||||
| 1987 | __m128i bottomRB = _mm_and_si128(bottom, colorMask); | - | ||||||||||||||||||
| 1988 | bottomAG = _mm_mullo_epi16 (bottomAG, disty_); | - | ||||||||||||||||||
| 1989 | bottomRB = _mm_mullo_epi16 (bottomRB, disty_); | - | ||||||||||||||||||
| 1990 | - | |||||||||||||||||||
| 1991 | // Add the values, and shift to only keep 8 significant bits per colors | - | ||||||||||||||||||
| 1992 | __m128i rAG =_mm_add_epi16(topAG, bottomAG); | - | ||||||||||||||||||
| 1993 | rAG = _mm_srli_epi16(rAG, 8); | - | ||||||||||||||||||
| 1994 | _mm_storeu_si128((__m128i*)(&intermediate_buffer[1][f]), rAG); | - | ||||||||||||||||||
| 1995 | __m128i rRB =_mm_add_epi16(topRB, bottomRB); | - | ||||||||||||||||||
| 1996 | rRB = _mm_srli_epi16(rRB, 8); | - | ||||||||||||||||||
| 1997 | _mm_storeu_si128((__m128i*)(&intermediate_buffer[0][f]), rRB); | - | ||||||||||||||||||
| 1998 | } never executed: end of block | 0 | ||||||||||||||||||
| 1999 | #elif defined(__ARM_NEON__) | - | ||||||||||||||||||
| 2000 | const int16x8_t disty_ = vdupq_n_s16(disty); | - | ||||||||||||||||||
| 2001 | const int16x8_t idisty_ = vdupq_n_s16(idisty); | - | ||||||||||||||||||
| 2002 | const int16x8_t colorMask = vdupq_n_s16(0x00ff); | - | ||||||||||||||||||
| 2003 | - | |||||||||||||||||||
| 2004 | lim -= 3; | - | ||||||||||||||||||
| 2005 | for (; f < lim; x += 4, f += 4) { | - | ||||||||||||||||||
| 2006 | // Load 4 pixels from s1, and split the alpha-green and red-blue component | - | ||||||||||||||||||
| 2007 | int16x8_t top = vld1q_s16((int16_t*)((const uint *)(s1)+x)); | - | ||||||||||||||||||
| 2008 | int16x8_t topAG = vreinterpretq_s16_u16(vshrq_n_u16(vreinterpretq_u16_s16(top), 8)); | - | ||||||||||||||||||
| 2009 | int16x8_t topRB = vandq_s16(top, colorMask); | - | ||||||||||||||||||
| 2010 | // Multiplies each colour component by idisty | - | ||||||||||||||||||
| 2011 | topAG = vmulq_s16(topAG, idisty_); | - | ||||||||||||||||||
| 2012 | topRB = vmulq_s16(topRB, idisty_); | - | ||||||||||||||||||
| 2013 | - | |||||||||||||||||||
| 2014 | // Same for the s2 vector | - | ||||||||||||||||||
| 2015 | int16x8_t bottom = vld1q_s16((int16_t*)((const uint *)(s2)+x)); | - | ||||||||||||||||||
| 2016 | int16x8_t bottomAG = vreinterpretq_s16_u16(vshrq_n_u16(vreinterpretq_u16_s16(bottom), 8)); | - | ||||||||||||||||||
| 2017 | int16x8_t bottomRB = vandq_s16(bottom, colorMask); | - | ||||||||||||||||||
| 2018 | bottomAG = vmulq_s16(bottomAG, disty_); | - | ||||||||||||||||||
| 2019 | bottomRB = vmulq_s16(bottomRB, disty_); | - | ||||||||||||||||||
| 2020 | - | |||||||||||||||||||
| 2021 | // Add the values, and shift to only keep 8 significant bits per colors | - | ||||||||||||||||||
| 2022 | int16x8_t rAG = vaddq_s16(topAG, bottomAG); | - | ||||||||||||||||||
| 2023 | rAG = vreinterpretq_s16_u16(vshrq_n_u16(vreinterpretq_u16_s16(rAG), 8)); | - | ||||||||||||||||||
| 2024 | vst1q_s16((int16_t*)(&intermediate_buffer[1][f]), rAG); | - | ||||||||||||||||||
| 2025 | int16x8_t rRB = vaddq_s16(topRB, bottomRB); | - | ||||||||||||||||||
| 2026 | rRB = vreinterpretq_s16_u16(vshrq_n_u16(vreinterpretq_u16_s16(rRB), 8)); | - | ||||||||||||||||||
| 2027 | vst1q_s16((int16_t*)(&intermediate_buffer[0][f]), rRB); | - | ||||||||||||||||||
| 2028 | } | - | ||||||||||||||||||
| 2029 | #endif | - | ||||||||||||||||||
| 2030 | } never executed: end of block | 0 | ||||||||||||||||||
| 2031 | for (; f < count; f++) { // Same as above but without sse2
| 0 | ||||||||||||||||||
| 2032 | if (blendType == BlendTransformedBilinearTiled) {
| 0 | ||||||||||||||||||
| 2033 | if (x >= image_width) x -= image_width; never executed: x -= image_width;
| 0 | ||||||||||||||||||
| 2034 | } else { never executed: end of block | 0 | ||||||||||||||||||
| 2035 | x = qMin(x, image_x2); | - | ||||||||||||||||||
| 2036 | } never executed: end of block | 0 | ||||||||||||||||||
| 2037 | - | |||||||||||||||||||
| 2038 | uint t = s1[x]; | - | ||||||||||||||||||
| 2039 | uint b = s2[x]; | - | ||||||||||||||||||
| 2040 | - | |||||||||||||||||||
| 2041 | intermediate_buffer[0][f] = (((t & 0xff00ff) * idisty + (b & 0xff00ff) * disty) >> 8) & 0xff00ff; | - | ||||||||||||||||||
| 2042 | intermediate_buffer[1][f] = ((((t>>8) & 0xff00ff) * idisty + ((b>>8) & 0xff00ff) * disty) >> 8) & 0xff00ff; | - | ||||||||||||||||||
| 2043 | x++; | - | ||||||||||||||||||
| 2044 | } never executed: end of block | 0 | ||||||||||||||||||
| 2045 | // Now interpolate the values from the intermediate_buffer to get the final result. | - | ||||||||||||||||||
| 2046 | fx &= fixed_scale - 1; | - | ||||||||||||||||||
| 2047 | Q_ASSERT((fx >> 16) == 0); | - | ||||||||||||||||||
| 2048 | while (b < end) {
| 0 | ||||||||||||||||||
| 2049 | int x1 = (fx >> 16); | - | ||||||||||||||||||
| 2050 | int x2 = x1 + 1; | - | ||||||||||||||||||
| 2051 | Q_ASSERT(x1 >= 0); | - | ||||||||||||||||||
| 2052 | Q_ASSERT(x2 < count); | - | ||||||||||||||||||
| 2053 | - | |||||||||||||||||||
| 2054 | int distx = (fx & 0x0000ffff) >> 8; | - | ||||||||||||||||||
| 2055 | int idistx = 256 - distx; | - | ||||||||||||||||||
| 2056 | int rb = ((intermediate_buffer[0][x1] * idistx + intermediate_buffer[0][x2] * distx) >> 8) & 0xff00ff; | - | ||||||||||||||||||
| 2057 | int ag = (intermediate_buffer[1][x1] * idistx + intermediate_buffer[1][x2] * distx) & 0xff00ff00; | - | ||||||||||||||||||
| 2058 | *b = rb | ag; | - | ||||||||||||||||||
| 2059 | b++; | - | ||||||||||||||||||
| 2060 | fx += fdx; | - | ||||||||||||||||||
| 2061 | } never executed: end of block | 0 | ||||||||||||||||||
| 2062 | } else if ((fdx < 0 && fdx > -(fixed_scale / 8)) || std::abs(data->m22) < (1./8.)) { // scale up more than 8x never executed: end of block
| 0 | ||||||||||||||||||
| 2063 | int y1 = (fy >> 16); | - | ||||||||||||||||||
| 2064 | int y2; | - | ||||||||||||||||||
| 2065 | fetchTransformedBilinear_pixelBounds<blendType>(image_height, image_y1, image_y2, y1, y2); | - | ||||||||||||||||||
| 2066 | const uint *s1 = (const uint *)data->texture.scanLine(y1); | - | ||||||||||||||||||
| 2067 | const uint *s2 = (const uint *)data->texture.scanLine(y2); | - | ||||||||||||||||||
| 2068 | int disty = (fy & 0x0000ffff) >> 8; | - | ||||||||||||||||||
| 2069 | while (b < end) {
| 0 | ||||||||||||||||||
| 2070 | int x1 = (fx >> 16); | - | ||||||||||||||||||
| 2071 | int x2; | - | ||||||||||||||||||
| 2072 | fetchTransformedBilinear_pixelBounds<blendType>(image_width, image_x1, image_x2, x1, x2); | - | ||||||||||||||||||
| 2073 | uint tl = s1[x1]; | - | ||||||||||||||||||
| 2074 | uint tr = s1[x2]; | - | ||||||||||||||||||
| 2075 | uint bl = s2[x1]; | - | ||||||||||||||||||
| 2076 | uint br = s2[x2]; | - | ||||||||||||||||||
| 2077 | int distx = (fx & 0x0000ffff) >> 8; | - | ||||||||||||||||||
| 2078 | *b = interpolate_4_pixels(tl, tr, bl, br, distx, disty); | - | ||||||||||||||||||
| 2079 | - | |||||||||||||||||||
| 2080 | fx += fdx; | - | ||||||||||||||||||
| 2081 | ++b; | - | ||||||||||||||||||
| 2082 | } never executed: end of block | 0 | ||||||||||||||||||
| 2083 | } else { //scale down never executed: end of block | 0 | ||||||||||||||||||
| 2084 | int y1 = (fy >> 16); | - | ||||||||||||||||||
| 2085 | int y2; | - | ||||||||||||||||||
| 2086 | fetchTransformedBilinear_pixelBounds<blendType>(image_height, image_y1, image_y2, y1, y2); | - | ||||||||||||||||||
| 2087 | const uint *s1 = (const uint *)data->texture.scanLine(y1); | - | ||||||||||||||||||
| 2088 | const uint *s2 = (const uint *)data->texture.scanLine(y2); | - | ||||||||||||||||||
| 2089 | int disty = (fy & 0x0000ffff) >> 12; | - | ||||||||||||||||||
| 2090 | - | |||||||||||||||||||
| 2091 | if (blendType != BlendTransformedBilinearTiled) {
| 0 | ||||||||||||||||||
| 2092 | #define BILINEAR_DOWNSCALE_BOUNDS_PROLOG \ | - | ||||||||||||||||||
| 2093 | while (b < end) { \ | - | ||||||||||||||||||
| 2094 | int x1 = (fx >> 16); \ | - | ||||||||||||||||||
| 2095 | int x2; \ | - | ||||||||||||||||||
| 2096 | fetchTransformedBilinear_pixelBounds<blendType>(image_width, image_x1, image_x2, x1, x2); \ | - | ||||||||||||||||||
| 2097 | if (x1 != x2) \ | - | ||||||||||||||||||
| 2098 | break; \ | - | ||||||||||||||||||
| 2099 | uint tl = s1[x1]; \ | - | ||||||||||||||||||
| 2100 | uint tr = s1[x2]; \ | - | ||||||||||||||||||
| 2101 | uint bl = s2[x1]; \ | - | ||||||||||||||||||
| 2102 | uint br = s2[x2]; \ | - | ||||||||||||||||||
| 2103 | int distx = (fx & 0x0000ffff) >> 12; \ | - | ||||||||||||||||||
| 2104 | *b = interpolate_4_pixels_16(tl, tr, bl, br, distx, disty); \ | - | ||||||||||||||||||
| 2105 | fx += fdx; \ | - | ||||||||||||||||||
| 2106 | ++b; \ | - | ||||||||||||||||||
| 2107 | } \ | - | ||||||||||||||||||
| 2108 | uint *boundedEnd; \ | - | ||||||||||||||||||
| 2109 | if (fdx > 0) \ | - | ||||||||||||||||||
| 2110 | boundedEnd = qMin(end, buffer + uint((image_x2 - (fx >> 16)) / data->m11)); \ | - | ||||||||||||||||||
| 2111 | else \ | - | ||||||||||||||||||
| 2112 | boundedEnd = qMin(end, buffer + uint((image_x1 - (fx >> 16)) / data->m11)); \ | - | ||||||||||||||||||
| 2113 | boundedEnd -= 3; | - | ||||||||||||||||||
| 2114 | - | |||||||||||||||||||
| 2115 | #if defined(__SSE2__) | - | ||||||||||||||||||
| 2116 | BILINEAR_DOWNSCALE_BOUNDS_PROLOG never executed: break;never executed: end of blocknever executed: boundedEnd = qMin(end, buffer + uint((image_x2 - (fx >> 16)) / data->m11));never executed: boundedEnd = qMin(end, buffer + uint((image_x1 - (fx >> 16)) / data->m11));
| 0 | ||||||||||||||||||
| 2117 | - | |||||||||||||||||||
| 2118 | const __m128i colorMask = _mm_set1_epi32(0x00ff00ff); | - | ||||||||||||||||||
| 2119 | const __m128i v_256 = _mm_set1_epi16(256); | - | ||||||||||||||||||
| 2120 | const __m128i v_disty = _mm_set1_epi16(disty); | - | ||||||||||||||||||
| 2121 | const __m128i v_fdx = _mm_set1_epi32(fdx*4); | - | ||||||||||||||||||
| 2122 | __m128i v_fx = _mm_setr_epi32(fx, fx + fdx, fx + fdx + fdx, fx + fdx + fdx + fdx); | - | ||||||||||||||||||
| 2123 | - | |||||||||||||||||||
| 2124 | while (b < boundedEnd) {
| 0 | ||||||||||||||||||
| 2125 | __m128i offset = _mm_srli_epi32(v_fx, 16); | - | ||||||||||||||||||
| 2126 | const int offset0 = _mm_cvtsi128_si32(offset); offset = _mm_srli_si128(offset, 4); | - | ||||||||||||||||||
| 2127 | const int offset1 = _mm_cvtsi128_si32(offset); offset = _mm_srli_si128(offset, 4); | - | ||||||||||||||||||
| 2128 | const int offset2 = _mm_cvtsi128_si32(offset); offset = _mm_srli_si128(offset, 4); | - | ||||||||||||||||||
| 2129 | const int offset3 = _mm_cvtsi128_si32(offset); | - | ||||||||||||||||||
| 2130 | const __m128i tl = _mm_setr_epi32(s1[offset0], s1[offset1], s1[offset2], s1[offset3]); | - | ||||||||||||||||||
| 2131 | const __m128i tr = _mm_setr_epi32(s1[offset0 + 1], s1[offset1 + 1], s1[offset2 + 1], s1[offset3 + 1]); | - | ||||||||||||||||||
| 2132 | const __m128i bl = _mm_setr_epi32(s2[offset0], s2[offset1], s2[offset2], s2[offset3]); | - | ||||||||||||||||||
| 2133 | const __m128i br = _mm_setr_epi32(s2[offset0 + 1], s2[offset1 + 1], s2[offset2 + 1], s2[offset3 + 1]); | - | ||||||||||||||||||
| 2134 | - | |||||||||||||||||||
| 2135 | __m128i v_distx = _mm_srli_epi16(v_fx, 12); | - | ||||||||||||||||||
| 2136 | v_distx = _mm_shufflehi_epi16(v_distx, _MM_SHUFFLE(2,2,0,0)); | - | ||||||||||||||||||
| 2137 | v_distx = _mm_shufflelo_epi16(v_distx, _MM_SHUFFLE(2,2,0,0)); | - | ||||||||||||||||||
| 2138 | - | |||||||||||||||||||
| 2139 | interpolate_4_pixels_16_sse2(tl, tr, bl, br, v_distx, v_disty, colorMask, v_256, b); | - | ||||||||||||||||||
| 2140 | b += 4; | - | ||||||||||||||||||
| 2141 | v_fx = _mm_add_epi32(v_fx, v_fdx); | - | ||||||||||||||||||
| 2142 | } never executed: end of block | 0 | ||||||||||||||||||
| 2143 | fx = _mm_cvtsi128_si32(v_fx); | - | ||||||||||||||||||
| 2144 | #elif defined(__ARM_NEON__) | - | ||||||||||||||||||
| 2145 | BILINEAR_DOWNSCALE_BOUNDS_PROLOG | - | ||||||||||||||||||
| 2146 | - | |||||||||||||||||||
| 2147 | const int16x8_t colorMask = vdupq_n_s16(0x00ff); | - | ||||||||||||||||||
| 2148 | const int16x8_t invColorMask = vmvnq_s16(colorMask); | - | ||||||||||||||||||
| 2149 | const int16x8_t v_256 = vdupq_n_s16(256); | - | ||||||||||||||||||
| 2150 | const int16x8_t v_disty = vdupq_n_s16(disty); | - | ||||||||||||||||||
| 2151 | const int16x8_t v_disty_ = vshlq_n_s16(v_disty, 4); | - | ||||||||||||||||||
| 2152 | int32x4_t v_fdx = vdupq_n_s32(fdx*4); | - | ||||||||||||||||||
| 2153 | - | |||||||||||||||||||
| 2154 | ptrdiff_t secondLine = reinterpret_cast<const uint *>(s2) - reinterpret_cast<const uint *>(s1); | - | ||||||||||||||||||
| 2155 | - | |||||||||||||||||||
| 2156 | union Vect_buffer { int32x4_t vect; quint32 i[4]; }; | - | ||||||||||||||||||
| 2157 | Vect_buffer v_fx; | - | ||||||||||||||||||
| 2158 | - | |||||||||||||||||||
| 2159 | for (int i = 0; i < 4; i++) { | - | ||||||||||||||||||
| 2160 | v_fx.i[i] = fx; | - | ||||||||||||||||||
| 2161 | fx += fdx; | - | ||||||||||||||||||
| 2162 | } | - | ||||||||||||||||||
| 2163 | - | |||||||||||||||||||
| 2164 | const int32x4_t v_ffff_mask = vdupq_n_s32(0x0000ffff); | - | ||||||||||||||||||
| 2165 | - | |||||||||||||||||||
| 2166 | while (b < boundedEnd) { | - | ||||||||||||||||||
| 2167 | - | |||||||||||||||||||
| 2168 | Vect_buffer tl, tr, bl, br; | - | ||||||||||||||||||
| 2169 | - | |||||||||||||||||||
| 2170 | Vect_buffer v_fx_shifted; | - | ||||||||||||||||||
| 2171 | v_fx_shifted.vect = vshrq_n_s32(v_fx.vect, 16); | - | ||||||||||||||||||
| 2172 | - | |||||||||||||||||||
| 2173 | int32x4_t v_distx = vshrq_n_s32(vandq_s32(v_fx.vect, v_ffff_mask), 12); | - | ||||||||||||||||||
| 2174 | - | |||||||||||||||||||
| 2175 | for (int i = 0; i < 4; i++) { | - | ||||||||||||||||||
| 2176 | int x1 = v_fx_shifted.i[i]; | - | ||||||||||||||||||
| 2177 | const uint *addr_tl = reinterpret_cast<const uint *>(s1) + x1; | - | ||||||||||||||||||
| 2178 | const uint *addr_tr = addr_tl + 1; | - | ||||||||||||||||||
| 2179 | tl.i[i] = *addr_tl; | - | ||||||||||||||||||
| 2180 | tr.i[i] = *addr_tr; | - | ||||||||||||||||||
| 2181 | bl.i[i] = *(addr_tl+secondLine); | - | ||||||||||||||||||
| 2182 | br.i[i] = *(addr_tr+secondLine); | - | ||||||||||||||||||
| 2183 | } | - | ||||||||||||||||||
| 2184 | - | |||||||||||||||||||
| 2185 | v_distx = vorrq_s32(v_distx, vshlq_n_s32(v_distx, 16)); | - | ||||||||||||||||||
| 2186 | - | |||||||||||||||||||
| 2187 | interpolate_4_pixels_16_neon(vreinterpretq_s16_s32(tl.vect), vreinterpretq_s16_s32(tr.vect), vreinterpretq_s16_s32(bl.vect), vreinterpretq_s16_s32(br.vect), vreinterpretq_s16_s32(v_distx), v_disty, v_disty_, colorMask, invColorMask, v_256, b); | - | ||||||||||||||||||
| 2188 | b+=4; | - | ||||||||||||||||||
| 2189 | v_fx.vect = vaddq_s32(v_fx.vect, v_fdx); | - | ||||||||||||||||||
| 2190 | } | - | ||||||||||||||||||
| 2191 | fx = v_fx.i[0]; | - | ||||||||||||||||||
| 2192 | #endif | - | ||||||||||||||||||
| 2193 | } never executed: end of block | 0 | ||||||||||||||||||
| 2194 | - | |||||||||||||||||||
| 2195 | while (b < end) {
| 0 | ||||||||||||||||||
| 2196 | int x1 = (fx >> 16); | - | ||||||||||||||||||
| 2197 | int x2; | - | ||||||||||||||||||
| 2198 | fetchTransformedBilinear_pixelBounds<blendType>(image_width, image_x1, image_x2, x1, x2); | - | ||||||||||||||||||
| 2199 | uint tl = s1[x1]; | - | ||||||||||||||||||
| 2200 | uint tr = s1[x2]; | - | ||||||||||||||||||
| 2201 | uint bl = s2[x1]; | - | ||||||||||||||||||
| 2202 | uint br = s2[x2]; | - | ||||||||||||||||||
| 2203 | int distx = (fx & 0x0000ffff) >> 12; | - | ||||||||||||||||||
| 2204 | *b = interpolate_4_pixels_16(tl, tr, bl, br, distx, disty); | - | ||||||||||||||||||
| 2205 | fx += fdx; | - | ||||||||||||||||||
| 2206 | ++b; | - | ||||||||||||||||||
| 2207 | } never executed: end of block | 0 | ||||||||||||||||||
| 2208 | } never executed: end of block | 0 | ||||||||||||||||||
| 2209 | } else { //rotation | - | ||||||||||||||||||
| 2210 | if (std::abs(data->m11) > 8 || std::abs(data->m22) > 8) {
| 0 | ||||||||||||||||||
| 2211 | //if we are zooming more than 8 times, we use 8bit precision for the position. | - | ||||||||||||||||||
| 2212 | while (b < end) {
| 0 | ||||||||||||||||||
| 2213 | int x1 = (fx >> 16); | - | ||||||||||||||||||
| 2214 | int x2; | - | ||||||||||||||||||
| 2215 | int y1 = (fy >> 16); | - | ||||||||||||||||||
| 2216 | int y2; | - | ||||||||||||||||||
| 2217 | - | |||||||||||||||||||
| 2218 | fetchTransformedBilinear_pixelBounds<blendType>(image_width, image_x1, image_x2, x1, x2); | - | ||||||||||||||||||
| 2219 | fetchTransformedBilinear_pixelBounds<blendType>(image_height, image_y1, image_y2, y1, y2); | - | ||||||||||||||||||
| 2220 | - | |||||||||||||||||||
| 2221 | const uint *s1 = (const uint *)data->texture.scanLine(y1); | - | ||||||||||||||||||
| 2222 | const uint *s2 = (const uint *)data->texture.scanLine(y2); | - | ||||||||||||||||||
| 2223 | - | |||||||||||||||||||
| 2224 | uint tl = s1[x1]; | - | ||||||||||||||||||
| 2225 | uint tr = s1[x2]; | - | ||||||||||||||||||
| 2226 | uint bl = s2[x1]; | - | ||||||||||||||||||
| 2227 | uint br = s2[x2]; | - | ||||||||||||||||||
| 2228 | - | |||||||||||||||||||
| 2229 | int distx = (fx & 0x0000ffff) >> 8; | - | ||||||||||||||||||
| 2230 | int disty = (fy & 0x0000ffff) >> 8; | - | ||||||||||||||||||
| 2231 | - | |||||||||||||||||||
| 2232 | *b = interpolate_4_pixels(tl, tr, bl, br, distx, disty); | - | ||||||||||||||||||
| 2233 | - | |||||||||||||||||||
| 2234 | fx += fdx; | - | ||||||||||||||||||
| 2235 | fy += fdy; | - | ||||||||||||||||||
| 2236 | ++b; | - | ||||||||||||||||||
| 2237 | } never executed: end of block | 0 | ||||||||||||||||||
| 2238 | } else { never executed: end of block | 0 | ||||||||||||||||||
| 2239 | //we are zooming less than 8x, use 4bit precision | - | ||||||||||||||||||
| 2240 | - | |||||||||||||||||||
| 2241 | if (blendType != BlendTransformedBilinearTiled) {
| 0 | ||||||||||||||||||
| 2242 | #define BILINEAR_ROTATE_BOUNDS_PROLOG \ | - | ||||||||||||||||||
| 2243 | while (b < end) { \ | - | ||||||||||||||||||
| 2244 | int x1 = (fx >> 16); \ | - | ||||||||||||||||||
| 2245 | int x2; \ | - | ||||||||||||||||||
| 2246 | int y1 = (fy >> 16); \ | - | ||||||||||||||||||
| 2247 | int y2; \ | - | ||||||||||||||||||
| 2248 | fetchTransformedBilinear_pixelBounds<blendType>(image_width, image_x1, image_x2, x1, x2); \ | - | ||||||||||||||||||
| 2249 | fetchTransformedBilinear_pixelBounds<blendType>(image_height, image_y1, image_y2, y1, y2); \ | - | ||||||||||||||||||
| 2250 | if (x1 != x2 && y1 != y2) \ | - | ||||||||||||||||||
| 2251 | break; \ | - | ||||||||||||||||||
| 2252 | const uint *s1 = (const uint *)data->texture.scanLine(y1); \ | - | ||||||||||||||||||
| 2253 | const uint *s2 = (const uint *)data->texture.scanLine(y2); \ | - | ||||||||||||||||||
| 2254 | uint tl = s1[x1]; \ | - | ||||||||||||||||||
| 2255 | uint tr = s1[x2]; \ | - | ||||||||||||||||||
| 2256 | uint bl = s2[x1]; \ | - | ||||||||||||||||||
| 2257 | uint br = s2[x2]; \ | - | ||||||||||||||||||
| 2258 | int distx = (fx & 0x0000ffff) >> 8; \ | - | ||||||||||||||||||
| 2259 | int disty = (fy & 0x0000ffff) >> 8; \ | - | ||||||||||||||||||
| 2260 | *b = interpolate_4_pixels(tl, tr, bl, br, distx, disty); \ | - | ||||||||||||||||||
| 2261 | fx += fdx; \ | - | ||||||||||||||||||
| 2262 | fy += fdy; \ | - | ||||||||||||||||||
| 2263 | ++b; \ | - | ||||||||||||||||||
| 2264 | } \ | - | ||||||||||||||||||
| 2265 | uint *boundedEnd = end - 3; \ | - | ||||||||||||||||||
| 2266 | boundedEnd -= 3; | - | ||||||||||||||||||
| 2267 | - | |||||||||||||||||||
| 2268 | #if defined(__SSE2__) | - | ||||||||||||||||||
| 2269 | BILINEAR_ROTATE_BOUNDS_PROLOG never executed: break;never executed: end of block
| 0 | ||||||||||||||||||
| 2270 | - | |||||||||||||||||||
| 2271 | const __m128i colorMask = _mm_set1_epi32(0x00ff00ff); | - | ||||||||||||||||||
| 2272 | const __m128i v_256 = _mm_set1_epi16(256); | - | ||||||||||||||||||
| 2273 | const __m128i v_fdx = _mm_set1_epi32(fdx*4); | - | ||||||||||||||||||
| 2274 | const __m128i v_fdy = _mm_set1_epi32(fdy*4); | - | ||||||||||||||||||
| 2275 | __m128i v_fx = _mm_setr_epi32(fx, fx + fdx, fx + fdx + fdx, fx + fdx + fdx + fdx); | - | ||||||||||||||||||
| 2276 | __m128i v_fy = _mm_setr_epi32(fy, fy + fdy, fy + fdy + fdy, fy + fdy + fdy + fdy); | - | ||||||||||||||||||
| 2277 | - | |||||||||||||||||||
| 2278 | const uchar *textureData = data->texture.imageData; | - | ||||||||||||||||||
| 2279 | const int bytesPerLine = data->texture.bytesPerLine; | - | ||||||||||||||||||
| 2280 | const __m128i vbpl = _mm_shufflelo_epi16(_mm_cvtsi32_si128(bytesPerLine/4), _MM_SHUFFLE(0, 0, 0, 0)); | - | ||||||||||||||||||
| 2281 | - | |||||||||||||||||||
| 2282 | while (b < boundedEnd) {
| 0 | ||||||||||||||||||
| 2283 | if (fdx > 0 && (short)_mm_extract_epi16(v_fx, 7) >= image_x2)
| 0 | ||||||||||||||||||
| 2284 | break; never executed: break; | 0 | ||||||||||||||||||
| 2285 | if (fdx < 0 && (short)_mm_extract_epi16(v_fx, 7) < image_x1)
| 0 | ||||||||||||||||||
| 2286 | break; never executed: break; | 0 | ||||||||||||||||||
| 2287 | if (fdy > 0 && (short)_mm_extract_epi16(v_fy, 7) >= image_y2)
| 0 | ||||||||||||||||||
| 2288 | break; never executed: break; | 0 | ||||||||||||||||||
| 2289 | if (fdy < 0 && (short)_mm_extract_epi16(v_fy, 7) < image_y1)
| 0 | ||||||||||||||||||
| 2290 | break; never executed: break; | 0 | ||||||||||||||||||
| 2291 | - | |||||||||||||||||||
| 2292 | const __m128i vy = _mm_packs_epi32(_mm_srli_epi32(v_fy, 16), _mm_setzero_si128()); | - | ||||||||||||||||||
| 2293 | // 4x16bit * 4x16bit -> 4x32bit | - | ||||||||||||||||||
| 2294 | __m128i offset = _mm_unpacklo_epi16(_mm_mullo_epi16(vy, vbpl), _mm_mulhi_epi16(vy, vbpl)); | - | ||||||||||||||||||
| 2295 | offset = _mm_add_epi32(offset, _mm_srli_epi32(v_fx, 16)); | - | ||||||||||||||||||
| 2296 | const int offset0 = _mm_cvtsi128_si32(offset); offset = _mm_srli_si128(offset, 4); | - | ||||||||||||||||||
| 2297 | const int offset1 = _mm_cvtsi128_si32(offset); offset = _mm_srli_si128(offset, 4); | - | ||||||||||||||||||
| 2298 | const int offset2 = _mm_cvtsi128_si32(offset); offset = _mm_srli_si128(offset, 4); | - | ||||||||||||||||||
| 2299 | const int offset3 = _mm_cvtsi128_si32(offset); | - | ||||||||||||||||||
| 2300 | const uint *topData = (const uint *)(textureData); | - | ||||||||||||||||||
| 2301 | const __m128i tl = _mm_setr_epi32(topData[offset0], topData[offset1], topData[offset2], topData[offset3]); | - | ||||||||||||||||||
| 2302 | const __m128i tr = _mm_setr_epi32(topData[offset0 + 1], topData[offset1 + 1], topData[offset2 + 1], topData[offset3 + 1]); | - | ||||||||||||||||||
| 2303 | const uint *bottomData = (const uint *)(textureData + bytesPerLine); | - | ||||||||||||||||||
| 2304 | const __m128i bl = _mm_setr_epi32(bottomData[offset0], bottomData[offset1], bottomData[offset2], bottomData[offset3]); | - | ||||||||||||||||||
| 2305 | const __m128i br = _mm_setr_epi32(bottomData[offset0 + 1], bottomData[offset1 + 1], bottomData[offset2 + 1], bottomData[offset3 + 1]); | - | ||||||||||||||||||
| 2306 | - | |||||||||||||||||||
| 2307 | __m128i v_distx = _mm_srli_epi16(v_fx, 12); | - | ||||||||||||||||||
| 2308 | __m128i v_disty = _mm_srli_epi16(v_fy, 12); | - | ||||||||||||||||||
| 2309 | v_distx = _mm_shufflehi_epi16(v_distx, _MM_SHUFFLE(2,2,0,0)); | - | ||||||||||||||||||
| 2310 | v_distx = _mm_shufflelo_epi16(v_distx, _MM_SHUFFLE(2,2,0,0)); | - | ||||||||||||||||||
| 2311 | v_disty = _mm_shufflehi_epi16(v_disty, _MM_SHUFFLE(2,2,0,0)); | - | ||||||||||||||||||
| 2312 | v_disty = _mm_shufflelo_epi16(v_disty, _MM_SHUFFLE(2,2,0,0)); | - | ||||||||||||||||||
| 2313 | - | |||||||||||||||||||
| 2314 | interpolate_4_pixels_16_sse2(tl, tr, bl, br, v_distx, v_disty, colorMask, v_256, b); | - | ||||||||||||||||||
| 2315 | b += 4; | - | ||||||||||||||||||
| 2316 | v_fx = _mm_add_epi32(v_fx, v_fdx); | - | ||||||||||||||||||
| 2317 | v_fy = _mm_add_epi32(v_fy, v_fdy); | - | ||||||||||||||||||
| 2318 | } never executed: end of block | 0 | ||||||||||||||||||
| 2319 | fx = _mm_cvtsi128_si32(v_fx); | - | ||||||||||||||||||
| 2320 | fy = _mm_cvtsi128_si32(v_fy); | - | ||||||||||||||||||
| 2321 | #endif | - | ||||||||||||||||||
| 2322 | } never executed: end of block | 0 | ||||||||||||||||||
| 2323 | - | |||||||||||||||||||
| 2324 | while (b < end) {
| 0 | ||||||||||||||||||
| 2325 | int x1 = (fx >> 16); | - | ||||||||||||||||||
| 2326 | int x2; | - | ||||||||||||||||||
| 2327 | int y1 = (fy >> 16); | - | ||||||||||||||||||
| 2328 | int y2; | - | ||||||||||||||||||
| 2329 | - | |||||||||||||||||||
| 2330 | fetchTransformedBilinear_pixelBounds<blendType>(image_width, image_x1, image_x2, x1, x2); | - | ||||||||||||||||||
| 2331 | fetchTransformedBilinear_pixelBounds<blendType>(image_height, image_y1, image_y2, y1, y2); | - | ||||||||||||||||||
| 2332 | - | |||||||||||||||||||
| 2333 | const uint *s1 = (const uint *)data->texture.scanLine(y1); | - | ||||||||||||||||||
| 2334 | const uint *s2 = (const uint *)data->texture.scanLine(y2); | - | ||||||||||||||||||
| 2335 | - | |||||||||||||||||||
| 2336 | uint tl = s1[x1]; | - | ||||||||||||||||||
| 2337 | uint tr = s1[x2]; | - | ||||||||||||||||||
| 2338 | uint bl = s2[x1]; | - | ||||||||||||||||||
| 2339 | uint br = s2[x2]; | - | ||||||||||||||||||
| 2340 | - | |||||||||||||||||||
| 2341 | #if defined(__SSE2__) | - | ||||||||||||||||||
| 2342 | // The SSE2 optimized interpolate_4_pixels is faster than interpolate_4_pixels_16. | - | ||||||||||||||||||
| 2343 | int distx = (fx & 0x0000ffff) >> 8; | - | ||||||||||||||||||
| 2344 | int disty = (fy & 0x0000ffff) >> 8; | - | ||||||||||||||||||
| 2345 | *b = interpolate_4_pixels(tl, tr, bl, br, distx, disty); | - | ||||||||||||||||||
| 2346 | #else | - | ||||||||||||||||||
| 2347 | int distx = (fx & 0x0000ffff) >> 12; | - | ||||||||||||||||||
| 2348 | int disty = (fy & 0x0000ffff) >> 12; | - | ||||||||||||||||||
| 2349 | *b = interpolate_4_pixels_16(tl, tr, bl, br, distx, disty); | - | ||||||||||||||||||
| 2350 | #endif | - | ||||||||||||||||||
| 2351 | - | |||||||||||||||||||
| 2352 | fx += fdx; | - | ||||||||||||||||||
| 2353 | fy += fdy; | - | ||||||||||||||||||
| 2354 | ++b; | - | ||||||||||||||||||
| 2355 | } never executed: end of block | 0 | ||||||||||||||||||
| 2356 | } never executed: end of block | 0 | ||||||||||||||||||
| 2357 | } | - | ||||||||||||||||||
| 2358 | } else { | - | ||||||||||||||||||
| 2359 | const qreal fdx = data->m11; | - | ||||||||||||||||||
| 2360 | const qreal fdy = data->m12; | - | ||||||||||||||||||
| 2361 | const qreal fdw = data->m13; | - | ||||||||||||||||||
| 2362 | - | |||||||||||||||||||
| 2363 | qreal fx = data->m21 * cy + data->m11 * cx + data->dx; | - | ||||||||||||||||||
| 2364 | qreal fy = data->m22 * cy + data->m12 * cx + data->dy; | - | ||||||||||||||||||
| 2365 | qreal fw = data->m23 * cy + data->m13 * cx + data->m33; | - | ||||||||||||||||||
| 2366 | - | |||||||||||||||||||
| 2367 | while (b < end) {
| 0 | ||||||||||||||||||
| 2368 | const qreal iw = fw == 0 ? 1 : 1 / fw; | - | ||||||||||||||||||
| 2369 | const qreal px = fx * iw - qreal(0.5); | - | ||||||||||||||||||
| 2370 | const qreal py = fy * iw - qreal(0.5); | - | ||||||||||||||||||
| 2371 | - | |||||||||||||||||||
| 2372 | int x1 = int(px) - (px < 0); | - | ||||||||||||||||||
| 2373 | int x2; | - | ||||||||||||||||||
| 2374 | int y1 = int(py) - (py < 0); | - | ||||||||||||||||||
| 2375 | int y2; | - | ||||||||||||||||||
| 2376 | - | |||||||||||||||||||
| 2377 | int distx = int((px - x1) * 256); | - | ||||||||||||||||||
| 2378 | int disty = int((py - y1) * 256); | - | ||||||||||||||||||
| 2379 | - | |||||||||||||||||||
| 2380 | fetchTransformedBilinear_pixelBounds<blendType>(image_width, image_x1, image_x2, x1, x2); | - | ||||||||||||||||||
| 2381 | fetchTransformedBilinear_pixelBounds<blendType>(image_height, image_y1, image_y2, y1, y2); | - | ||||||||||||||||||
| 2382 | - | |||||||||||||||||||
| 2383 | const uint *s1 = (const uint *)data->texture.scanLine(y1); | - | ||||||||||||||||||
| 2384 | const uint *s2 = (const uint *)data->texture.scanLine(y2); | - | ||||||||||||||||||
| 2385 | - | |||||||||||||||||||
| 2386 | uint tl = s1[x1]; | - | ||||||||||||||||||
| 2387 | uint tr = s1[x2]; | - | ||||||||||||||||||
| 2388 | uint bl = s2[x1]; | - | ||||||||||||||||||
| 2389 | uint br = s2[x2]; | - | ||||||||||||||||||
| 2390 | - | |||||||||||||||||||
| 2391 | *b = interpolate_4_pixels(tl, tr, bl, br, distx, disty); | - | ||||||||||||||||||
| 2392 | - | |||||||||||||||||||
| 2393 | fx += fdx; | - | ||||||||||||||||||
| 2394 | fy += fdy; | - | ||||||||||||||||||
| 2395 | fw += fdw; | - | ||||||||||||||||||
| 2396 | //force increment to avoid /0 | - | ||||||||||||||||||
| 2397 | if (!fw) {
| 0 | ||||||||||||||||||
| 2398 | fw += fdw; | - | ||||||||||||||||||
| 2399 | } never executed: end of block | 0 | ||||||||||||||||||
| 2400 | ++b; | - | ||||||||||||||||||
| 2401 | } never executed: end of block | 0 | ||||||||||||||||||
| 2402 | } never executed: end of block | 0 | ||||||||||||||||||
| 2403 | - | |||||||||||||||||||
| 2404 | return buffer; never executed: return buffer; | 0 | ||||||||||||||||||
| 2405 | } | - | ||||||||||||||||||
| 2406 | - | |||||||||||||||||||
| 2407 | // blendType = BlendTransformedBilinear or BlendTransformedBilinearTiled | - | ||||||||||||||||||
| 2408 | template<TextureBlendType blendType> | - | ||||||||||||||||||
| 2409 | static const uint *QT_FASTCALL fetchTransformedBilinear(uint *buffer, const Operator *, | - | ||||||||||||||||||
| 2410 | const QSpanData *data, int y, int x, int length) | - | ||||||||||||||||||
| 2411 | { | - | ||||||||||||||||||
| 2412 | const QPixelLayout *layout = &qPixelLayouts[data->texture.format]; | - | ||||||||||||||||||
| 2413 | const QRgb *clut = data->texture.colorTable ? data->texture.colorTable->constData() : 0; | - | ||||||||||||||||||
| 2414 | - | |||||||||||||||||||
| 2415 | int image_width = data->texture.width; | - | ||||||||||||||||||
| 2416 | int image_height = data->texture.height; | - | ||||||||||||||||||
| 2417 | - | |||||||||||||||||||
| 2418 | int image_x1 = data->texture.x1; | - | ||||||||||||||||||
| 2419 | int image_y1 = data->texture.y1; | - | ||||||||||||||||||
| 2420 | int image_x2 = data->texture.x2 - 1; | - | ||||||||||||||||||
| 2421 | int image_y2 = data->texture.y2 - 1; | - | ||||||||||||||||||
| 2422 | - | |||||||||||||||||||
| 2423 | const qreal cx = x + qreal(0.5); | - | ||||||||||||||||||
| 2424 | const qreal cy = y + qreal(0.5); | - | ||||||||||||||||||
| 2425 | - | |||||||||||||||||||
| 2426 | if (data->fast_matrix) {
| 0 | ||||||||||||||||||
| 2427 | // The increment pr x in the scanline | - | ||||||||||||||||||
| 2428 | int fdx = (int)(data->m11 * fixed_scale); | - | ||||||||||||||||||
| 2429 | int fdy = (int)(data->m12 * fixed_scale); | - | ||||||||||||||||||
| 2430 | - | |||||||||||||||||||
| 2431 | int fx = int((data->m21 * cy + data->m11 * cx + data->dx) * fixed_scale); | - | ||||||||||||||||||
| 2432 | int fy = int((data->m22 * cy + data->m12 * cx + data->dy) * fixed_scale); | - | ||||||||||||||||||
| 2433 | - | |||||||||||||||||||
| 2434 | fx -= half_point; | - | ||||||||||||||||||
| 2435 | fy -= half_point; | - | ||||||||||||||||||
| 2436 | - | |||||||||||||||||||
| 2437 | if (fdy == 0) { //simple scale, no rotation
| 0 | ||||||||||||||||||
| 2438 | int y1 = (fy >> 16); | - | ||||||||||||||||||
| 2439 | int y2; | - | ||||||||||||||||||
| 2440 | fetchTransformedBilinear_pixelBounds<blendType>(image_height, image_y1, image_y2, y1, y2); | - | ||||||||||||||||||
| 2441 | const uchar *s1 = data->texture.scanLine(y1); | - | ||||||||||||||||||
| 2442 | const uchar *s2 = data->texture.scanLine(y2); | - | ||||||||||||||||||
| 2443 | - | |||||||||||||||||||
| 2444 | if (fdx <= fixed_scale && fdx > 0) { // scale up on X
| 0 | ||||||||||||||||||
| 2445 | int disty = (fy & 0x0000ffff) >> 8; | - | ||||||||||||||||||
| 2446 | int idisty = 256 - disty; | - | ||||||||||||||||||
| 2447 | int x = fx >> 16; | - | ||||||||||||||||||
| 2448 | - | |||||||||||||||||||
| 2449 | // The idea is first to do the interpolation between the row s1 and the row s2 | - | ||||||||||||||||||
| 2450 | // into an intermediate buffer, then we interpolate between two pixel of this buffer. | - | ||||||||||||||||||
| 2451 | FetchPixelsFunc fetch = qFetchPixels[layout->bpp]; | - | ||||||||||||||||||
| 2452 | // +1 for the last pixel to interpolate with, and +1 for rounding errors. | - | ||||||||||||||||||
| 2453 | uint buf1[buffer_size + 2]; | - | ||||||||||||||||||
| 2454 | uint buf2[buffer_size + 2]; | - | ||||||||||||||||||
| 2455 | const uint *ptr1; | - | ||||||||||||||||||
| 2456 | const uint *ptr2; | - | ||||||||||||||||||
| 2457 | - | |||||||||||||||||||
| 2458 | int count = (qint64(length) * fdx + fixed_scale - 1) / fixed_scale + 2; | - | ||||||||||||||||||
| 2459 | Q_ASSERT(count <= buffer_size + 2); //length is supposed to be <= buffer_size and data->m11 < 1 in this case | - | ||||||||||||||||||
| 2460 | - | |||||||||||||||||||
| 2461 | if (blendType == BlendTransformedBilinearTiled) {
| 0 | ||||||||||||||||||
| 2462 | x %= image_width; | - | ||||||||||||||||||
| 2463 | if (x < 0)
| 0 | ||||||||||||||||||
| 2464 | x += image_width; never executed: x += image_width; | 0 | ||||||||||||||||||
| 2465 | int len1 = qMin(count, image_width - x); | - | ||||||||||||||||||
| 2466 | int len2 = qMin(x, count - len1); | - | ||||||||||||||||||
| 2467 | - | |||||||||||||||||||
| 2468 | ptr1 = fetch(buf1, s1, x, len1); | - | ||||||||||||||||||
| 2469 | ptr1 = layout->convertToARGB32PM(buf1, ptr1, len1, layout, clut); | - | ||||||||||||||||||
| 2470 | ptr2 = fetch(buf2, s2, x, len1); | - | ||||||||||||||||||
| 2471 | ptr2 = layout->convertToARGB32PM(buf2, ptr2, len1, layout, clut); | - | ||||||||||||||||||
| 2472 | for (int i = 0; i < len1; ++i) {
| 0 | ||||||||||||||||||
| 2473 | uint t = ptr1[i]; | - | ||||||||||||||||||
| 2474 | uint b = ptr2[i]; | - | ||||||||||||||||||
| 2475 | buf1[i] = (((t & 0xff00ff) * idisty + (b & 0xff00ff) * disty) >> 8) & 0xff00ff; | - | ||||||||||||||||||
| 2476 | buf2[i] = ((((t >> 8) & 0xff00ff) * idisty + ((b >> 8) & 0xff00ff) * disty) >> 8) & 0xff00ff; | - | ||||||||||||||||||
| 2477 | } never executed: end of block | 0 | ||||||||||||||||||
| 2478 | - | |||||||||||||||||||
| 2479 | if (len2) {
| 0 | ||||||||||||||||||
| 2480 | ptr1 = fetch(buf1 + len1, s1, 0, len2); | - | ||||||||||||||||||
| 2481 | ptr1 = layout->convertToARGB32PM(buf1 + len1, ptr1, len2, layout, clut); | - | ||||||||||||||||||
| 2482 | ptr2 = fetch(buf2 + len1, s2, 0, len2); | - | ||||||||||||||||||
| 2483 | ptr2 = layout->convertToARGB32PM(buf2 + len1, ptr2, len2, layout, clut); | - | ||||||||||||||||||
| 2484 | for (int i = 0; i < len2; ++i) {
| 0 | ||||||||||||||||||
| 2485 | uint t = ptr1[i]; | - | ||||||||||||||||||
| 2486 | uint b = ptr2[i]; | - | ||||||||||||||||||
| 2487 | buf1[i + len1] = (((t & 0xff00ff) * idisty + (b & 0xff00ff) * disty) >> 8) & 0xff00ff; | - | ||||||||||||||||||
| 2488 | buf2[i + len1] = ((((t >> 8) & 0xff00ff) * idisty + ((b >> 8) & 0xff00ff) * disty) >> 8) & 0xff00ff; | - | ||||||||||||||||||
| 2489 | } never executed: end of block | 0 | ||||||||||||||||||
| 2490 | } never executed: end of block | 0 | ||||||||||||||||||
| 2491 | for (int i = image_width; i < count; ++i) {
| 0 | ||||||||||||||||||
| 2492 | buf1[i] = buf1[i - image_width]; | - | ||||||||||||||||||
| 2493 | buf2[i] = buf2[i - image_width]; | - | ||||||||||||||||||
| 2494 | } never executed: end of block | 0 | ||||||||||||||||||
| 2495 | } else { never executed: end of block | 0 | ||||||||||||||||||
| 2496 | int start = qMax(x, image_x1); | - | ||||||||||||||||||
| 2497 | int end = qMin(x + count, image_x2 + 1); | - | ||||||||||||||||||
| 2498 | int len = qMax(1, end - start); | - | ||||||||||||||||||
| 2499 | int leading = start - x; | - | ||||||||||||||||||
| 2500 | - | |||||||||||||||||||
| 2501 | ptr1 = fetch(buf1 + leading, s1, start, len); | - | ||||||||||||||||||
| 2502 | ptr1 = layout->convertToARGB32PM(buf1 + leading, ptr1, len, layout, clut); | - | ||||||||||||||||||
| 2503 | ptr2 = fetch(buf2 + leading, s2, start, len); | - | ||||||||||||||||||
| 2504 | ptr2 = layout->convertToARGB32PM(buf2 + leading, ptr2, len, layout, clut); | - | ||||||||||||||||||
| 2505 | - | |||||||||||||||||||
| 2506 | for (int i = 0; i < len; ++i) {
| 0 | ||||||||||||||||||
| 2507 | uint t = ptr1[i]; | - | ||||||||||||||||||
| 2508 | uint b = ptr2[i]; | - | ||||||||||||||||||
| 2509 | buf1[i + leading] = (((t & 0xff00ff) * idisty + (b & 0xff00ff) * disty) >> 8) & 0xff00ff; | - | ||||||||||||||||||
| 2510 | buf2[i + leading] = ((((t >> 8) & 0xff00ff) * idisty + ((b >> 8) & 0xff00ff) * disty) >> 8) & 0xff00ff; | - | ||||||||||||||||||
| 2511 | } never executed: end of block | 0 | ||||||||||||||||||
| 2512 | - | |||||||||||||||||||
| 2513 | for (int i = 0; i < leading; ++i) {
| 0 | ||||||||||||||||||
| 2514 | buf1[i] = buf1[leading]; | - | ||||||||||||||||||
| 2515 | buf2[i] = buf2[leading]; | - | ||||||||||||||||||
| 2516 | } never executed: end of block | 0 | ||||||||||||||||||
| 2517 | for (int i = leading + len; i < count; ++i) {
| 0 | ||||||||||||||||||
| 2518 | buf1[i] = buf1[i - 1]; | - | ||||||||||||||||||
| 2519 | buf2[i] = buf2[i - 1]; | - | ||||||||||||||||||
| 2520 | } never executed: end of block | 0 | ||||||||||||||||||
| 2521 | } never executed: end of block | 0 | ||||||||||||||||||
| 2522 | - | |||||||||||||||||||
| 2523 | // Now interpolate the values from the intermediate_buffer to get the final result. | - | ||||||||||||||||||
| 2524 | fx &= fixed_scale - 1; | - | ||||||||||||||||||
| 2525 | Q_ASSERT((fx >> 16) == 0); | - | ||||||||||||||||||
| 2526 | for (int i = 0; i < length; ++i) {
| 0 | ||||||||||||||||||
| 2527 | int x1 = (fx >> 16); | - | ||||||||||||||||||
| 2528 | int x2 = x1 + 1; | - | ||||||||||||||||||
| 2529 | Q_ASSERT(x1 >= 0); | - | ||||||||||||||||||
| 2530 | Q_ASSERT(x2 < count); | - | ||||||||||||||||||
| 2531 | - | |||||||||||||||||||
| 2532 | int distx = (fx & 0x0000ffff) >> 8; | - | ||||||||||||||||||
| 2533 | int idistx = 256 - distx; | - | ||||||||||||||||||
| 2534 | int rb = ((buf1[x1] * idistx + buf1[x2] * distx) >> 8) & 0xff00ff; | - | ||||||||||||||||||
| 2535 | int ag = (buf2[x1] * idistx + buf2[x2] * distx) & 0xff00ff00; | - | ||||||||||||||||||
| 2536 | buffer[i] = rb | ag; | - | ||||||||||||||||||
| 2537 | fx += fdx; | - | ||||||||||||||||||
| 2538 | } never executed: end of block | 0 | ||||||||||||||||||
| 2539 | } else { never executed: end of block | 0 | ||||||||||||||||||
| 2540 | FetchPixelFunc fetch = qFetchPixel[layout->bpp]; | - | ||||||||||||||||||
| 2541 | uint buf1[buffer_size]; | - | ||||||||||||||||||
| 2542 | uint buf2[buffer_size]; | - | ||||||||||||||||||
| 2543 | uint *b = buffer; | - | ||||||||||||||||||
| 2544 | while (length) {
| 0 | ||||||||||||||||||
| 2545 | int len = qMin(length, buffer_size / 2); | - | ||||||||||||||||||
| 2546 | int fracX = fx; | - | ||||||||||||||||||
| 2547 | for (int i = 0; i < len; ++i) {
| 0 | ||||||||||||||||||
| 2548 | int x1 = (fx >> 16); | - | ||||||||||||||||||
| 2549 | int x2; | - | ||||||||||||||||||
| 2550 | fetchTransformedBilinear_pixelBounds<blendType>(image_width, image_x1, image_x2, x1, x2); | - | ||||||||||||||||||
| 2551 | - | |||||||||||||||||||
| 2552 | if (layout->bpp == QPixelLayout::BPP32) {
| 0 | ||||||||||||||||||
| 2553 | buf1[i * 2 + 0] = ((const uint*)s1)[x1]; | - | ||||||||||||||||||
| 2554 | buf1[i * 2 + 1] = ((const uint*)s1)[x2]; | - | ||||||||||||||||||
| 2555 | buf2[i * 2 + 0] = ((const uint*)s2)[x1]; | - | ||||||||||||||||||
| 2556 | buf2[i * 2 + 1] = ((const uint*)s2)[x2]; | - | ||||||||||||||||||
| 2557 | } else { never executed: end of block | 0 | ||||||||||||||||||
| 2558 | buf1[i * 2 + 0] = fetch(s1, x1); | - | ||||||||||||||||||
| 2559 | buf1[i * 2 + 1] = fetch(s1, x2); | - | ||||||||||||||||||
| 2560 | buf2[i * 2 + 0] = fetch(s2, x1); | - | ||||||||||||||||||
| 2561 | buf2[i * 2 + 1] = fetch(s2, x2); | - | ||||||||||||||||||
| 2562 | } never executed: end of block | 0 | ||||||||||||||||||
| 2563 | - | |||||||||||||||||||
| 2564 | fx += fdx; | - | ||||||||||||||||||
| 2565 | } never executed: end of block | 0 | ||||||||||||||||||
| 2566 | layout->convertToARGB32PM(buf1, buf1, len * 2, layout, clut); | - | ||||||||||||||||||
| 2567 | layout->convertToARGB32PM(buf2, buf2, len * 2, layout, clut); | - | ||||||||||||||||||
| 2568 | - | |||||||||||||||||||
| 2569 | if ((fdx < 0 && fdx > -(fixed_scale / 8)) || std::abs(data->m22) < (1./8.)) { // scale up more than 8x
| 0 | ||||||||||||||||||
| 2570 | int disty = (fy & 0x0000ffff) >> 8; | - | ||||||||||||||||||
| 2571 | for (int i = 0; i < len; ++i) {
| 0 | ||||||||||||||||||
| 2572 | uint tl = buf1[i * 2 + 0]; | - | ||||||||||||||||||
| 2573 | uint tr = buf1[i * 2 + 1]; | - | ||||||||||||||||||
| 2574 | uint bl = buf2[i * 2 + 0]; | - | ||||||||||||||||||
| 2575 | uint br = buf2[i * 2 + 1]; | - | ||||||||||||||||||
| 2576 | int distx = (fracX & 0x0000ffff) >> 8; | - | ||||||||||||||||||
| 2577 | b[i] = interpolate_4_pixels(tl, tr, bl, br, distx, disty); | - | ||||||||||||||||||
| 2578 | fracX += fdx; | - | ||||||||||||||||||
| 2579 | } never executed: end of block | 0 | ||||||||||||||||||
| 2580 | } else { //scale down never executed: end of block | 0 | ||||||||||||||||||
| 2581 | int disty = (fy & 0x0000ffff) >> 12; | - | ||||||||||||||||||
| 2582 | for (int i = 0; i < len; ++i) {
| 0 | ||||||||||||||||||
| 2583 | uint tl = buf1[i * 2 + 0]; | - | ||||||||||||||||||
| 2584 | uint tr = buf1[i * 2 + 1]; | - | ||||||||||||||||||
| 2585 | uint bl = buf2[i * 2 + 0]; | - | ||||||||||||||||||
| 2586 | uint br = buf2[i * 2 + 1]; | - | ||||||||||||||||||
| 2587 | int distx = (fracX & 0x0000ffff) >> 12; | - | ||||||||||||||||||
| 2588 | b[i] = interpolate_4_pixels_16(tl, tr, bl, br, distx, disty); | - | ||||||||||||||||||
| 2589 | fracX += fdx; | - | ||||||||||||||||||
| 2590 | } never executed: end of block | 0 | ||||||||||||||||||
| 2591 | } never executed: end of block | 0 | ||||||||||||||||||
| 2592 | length -= len; | - | ||||||||||||||||||
| 2593 | b += len; | - | ||||||||||||||||||
| 2594 | } never executed: end of block | 0 | ||||||||||||||||||
| 2595 | } never executed: end of block | 0 | ||||||||||||||||||
| 2596 | } else { //rotation | - | ||||||||||||||||||
| 2597 | FetchPixelFunc fetch = qFetchPixel[layout->bpp]; | - | ||||||||||||||||||
| 2598 | uint buf1[buffer_size]; | - | ||||||||||||||||||
| 2599 | uint buf2[buffer_size]; | - | ||||||||||||||||||
| 2600 | uint *b = buffer; | - | ||||||||||||||||||
| 2601 | - | |||||||||||||||||||
| 2602 | while (length) {
| 0 | ||||||||||||||||||
| 2603 | int len = qMin(length, buffer_size / 2); | - | ||||||||||||||||||
| 2604 | int fracX = fx; | - | ||||||||||||||||||
| 2605 | int fracY = fy; | - | ||||||||||||||||||
| 2606 | for (int i = 0; i < len; ++i) {
| 0 | ||||||||||||||||||
| 2607 | int x1 = (fx >> 16); | - | ||||||||||||||||||
| 2608 | int x2; | - | ||||||||||||||||||
| 2609 | int y1 = (fy >> 16); | - | ||||||||||||||||||
| 2610 | int y2; | - | ||||||||||||||||||
| 2611 | fetchTransformedBilinear_pixelBounds<blendType>(image_width, image_x1, image_x2, x1, x2); | - | ||||||||||||||||||
| 2612 | fetchTransformedBilinear_pixelBounds<blendType>(image_height, image_y1, image_y2, y1, y2); | - | ||||||||||||||||||
| 2613 | - | |||||||||||||||||||
| 2614 | const uchar *s1 = data->texture.scanLine(y1); | - | ||||||||||||||||||
| 2615 | const uchar *s2 = data->texture.scanLine(y2); | - | ||||||||||||||||||
| 2616 | - | |||||||||||||||||||
| 2617 | if (layout->bpp == QPixelLayout::BPP32) {
| 0 | ||||||||||||||||||
| 2618 | buf1[i * 2 + 0] = ((const uint*)s1)[x1]; | - | ||||||||||||||||||
| 2619 | buf1[i * 2 + 1] = ((const uint*)s1)[x2]; | - | ||||||||||||||||||
| 2620 | buf2[i * 2 + 0] = ((const uint*)s2)[x1]; | - | ||||||||||||||||||
| 2621 | buf2[i * 2 + 1] = ((const uint*)s2)[x2]; | - | ||||||||||||||||||
| 2622 | } else { never executed: end of block | 0 | ||||||||||||||||||
| 2623 | buf1[i * 2 + 0] = fetch(s1, x1); | - | ||||||||||||||||||
| 2624 | buf1[i * 2 + 1] = fetch(s1, x2); | - | ||||||||||||||||||
| 2625 | buf2[i * 2 + 0] = fetch(s2, x1); | - | ||||||||||||||||||
| 2626 | buf2[i * 2 + 1] = fetch(s2, x2); | - | ||||||||||||||||||
| 2627 | } never executed: end of block | 0 | ||||||||||||||||||
| 2628 | - | |||||||||||||||||||
| 2629 | fx += fdx; | - | ||||||||||||||||||
| 2630 | fy += fdy; | - | ||||||||||||||||||
| 2631 | } never executed: end of block | 0 | ||||||||||||||||||
| 2632 | layout->convertToARGB32PM(buf1, buf1, len * 2, layout, clut); | - | ||||||||||||||||||
| 2633 | layout->convertToARGB32PM(buf2, buf2, len * 2, layout, clut); | - | ||||||||||||||||||
| 2634 | - | |||||||||||||||||||
| 2635 | if (std::abs(data->m11) > 8 || std::abs(data->m22) > 8) {
| 0 | ||||||||||||||||||
| 2636 | //if we are zooming more than 8 times, we use 8bit precision for the position. | - | ||||||||||||||||||
| 2637 | for (int i = 0; i < len; ++i) {
| 0 | ||||||||||||||||||
| 2638 | uint tl = buf1[i * 2 + 0]; | - | ||||||||||||||||||
| 2639 | uint tr = buf1[i * 2 + 1]; | - | ||||||||||||||||||
| 2640 | uint bl = buf2[i * 2 + 0]; | - | ||||||||||||||||||
| 2641 | uint br = buf2[i * 2 + 1]; | - | ||||||||||||||||||
| 2642 | - | |||||||||||||||||||
| 2643 | int distx = (fracX & 0x0000ffff) >> 8; | - | ||||||||||||||||||
| 2644 | int disty = (fracY & 0x0000ffff) >> 8; | - | ||||||||||||||||||
| 2645 | - | |||||||||||||||||||
| 2646 | b[i] = interpolate_4_pixels(tl, tr, bl, br, distx, disty); | - | ||||||||||||||||||
| 2647 | fracX += fdx; | - | ||||||||||||||||||
| 2648 | fracY += fdy; | - | ||||||||||||||||||
| 2649 | } never executed: end of block | 0 | ||||||||||||||||||
| 2650 | } else { never executed: end of block | 0 | ||||||||||||||||||
| 2651 | //we are zooming less than 8x, use 4bit precision | - | ||||||||||||||||||
| 2652 | for (int i = 0; i < len; ++i) {
| 0 | ||||||||||||||||||
| 2653 | uint tl = buf1[i * 2 + 0]; | - | ||||||||||||||||||
| 2654 | uint tr = buf1[i * 2 + 1]; | - | ||||||||||||||||||
| 2655 | uint bl = buf2[i * 2 + 0]; | - | ||||||||||||||||||
| 2656 | uint br = buf2[i * 2 + 1]; | - | ||||||||||||||||||
| 2657 | - | |||||||||||||||||||
| 2658 | int distx = (fracX & 0x0000ffff) >> 12; | - | ||||||||||||||||||
| 2659 | int disty = (fracY & 0x0000ffff) >> 12; | - | ||||||||||||||||||
| 2660 | - | |||||||||||||||||||
| 2661 | b[i] = interpolate_4_pixels_16(tl, tr, bl, br, distx, disty); | - | ||||||||||||||||||
| 2662 | fracX += fdx; | - | ||||||||||||||||||
| 2663 | fracY += fdy; | - | ||||||||||||||||||
| 2664 | } never executed: end of block | 0 | ||||||||||||||||||
| 2665 | } never executed: end of block | 0 | ||||||||||||||||||
| 2666 | - | |||||||||||||||||||
| 2667 | length -= len; | - | ||||||||||||||||||
| 2668 | b += len; | - | ||||||||||||||||||
| 2669 | } never executed: end of block | 0 | ||||||||||||||||||
| 2670 | } never executed: end of block | 0 | ||||||||||||||||||
| 2671 | } else { | - | ||||||||||||||||||
| 2672 | const qreal fdx = data->m11; | - | ||||||||||||||||||
| 2673 | const qreal fdy = data->m12; | - | ||||||||||||||||||
| 2674 | const qreal fdw = data->m13; | - | ||||||||||||||||||
| 2675 | - | |||||||||||||||||||
| 2676 | qreal fx = data->m21 * cy + data->m11 * cx + data->dx; | - | ||||||||||||||||||
| 2677 | qreal fy = data->m22 * cy + data->m12 * cx + data->dy; | - | ||||||||||||||||||
| 2678 | qreal fw = data->m23 * cy + data->m13 * cx + data->m33; | - | ||||||||||||||||||
| 2679 | - | |||||||||||||||||||
| 2680 | FetchPixelFunc fetch = qFetchPixel[layout->bpp]; | - | ||||||||||||||||||
| 2681 | uint buf1[buffer_size]; | - | ||||||||||||||||||
| 2682 | uint buf2[buffer_size]; | - | ||||||||||||||||||
| 2683 | uint *b = buffer; | - | ||||||||||||||||||
| 2684 | - | |||||||||||||||||||
| 2685 | int distxs[buffer_size / 2]; | - | ||||||||||||||||||
| 2686 | int distys[buffer_size / 2]; | - | ||||||||||||||||||
| 2687 | - | |||||||||||||||||||
| 2688 | while (length) {
| 0 | ||||||||||||||||||
| 2689 | int len = qMin(length, buffer_size / 2); | - | ||||||||||||||||||
| 2690 | for (int i = 0; i < len; ++i) {
| 0 | ||||||||||||||||||
| 2691 | const qreal iw = fw == 0 ? 1 : 1 / fw; | - | ||||||||||||||||||
| 2692 | const qreal px = fx * iw - qreal(0.5); | - | ||||||||||||||||||
| 2693 | const qreal py = fy * iw - qreal(0.5); | - | ||||||||||||||||||
| 2694 | - | |||||||||||||||||||
| 2695 | int x1 = int(px) - (px < 0); | - | ||||||||||||||||||
| 2696 | int x2; | - | ||||||||||||||||||
| 2697 | int y1 = int(py) - (py < 0); | - | ||||||||||||||||||
| 2698 | int y2; | - | ||||||||||||||||||
| 2699 | - | |||||||||||||||||||
| 2700 | distxs[i] = int((px - x1) * 256); | - | ||||||||||||||||||
| 2701 | distys[i] = int((py - y1) * 256); | - | ||||||||||||||||||
| 2702 | - | |||||||||||||||||||
| 2703 | fetchTransformedBilinear_pixelBounds<blendType>(image_width, image_x1, image_x2, x1, x2); | - | ||||||||||||||||||
| 2704 | fetchTransformedBilinear_pixelBounds<blendType>(image_height, image_y1, image_y2, y1, y2); | - | ||||||||||||||||||
| 2705 | - | |||||||||||||||||||
| 2706 | const uchar *s1 = data->texture.scanLine(y1); | - | ||||||||||||||||||
| 2707 | const uchar *s2 = data->texture.scanLine(y2); | - | ||||||||||||||||||
| 2708 | - | |||||||||||||||||||
| 2709 | if (layout->bpp == QPixelLayout::BPP32) {
| 0 | ||||||||||||||||||
| 2710 | buf1[i * 2 + 0] = ((const uint*)s1)[x1]; | - | ||||||||||||||||||
| 2711 | buf1[i * 2 + 1] = ((const uint*)s1)[x2]; | - | ||||||||||||||||||
| 2712 | buf2[i * 2 + 0] = ((const uint*)s2)[x1]; | - | ||||||||||||||||||
| 2713 | buf2[i * 2 + 1] = ((const uint*)s2)[x2]; | - | ||||||||||||||||||
| 2714 | } else { never executed: end of block | 0 | ||||||||||||||||||
| 2715 | buf1[i * 2 + 0] = fetch(s1, x1); | - | ||||||||||||||||||
| 2716 | buf1[i * 2 + 1] = fetch(s1, x2); | - | ||||||||||||||||||
| 2717 | buf2[i * 2 + 0] = fetch(s2, x1); | - | ||||||||||||||||||
| 2718 | buf2[i * 2 + 1] = fetch(s2, x2); | - | ||||||||||||||||||
| 2719 | } never executed: end of block | 0 | ||||||||||||||||||
| 2720 | - | |||||||||||||||||||
| 2721 | fx += fdx; | - | ||||||||||||||||||
| 2722 | fy += fdy; | - | ||||||||||||||||||
| 2723 | fw += fdw; | - | ||||||||||||||||||
| 2724 | //force increment to avoid /0 | - | ||||||||||||||||||
| 2725 | if (!fw)
| 0 | ||||||||||||||||||
| 2726 | fw += fdw; never executed: fw += fdw; | 0 | ||||||||||||||||||
| 2727 | } never executed: end of block | 0 | ||||||||||||||||||
| 2728 | - | |||||||||||||||||||
| 2729 | layout->convertToARGB32PM(buf1, buf1, len * 2, layout, clut); | - | ||||||||||||||||||
| 2730 | layout->convertToARGB32PM(buf2, buf2, len * 2, layout, clut); | - | ||||||||||||||||||
| 2731 | - | |||||||||||||||||||
| 2732 | for (int i = 0; i < len; ++i) {
| 0 | ||||||||||||||||||
| 2733 | int distx = distxs[i]; | - | ||||||||||||||||||
| 2734 | int disty = distys[i]; | - | ||||||||||||||||||
| 2735 | - | |||||||||||||||||||
| 2736 | uint tl = buf1[i * 2 + 0]; | - | ||||||||||||||||||
| 2737 | uint tr = buf1[i * 2 + 1]; | - | ||||||||||||||||||
| 2738 | uint bl = buf2[i * 2 + 0]; | - | ||||||||||||||||||
| 2739 | uint br = buf2[i * 2 + 1]; | - | ||||||||||||||||||
| 2740 | - | |||||||||||||||||||
| 2741 | b[i] = interpolate_4_pixels(tl, tr, bl, br, distx, disty); | - | ||||||||||||||||||
| 2742 | } never executed: end of block | 0 | ||||||||||||||||||
| 2743 | length -= len; | - | ||||||||||||||||||
| 2744 | b += len; | - | ||||||||||||||||||
| 2745 | } never executed: end of block | 0 | ||||||||||||||||||
| 2746 | } never executed: end of block | 0 | ||||||||||||||||||
| 2747 | - | |||||||||||||||||||
| 2748 | return buffer; never executed: return buffer; | 0 | ||||||||||||||||||
| 2749 | } | - | ||||||||||||||||||
| 2750 | - | |||||||||||||||||||
| 2751 | template<TextureBlendType blendType> | - | ||||||||||||||||||
| 2752 | static const QRgba64 *QT_FASTCALL fetchTransformedBilinear64(QRgba64 *buffer, const Operator *, | - | ||||||||||||||||||
| 2753 | const QSpanData *data, int y, int x, int length) | - | ||||||||||||||||||
| 2754 | { | - | ||||||||||||||||||
| 2755 | const QPixelLayout *layout = &qPixelLayouts[data->texture.format]; | - | ||||||||||||||||||
| 2756 | const QRgb *clut = data->texture.colorTable ? data->texture.colorTable->constData() : 0; | - | ||||||||||||||||||
| 2757 | - | |||||||||||||||||||
| 2758 | int image_width = data->texture.width; | - | ||||||||||||||||||
| 2759 | int image_height = data->texture.height; | - | ||||||||||||||||||
| 2760 | - | |||||||||||||||||||
| 2761 | int image_x1 = data->texture.x1; | - | ||||||||||||||||||
| 2762 | int image_y1 = data->texture.y1; | - | ||||||||||||||||||
| 2763 | int image_x2 = data->texture.x2 - 1; | - | ||||||||||||||||||
| 2764 | int image_y2 = data->texture.y2 - 1; | - | ||||||||||||||||||
| 2765 | - | |||||||||||||||||||
| 2766 | const qreal cx = x + qreal(0.5); | - | ||||||||||||||||||
| 2767 | const qreal cy = y + qreal(0.5); | - | ||||||||||||||||||
| 2768 | - | |||||||||||||||||||
| 2769 | const qreal fdx = data->m11; | - | ||||||||||||||||||
| 2770 | const qreal fdy = data->m12; | - | ||||||||||||||||||
| 2771 | const qreal fdw = data->m13; | - | ||||||||||||||||||
| 2772 | - | |||||||||||||||||||
| 2773 | if (data->fast_matrix) {
| 0 | ||||||||||||||||||
| 2774 | // The increment pr x in the scanline | - | ||||||||||||||||||
| 2775 | int fdx = (int)(data->m11 * fixed_scale); | - | ||||||||||||||||||
| 2776 | int fdy = (int)(data->m12 * fixed_scale); | - | ||||||||||||||||||
| 2777 | - | |||||||||||||||||||
| 2778 | int fx = int((data->m21 * cy + data->m11 * cx + data->dx) * fixed_scale); | - | ||||||||||||||||||
| 2779 | int fy = int((data->m22 * cy + data->m12 * cx + data->dy) * fixed_scale); | - | ||||||||||||||||||
| 2780 | - | |||||||||||||||||||
| 2781 | fx -= half_point; | - | ||||||||||||||||||
| 2782 | fy -= half_point; | - | ||||||||||||||||||
| 2783 | - | |||||||||||||||||||
| 2784 | if (fdy == 0) { //simple scale, no rotation
| 0 | ||||||||||||||||||
| 2785 | int y1 = (fy >> 16); | - | ||||||||||||||||||
| 2786 | int y2; | - | ||||||||||||||||||
| 2787 | fetchTransformedBilinear_pixelBounds<blendType>(image_height, image_y1, image_y2, y1, y2); | - | ||||||||||||||||||
| 2788 | const uchar *s1 = data->texture.scanLine(y1); | - | ||||||||||||||||||
| 2789 | const uchar *s2 = data->texture.scanLine(y2); | - | ||||||||||||||||||
| 2790 | - | |||||||||||||||||||
| 2791 | FetchPixelFunc fetch = qFetchPixel[layout->bpp]; | - | ||||||||||||||||||
| 2792 | uint sbuf1[buffer_size]; | - | ||||||||||||||||||
| 2793 | uint sbuf2[buffer_size]; | - | ||||||||||||||||||
| 2794 | QRgba64 buf1[buffer_size]; | - | ||||||||||||||||||
| 2795 | QRgba64 buf2[buffer_size]; | - | ||||||||||||||||||
| 2796 | QRgba64 *b = buffer; | - | ||||||||||||||||||
| 2797 | while (length) {
| 0 | ||||||||||||||||||
| 2798 | int len = qMin(length, buffer_size / 2); | - | ||||||||||||||||||
| 2799 | int fracX = fx; | - | ||||||||||||||||||
| 2800 | int i = 0; | - | ||||||||||||||||||
| 2801 | int disty = (fy & 0x0000ffff); | - | ||||||||||||||||||
| 2802 | #if defined(__SSE2__) | - | ||||||||||||||||||
| 2803 | const __m128i vdy = _mm_set1_epi16(disty); | - | ||||||||||||||||||
| 2804 | const __m128i vidy = _mm_set1_epi16(0x10000 - disty); | - | ||||||||||||||||||
| 2805 | if (blendType != BlendTransformedBilinearTiled && layout->bpp == QPixelLayout::BPP32) {
| 0 | ||||||||||||||||||
| 2806 | for (; i < len; ++i) {
| 0 | ||||||||||||||||||
| 2807 | int x1 = (fx >> 16); | - | ||||||||||||||||||
| 2808 | int x2; | - | ||||||||||||||||||
| 2809 | fetchTransformedBilinear_pixelBounds<blendType>(image_width, image_x1, image_x2, x1, x2); | - | ||||||||||||||||||
| 2810 | if (x1 != x2)
| 0 | ||||||||||||||||||
| 2811 | break; never executed: break; | 0 | ||||||||||||||||||
| 2812 | sbuf1[i * 2 + 0] = ((const uint*)s1)[x1]; | - | ||||||||||||||||||
| 2813 | sbuf1[i * 2 + 1] = ((const uint*)s1)[x2]; | - | ||||||||||||||||||
| 2814 | sbuf2[i * 2 + 0] = ((const uint*)s2)[x1]; | - | ||||||||||||||||||
| 2815 | sbuf2[i * 2 + 1] = ((const uint*)s2)[x2]; | - | ||||||||||||||||||
| 2816 | fx += fdx; | - | ||||||||||||||||||
| 2817 | } never executed: end of block | 0 | ||||||||||||||||||
| 2818 | int fastLen; | - | ||||||||||||||||||
| 2819 | if (fdx > 0)
| 0 | ||||||||||||||||||
| 2820 | fastLen = qMin(len, int((image_x2 - (fx >> 16)) / data->m11)); never executed: fastLen = qMin(len, int((image_x2 - (fx >> 16)) / data->m11)); | 0 | ||||||||||||||||||
| 2821 | else | - | ||||||||||||||||||
| 2822 | fastLen = qMin(len, int((image_x1 - (fx >> 16)) / data->m11)); never executed: fastLen = qMin(len, int((image_x1 - (fx >> 16)) / data->m11)); | 0 | ||||||||||||||||||
| 2823 | fastLen -= 3; | - | ||||||||||||||||||
| 2824 | - | |||||||||||||||||||
| 2825 | const __m128i v_fdx = _mm_set1_epi32(fdx*4); | - | ||||||||||||||||||
| 2826 | __m128i v_fx = _mm_setr_epi32(fx, fx + fdx, fx + fdx + fdx, fx + fdx + fdx + fdx); | - | ||||||||||||||||||
| 2827 | for (; i < fastLen; i += 4) {
| 0 | ||||||||||||||||||
| 2828 | int offset = _mm_extract_epi16(v_fx, 1); | - | ||||||||||||||||||
| 2829 | sbuf1[i * 2 + 0] = ((const uint*)s1)[offset]; | - | ||||||||||||||||||
| 2830 | sbuf1[i * 2 + 1] = ((const uint*)s1)[offset + 1]; | - | ||||||||||||||||||
| 2831 | sbuf2[i * 2 + 0] = ((const uint*)s2)[offset]; | - | ||||||||||||||||||
| 2832 | sbuf2[i * 2 + 1] = ((const uint*)s2)[offset + 1]; | - | ||||||||||||||||||
| 2833 | offset = _mm_extract_epi16(v_fx, 3); | - | ||||||||||||||||||
| 2834 | sbuf1[i * 2 + 2] = ((const uint*)s1)[offset]; | - | ||||||||||||||||||
| 2835 | sbuf1[i * 2 + 3] = ((const uint*)s1)[offset + 1]; | - | ||||||||||||||||||
| 2836 | sbuf2[i * 2 + 2] = ((const uint*)s2)[offset]; | - | ||||||||||||||||||
| 2837 | sbuf2[i * 2 + 3] = ((const uint*)s2)[offset + 1]; | - | ||||||||||||||||||
| 2838 | offset = _mm_extract_epi16(v_fx, 5); | - | ||||||||||||||||||
| 2839 | sbuf1[i * 2 + 4] = ((const uint*)s1)[offset]; | - | ||||||||||||||||||
| 2840 | sbuf1[i * 2 + 5] = ((const uint*)s1)[offset + 1]; | - | ||||||||||||||||||
| 2841 | sbuf2[i * 2 + 4] = ((const uint*)s2)[offset]; | - | ||||||||||||||||||
| 2842 | sbuf2[i * 2 + 5] = ((const uint*)s2)[offset + 1]; | - | ||||||||||||||||||
| 2843 | offset = _mm_extract_epi16(v_fx, 7); | - | ||||||||||||||||||
| 2844 | sbuf1[i * 2 + 6] = ((const uint*)s1)[offset]; | - | ||||||||||||||||||
| 2845 | sbuf1[i * 2 + 7] = ((const uint*)s1)[offset + 1]; | - | ||||||||||||||||||
| 2846 | sbuf2[i * 2 + 6] = ((const uint*)s2)[offset]; | - | ||||||||||||||||||
| 2847 | sbuf2[i * 2 + 7] = ((const uint*)s2)[offset + 1]; | - | ||||||||||||||||||
| 2848 | v_fx = _mm_add_epi32(v_fx, v_fdx); | - | ||||||||||||||||||
| 2849 | } never executed: end of block | 0 | ||||||||||||||||||
| 2850 | fx = _mm_cvtsi128_si32(v_fx); | - | ||||||||||||||||||
| 2851 | } never executed: end of block | 0 | ||||||||||||||||||
| 2852 | #endif | - | ||||||||||||||||||
| 2853 | for (; i < len; ++i) {
| 0 | ||||||||||||||||||
| 2854 | int x1 = (fx >> 16); | - | ||||||||||||||||||
| 2855 | int x2; | - | ||||||||||||||||||
| 2856 | fetchTransformedBilinear_pixelBounds<blendType>(image_width, image_x1, image_x2, x1, x2); | - | ||||||||||||||||||
| 2857 | - | |||||||||||||||||||
| 2858 | if (layout->bpp == QPixelLayout::BPP32) {
| 0 | ||||||||||||||||||
| 2859 | sbuf1[i * 2 + 0] = ((const uint*)s1)[x1]; | - | ||||||||||||||||||
| 2860 | sbuf1[i * 2 + 1] = ((const uint*)s1)[x2]; | - | ||||||||||||||||||
| 2861 | sbuf2[i * 2 + 0] = ((const uint*)s2)[x1]; | - | ||||||||||||||||||
| 2862 | sbuf2[i * 2 + 1] = ((const uint*)s2)[x2]; | - | ||||||||||||||||||
| 2863 | - | |||||||||||||||||||
| 2864 | } else { never executed: end of block | 0 | ||||||||||||||||||
| 2865 | sbuf1[i * 2 + 0] = fetch(s1, x1); | - | ||||||||||||||||||
| 2866 | sbuf1[i * 2 + 1] = fetch(s1, x2); | - | ||||||||||||||||||
| 2867 | sbuf2[i * 2 + 0] = fetch(s2, x1); | - | ||||||||||||||||||
| 2868 | sbuf2[i * 2 + 1] = fetch(s2, x2); | - | ||||||||||||||||||
| 2869 | } never executed: end of block | 0 | ||||||||||||||||||
| 2870 | - | |||||||||||||||||||
| 2871 | fx += fdx; | - | ||||||||||||||||||
| 2872 | } never executed: end of block | 0 | ||||||||||||||||||
| 2873 | layout->convertToARGB64PM(buf1, sbuf1, len * 2, layout, clut); | - | ||||||||||||||||||
| 2874 | if (disty)
| 0 | ||||||||||||||||||
| 2875 | layout->convertToARGB64PM(buf2, sbuf2, len * 2, layout, clut); never executed: layout->convertToARGB64PM(buf2, sbuf2, len * 2, layout, clut); | 0 | ||||||||||||||||||
| 2876 | - | |||||||||||||||||||
| 2877 | for (int i = 0; i < len; ++i) {
| 0 | ||||||||||||||||||
| 2878 | int distx = (fracX & 0x0000ffff); | - | ||||||||||||||||||
| 2879 | #if defined(__SSE2__) | - | ||||||||||||||||||
| 2880 | const __m128i vdistx = _mm_shufflelo_epi16(_mm_cvtsi32_si128(distx), _MM_SHUFFLE(0, 0, 0, 0)); | - | ||||||||||||||||||
| 2881 | const __m128i vidistx = _mm_shufflelo_epi16(_mm_cvtsi32_si128(0x10000 - distx), _MM_SHUFFLE(0, 0, 0, 0)); | - | ||||||||||||||||||
| 2882 | __m128i vt = _mm_loadu_si128((const __m128i*)(buf1 + i*2)); | - | ||||||||||||||||||
| 2883 | if (disty) {
| 0 | ||||||||||||||||||
| 2884 | __m128i vb = _mm_loadu_si128((const __m128i*)(buf2 + i*2)); | - | ||||||||||||||||||
| 2885 | vt = _mm_mulhi_epu16(vt, vidy); | - | ||||||||||||||||||
| 2886 | vb = _mm_mulhi_epu16(vb, vdy); | - | ||||||||||||||||||
| 2887 | vt = _mm_add_epi16(vt, vb); | - | ||||||||||||||||||
| 2888 | } never executed: end of block | 0 | ||||||||||||||||||
| 2889 | vt = _mm_mulhi_epu16(vt, _mm_unpacklo_epi64(vidistx, vdistx)); | - | ||||||||||||||||||
| 2890 | vt = _mm_add_epi16(vt, _mm_srli_si128(vt, 8)); | - | ||||||||||||||||||
| 2891 | _mm_storel_epi64((__m128i*)(b+i), vt); | - | ||||||||||||||||||
| 2892 | #else | - | ||||||||||||||||||
| 2893 | b[i] = interpolate_4_pixels_rgb64(buf1 + i*2, buf2 + i*2, distx, disty); | - | ||||||||||||||||||
| 2894 | #endif | - | ||||||||||||||||||
| 2895 | fracX += fdx; | - | ||||||||||||||||||
| 2896 | } never executed: end of block | 0 | ||||||||||||||||||
| 2897 | length -= len; | - | ||||||||||||||||||
| 2898 | b += len; | - | ||||||||||||||||||
| 2899 | } never executed: end of block | 0 | ||||||||||||||||||
| 2900 | } else { //rotation never executed: end of block | 0 | ||||||||||||||||||
| 2901 | FetchPixelFunc fetch = qFetchPixel[layout->bpp]; | - | ||||||||||||||||||
| 2902 | uint sbuf1[buffer_size]; | - | ||||||||||||||||||
| 2903 | uint sbuf2[buffer_size]; | - | ||||||||||||||||||
| 2904 | QRgba64 buf1[buffer_size]; | - | ||||||||||||||||||
| 2905 | QRgba64 buf2[buffer_size]; | - | ||||||||||||||||||
| 2906 | QRgba64 *end = buffer + length; | - | ||||||||||||||||||
| 2907 | QRgba64 *b = buffer; | - | ||||||||||||||||||
| 2908 | - | |||||||||||||||||||
| 2909 | while (b < end) {
| 0 | ||||||||||||||||||
| 2910 | int len = qMin(length, buffer_size / 2); | - | ||||||||||||||||||
| 2911 | int fracX = fx; | - | ||||||||||||||||||
| 2912 | int fracY = fy; | - | ||||||||||||||||||
| 2913 | int i = 0; | - | ||||||||||||||||||
| 2914 | #if defined(__SSE2__) | - | ||||||||||||||||||
| 2915 | if (blendType != BlendTransformedBilinearTiled && layout->bpp == QPixelLayout::BPP32) {
| 0 | ||||||||||||||||||
| 2916 | for (; i < len; ++i) {
| 0 | ||||||||||||||||||
| 2917 | int x1 = (fx >> 16); | - | ||||||||||||||||||
| 2918 | int x2; | - | ||||||||||||||||||
| 2919 | int y1 = (fy >> 16); | - | ||||||||||||||||||
| 2920 | int y2; | - | ||||||||||||||||||
| 2921 | fetchTransformedBilinear_pixelBounds<blendType>(image_width, image_x1, image_x2, x1, x2); | - | ||||||||||||||||||
| 2922 | fetchTransformedBilinear_pixelBounds<blendType>(image_height, image_y1, image_y2, y1, y2); | - | ||||||||||||||||||
| 2923 | if (x1 != x2 && y1 != y2)
| 0 | ||||||||||||||||||
| 2924 | break; never executed: break; | 0 | ||||||||||||||||||
| 2925 | const uchar *s1 = data->texture.scanLine(y1); | - | ||||||||||||||||||
| 2926 | const uchar *s2 = data->texture.scanLine(y2); | - | ||||||||||||||||||
| 2927 | sbuf1[i * 2 + 0] = ((const uint*)s1)[x1]; | - | ||||||||||||||||||
| 2928 | sbuf1[i * 2 + 1] = ((const uint*)s1)[x2]; | - | ||||||||||||||||||
| 2929 | sbuf2[i * 2 + 0] = ((const uint*)s2)[x1]; | - | ||||||||||||||||||
| 2930 | sbuf2[i * 2 + 1] = ((const uint*)s2)[x2]; | - | ||||||||||||||||||
| 2931 | fx += fdx; | - | ||||||||||||||||||
| 2932 | fy += fdy; | - | ||||||||||||||||||
| 2933 | } never executed: end of block | 0 | ||||||||||||||||||
| 2934 | - | |||||||||||||||||||
| 2935 | const __m128i v_fdx = _mm_set1_epi32(fdx*4); | - | ||||||||||||||||||
| 2936 | const __m128i v_fdy = _mm_set1_epi32(fdy*4); | - | ||||||||||||||||||
| 2937 | __m128i v_fx = _mm_setr_epi32(fx, fx + fdx, fx + fdx + fdx, fx + fdx + fdx + fdx); | - | ||||||||||||||||||
| 2938 | __m128i v_fy = _mm_setr_epi32(fy, fy + fdy, fy + fdy + fdy, fy + fdy + fdy + fdy); | - | ||||||||||||||||||
| 2939 | const int bytesPerLine = data->texture.bytesPerLine; | - | ||||||||||||||||||
| 2940 | const uchar *s1 = data->texture.imageData; | - | ||||||||||||||||||
| 2941 | const uchar *s2 = s1 + bytesPerLine; | - | ||||||||||||||||||
| 2942 | const __m128i vbpl = _mm_shufflelo_epi16(_mm_cvtsi32_si128(bytesPerLine/4), _MM_SHUFFLE(0, 0, 0, 0)); | - | ||||||||||||||||||
| 2943 | for (; i < len-3; i+=4) {
| 0 | ||||||||||||||||||
| 2944 | if (fdx > 0 && (short)_mm_extract_epi16(v_fx, 7) >= image_x2)
| 0 | ||||||||||||||||||
| 2945 | break; never executed: break; | 0 | ||||||||||||||||||
| 2946 | if (fdx < 0 && (short)_mm_extract_epi16(v_fx, 7) < image_x1)
| 0 | ||||||||||||||||||
| 2947 | break; never executed: break; | 0 | ||||||||||||||||||
| 2948 | if (fdy > 0 && (short)_mm_extract_epi16(v_fy, 7) >= image_y2)
| 0 | ||||||||||||||||||
| 2949 | break; never executed: break; | 0 | ||||||||||||||||||
| 2950 | if (fdy < 0 && (short)_mm_extract_epi16(v_fy, 7) < image_y1)
| 0 | ||||||||||||||||||
| 2951 | break; never executed: break; | 0 | ||||||||||||||||||
| 2952 | const __m128i vy = _mm_packs_epi32(_mm_srai_epi32(v_fy, 16), _mm_setzero_si128()); | - | ||||||||||||||||||
| 2953 | __m128i voffset = _mm_unpacklo_epi16(_mm_mullo_epi16(vy, vbpl), _mm_mulhi_epu16(vy, vbpl)); | - | ||||||||||||||||||
| 2954 | voffset = _mm_add_epi32(voffset, _mm_srli_epi32(v_fx, 16)); | - | ||||||||||||||||||
| 2955 | - | |||||||||||||||||||
| 2956 | int offset = _mm_cvtsi128_si32(voffset); voffset = _mm_srli_si128(voffset, 4); | - | ||||||||||||||||||
| 2957 | sbuf1[i * 2 + 0] = ((const uint*)s1)[offset]; | - | ||||||||||||||||||
| 2958 | sbuf1[i * 2 + 1] = ((const uint*)s1)[offset + 1]; | - | ||||||||||||||||||
| 2959 | sbuf2[i * 2 + 0] = ((const uint*)s2)[offset]; | - | ||||||||||||||||||
| 2960 | sbuf2[i * 2 + 1] = ((const uint*)s2)[offset + 1]; | - | ||||||||||||||||||
| 2961 | offset = _mm_cvtsi128_si32(voffset); voffset = _mm_srli_si128(voffset, 4); | - | ||||||||||||||||||
| 2962 | sbuf1[i * 2 + 2] = ((const uint*)s1)[offset]; | - | ||||||||||||||||||
| 2963 | sbuf1[i * 2 + 3] = ((const uint*)s1)[offset + 1]; | - | ||||||||||||||||||
| 2964 | sbuf2[i * 2 + 2] = ((const uint*)s2)[offset]; | - | ||||||||||||||||||
| 2965 | sbuf2[i * 2 + 3] = ((const uint*)s2)[offset + 1]; | - | ||||||||||||||||||
| 2966 | offset = _mm_cvtsi128_si32(voffset); voffset = _mm_srli_si128(voffset, 4); | - | ||||||||||||||||||
| 2967 | sbuf1[i * 2 + 4] = ((const uint*)s1)[offset]; | - | ||||||||||||||||||
| 2968 | sbuf1[i * 2 + 5] = ((const uint*)s1)[offset + 1]; | - | ||||||||||||||||||
| 2969 | sbuf2[i * 2 + 4] = ((const uint*)s2)[offset]; | - | ||||||||||||||||||
| 2970 | sbuf2[i * 2 + 5] = ((const uint*)s2)[offset + 1]; | - | ||||||||||||||||||
| 2971 | offset = _mm_cvtsi128_si32(voffset); | - | ||||||||||||||||||
| 2972 | sbuf1[i * 2 + 6] = ((const uint*)s1)[offset]; | - | ||||||||||||||||||
| 2973 | sbuf1[i * 2 + 7] = ((const uint*)s1)[offset + 1]; | - | ||||||||||||||||||
| 2974 | sbuf2[i * 2 + 6] = ((const uint*)s2)[offset]; | - | ||||||||||||||||||
| 2975 | sbuf2[i * 2 + 7] = ((const uint*)s2)[offset + 1]; | - | ||||||||||||||||||
| 2976 | - | |||||||||||||||||||
| 2977 | v_fx = _mm_add_epi32(v_fx, v_fdx); | - | ||||||||||||||||||
| 2978 | v_fy = _mm_add_epi32(v_fy, v_fdy); | - | ||||||||||||||||||
| 2979 | } never executed: end of block | 0 | ||||||||||||||||||
| 2980 | fx = _mm_cvtsi128_si32(v_fx); | - | ||||||||||||||||||
| 2981 | fy = _mm_cvtsi128_si32(v_fy); | - | ||||||||||||||||||
| 2982 | } never executed: end of block | 0 | ||||||||||||||||||
| 2983 | #endif | - | ||||||||||||||||||
| 2984 | for (; i < len; ++i) {
| 0 | ||||||||||||||||||
| 2985 | int x1 = (fx >> 16); | - | ||||||||||||||||||
| 2986 | int x2; | - | ||||||||||||||||||
| 2987 | int y1 = (fy >> 16); | - | ||||||||||||||||||
| 2988 | int y2; | - | ||||||||||||||||||
| 2989 | fetchTransformedBilinear_pixelBounds<blendType>(image_width, image_x1, image_x2, x1, x2); | - | ||||||||||||||||||
| 2990 | fetchTransformedBilinear_pixelBounds<blendType>(image_height, image_y1, image_y2, y1, y2); | - | ||||||||||||||||||
| 2991 | - | |||||||||||||||||||
| 2992 | const uchar *s1 = data->texture.scanLine(y1); | - | ||||||||||||||||||
| 2993 | const uchar *s2 = data->texture.scanLine(y2); | - | ||||||||||||||||||
| 2994 | - | |||||||||||||||||||
| 2995 | if (layout->bpp == QPixelLayout::BPP32) {
| 0 | ||||||||||||||||||
| 2996 | sbuf1[i * 2 + 0] = ((const uint*)s1)[x1]; | - | ||||||||||||||||||
| 2997 | sbuf1[i * 2 + 1] = ((const uint*)s1)[x2]; | - | ||||||||||||||||||
| 2998 | sbuf2[i * 2 + 0] = ((const uint*)s2)[x1]; | - | ||||||||||||||||||
| 2999 | sbuf2[i * 2 + 1] = ((const uint*)s2)[x2]; | - | ||||||||||||||||||
| 3000 | - | |||||||||||||||||||
| 3001 | } else { never executed: end of block | 0 | ||||||||||||||||||
| 3002 | sbuf1[i * 2 + 0] = fetch(s1, x1); | - | ||||||||||||||||||
| 3003 | sbuf1[i * 2 + 1] = fetch(s1, x2); | - | ||||||||||||||||||
| 3004 | sbuf2[i * 2 + 0] = fetch(s2, x1); | - | ||||||||||||||||||
| 3005 | sbuf2[i * 2 + 1] = fetch(s2, x2); | - | ||||||||||||||||||
| 3006 | } never executed: end of block | 0 | ||||||||||||||||||
| 3007 | - | |||||||||||||||||||
| 3008 | fx += fdx; | - | ||||||||||||||||||
| 3009 | fy += fdy; | - | ||||||||||||||||||
| 3010 | } never executed: end of block | 0 | ||||||||||||||||||
| 3011 | layout->convertToARGB64PM(buf1, sbuf1, len * 2, layout, clut); | - | ||||||||||||||||||
| 3012 | layout->convertToARGB64PM(buf2, sbuf2, len * 2, layout, clut); | - | ||||||||||||||||||
| 3013 | - | |||||||||||||||||||
| 3014 | for (int i = 0; i < len; ++i) {
| 0 | ||||||||||||||||||
| 3015 | int distx = (fracX & 0x0000ffff); | - | ||||||||||||||||||
| 3016 | int disty = (fracY & 0x0000ffff); | - | ||||||||||||||||||
| 3017 | b[i] = interpolate_4_pixels_rgb64(buf1 + i*2, buf2 + i*2, distx, disty); | - | ||||||||||||||||||
| 3018 | fracX += fdx; | - | ||||||||||||||||||
| 3019 | fracY += fdy; | - | ||||||||||||||||||
| 3020 | } never executed: end of block | 0 | ||||||||||||||||||
| 3021 | - | |||||||||||||||||||
| 3022 | length -= len; | - | ||||||||||||||||||
| 3023 | b += len; | - | ||||||||||||||||||
| 3024 | } never executed: end of block | 0 | ||||||||||||||||||
| 3025 | } never executed: end of block | 0 | ||||||||||||||||||
| 3026 | } else { | - | ||||||||||||||||||
| 3027 | qreal fx = data->m21 * cy + data->m11 * cx + data->dx; | - | ||||||||||||||||||
| 3028 | qreal fy = data->m22 * cy + data->m12 * cx + data->dy; | - | ||||||||||||||||||
| 3029 | qreal fw = data->m23 * cy + data->m13 * cx + data->m33; | - | ||||||||||||||||||
| 3030 | - | |||||||||||||||||||
| 3031 | FetchPixelFunc fetch = qFetchPixel[layout->bpp]; | - | ||||||||||||||||||
| 3032 | uint sbuf1[buffer_size]; | - | ||||||||||||||||||
| 3033 | uint sbuf2[buffer_size]; | - | ||||||||||||||||||
| 3034 | QRgba64 buf1[buffer_size]; | - | ||||||||||||||||||
| 3035 | QRgba64 buf2[buffer_size]; | - | ||||||||||||||||||
| 3036 | QRgba64 *b = buffer; | - | ||||||||||||||||||
| 3037 | - | |||||||||||||||||||
| 3038 | int distxs[buffer_size / 2]; | - | ||||||||||||||||||
| 3039 | int distys[buffer_size / 2]; | - | ||||||||||||||||||
| 3040 | - | |||||||||||||||||||
| 3041 | while (length) {
| 0 | ||||||||||||||||||
| 3042 | int len = qMin(length, buffer_size / 2); | - | ||||||||||||||||||
| 3043 | for (int i = 0; i < len; ++i) {
| 0 | ||||||||||||||||||
| 3044 | const qreal iw = fw == 0 ? 1 : 1 / fw; | - | ||||||||||||||||||
| 3045 | const qreal px = fx * iw - qreal(0.5); | - | ||||||||||||||||||
| 3046 | const qreal py = fy * iw - qreal(0.5); | - | ||||||||||||||||||
| 3047 | - | |||||||||||||||||||
| 3048 | int x1 = int(px) - (px < 0); | - | ||||||||||||||||||
| 3049 | int x2; | - | ||||||||||||||||||
| 3050 | int y1 = int(py) - (py < 0); | - | ||||||||||||||||||
| 3051 | int y2; | - | ||||||||||||||||||
| 3052 | - | |||||||||||||||||||
| 3053 | distxs[i] = int((px - x1) * (1<<16)); | - | ||||||||||||||||||
| 3054 | distys[i] = int((py - y1) * (1<<16)); | - | ||||||||||||||||||
| 3055 | - | |||||||||||||||||||
| 3056 | fetchTransformedBilinear_pixelBounds<blendType>(image_width, image_x1, image_x2, x1, x2); | - | ||||||||||||||||||
| 3057 | fetchTransformedBilinear_pixelBounds<blendType>(image_height, image_y1, image_y2, y1, y2); | - | ||||||||||||||||||
| 3058 | - | |||||||||||||||||||
| 3059 | const uchar *s1 = data->texture.scanLine(y1); | - | ||||||||||||||||||
| 3060 | const uchar *s2 = data->texture.scanLine(y2); | - | ||||||||||||||||||
| 3061 | - | |||||||||||||||||||
| 3062 | if (layout->bpp == QPixelLayout::BPP32) {
| 0 | ||||||||||||||||||
| 3063 | sbuf1[i * 2 + 0] = ((const uint*)s1)[x1]; | - | ||||||||||||||||||
| 3064 | sbuf1[i * 2 + 1] = ((const uint*)s1)[x2]; | - | ||||||||||||||||||
| 3065 | sbuf2[i * 2 + 0] = ((const uint*)s2)[x1]; | - | ||||||||||||||||||
| 3066 | sbuf2[i * 2 + 1] = ((const uint*)s2)[x2]; | - | ||||||||||||||||||
| 3067 | - | |||||||||||||||||||
| 3068 | } else { never executed: end of block | 0 | ||||||||||||||||||
| 3069 | sbuf1[i * 2 + 0] = fetch(s1, x1); | - | ||||||||||||||||||
| 3070 | sbuf1[i * 2 + 1] = fetch(s1, x2); | - | ||||||||||||||||||
| 3071 | sbuf2[i * 2 + 0] = fetch(s2, x1); | - | ||||||||||||||||||
| 3072 | sbuf2[i * 2 + 1] = fetch(s2, x2); | - | ||||||||||||||||||
| 3073 | } never executed: end of block | 0 | ||||||||||||||||||
| 3074 | - | |||||||||||||||||||
| 3075 | fx += fdx; | - | ||||||||||||||||||
| 3076 | fy += fdy; | - | ||||||||||||||||||
| 3077 | fw += fdw; | - | ||||||||||||||||||
| 3078 | //force increment to avoid /0 | - | ||||||||||||||||||
| 3079 | if (!fw)
| 0 | ||||||||||||||||||
| 3080 | fw += fdw; never executed: fw += fdw; | 0 | ||||||||||||||||||
| 3081 | } never executed: end of block | 0 | ||||||||||||||||||
| 3082 | - | |||||||||||||||||||
| 3083 | layout->convertToARGB64PM(buf1, sbuf1, len * 2, layout, clut); | - | ||||||||||||||||||
| 3084 | layout->convertToARGB64PM(buf2, sbuf2, len * 2, layout, clut); | - | ||||||||||||||||||
| 3085 | - | |||||||||||||||||||
| 3086 | for (int i = 0; i < len; ++i) {
| 0 | ||||||||||||||||||
| 3087 | int distx = distxs[i]; | - | ||||||||||||||||||
| 3088 | int disty = distys[i]; | - | ||||||||||||||||||
| 3089 | b[i] = interpolate_4_pixels_rgb64(buf1 + i*2, buf2 + i*2, distx, disty); | - | ||||||||||||||||||
| 3090 | } never executed: end of block | 0 | ||||||||||||||||||
| 3091 | - | |||||||||||||||||||
| 3092 | length -= len; | - | ||||||||||||||||||
| 3093 | b += len; | - | ||||||||||||||||||
| 3094 | } never executed: end of block | 0 | ||||||||||||||||||
| 3095 | } never executed: end of block | 0 | ||||||||||||||||||
| 3096 | - | |||||||||||||||||||
| 3097 | return buffer; never executed: return buffer; | 0 | ||||||||||||||||||
| 3098 | } | - | ||||||||||||||||||
| 3099 | - | |||||||||||||||||||
| 3100 | static SourceFetchProc sourceFetch[NBlendTypes][QImage::NImageFormats] = { | - | ||||||||||||||||||
| 3101 | // Untransformed | - | ||||||||||||||||||
| 3102 | { | - | ||||||||||||||||||
| 3103 | 0, // Invalid | - | ||||||||||||||||||
| 3104 | fetchUntransformed, // Mono | - | ||||||||||||||||||
| 3105 | fetchUntransformed, // MonoLsb | - | ||||||||||||||||||
| 3106 | fetchUntransformed, // Indexed8 | - | ||||||||||||||||||
| 3107 | fetchUntransformedARGB32PM, // RGB32 | - | ||||||||||||||||||
| 3108 | fetchUntransformed, // ARGB32 | - | ||||||||||||||||||
| 3109 | fetchUntransformedARGB32PM, // ARGB32_Premultiplied | - | ||||||||||||||||||
| 3110 | fetchUntransformedRGB16, // RGB16 | - | ||||||||||||||||||
| 3111 | fetchUntransformed, // ARGB8565_Premultiplied | - | ||||||||||||||||||
| 3112 | fetchUntransformed, // RGB666 | - | ||||||||||||||||||
| 3113 | fetchUntransformed, // ARGB6666_Premultiplied | - | ||||||||||||||||||
| 3114 | fetchUntransformed, // RGB555 | - | ||||||||||||||||||
| 3115 | fetchUntransformed, // ARGB8555_Premultiplied | - | ||||||||||||||||||
| 3116 | fetchUntransformed, // RGB888 | - | ||||||||||||||||||
| 3117 | fetchUntransformed, // RGB444 | - | ||||||||||||||||||
| 3118 | fetchUntransformed, // ARGB4444_Premultiplied | - | ||||||||||||||||||
| 3119 | fetchUntransformed, // RGBX8888 | - | ||||||||||||||||||
| 3120 | fetchUntransformed, // RGBA8888 | - | ||||||||||||||||||
| 3121 | fetchUntransformed, // RGBA8888_Premultiplied | - | ||||||||||||||||||
| 3122 | fetchUntransformed, // Format_BGR30 | - | ||||||||||||||||||
| 3123 | fetchUntransformed, // Format_A2BGR30_Premultiplied | - | ||||||||||||||||||
| 3124 | fetchUntransformed, // Format_RGB30 | - | ||||||||||||||||||
| 3125 | fetchUntransformed, // Format_A2RGB30_Premultiplied | - | ||||||||||||||||||
| 3126 | fetchUntransformed, // Alpha8 | - | ||||||||||||||||||
| 3127 | fetchUntransformed, // Grayscale8 | - | ||||||||||||||||||
| 3128 | }, | - | ||||||||||||||||||
| 3129 | // Tiled | - | ||||||||||||||||||
| 3130 | { | - | ||||||||||||||||||
| 3131 | 0, // Invalid | - | ||||||||||||||||||
| 3132 | fetchUntransformed, // Mono | - | ||||||||||||||||||
| 3133 | fetchUntransformed, // MonoLsb | - | ||||||||||||||||||
| 3134 | fetchUntransformed, // Indexed8 | - | ||||||||||||||||||
| 3135 | fetchUntransformedARGB32PM, // RGB32 | - | ||||||||||||||||||
| 3136 | fetchUntransformed, // ARGB32 | - | ||||||||||||||||||
| 3137 | fetchUntransformedARGB32PM, // ARGB32_Premultiplied | - | ||||||||||||||||||
| 3138 | fetchUntransformedRGB16, // RGB16 | - | ||||||||||||||||||
| 3139 | fetchUntransformed, // ARGB8565_Premultiplied | - | ||||||||||||||||||
| 3140 | fetchUntransformed, // RGB666 | - | ||||||||||||||||||
| 3141 | fetchUntransformed, // ARGB6666_Premultiplied | - | ||||||||||||||||||
| 3142 | fetchUntransformed, // RGB555 | - | ||||||||||||||||||
| 3143 | fetchUntransformed, // ARGB8555_Premultiplied | - | ||||||||||||||||||
| 3144 | fetchUntransformed, // RGB888 | - | ||||||||||||||||||
| 3145 | fetchUntransformed, // RGB444 | - | ||||||||||||||||||
| 3146 | fetchUntransformed, // ARGB4444_Premultiplied | - | ||||||||||||||||||
| 3147 | fetchUntransformed, // RGBX8888 | - | ||||||||||||||||||
| 3148 | fetchUntransformed, // RGBA8888 | - | ||||||||||||||||||
| 3149 | fetchUntransformed, // RGBA8888_Premultiplied | - | ||||||||||||||||||
| 3150 | fetchUntransformed, // BGR30 | - | ||||||||||||||||||
| 3151 | fetchUntransformed, // A2BGR30_Premultiplied | - | ||||||||||||||||||
| 3152 | fetchUntransformed, // RGB30 | - | ||||||||||||||||||
| 3153 | fetchUntransformed, // A2RGB30_Premultiplied | - | ||||||||||||||||||
| 3154 | fetchUntransformed, // Alpha8 | - | ||||||||||||||||||
| 3155 | fetchUntransformed, // Grayscale8 | - | ||||||||||||||||||
| 3156 | }, | - | ||||||||||||||||||
| 3157 | // Transformed | - | ||||||||||||||||||
| 3158 | { | - | ||||||||||||||||||
| 3159 | 0, // Invalid | - | ||||||||||||||||||
| 3160 | fetchTransformed<BlendTransformed>, // Mono | - | ||||||||||||||||||
| 3161 | fetchTransformed<BlendTransformed>, // MonoLsb | - | ||||||||||||||||||
| 3162 | fetchTransformed<BlendTransformed>, // Indexed8 | - | ||||||||||||||||||
| 3163 | fetchTransformedARGB32PM<BlendTransformed>, // RGB32 | - | ||||||||||||||||||
| 3164 | fetchTransformed<BlendTransformed>, // ARGB32 | - | ||||||||||||||||||
| 3165 | fetchTransformedARGB32PM<BlendTransformed>, // ARGB32_Premultiplied | - | ||||||||||||||||||
| 3166 | fetchTransformed<BlendTransformed>, // RGB16 | - | ||||||||||||||||||
| 3167 | fetchTransformed<BlendTransformed>, // ARGB8565_Premultiplied | - | ||||||||||||||||||
| 3168 | fetchTransformed<BlendTransformed>, // RGB666 | - | ||||||||||||||||||
| 3169 | fetchTransformed<BlendTransformed>, // ARGB6666_Premultiplied | - | ||||||||||||||||||
| 3170 | fetchTransformed<BlendTransformed>, // RGB555 | - | ||||||||||||||||||
| 3171 | fetchTransformed<BlendTransformed>, // ARGB8555_Premultiplied | - | ||||||||||||||||||
| 3172 | fetchTransformed<BlendTransformed>, // RGB888 | - | ||||||||||||||||||
| 3173 | fetchTransformed<BlendTransformed>, // RGB444 | - | ||||||||||||||||||
| 3174 | fetchTransformed<BlendTransformed>, // ARGB4444_Premultiplied | - | ||||||||||||||||||
| 3175 | fetchTransformed<BlendTransformed>, // RGBX8888 | - | ||||||||||||||||||
| 3176 | fetchTransformed<BlendTransformed>, // RGBA8888 | - | ||||||||||||||||||
| 3177 | fetchTransformed<BlendTransformed>, // RGBA8888_Premultiplied | - | ||||||||||||||||||
| 3178 | fetchTransformed<BlendTransformed>, // BGR30 | - | ||||||||||||||||||
| 3179 | fetchTransformed<BlendTransformed>, // A2BGR30_Premultiplied | - | ||||||||||||||||||
| 3180 | fetchTransformed<BlendTransformed>, // RGB30 | - | ||||||||||||||||||
| 3181 | fetchTransformed<BlendTransformed>, // A2RGB30_Premultiplied | - | ||||||||||||||||||
| 3182 | fetchTransformed<BlendTransformed>, // Alpah8 | - | ||||||||||||||||||
| 3183 | fetchTransformed<BlendTransformed>, // Grayscale8 | - | ||||||||||||||||||
| 3184 | }, | - | ||||||||||||||||||
| 3185 | { | - | ||||||||||||||||||
| 3186 | 0, // TransformedTiled | - | ||||||||||||||||||
| 3187 | fetchTransformed<BlendTransformedTiled>, // Mono | - | ||||||||||||||||||
| 3188 | fetchTransformed<BlendTransformedTiled>, // MonoLsb | - | ||||||||||||||||||
| 3189 | fetchTransformed<BlendTransformedTiled>, // Indexed8 | - | ||||||||||||||||||
| 3190 | fetchTransformedARGB32PM<BlendTransformedTiled>, // RGB32 | - | ||||||||||||||||||
| 3191 | fetchTransformed<BlendTransformedTiled>, // ARGB32 | - | ||||||||||||||||||
| 3192 | fetchTransformedARGB32PM<BlendTransformedTiled>, // ARGB32_Premultiplied | - | ||||||||||||||||||
| 3193 | fetchTransformed<BlendTransformedTiled>, // RGB16 | - | ||||||||||||||||||
| 3194 | fetchTransformed<BlendTransformedTiled>, // ARGB8565_Premultiplied | - | ||||||||||||||||||
| 3195 | fetchTransformed<BlendTransformedTiled>, // RGB666 | - | ||||||||||||||||||
| 3196 | fetchTransformed<BlendTransformedTiled>, // ARGB6666_Premultiplied | - | ||||||||||||||||||
| 3197 | fetchTransformed<BlendTransformedTiled>, // RGB555 | - | ||||||||||||||||||
| 3198 | fetchTransformed<BlendTransformedTiled>, // ARGB8555_Premultiplied | - | ||||||||||||||||||
| 3199 | fetchTransformed<BlendTransformedTiled>, // RGB888 | - | ||||||||||||||||||
| 3200 | fetchTransformed<BlendTransformedTiled>, // RGB444 | - | ||||||||||||||||||
| 3201 | fetchTransformed<BlendTransformedTiled>, // ARGB4444_Premultiplied | - | ||||||||||||||||||
| 3202 | fetchTransformed<BlendTransformedTiled>, // RGBX8888 | - | ||||||||||||||||||
| 3203 | fetchTransformed<BlendTransformedTiled>, // RGBA8888 | - | ||||||||||||||||||
| 3204 | fetchTransformed<BlendTransformedTiled>, // RGBA8888_Premultiplied | - | ||||||||||||||||||
| 3205 | fetchTransformed<BlendTransformedTiled>, // BGR30 | - | ||||||||||||||||||
| 3206 | fetchTransformed<BlendTransformedTiled>, // A2BGR30_Premultiplied | - | ||||||||||||||||||
| 3207 | fetchTransformed<BlendTransformedTiled>, // RGB30 | - | ||||||||||||||||||
| 3208 | fetchTransformed<BlendTransformedTiled>, // A2RGB30_Premultiplied | - | ||||||||||||||||||
| 3209 | fetchTransformed<BlendTransformedTiled>, // Alpha8 | - | ||||||||||||||||||
| 3210 | fetchTransformed<BlendTransformedTiled>, // Grayscale8 | - | ||||||||||||||||||
| 3211 | }, | - | ||||||||||||||||||
| 3212 | { | - | ||||||||||||||||||
| 3213 | 0, // Bilinear | - | ||||||||||||||||||
| 3214 | fetchTransformedBilinear<BlendTransformedBilinear>, // Mono | - | ||||||||||||||||||
| 3215 | fetchTransformedBilinear<BlendTransformedBilinear>, // MonoLsb | - | ||||||||||||||||||
| 3216 | fetchTransformedBilinear<BlendTransformedBilinear>, // Indexed8 | - | ||||||||||||||||||
| 3217 | fetchTransformedBilinearARGB32PM<BlendTransformedBilinear>, // RGB32 | - | ||||||||||||||||||
| 3218 | fetchTransformedBilinear<BlendTransformedBilinear>, // ARGB32 | - | ||||||||||||||||||
| 3219 | fetchTransformedBilinearARGB32PM<BlendTransformedBilinear>, // ARGB32_Premultiplied | - | ||||||||||||||||||
| 3220 | fetchTransformedBilinear<BlendTransformedBilinear>, // RGB16 | - | ||||||||||||||||||
| 3221 | fetchTransformedBilinear<BlendTransformedBilinear>, // ARGB8565_Premultiplied | - | ||||||||||||||||||
| 3222 | fetchTransformedBilinear<BlendTransformedBilinear>, // RGB666 | - | ||||||||||||||||||
| 3223 | fetchTransformedBilinear<BlendTransformedBilinear>, // ARGB6666_Premultiplied | - | ||||||||||||||||||
| 3224 | fetchTransformedBilinear<BlendTransformedBilinear>, // RGB555 | - | ||||||||||||||||||
| 3225 | fetchTransformedBilinear<BlendTransformedBilinear>, // ARGB8555_Premultiplied | - | ||||||||||||||||||
| 3226 | fetchTransformedBilinear<BlendTransformedBilinear>, // RGB888 | - | ||||||||||||||||||
| 3227 | fetchTransformedBilinear<BlendTransformedBilinear>, // RGB444 | - | ||||||||||||||||||
| 3228 | fetchTransformedBilinear<BlendTransformedBilinear>, // ARGB4444_Premultiplied | - | ||||||||||||||||||
| 3229 | fetchTransformedBilinear<BlendTransformedBilinear>, // RGBX8888 | - | ||||||||||||||||||
| 3230 | fetchTransformedBilinear<BlendTransformedBilinear>, // RGBA8888 | - | ||||||||||||||||||
| 3231 | fetchTransformedBilinear<BlendTransformedBilinear>, // RGBA8888_Premultiplied | - | ||||||||||||||||||
| 3232 | fetchTransformedBilinear<BlendTransformedBilinear>, // BGR30 | - | ||||||||||||||||||
| 3233 | fetchTransformedBilinear<BlendTransformedBilinear>, // A2BGR30_Premultiplied | - | ||||||||||||||||||
| 3234 | fetchTransformedBilinear<BlendTransformedBilinear>, // RGB30 | - | ||||||||||||||||||
| 3235 | fetchTransformedBilinear<BlendTransformedBilinear>, // A2RGB30_Premultiplied | - | ||||||||||||||||||
| 3236 | fetchTransformedBilinear<BlendTransformedBilinear>, // Alpha8 | - | ||||||||||||||||||
| 3237 | fetchTransformedBilinear<BlendTransformedBilinear>, // Grayscale8 | - | ||||||||||||||||||
| 3238 | }, | - | ||||||||||||||||||
| 3239 | { | - | ||||||||||||||||||
| 3240 | 0, // BilinearTiled | - | ||||||||||||||||||
| 3241 | fetchTransformedBilinear<BlendTransformedBilinearTiled>, // Mono | - | ||||||||||||||||||
| 3242 | fetchTransformedBilinear<BlendTransformedBilinearTiled>, // MonoLsb | - | ||||||||||||||||||
| 3243 | fetchTransformedBilinear<BlendTransformedBilinearTiled>, // Indexed8 | - | ||||||||||||||||||
| 3244 | fetchTransformedBilinearARGB32PM<BlendTransformedBilinearTiled>, // RGB32 | - | ||||||||||||||||||
| 3245 | fetchTransformedBilinear<BlendTransformedBilinearTiled>, // ARGB32 | - | ||||||||||||||||||
| 3246 | fetchTransformedBilinearARGB32PM<BlendTransformedBilinearTiled>, // ARGB32_Premultiplied | - | ||||||||||||||||||
| 3247 | fetchTransformedBilinear<BlendTransformedBilinearTiled>, // RGB16 | - | ||||||||||||||||||
| 3248 | fetchTransformedBilinear<BlendTransformedBilinearTiled>, // ARGB8565_Premultiplied | - | ||||||||||||||||||
| 3249 | fetchTransformedBilinear<BlendTransformedBilinearTiled>, // RGB666 | - | ||||||||||||||||||
| 3250 | fetchTransformedBilinear<BlendTransformedBilinearTiled>, // ARGB6666_Premultiplied | - | ||||||||||||||||||
| 3251 | fetchTransformedBilinear<BlendTransformedBilinearTiled>, // RGB555 | - | ||||||||||||||||||
| 3252 | fetchTransformedBilinear<BlendTransformedBilinearTiled>, // ARGB8555_Premultiplied | - | ||||||||||||||||||
| 3253 | fetchTransformedBilinear<BlendTransformedBilinearTiled>, // RGB888 | - | ||||||||||||||||||
| 3254 | fetchTransformedBilinear<BlendTransformedBilinearTiled>, // RGB444 | - | ||||||||||||||||||
| 3255 | fetchTransformedBilinear<BlendTransformedBilinearTiled>, // ARGB4444_Premultiplied | - | ||||||||||||||||||
| 3256 | fetchTransformedBilinear<BlendTransformedBilinearTiled>, // RGBX8888 | - | ||||||||||||||||||
| 3257 | fetchTransformedBilinear<BlendTransformedBilinearTiled>, // RGBA8888 | - | ||||||||||||||||||
| 3258 | fetchTransformedBilinear<BlendTransformedBilinearTiled>, // RGBA8888_Premultiplied | - | ||||||||||||||||||
| 3259 | fetchTransformedBilinear<BlendTransformedBilinearTiled>, // BGR30 | - | ||||||||||||||||||
| 3260 | fetchTransformedBilinear<BlendTransformedBilinearTiled>, // A2BGR30_Premultiplied | - | ||||||||||||||||||
| 3261 | fetchTransformedBilinear<BlendTransformedBilinearTiled>, // RGB30 | - | ||||||||||||||||||
| 3262 | fetchTransformedBilinear<BlendTransformedBilinearTiled>, // A2RGB30_Premultiplied | - | ||||||||||||||||||
| 3263 | fetchTransformedBilinear<BlendTransformedBilinearTiled>, // Alpha8 | - | ||||||||||||||||||
| 3264 | fetchTransformedBilinear<BlendTransformedBilinearTiled>, // Grayscale8 | - | ||||||||||||||||||
| 3265 | }, | - | ||||||||||||||||||
| 3266 | }; | - | ||||||||||||||||||
| 3267 | - | |||||||||||||||||||
| 3268 | static SourceFetchProc64 sourceFetch64[NBlendTypes][QImage::NImageFormats] = { | - | ||||||||||||||||||
| 3269 | // Untransformed | - | ||||||||||||||||||
| 3270 | { | - | ||||||||||||||||||
| 3271 | 0, // Invalid | - | ||||||||||||||||||
| 3272 | fetchUntransformed64, // Mono | - | ||||||||||||||||||
| 3273 | fetchUntransformed64, // MonoLsb | - | ||||||||||||||||||
| 3274 | fetchUntransformed64, // Indexed8 | - | ||||||||||||||||||
| 3275 | fetchUntransformed64, // RGB32 | - | ||||||||||||||||||
| 3276 | fetchUntransformed64, // ARGB32 | - | ||||||||||||||||||
| 3277 | fetchUntransformed64, // ARGB32_Premultiplied | - | ||||||||||||||||||
| 3278 | fetchUntransformed64, // RGB16 | - | ||||||||||||||||||
| 3279 | fetchUntransformed64, // ARGB8565_Premultiplied | - | ||||||||||||||||||
| 3280 | fetchUntransformed64, // RGB666 | - | ||||||||||||||||||
| 3281 | fetchUntransformed64, // ARGB6666_Premultiplied | - | ||||||||||||||||||
| 3282 | fetchUntransformed64, // RGB555 | - | ||||||||||||||||||
| 3283 | fetchUntransformed64, // ARGB8555_Premultiplied | - | ||||||||||||||||||
| 3284 | fetchUntransformed64, // RGB888 | - | ||||||||||||||||||
| 3285 | fetchUntransformed64, // RGB444 | - | ||||||||||||||||||
| 3286 | fetchUntransformed64, // ARGB4444_Premultiplied | - | ||||||||||||||||||
| 3287 | fetchUntransformed64, // RGBX8888 | - | ||||||||||||||||||
| 3288 | fetchUntransformed64, // RGBA8888 | - | ||||||||||||||||||
| 3289 | fetchUntransformed64, // RGBA8888_Premultiplied | - | ||||||||||||||||||
| 3290 | fetchUntransformed64, // Format_BGR30 | - | ||||||||||||||||||
| 3291 | fetchUntransformed64, // Format_A2BGR30_Premultiplied | - | ||||||||||||||||||
| 3292 | fetchUntransformed64, // Format_RGB30 | - | ||||||||||||||||||
| 3293 | fetchUntransformed64, // Format_A2RGB30_Premultiplied | - | ||||||||||||||||||
| 3294 | fetchUntransformed64, // Alpha8 | - | ||||||||||||||||||
| 3295 | fetchUntransformed64, // Grayscale8 | - | ||||||||||||||||||
| 3296 | }, | - | ||||||||||||||||||
| 3297 | // Tiled | - | ||||||||||||||||||
| 3298 | { | - | ||||||||||||||||||
| 3299 | 0, // Invalid | - | ||||||||||||||||||
| 3300 | fetchUntransformed64, // Mono | - | ||||||||||||||||||
| 3301 | fetchUntransformed64, // MonoLsb | - | ||||||||||||||||||
| 3302 | fetchUntransformed64, // Indexed8 | - | ||||||||||||||||||
| 3303 | fetchUntransformed64, // RGB32 | - | ||||||||||||||||||
| 3304 | fetchUntransformed64, // ARGB32 | - | ||||||||||||||||||
| 3305 | fetchUntransformed64, // ARGB32_Premultiplied | - | ||||||||||||||||||
| 3306 | fetchUntransformed64, // RGB16 | - | ||||||||||||||||||
| 3307 | fetchUntransformed64, // ARGB8565_Premultiplied | - | ||||||||||||||||||
| 3308 | fetchUntransformed64, // RGB666 | - | ||||||||||||||||||
| 3309 | fetchUntransformed64, // ARGB6666_Premultiplied | - | ||||||||||||||||||
| 3310 | fetchUntransformed64, // RGB555 | - | ||||||||||||||||||
| 3311 | fetchUntransformed64, // ARGB8555_Premultiplied | - | ||||||||||||||||||
| 3312 | fetchUntransformed64, // RGB888 | - | ||||||||||||||||||
| 3313 | fetchUntransformed64, // RGB444 | - | ||||||||||||||||||
| 3314 | fetchUntransformed64, // ARGB4444_Premultiplied | - | ||||||||||||||||||
| 3315 | fetchUntransformed64, // RGBX8888 | - | ||||||||||||||||||
| 3316 | fetchUntransformed64, // RGBA8888 | - | ||||||||||||||||||
| 3317 | fetchUntransformed64, // RGBA8888_Premultiplied | - | ||||||||||||||||||
| 3318 | fetchUntransformed64, // BGR30 | - | ||||||||||||||||||
| 3319 | fetchUntransformed64, // A2BGR30_Premultiplied | - | ||||||||||||||||||
| 3320 | fetchUntransformed64, // RGB30 | - | ||||||||||||||||||
| 3321 | fetchUntransformed64, // A2RGB30_Premultiplied | - | ||||||||||||||||||
| 3322 | fetchUntransformed64, // Alpha8 | - | ||||||||||||||||||
| 3323 | fetchUntransformed64, // Grayscale8 | - | ||||||||||||||||||
| 3324 | }, | - | ||||||||||||||||||
| 3325 | // Transformed | - | ||||||||||||||||||
| 3326 | { | - | ||||||||||||||||||
| 3327 | 0, // Invalid | - | ||||||||||||||||||
| 3328 | fetchTransformed64<BlendTransformed>, // Mono | - | ||||||||||||||||||
| 3329 | fetchTransformed64<BlendTransformed>, // MonoLsb | - | ||||||||||||||||||
| 3330 | fetchTransformed64<BlendTransformed>, // Indexed8 | - | ||||||||||||||||||
| 3331 | fetchTransformed64<BlendTransformed>, // RGB32 | - | ||||||||||||||||||
| 3332 | fetchTransformed64<BlendTransformed>, // ARGB32 | - | ||||||||||||||||||
| 3333 | fetchTransformed64<BlendTransformed>, // ARGB32_Premultiplied | - | ||||||||||||||||||
| 3334 | fetchTransformed64<BlendTransformed>, // RGB16 | - | ||||||||||||||||||
| 3335 | fetchTransformed64<BlendTransformed>, // ARGB8565_Premultiplied | - | ||||||||||||||||||
| 3336 | fetchTransformed64<BlendTransformed>, // RGB666 | - | ||||||||||||||||||
| 3337 | fetchTransformed64<BlendTransformed>, // ARGB6666_Premultiplied | - | ||||||||||||||||||
| 3338 | fetchTransformed64<BlendTransformed>, // RGB555 | - | ||||||||||||||||||
| 3339 | fetchTransformed64<BlendTransformed>, // ARGB8555_Premultiplied | - | ||||||||||||||||||
| 3340 | fetchTransformed64<BlendTransformed>, // RGB888 | - | ||||||||||||||||||
| 3341 | fetchTransformed64<BlendTransformed>, // RGB444 | - | ||||||||||||||||||
| 3342 | fetchTransformed64<BlendTransformed>, // ARGB4444_Premultiplied | - | ||||||||||||||||||
| 3343 | fetchTransformed64<BlendTransformed>, // RGBX8888 | - | ||||||||||||||||||
| 3344 | fetchTransformed64<BlendTransformed>, // RGBA8888 | - | ||||||||||||||||||
| 3345 | fetchTransformed64<BlendTransformed>, // RGBA8888_Premultiplied | - | ||||||||||||||||||
| 3346 | fetchTransformed64<BlendTransformed>, // BGR30 | - | ||||||||||||||||||
| 3347 | fetchTransformed64<BlendTransformed>, // A2BGR30_Premultiplied | - | ||||||||||||||||||
| 3348 | fetchTransformed64<BlendTransformed>, // RGB30 | - | ||||||||||||||||||
| 3349 | fetchTransformed64<BlendTransformed>, // A2RGB30_Premultiplied | - | ||||||||||||||||||
| 3350 | fetchTransformed64<BlendTransformed>, // Alpah8 | - | ||||||||||||||||||
| 3351 | fetchTransformed64<BlendTransformed>, // Grayscale8 | - | ||||||||||||||||||
| 3352 | }, | - | ||||||||||||||||||
| 3353 | { | - | ||||||||||||||||||
| 3354 | 0, // TransformedTiled | - | ||||||||||||||||||
| 3355 | fetchTransformed64<BlendTransformedTiled>, // Mono | - | ||||||||||||||||||
| 3356 | fetchTransformed64<BlendTransformedTiled>, // MonoLsb | - | ||||||||||||||||||
| 3357 | fetchTransformed64<BlendTransformedTiled>, // Indexed8 | - | ||||||||||||||||||
| 3358 | fetchTransformed64<BlendTransformedTiled>, // RGB32 | - | ||||||||||||||||||
| 3359 | fetchTransformed64<BlendTransformedTiled>, // ARGB32 | - | ||||||||||||||||||
| 3360 | fetchTransformed64<BlendTransformedTiled>, // ARGB32_Premultiplied | - | ||||||||||||||||||
| 3361 | fetchTransformed64<BlendTransformedTiled>, // RGB16 | - | ||||||||||||||||||
| 3362 | fetchTransformed64<BlendTransformedTiled>, // ARGB8565_Premultiplied | - | ||||||||||||||||||
| 3363 | fetchTransformed64<BlendTransformedTiled>, // RGB666 | - | ||||||||||||||||||
| 3364 | fetchTransformed64<BlendTransformedTiled>, // ARGB6666_Premultiplied | - | ||||||||||||||||||
| 3365 | fetchTransformed64<BlendTransformedTiled>, // RGB555 | - | ||||||||||||||||||
| 3366 | fetchTransformed64<BlendTransformedTiled>, // ARGB8555_Premultiplied | - | ||||||||||||||||||
| 3367 | fetchTransformed64<BlendTransformedTiled>, // RGB888 | - | ||||||||||||||||||
| 3368 | fetchTransformed64<BlendTransformedTiled>, // RGB444 | - | ||||||||||||||||||
| 3369 | fetchTransformed64<BlendTransformedTiled>, // ARGB4444_Premultiplied | - | ||||||||||||||||||
| 3370 | fetchTransformed64<BlendTransformedTiled>, // RGBX8888 | - | ||||||||||||||||||
| 3371 | fetchTransformed64<BlendTransformedTiled>, // RGBA8888 | - | ||||||||||||||||||
| 3372 | fetchTransformed64<BlendTransformedTiled>, // RGBA8888_Premultiplied | - | ||||||||||||||||||
| 3373 | fetchTransformed64<BlendTransformedTiled>, // BGR30 | - | ||||||||||||||||||
| 3374 | fetchTransformed64<BlendTransformedTiled>, // A2BGR30_Premultiplied | - | ||||||||||||||||||
| 3375 | fetchTransformed64<BlendTransformedTiled>, // RGB30 | - | ||||||||||||||||||
| 3376 | fetchTransformed64<BlendTransformedTiled>, // A2RGB30_Premultiplied | - | ||||||||||||||||||
| 3377 | fetchTransformed64<BlendTransformedTiled>, // Alpha8 | - | ||||||||||||||||||
| 3378 | fetchTransformed64<BlendTransformedTiled>, // Grayscale8 | - | ||||||||||||||||||
| 3379 | }, | - | ||||||||||||||||||
| 3380 | { | - | ||||||||||||||||||
| 3381 | 0, // Bilinear | - | ||||||||||||||||||
| 3382 | fetchTransformedBilinear64<BlendTransformedBilinear>, // Mono | - | ||||||||||||||||||
| 3383 | fetchTransformedBilinear64<BlendTransformedBilinear>, // MonoLsb | - | ||||||||||||||||||
| 3384 | fetchTransformedBilinear64<BlendTransformedBilinear>, // Indexed8 | - | ||||||||||||||||||
| 3385 | fetchTransformedBilinear64<BlendTransformedBilinear>, // RGB32 | - | ||||||||||||||||||
| 3386 | fetchTransformedBilinear64<BlendTransformedBilinear>, // ARGB32 | - | ||||||||||||||||||
| 3387 | fetchTransformedBilinear64<BlendTransformedBilinear>, // ARGB32_Premultiplied | - | ||||||||||||||||||
| 3388 | fetchTransformedBilinear64<BlendTransformedBilinear>, // RGB16 | - | ||||||||||||||||||
| 3389 | fetchTransformedBilinear64<BlendTransformedBilinear>, // ARGB8565_Premultiplied | - | ||||||||||||||||||
| 3390 | fetchTransformedBilinear64<BlendTransformedBilinear>, // RGB666 | - | ||||||||||||||||||
| 3391 | fetchTransformedBilinear64<BlendTransformedBilinear>, // ARGB6666_Premultiplied | - | ||||||||||||||||||
| 3392 | fetchTransformedBilinear64<BlendTransformedBilinear>, // RGB555 | - | ||||||||||||||||||
| 3393 | fetchTransformedBilinear64<BlendTransformedBilinear>, // ARGB8555_Premultiplied | - | ||||||||||||||||||
| 3394 | fetchTransformedBilinear64<BlendTransformedBilinear>, // RGB888 | - | ||||||||||||||||||
| 3395 | fetchTransformedBilinear64<BlendTransformedBilinear>, // RGB444 | - | ||||||||||||||||||
| 3396 | fetchTransformedBilinear64<BlendTransformedBilinear>, // ARGB4444_Premultiplied | - | ||||||||||||||||||
| 3397 | fetchTransformedBilinear64<BlendTransformedBilinear>, // RGBX8888 | - | ||||||||||||||||||
| 3398 | fetchTransformedBilinear64<BlendTransformedBilinear>, // RGBA8888 | - | ||||||||||||||||||
| 3399 | fetchTransformedBilinear64<BlendTransformedBilinear>, // RGBA8888_Premultiplied | - | ||||||||||||||||||
| 3400 | fetchTransformedBilinear64<BlendTransformedBilinear>, // BGR30 | - | ||||||||||||||||||
| 3401 | fetchTransformedBilinear64<BlendTransformedBilinear>, // A2BGR30_Premultiplied | - | ||||||||||||||||||
| 3402 | fetchTransformedBilinear64<BlendTransformedBilinear>, // RGB30 | - | ||||||||||||||||||
| 3403 | fetchTransformedBilinear64<BlendTransformedBilinear>, // A2RGB30_Premultiplied | - | ||||||||||||||||||
| 3404 | fetchTransformedBilinear64<BlendTransformedBilinear>, // Alpha8 | - | ||||||||||||||||||
| 3405 | fetchTransformedBilinear64<BlendTransformedBilinear>, // Grayscale8 | - | ||||||||||||||||||
| 3406 | }, | - | ||||||||||||||||||
| 3407 | { | - | ||||||||||||||||||
| 3408 | 0, // BilinearTiled | - | ||||||||||||||||||
| 3409 | fetchTransformedBilinear64<BlendTransformedBilinearTiled>, // Mono | - | ||||||||||||||||||
| 3410 | fetchTransformedBilinear64<BlendTransformedBilinearTiled>, // MonoLsb | - | ||||||||||||||||||
| 3411 | fetchTransformedBilinear64<BlendTransformedBilinearTiled>, // Indexed8 | - | ||||||||||||||||||
| 3412 | fetchTransformedBilinear64<BlendTransformedBilinearTiled>, // RGB32 | - | ||||||||||||||||||
| 3413 | fetchTransformedBilinear64<BlendTransformedBilinearTiled>, // ARGB32 | - | ||||||||||||||||||
| 3414 | fetchTransformedBilinear64<BlendTransformedBilinearTiled>, // ARGB32_Premultiplied | - | ||||||||||||||||||
| 3415 | fetchTransformedBilinear64<BlendTransformedBilinearTiled>, // RGB16 | - | ||||||||||||||||||
| 3416 | fetchTransformedBilinear64<BlendTransformedBilinearTiled>, // ARGB8565_Premultiplied | - | ||||||||||||||||||
| 3417 | fetchTransformedBilinear64<BlendTransformedBilinearTiled>, // RGB666 | - | ||||||||||||||||||
| 3418 | fetchTransformedBilinear64<BlendTransformedBilinearTiled>, // ARGB6666_Premultiplied | - | ||||||||||||||||||
| 3419 | fetchTransformedBilinear64<BlendTransformedBilinearTiled>, // RGB555 | - | ||||||||||||||||||
| 3420 | fetchTransformedBilinear64<BlendTransformedBilinearTiled>, // ARGB8555_Premultiplied | - | ||||||||||||||||||
| 3421 | fetchTransformedBilinear64<BlendTransformedBilinearTiled>, // RGB888 | - | ||||||||||||||||||
| 3422 | fetchTransformedBilinear64<BlendTransformedBilinearTiled>, // RGB444 | - | ||||||||||||||||||
| 3423 | fetchTransformedBilinear64<BlendTransformedBilinearTiled>, // ARGB4444_Premultiplied | - | ||||||||||||||||||
| 3424 | fetchTransformedBilinear64<BlendTransformedBilinearTiled>, // RGBX8888 | - | ||||||||||||||||||
| 3425 | fetchTransformedBilinear64<BlendTransformedBilinearTiled>, // RGBA8888 | - | ||||||||||||||||||
| 3426 | fetchTransformedBilinear64<BlendTransformedBilinearTiled>, // RGBA8888_Premultiplied | - | ||||||||||||||||||
| 3427 | fetchTransformedBilinear64<BlendTransformedBilinearTiled>, // BGR30 | - | ||||||||||||||||||
| 3428 | fetchTransformedBilinear64<BlendTransformedBilinearTiled>, // A2BGR30_Premultiplied | - | ||||||||||||||||||
| 3429 | fetchTransformedBilinear64<BlendTransformedBilinearTiled>, // RGB30 | - | ||||||||||||||||||
| 3430 | fetchTransformedBilinear64<BlendTransformedBilinearTiled>, // A2RGB30_Premultiplied | - | ||||||||||||||||||
| 3431 | fetchTransformedBilinear64<BlendTransformedBilinearTiled>, // Alpha8 | - | ||||||||||||||||||
| 3432 | fetchTransformedBilinear64<BlendTransformedBilinearTiled>, // Grayscale8 | - | ||||||||||||||||||
| 3433 | }, | - | ||||||||||||||||||
| 3434 | }; | - | ||||||||||||||||||
| 3435 | - | |||||||||||||||||||
| 3436 | #define FIXPT_BITS 8 | - | ||||||||||||||||||
| 3437 | #define FIXPT_SIZE (1<<FIXPT_BITS) | - | ||||||||||||||||||
| 3438 | - | |||||||||||||||||||
| 3439 | static uint qt_gradient_pixel_fixed(const QGradientData *data, int fixed_pos) | - | ||||||||||||||||||
| 3440 | { | - | ||||||||||||||||||
| 3441 | int ipos = (fixed_pos + (FIXPT_SIZE / 2)) >> FIXPT_BITS; | - | ||||||||||||||||||
| 3442 | return data->colorTable32[qt_gradient_clamp(data, ipos)]; never executed: return data->colorTable32[qt_gradient_clamp(data, ipos)]; | 0 | ||||||||||||||||||
| 3443 | } | - | ||||||||||||||||||
| 3444 | - | |||||||||||||||||||
| 3445 | static const QRgba64& qt_gradient_pixel64_fixed(const QGradientData *data, int fixed_pos) | - | ||||||||||||||||||
| 3446 | { | - | ||||||||||||||||||
| 3447 | int ipos = (fixed_pos + (FIXPT_SIZE / 2)) >> FIXPT_BITS; | - | ||||||||||||||||||
| 3448 | return data->colorTable64[qt_gradient_clamp(data, ipos)]; never executed: return data->colorTable64[qt_gradient_clamp(data, ipos)]; | 0 | ||||||||||||||||||
| 3449 | } | - | ||||||||||||||||||
| 3450 | - | |||||||||||||||||||
| 3451 | static void QT_FASTCALL getLinearGradientValues(LinearGradientValues *v, const QSpanData *data) | - | ||||||||||||||||||
| 3452 | { | - | ||||||||||||||||||
| 3453 | v->dx = data->gradient.linear.end.x - data->gradient.linear.origin.x; | - | ||||||||||||||||||
| 3454 | v->dy = data->gradient.linear.end.y - data->gradient.linear.origin.y; | - | ||||||||||||||||||
| 3455 | v->l = v->dx * v->dx + v->dy * v->dy; | - | ||||||||||||||||||
| 3456 | v->off = 0; | - | ||||||||||||||||||
| 3457 | if (v->l != 0) {
| 0 | ||||||||||||||||||
| 3458 | v->dx /= v->l; | - | ||||||||||||||||||
| 3459 | v->dy /= v->l; | - | ||||||||||||||||||
| 3460 | v->off = -v->dx * data->gradient.linear.origin.x - v->dy * data->gradient.linear.origin.y; | - | ||||||||||||||||||
| 3461 | } never executed: end of block | 0 | ||||||||||||||||||
| 3462 | } never executed: end of block | 0 | ||||||||||||||||||
| 3463 | - | |||||||||||||||||||
| 3464 | class GradientBase32 | - | ||||||||||||||||||
| 3465 | { | - | ||||||||||||||||||
| 3466 | public: | - | ||||||||||||||||||
| 3467 | typedef uint Type; | - | ||||||||||||||||||
| 3468 | static Type null() { return 0; } never executed: return 0; | 0 | ||||||||||||||||||
| 3469 | static Type fetchSingle(const QGradientData& gradient, qreal v) | - | ||||||||||||||||||
| 3470 | { | - | ||||||||||||||||||
| 3471 | return qt_gradient_pixel(&gradient, v); never executed: return qt_gradient_pixel(&gradient, v); | 0 | ||||||||||||||||||
| 3472 | } | - | ||||||||||||||||||
| 3473 | static Type fetchSingle(const QGradientData& gradient, int v) | - | ||||||||||||||||||
| 3474 | { | - | ||||||||||||||||||
| 3475 | return qt_gradient_pixel_fixed(&gradient, v); never executed: return qt_gradient_pixel_fixed(&gradient, v); | 0 | ||||||||||||||||||
| 3476 | } | - | ||||||||||||||||||
| 3477 | static void memfill(Type *buffer, Type fill, int length) | - | ||||||||||||||||||
| 3478 | { | - | ||||||||||||||||||
| 3479 | qt_memfill32(buffer, fill, length); | - | ||||||||||||||||||
| 3480 | } never executed: end of block | 0 | ||||||||||||||||||
| 3481 | }; | - | ||||||||||||||||||
| 3482 | - | |||||||||||||||||||
| 3483 | class GradientBase64 | - | ||||||||||||||||||
| 3484 | { | - | ||||||||||||||||||
| 3485 | public: | - | ||||||||||||||||||
| 3486 | typedef QRgba64 Type; | - | ||||||||||||||||||
| 3487 | static Type null() { return QRgba64::fromRgba64(0); } never executed: return QRgba64::fromRgba64(0); | 0 | ||||||||||||||||||
| 3488 | static Type fetchSingle(const QGradientData& gradient, qreal v) | - | ||||||||||||||||||
| 3489 | { | - | ||||||||||||||||||
| 3490 | return qt_gradient_pixel64(&gradient, v); never executed: return qt_gradient_pixel64(&gradient, v); | 0 | ||||||||||||||||||
| 3491 | } | - | ||||||||||||||||||
| 3492 | static Type fetchSingle(const QGradientData& gradient, int v) | - | ||||||||||||||||||
| 3493 | { | - | ||||||||||||||||||
| 3494 | return qt_gradient_pixel64_fixed(&gradient, v); never executed: return qt_gradient_pixel64_fixed(&gradient, v); | 0 | ||||||||||||||||||
| 3495 | } | - | ||||||||||||||||||
| 3496 | static void memfill(Type *buffer, Type fill, int length) | - | ||||||||||||||||||
| 3497 | { | - | ||||||||||||||||||
| 3498 | qt_memfill64((quint64*)buffer, fill, length); | - | ||||||||||||||||||
| 3499 | } never executed: end of block | 0 | ||||||||||||||||||
| 3500 | }; | - | ||||||||||||||||||
| 3501 | - | |||||||||||||||||||
| 3502 | template<class GradientBase, typename BlendType> | - | ||||||||||||||||||
| 3503 | static inline const BlendType * QT_FASTCALL qt_fetch_linear_gradient_template( | - | ||||||||||||||||||
| 3504 | BlendType *buffer, const Operator *op, const QSpanData *data, | - | ||||||||||||||||||
| 3505 | int y, int x, int length) | - | ||||||||||||||||||
| 3506 | { | - | ||||||||||||||||||
| 3507 | const BlendType *b = buffer; | - | ||||||||||||||||||
| 3508 | qreal t, inc; | - | ||||||||||||||||||
| 3509 | - | |||||||||||||||||||
| 3510 | bool affine = true; | - | ||||||||||||||||||
| 3511 | qreal rx=0, ry=0; | - | ||||||||||||||||||
| 3512 | if (op->linear.l == 0) {
| 0 | ||||||||||||||||||
| 3513 | t = inc = 0; | - | ||||||||||||||||||
| 3514 | } else { never executed: end of block | 0 | ||||||||||||||||||
| 3515 | rx = data->m21 * (y + qreal(0.5)) + data->m11 * (x + qreal(0.5)) + data->dx; | - | ||||||||||||||||||
| 3516 | ry = data->m22 * (y + qreal(0.5)) + data->m12 * (x + qreal(0.5)) + data->dy; | - | ||||||||||||||||||
| 3517 | t = op->linear.dx*rx + op->linear.dy*ry + op->linear.off; | - | ||||||||||||||||||
| 3518 | inc = op->linear.dx * data->m11 + op->linear.dy * data->m12; | - | ||||||||||||||||||
| 3519 | affine = !data->m13 && !data->m23;
| 0 | ||||||||||||||||||
| 3520 | - | |||||||||||||||||||
| 3521 | if (affine) {
| 0 | ||||||||||||||||||
| 3522 | t *= (GRADIENT_STOPTABLE_SIZE - 1); | - | ||||||||||||||||||
| 3523 | inc *= (GRADIENT_STOPTABLE_SIZE - 1); | - | ||||||||||||||||||
| 3524 | } never executed: end of block | 0 | ||||||||||||||||||
| 3525 | } never executed: end of block | 0 | ||||||||||||||||||
| 3526 | - | |||||||||||||||||||
| 3527 | const BlendType *end = buffer + length; | - | ||||||||||||||||||
| 3528 | if (affine) {
| 0 | ||||||||||||||||||
| 3529 | if (inc > qreal(-1e-5) && inc < qreal(1e-5)) {
| 0 | ||||||||||||||||||
| 3530 | GradientBase::memfill(buffer, GradientBase::fetchSingle(data->gradient, int(t * FIXPT_SIZE)), length); | - | ||||||||||||||||||
| 3531 | } else { never executed: end of block | 0 | ||||||||||||||||||
| 3532 | if (t+inc*length < qreal(INT_MAX >> (FIXPT_BITS + 1)) &&
| 0 | ||||||||||||||||||
| 3533 | t+inc*length > qreal(INT_MIN >> (FIXPT_BITS + 1))) {
| 0 | ||||||||||||||||||
| 3534 | // we can use fixed point math | - | ||||||||||||||||||
| 3535 | int t_fixed = int(t * FIXPT_SIZE); | - | ||||||||||||||||||
| 3536 | int inc_fixed = int(inc * FIXPT_SIZE); | - | ||||||||||||||||||
| 3537 | while (buffer < end) {
| 0 | ||||||||||||||||||
| 3538 | *buffer = GradientBase::fetchSingle(data->gradient, t_fixed); | - | ||||||||||||||||||
| 3539 | t_fixed += inc_fixed; | - | ||||||||||||||||||
| 3540 | ++buffer; | - | ||||||||||||||||||
| 3541 | } never executed: end of block | 0 | ||||||||||||||||||
| 3542 | } else { never executed: end of block | 0 | ||||||||||||||||||
| 3543 | // we have to fall back to float math | - | ||||||||||||||||||
| 3544 | while (buffer < end) {
| 0 | ||||||||||||||||||
| 3545 | *buffer = GradientBase::fetchSingle(data->gradient, t/GRADIENT_STOPTABLE_SIZE); | - | ||||||||||||||||||
| 3546 | t += inc; | - | ||||||||||||||||||
| 3547 | ++buffer; | - | ||||||||||||||||||
| 3548 | } never executed: end of block | 0 | ||||||||||||||||||
| 3549 | } never executed: end of block | 0 | ||||||||||||||||||
| 3550 | } | - | ||||||||||||||||||
| 3551 | } else { // fall back to float math here as well | - | ||||||||||||||||||
| 3552 | qreal rw = data->m23 * (y + qreal(0.5)) + data->m13 * (x + qreal(0.5)) + data->m33; | - | ||||||||||||||||||
| 3553 | while (buffer < end) {
| 0 | ||||||||||||||||||
| 3554 | qreal x = rx/rw; | - | ||||||||||||||||||
| 3555 | qreal y = ry/rw; | - | ||||||||||||||||||
| 3556 | t = (op->linear.dx*x + op->linear.dy *y) + op->linear.off; | - | ||||||||||||||||||
| 3557 | - | |||||||||||||||||||
| 3558 | *buffer = GradientBase::fetchSingle(data->gradient, t); | - | ||||||||||||||||||
| 3559 | rx += data->m11; | - | ||||||||||||||||||
| 3560 | ry += data->m12; | - | ||||||||||||||||||
| 3561 | rw += data->m13; | - | ||||||||||||||||||
| 3562 | if (!rw) {
| 0 | ||||||||||||||||||
| 3563 | rw += data->m13; | - | ||||||||||||||||||
| 3564 | } never executed: end of block | 0 | ||||||||||||||||||
| 3565 | ++buffer; | - | ||||||||||||||||||
| 3566 | } never executed: end of block | 0 | ||||||||||||||||||
| 3567 | } never executed: end of block | 0 | ||||||||||||||||||
| 3568 | - | |||||||||||||||||||
| 3569 | return b; never executed: return b; | 0 | ||||||||||||||||||
| 3570 | } | - | ||||||||||||||||||
| 3571 | - | |||||||||||||||||||
| 3572 | static const uint * QT_FASTCALL qt_fetch_linear_gradient(uint *buffer, const Operator *op, const QSpanData *data, | - | ||||||||||||||||||
| 3573 | int y, int x, int length) | - | ||||||||||||||||||
| 3574 | { | - | ||||||||||||||||||
| 3575 | return qt_fetch_linear_gradient_template<GradientBase32, uint>(buffer, op, data, y, x, length); never executed: return qt_fetch_linear_gradient_template<GradientBase32, uint>(buffer, op, data, y, x, length); | 0 | ||||||||||||||||||
| 3576 | } | - | ||||||||||||||||||
| 3577 | - | |||||||||||||||||||
| 3578 | static const QRgba64 * QT_FASTCALL qt_fetch_linear_gradient_rgb64(QRgba64 *buffer, const Operator *op, const QSpanData *data, | - | ||||||||||||||||||
| 3579 | int y, int x, int length) | - | ||||||||||||||||||
| 3580 | { | - | ||||||||||||||||||
| 3581 | return qt_fetch_linear_gradient_template<GradientBase64, QRgba64>(buffer, op, data, y, x, length); never executed: return qt_fetch_linear_gradient_template<GradientBase64, QRgba64>(buffer, op, data, y, x, length); | 0 | ||||||||||||||||||
| 3582 | } | - | ||||||||||||||||||
| 3583 | - | |||||||||||||||||||
| 3584 | static void QT_FASTCALL getRadialGradientValues(RadialGradientValues *v, const QSpanData *data) | - | ||||||||||||||||||
| 3585 | { | - | ||||||||||||||||||
| 3586 | v->dx = data->gradient.radial.center.x - data->gradient.radial.focal.x; | - | ||||||||||||||||||
| 3587 | v->dy = data->gradient.radial.center.y - data->gradient.radial.focal.y; | - | ||||||||||||||||||
| 3588 | - | |||||||||||||||||||
| 3589 | v->dr = data->gradient.radial.center.radius - data->gradient.radial.focal.radius; | - | ||||||||||||||||||
| 3590 | v->sqrfr = data->gradient.radial.focal.radius * data->gradient.radial.focal.radius; | - | ||||||||||||||||||
| 3591 | - | |||||||||||||||||||
| 3592 | v->a = v->dr * v->dr - v->dx*v->dx - v->dy*v->dy; | - | ||||||||||||||||||
| 3593 | v->inv2a = 1 / (2 * v->a); | - | ||||||||||||||||||
| 3594 | - | |||||||||||||||||||
| 3595 | v->extended = !qFuzzyIsNull(data->gradient.radial.focal.radius) || v->a <= 0;
| 0 | ||||||||||||||||||
| 3596 | } never executed: end of block | 0 | ||||||||||||||||||
| 3597 | - | |||||||||||||||||||
| 3598 | template <class GradientBase> | - | ||||||||||||||||||
| 3599 | class RadialFetchPlain : public GradientBase | - | ||||||||||||||||||
| 3600 | { | - | ||||||||||||||||||
| 3601 | public: | - | ||||||||||||||||||
| 3602 | typedef typename GradientBase::Type BlendType; | - | ||||||||||||||||||
| 3603 | static void fetch(BlendType *buffer, BlendType *end, | - | ||||||||||||||||||
| 3604 | const Operator *op, const QSpanData *data, qreal det, | - | ||||||||||||||||||
| 3605 | qreal delta_det, qreal delta_delta_det, qreal b, qreal delta_b) | - | ||||||||||||||||||
| 3606 | { | - | ||||||||||||||||||
| 3607 | if (op->radial.extended) {
| 0 | ||||||||||||||||||
| 3608 | while (buffer < end) {
| 0 | ||||||||||||||||||
| 3609 | BlendType result = GradientBase::null(); | - | ||||||||||||||||||
| 3610 | if (det >= 0) {
| 0 | ||||||||||||||||||
| 3611 | qreal w = qSqrt(det) - b; | - | ||||||||||||||||||
| 3612 | if (data->gradient.radial.focal.radius + op->radial.dr * w >= 0)
| 0 | ||||||||||||||||||
| 3613 | result = GradientBase::fetchSingle(data->gradient, w); never executed: result = GradientBase::fetchSingle(data->gradient, w); | 0 | ||||||||||||||||||
| 3614 | } never executed: end of block | 0 | ||||||||||||||||||
| 3615 | - | |||||||||||||||||||
| 3616 | *buffer = result; | - | ||||||||||||||||||
| 3617 | - | |||||||||||||||||||
| 3618 | det += delta_det; | - | ||||||||||||||||||
| 3619 | delta_det += delta_delta_det; | - | ||||||||||||||||||
| 3620 | b += delta_b; | - | ||||||||||||||||||
| 3621 | - | |||||||||||||||||||
| 3622 | ++buffer; | - | ||||||||||||||||||
| 3623 | } never executed: end of block | 0 | ||||||||||||||||||
| 3624 | } else { never executed: end of block | 0 | ||||||||||||||||||
| 3625 | while (buffer < end) {
| 0 | ||||||||||||||||||
| 3626 | *buffer++ = GradientBase::fetchSingle(data->gradient, qSqrt(det) - b); | - | ||||||||||||||||||
| 3627 | - | |||||||||||||||||||
| 3628 | det += delta_det; | - | ||||||||||||||||||
| 3629 | delta_det += delta_delta_det; | - | ||||||||||||||||||
| 3630 | b += delta_b; | - | ||||||||||||||||||
| 3631 | } never executed: end of block | 0 | ||||||||||||||||||
| 3632 | } never executed: end of block | 0 | ||||||||||||||||||
| 3633 | } | - | ||||||||||||||||||
| 3634 | }; | - | ||||||||||||||||||
| 3635 | - | |||||||||||||||||||
| 3636 | const uint * QT_FASTCALL qt_fetch_radial_gradient_plain(uint *buffer, const Operator *op, const QSpanData *data, | - | ||||||||||||||||||
| 3637 | int y, int x, int length) | - | ||||||||||||||||||
| 3638 | { | - | ||||||||||||||||||
| 3639 | return qt_fetch_radial_gradient_template<RadialFetchPlain<GradientBase32>, uint>(buffer, op, data, y, x, length); never executed: return qt_fetch_radial_gradient_template<RadialFetchPlain<GradientBase32>, uint>(buffer, op, data, y, x, length); | 0 | ||||||||||||||||||
| 3640 | } | - | ||||||||||||||||||
| 3641 | - | |||||||||||||||||||
| 3642 | static SourceFetchProc qt_fetch_radial_gradient = qt_fetch_radial_gradient_plain; | - | ||||||||||||||||||
| 3643 | - | |||||||||||||||||||
| 3644 | const QRgba64 * QT_FASTCALL qt_fetch_radial_gradient_rgb64(QRgba64 *buffer, const Operator *op, const QSpanData *data, | - | ||||||||||||||||||
| 3645 | int y, int x, int length) | - | ||||||||||||||||||
| 3646 | { | - | ||||||||||||||||||
| 3647 | return qt_fetch_radial_gradient_template<RadialFetchPlain<GradientBase64>, QRgba64>(buffer, op, data, y, x, length); never executed: return qt_fetch_radial_gradient_template<RadialFetchPlain<GradientBase64>, QRgba64>(buffer, op, data, y, x, length); | 0 | ||||||||||||||||||
| 3648 | } | - | ||||||||||||||||||
| 3649 | - | |||||||||||||||||||
| 3650 | template <class GradientBase, typename BlendType> | - | ||||||||||||||||||
| 3651 | static inline const BlendType * QT_FASTCALL qt_fetch_conical_gradient_template( | - | ||||||||||||||||||
| 3652 | BlendType *buffer, const QSpanData *data, | - | ||||||||||||||||||
| 3653 | int y, int x, int length) | - | ||||||||||||||||||
| 3654 | { | - | ||||||||||||||||||
| 3655 | const BlendType *b = buffer; | - | ||||||||||||||||||
| 3656 | qreal rx = data->m21 * (y + qreal(0.5)) | - | ||||||||||||||||||
| 3657 | + data->dx + data->m11 * (x + qreal(0.5)); | - | ||||||||||||||||||
| 3658 | qreal ry = data->m22 * (y + qreal(0.5)) | - | ||||||||||||||||||
| 3659 | + data->dy + data->m12 * (x + qreal(0.5)); | - | ||||||||||||||||||
| 3660 | bool affine = !data->m13 && !data->m23;
| 0 | ||||||||||||||||||
| 3661 | - | |||||||||||||||||||
| 3662 | const qreal inv2pi = M_1_PI / 2.0; | - | ||||||||||||||||||
| 3663 | - | |||||||||||||||||||
| 3664 | const BlendType *end = buffer + length; | - | ||||||||||||||||||
| 3665 | if (affine) {
| 0 | ||||||||||||||||||
| 3666 | rx -= data->gradient.conical.center.x; | - | ||||||||||||||||||
| 3667 | ry -= data->gradient.conical.center.y; | - | ||||||||||||||||||
| 3668 | while (buffer < end) {
| 0 | ||||||||||||||||||
| 3669 | qreal angle = qAtan2(ry, rx) + data->gradient.conical.angle; | - | ||||||||||||||||||
| 3670 | - | |||||||||||||||||||
| 3671 | *buffer = GradientBase::fetchSingle(data->gradient, 1 - angle * inv2pi); | - | ||||||||||||||||||
| 3672 | - | |||||||||||||||||||
| 3673 | rx += data->m11; | - | ||||||||||||||||||
| 3674 | ry += data->m12; | - | ||||||||||||||||||
| 3675 | ++buffer; | - | ||||||||||||||||||
| 3676 | } never executed: end of block | 0 | ||||||||||||||||||
| 3677 | } else { never executed: end of block | 0 | ||||||||||||||||||
| 3678 | qreal rw = data->m23 * (y + qreal(0.5)) | - | ||||||||||||||||||
| 3679 | + data->m33 + data->m13 * (x + qreal(0.5)); | - | ||||||||||||||||||
| 3680 | if (!rw)
| 0 | ||||||||||||||||||
| 3681 | rw = 1; never executed: rw = 1; | 0 | ||||||||||||||||||
| 3682 | while (buffer < end) {
| 0 | ||||||||||||||||||
| 3683 | qreal angle = qAtan2(ry/rw - data->gradient.conical.center.x, | - | ||||||||||||||||||
| 3684 | rx/rw - data->gradient.conical.center.y) | - | ||||||||||||||||||
| 3685 | + data->gradient.conical.angle; | - | ||||||||||||||||||
| 3686 | - | |||||||||||||||||||
| 3687 | *buffer = GradientBase::fetchSingle(data->gradient, 1 - angle * inv2pi); | - | ||||||||||||||||||
| 3688 | - | |||||||||||||||||||
| 3689 | rx += data->m11; | - | ||||||||||||||||||
| 3690 | ry += data->m12; | - | ||||||||||||||||||
| 3691 | rw += data->m13; | - | ||||||||||||||||||
| 3692 | if (!rw) {
| 0 | ||||||||||||||||||
| 3693 | rw += data->m13; | - | ||||||||||||||||||
| 3694 | } never executed: end of block | 0 | ||||||||||||||||||
| 3695 | ++buffer; | - | ||||||||||||||||||
| 3696 | } never executed: end of block | 0 | ||||||||||||||||||
| 3697 | } never executed: end of block | 0 | ||||||||||||||||||
| 3698 | return b; never executed: return b; | 0 | ||||||||||||||||||
| 3699 | } | - | ||||||||||||||||||
| 3700 | - | |||||||||||||||||||
| 3701 | static const uint * QT_FASTCALL qt_fetch_conical_gradient(uint *buffer, const Operator *, const QSpanData *data, | - | ||||||||||||||||||
| 3702 | int y, int x, int length) | - | ||||||||||||||||||
| 3703 | { | - | ||||||||||||||||||
| 3704 | return qt_fetch_conical_gradient_template<GradientBase32, uint>(buffer, data, y, x, length); never executed: return qt_fetch_conical_gradient_template<GradientBase32, uint>(buffer, data, y, x, length); | 0 | ||||||||||||||||||
| 3705 | } | - | ||||||||||||||||||
| 3706 | - | |||||||||||||||||||
| 3707 | static const QRgba64 * QT_FASTCALL qt_fetch_conical_gradient_rgb64(QRgba64 *buffer, const Operator *, const QSpanData *data, | - | ||||||||||||||||||
| 3708 | int y, int x, int length) | - | ||||||||||||||||||
| 3709 | { | - | ||||||||||||||||||
| 3710 | return qt_fetch_conical_gradient_template<GradientBase64, QRgba64>(buffer, data, y, x, length); never executed: return qt_fetch_conical_gradient_template<GradientBase64, QRgba64>(buffer, data, y, x, length); | 0 | ||||||||||||||||||
| 3711 | } | - | ||||||||||||||||||
| 3712 | - | |||||||||||||||||||
| 3713 | extern CompositionFunctionSolid qt_functionForModeSolid_C[]; | - | ||||||||||||||||||
| 3714 | extern CompositionFunctionSolid64 qt_functionForModeSolid64_C[]; | - | ||||||||||||||||||
| 3715 | - | |||||||||||||||||||
| 3716 | static const CompositionFunctionSolid *functionForModeSolid = qt_functionForModeSolid_C; | - | ||||||||||||||||||
| 3717 | static const CompositionFunctionSolid64 *functionForModeSolid64 = qt_functionForModeSolid64_C; | - | ||||||||||||||||||
| 3718 | - | |||||||||||||||||||
| 3719 | extern CompositionFunction qt_functionForMode_C[]; | - | ||||||||||||||||||
| 3720 | extern CompositionFunction64 qt_functionForMode64_C[]; | - | ||||||||||||||||||
| 3721 | - | |||||||||||||||||||
| 3722 | static const CompositionFunction *functionForMode = qt_functionForMode_C; | - | ||||||||||||||||||
| 3723 | static const CompositionFunction64 *functionForMode64 = qt_functionForMode64_C; | - | ||||||||||||||||||
| 3724 | - | |||||||||||||||||||
| 3725 | static TextureBlendType getBlendType(const QSpanData *data) | - | ||||||||||||||||||
| 3726 | { | - | ||||||||||||||||||
| 3727 | TextureBlendType ft; | - | ||||||||||||||||||
| 3728 | if (data->txop <= QTransform::TxTranslate)
| 0 | ||||||||||||||||||
| 3729 | if (data->texture.type == QTextureData::Tiled)
| 0 | ||||||||||||||||||
| 3730 | ft = BlendTiled; never executed: ft = BlendTiled; | 0 | ||||||||||||||||||
| 3731 | else | - | ||||||||||||||||||
| 3732 | ft = BlendUntransformed; never executed: ft = BlendUntransformed; | 0 | ||||||||||||||||||
| 3733 | else if (data->bilinear)
| 0 | ||||||||||||||||||
| 3734 | if (data->texture.type == QTextureData::Tiled)
| 0 | ||||||||||||||||||
| 3735 | ft = BlendTransformedBilinearTiled; never executed: ft = BlendTransformedBilinearTiled; | 0 | ||||||||||||||||||
| 3736 | else | - | ||||||||||||||||||
| 3737 | ft = BlendTransformedBilinear; never executed: ft = BlendTransformedBilinear; | 0 | ||||||||||||||||||
| 3738 | else | - | ||||||||||||||||||
| 3739 | if (data->texture.type == QTextureData::Tiled)
| 0 | ||||||||||||||||||
| 3740 | ft = BlendTransformedTiled; never executed: ft = BlendTransformedTiled; | 0 | ||||||||||||||||||
| 3741 | else | - | ||||||||||||||||||
| 3742 | ft = BlendTransformed; never executed: ft = BlendTransformed; | 0 | ||||||||||||||||||
| 3743 | return ft; never executed: return ft; | 0 | ||||||||||||||||||
| 3744 | } | - | ||||||||||||||||||
| 3745 | - | |||||||||||||||||||
| 3746 | static inline Operator getOperator(const QSpanData *data, const QSpan *spans, int spanCount) | - | ||||||||||||||||||
| 3747 | { | - | ||||||||||||||||||
| 3748 | Operator op; | - | ||||||||||||||||||
| 3749 | bool solidSource = false; | - | ||||||||||||||||||
| 3750 | - | |||||||||||||||||||
| 3751 | switch(data->type) { | - | ||||||||||||||||||
| 3752 | case QSpanData::Solid: never executed: case QSpanData::Solid: | 0 | ||||||||||||||||||
| 3753 | solidSource = data->solid.color.isOpaque(); | - | ||||||||||||||||||
| 3754 | op.srcFetch = 0; | - | ||||||||||||||||||
| 3755 | op.srcFetch64 = 0; | - | ||||||||||||||||||
| 3756 | break; never executed: break; | 0 | ||||||||||||||||||
| 3757 | case QSpanData::LinearGradient: never executed: case QSpanData::LinearGradient: | 0 | ||||||||||||||||||
| 3758 | solidSource = !data->gradient.alphaColor; | - | ||||||||||||||||||
| 3759 | getLinearGradientValues(&op.linear, data); | - | ||||||||||||||||||
| 3760 | op.srcFetch = qt_fetch_linear_gradient; | - | ||||||||||||||||||
| 3761 | op.srcFetch64 = qt_fetch_linear_gradient_rgb64; | - | ||||||||||||||||||
| 3762 | break; never executed: break; | 0 | ||||||||||||||||||
| 3763 | case QSpanData::RadialGradient: never executed: case QSpanData::RadialGradient: | 0 | ||||||||||||||||||
| 3764 | solidSource = !data->gradient.alphaColor; | - | ||||||||||||||||||
| 3765 | getRadialGradientValues(&op.radial, data); | - | ||||||||||||||||||
| 3766 | op.srcFetch = qt_fetch_radial_gradient; | - | ||||||||||||||||||
| 3767 | op.srcFetch64 = qt_fetch_radial_gradient_rgb64; | - | ||||||||||||||||||
| 3768 | break; never executed: break; | 0 | ||||||||||||||||||
| 3769 | case QSpanData::ConicalGradient: never executed: case QSpanData::ConicalGradient: | 0 | ||||||||||||||||||
| 3770 | solidSource = !data->gradient.alphaColor; | - | ||||||||||||||||||
| 3771 | op.srcFetch = qt_fetch_conical_gradient; | - | ||||||||||||||||||
| 3772 | op.srcFetch64 = qt_fetch_conical_gradient_rgb64; | - | ||||||||||||||||||
| 3773 | break; never executed: break; | 0 | ||||||||||||||||||
| 3774 | case QSpanData::Texture: never executed: case QSpanData::Texture: | 0 | ||||||||||||||||||
| 3775 | solidSource = !data->texture.hasAlpha; | - | ||||||||||||||||||
| 3776 | op.srcFetch = sourceFetch[getBlendType(data)][data->texture.format]; | - | ||||||||||||||||||
| 3777 | op.srcFetch64 = sourceFetch64[getBlendType(data)][data->texture.format]; | - | ||||||||||||||||||
| 3778 | break; never executed: break; | 0 | ||||||||||||||||||
| 3779 | default: never executed: default: | 0 | ||||||||||||||||||
| 3780 | Q_UNREACHABLE(); | - | ||||||||||||||||||
| 3781 | break; never executed: break; | 0 | ||||||||||||||||||
| 3782 | } | - | ||||||||||||||||||
| 3783 | - | |||||||||||||||||||
| 3784 | op.mode = data->rasterBuffer->compositionMode; | - | ||||||||||||||||||
| 3785 | if (op.mode == QPainter::CompositionMode_SourceOver && solidSource)
| 0 | ||||||||||||||||||
| 3786 | op.mode = QPainter::CompositionMode_Source; never executed: op.mode = QPainter::CompositionMode_Source; | 0 | ||||||||||||||||||
| 3787 | - | |||||||||||||||||||
| 3788 | op.destFetch = destFetchProc[data->rasterBuffer->format]; | - | ||||||||||||||||||
| 3789 | op.destFetch64 = destFetchProc64[data->rasterBuffer->format]; | - | ||||||||||||||||||
| 3790 | if (op.mode == QPainter::CompositionMode_Source) {
| 0 | ||||||||||||||||||
| 3791 | switch (data->rasterBuffer->format) { | - | ||||||||||||||||||
| 3792 | case QImage::Format_RGB32: never executed: case QImage::Format_RGB32: | 0 | ||||||||||||||||||
| 3793 | case QImage::Format_ARGB32_Premultiplied: never executed: case QImage::Format_ARGB32_Premultiplied: | 0 | ||||||||||||||||||
| 3794 | // don't clear destFetch as it sets up the pointer correctly to save one copy | - | ||||||||||||||||||
| 3795 | break; never executed: break; | 0 | ||||||||||||||||||
| 3796 | default: { never executed: default: | 0 | ||||||||||||||||||
| 3797 | if (data->type == QSpanData::Texture && data->texture.const_alpha != 256)
| 0 | ||||||||||||||||||
| 3798 | break; never executed: break; | 0 | ||||||||||||||||||
| 3799 | const QSpan *lastSpan = spans + spanCount; | - | ||||||||||||||||||
| 3800 | bool alphaSpans = false; | - | ||||||||||||||||||
| 3801 | while (spans < lastSpan) {
| 0 | ||||||||||||||||||
| 3802 | if (spans->coverage != 255) {
| 0 | ||||||||||||||||||
| 3803 | alphaSpans = true; | - | ||||||||||||||||||
| 3804 | break; never executed: break; | 0 | ||||||||||||||||||
| 3805 | } | - | ||||||||||||||||||
| 3806 | ++spans; | - | ||||||||||||||||||
| 3807 | } never executed: end of block | 0 | ||||||||||||||||||
| 3808 | if (!alphaSpans)
| 0 | ||||||||||||||||||
| 3809 | op.destFetch = 0; never executed: op.destFetch = 0; | 0 | ||||||||||||||||||
| 3810 | } | - | ||||||||||||||||||
| 3811 | } never executed: end of block | 0 | ||||||||||||||||||
| 3812 | } | - | ||||||||||||||||||
| 3813 | - | |||||||||||||||||||
| 3814 | op.destStore = destStoreProc[data->rasterBuffer->format]; | - | ||||||||||||||||||
| 3815 | op.destStore64 = destStoreProc64[data->rasterBuffer->format]; | - | ||||||||||||||||||
| 3816 | - | |||||||||||||||||||
| 3817 | op.funcSolid = functionForModeSolid[op.mode]; | - | ||||||||||||||||||
| 3818 | op.funcSolid64 = functionForModeSolid64[op.mode]; | - | ||||||||||||||||||
| 3819 | op.func = functionForMode[op.mode]; | - | ||||||||||||||||||
| 3820 | op.func64 = functionForMode64[op.mode]; | - | ||||||||||||||||||
| 3821 | - | |||||||||||||||||||
| 3822 | return op; never executed: return op; | 0 | ||||||||||||||||||
| 3823 | } | - | ||||||||||||||||||
| 3824 | - | |||||||||||||||||||
| 3825 | - | |||||||||||||||||||
| 3826 | - | |||||||||||||||||||
| 3827 | // -------------------- blend methods --------------------- | - | ||||||||||||||||||
| 3828 | - | |||||||||||||||||||
| 3829 | #if !defined(Q_CC_SUN) | - | ||||||||||||||||||
| 3830 | static | - | ||||||||||||||||||
| 3831 | #endif | - | ||||||||||||||||||
| 3832 | void blend_color_generic(int count, const QSpan *spans, void *userData) | - | ||||||||||||||||||
| 3833 | { | - | ||||||||||||||||||
| 3834 | QSpanData *data = reinterpret_cast<QSpanData *>(userData); | - | ||||||||||||||||||
| 3835 | uint buffer[buffer_size]; | - | ||||||||||||||||||
| 3836 | Operator op = getOperator(data, spans, count); | - | ||||||||||||||||||
| 3837 | const uint color = data->solid.color.toArgb32(); | - | ||||||||||||||||||
| 3838 | - | |||||||||||||||||||
| 3839 | while (count--) {
| 0 | ||||||||||||||||||
| 3840 | int x = spans->x; | - | ||||||||||||||||||
| 3841 | int length = spans->len; | - | ||||||||||||||||||
| 3842 | while (length) {
| 0 | ||||||||||||||||||
| 3843 | int l = qMin(buffer_size, length); | - | ||||||||||||||||||
| 3844 | uint *dest = op.destFetch ? op.destFetch(buffer, data->rasterBuffer, x, spans->y, l) : buffer;
| 0 | ||||||||||||||||||
| 3845 | op.funcSolid(dest, l, color, spans->coverage); | - | ||||||||||||||||||
| 3846 | if (op.destStore)
| 0 | ||||||||||||||||||
| 3847 | op.destStore(data->rasterBuffer, x, spans->y, dest, l); never executed: op.destStore(data->rasterBuffer, x, spans->y, dest, l); | 0 | ||||||||||||||||||
| 3848 | length -= l; | - | ||||||||||||||||||
| 3849 | x += l; | - | ||||||||||||||||||
| 3850 | } never executed: end of block | 0 | ||||||||||||||||||
| 3851 | ++spans; | - | ||||||||||||||||||
| 3852 | } never executed: end of block | 0 | ||||||||||||||||||
| 3853 | } never executed: end of block | 0 | ||||||||||||||||||
| 3854 | - | |||||||||||||||||||
| 3855 | static void blend_color_argb(int count, const QSpan *spans, void *userData) | - | ||||||||||||||||||
| 3856 | { | - | ||||||||||||||||||
| 3857 | QSpanData *data = reinterpret_cast<QSpanData *>(userData); | - | ||||||||||||||||||
| 3858 | - | |||||||||||||||||||
| 3859 | Operator op = getOperator(data, spans, count); | - | ||||||||||||||||||
| 3860 | const uint color = data->solid.color.toArgb32(); | - | ||||||||||||||||||
| 3861 | - | |||||||||||||||||||
| 3862 | if (op.mode == QPainter::CompositionMode_Source) {
| 0 | ||||||||||||||||||
| 3863 | // inline for performance | - | ||||||||||||||||||
| 3864 | while (count--) {
| 0 | ||||||||||||||||||
| 3865 | uint *target = ((uint *)data->rasterBuffer->scanLine(spans->y)) + spans->x; | - | ||||||||||||||||||
| 3866 | if (spans->coverage == 255) {
| 0 | ||||||||||||||||||
| 3867 | QT_MEMFILL_UINT(target, spans->len, color); | - | ||||||||||||||||||
| 3868 | } else { never executed: end of block | 0 | ||||||||||||||||||
| 3869 | uint c = BYTE_MUL(color, spans->coverage); | - | ||||||||||||||||||
| 3870 | int ialpha = 255 - spans->coverage; | - | ||||||||||||||||||
| 3871 | for (int i = 0; i < spans->len; ++i)
| 0 | ||||||||||||||||||
| 3872 | target[i] = c + BYTE_MUL(target[i], ialpha); never executed: target[i] = c + BYTE_MUL(target[i], ialpha); | 0 | ||||||||||||||||||
| 3873 | } never executed: end of block | 0 | ||||||||||||||||||
| 3874 | ++spans; | - | ||||||||||||||||||
| 3875 | } never executed: end of block | 0 | ||||||||||||||||||
| 3876 | return; never executed: return; | 0 | ||||||||||||||||||
| 3877 | } | - | ||||||||||||||||||
| 3878 | - | |||||||||||||||||||
| 3879 | while (count--) {
| 0 | ||||||||||||||||||
| 3880 | uint *target = ((uint *)data->rasterBuffer->scanLine(spans->y)) + spans->x; | - | ||||||||||||||||||
| 3881 | op.funcSolid(target, spans->len, color, spans->coverage); | - | ||||||||||||||||||
| 3882 | ++spans; | - | ||||||||||||||||||
| 3883 | } never executed: end of block | 0 | ||||||||||||||||||
| 3884 | } never executed: end of block | 0 | ||||||||||||||||||
| 3885 | - | |||||||||||||||||||
| 3886 | void blend_color_generic_rgb64(int count, const QSpan *spans, void *userData) | - | ||||||||||||||||||
| 3887 | { | - | ||||||||||||||||||
| 3888 | QSpanData *data = reinterpret_cast<QSpanData *>(userData); | - | ||||||||||||||||||
| 3889 | Operator op = getOperator(data, spans, count); | - | ||||||||||||||||||
| 3890 | if (!op.funcSolid64) {
| 0 | ||||||||||||||||||
| 3891 | qDebug("unsupported 64bit blend attempted"); | - | ||||||||||||||||||
| 3892 | return blend_color_generic(count, spans, userData); never executed: return blend_color_generic(count, spans, userData); | 0 | ||||||||||||||||||
| 3893 | } | - | ||||||||||||||||||
| 3894 | - | |||||||||||||||||||
| 3895 | QRgba64 buffer[buffer_size]; | - | ||||||||||||||||||
| 3896 | const QRgba64 color = data->solid.color; | - | ||||||||||||||||||
| 3897 | - | |||||||||||||||||||
| 3898 | while (count--) {
| 0 | ||||||||||||||||||
| 3899 | int x = spans->x; | - | ||||||||||||||||||
| 3900 | int length = spans->len; | - | ||||||||||||||||||
| 3901 | while (length) {
| 0 | ||||||||||||||||||
| 3902 | int l = qMin(buffer_size, length); | - | ||||||||||||||||||
| 3903 | QRgba64 *dest = op.destFetch64(buffer, data->rasterBuffer, x, spans->y, l); | - | ||||||||||||||||||
| 3904 | op.funcSolid64(dest, l, color, spans->coverage); | - | ||||||||||||||||||
| 3905 | op.destStore64(data->rasterBuffer, x, spans->y, dest, l); | - | ||||||||||||||||||
| 3906 | length -= l; | - | ||||||||||||||||||
| 3907 | x += l; | - | ||||||||||||||||||
| 3908 | } never executed: end of block | 0 | ||||||||||||||||||
| 3909 | ++spans; | - | ||||||||||||||||||
| 3910 | } never executed: end of block | 0 | ||||||||||||||||||
| 3911 | } never executed: end of block | 0 | ||||||||||||||||||
| 3912 | - | |||||||||||||||||||
| 3913 | static void blend_color_rgb16(int count, const QSpan *spans, void *userData) | - | ||||||||||||||||||
| 3914 | { | - | ||||||||||||||||||
| 3915 | QSpanData *data = reinterpret_cast<QSpanData *>(userData); | - | ||||||||||||||||||
| 3916 | - | |||||||||||||||||||
| 3917 | /* | - | ||||||||||||||||||
| 3918 | We duplicate a little logic from getOperator() and calculate the | - | ||||||||||||||||||
| 3919 | composition mode directly. This allows blend_color_rgb16 to be used | - | ||||||||||||||||||
| 3920 | from qt_gradient_quint16 with minimal overhead. | - | ||||||||||||||||||
| 3921 | */ | - | ||||||||||||||||||
| 3922 | QPainter::CompositionMode mode = data->rasterBuffer->compositionMode; | - | ||||||||||||||||||
| 3923 | if (mode == QPainter::CompositionMode_SourceOver && data->solid.color.isOpaque())
| 0 | ||||||||||||||||||
| 3924 | mode = QPainter::CompositionMode_Source; never executed: mode = QPainter::CompositionMode_Source; | 0 | ||||||||||||||||||
| 3925 | - | |||||||||||||||||||
| 3926 | if (mode == QPainter::CompositionMode_Source) {
| 0 | ||||||||||||||||||
| 3927 | // inline for performance | - | ||||||||||||||||||
| 3928 | ushort c = data->solid.color.toRgb16(); | - | ||||||||||||||||||
| 3929 | while (count--) {
| 0 | ||||||||||||||||||
| 3930 | ushort *target = ((ushort *)data->rasterBuffer->scanLine(spans->y)) + spans->x; | - | ||||||||||||||||||
| 3931 | if (spans->coverage == 255) {
| 0 | ||||||||||||||||||
| 3932 | QT_MEMFILL_USHORT(target, spans->len, c); | - | ||||||||||||||||||
| 3933 | } else { never executed: end of block | 0 | ||||||||||||||||||
| 3934 | ushort color = BYTE_MUL_RGB16(c, spans->coverage); | - | ||||||||||||||||||
| 3935 | int ialpha = 255 - spans->coverage; | - | ||||||||||||||||||
| 3936 | const ushort *end = target + spans->len; | - | ||||||||||||||||||
| 3937 | while (target < end) {
| 0 | ||||||||||||||||||
| 3938 | *target = color + BYTE_MUL_RGB16(*target, ialpha); | - | ||||||||||||||||||
| 3939 | ++target; | - | ||||||||||||||||||
| 3940 | } never executed: end of block | 0 | ||||||||||||||||||
| 3941 | } never executed: end of block | 0 | ||||||||||||||||||
| 3942 | ++spans; | - | ||||||||||||||||||
| 3943 | } never executed: end of block | 0 | ||||||||||||||||||
| 3944 | return; never executed: return; | 0 | ||||||||||||||||||
| 3945 | } | - | ||||||||||||||||||
| 3946 | - | |||||||||||||||||||
| 3947 | if (mode == QPainter::CompositionMode_SourceOver) {
| 0 | ||||||||||||||||||
| 3948 | while (count--) {
| 0 | ||||||||||||||||||
| 3949 | uint color = BYTE_MUL(data->solid.color.toArgb32(), spans->coverage); | - | ||||||||||||||||||
| 3950 | int ialpha = qAlpha(~color); | - | ||||||||||||||||||
| 3951 | ushort c = qConvertRgb32To16(color); | - | ||||||||||||||||||
| 3952 | ushort *target = ((ushort *)data->rasterBuffer->scanLine(spans->y)) + spans->x; | - | ||||||||||||||||||
| 3953 | int len = spans->len; | - | ||||||||||||||||||
| 3954 | bool pre = (((quintptr)target) & 0x3) != 0; | - | ||||||||||||||||||
| 3955 | bool post = false; | - | ||||||||||||||||||
| 3956 | if (pre) {
| 0 | ||||||||||||||||||
| 3957 | // skip to word boundary | - | ||||||||||||||||||
| 3958 | *target = c + BYTE_MUL_RGB16(*target, ialpha); | - | ||||||||||||||||||
| 3959 | ++target; | - | ||||||||||||||||||
| 3960 | --len; | - | ||||||||||||||||||
| 3961 | } never executed: end of block | 0 | ||||||||||||||||||
| 3962 | if (len & 0x1) {
| 0 | ||||||||||||||||||
| 3963 | post = true; | - | ||||||||||||||||||
| 3964 | --len; | - | ||||||||||||||||||
| 3965 | } never executed: end of block | 0 | ||||||||||||||||||
| 3966 | uint *target32 = (uint*)target; | - | ||||||||||||||||||
| 3967 | uint c32 = c | (c<<16); | - | ||||||||||||||||||
| 3968 | len >>= 1; | - | ||||||||||||||||||
| 3969 | uint salpha = (ialpha+1) >> 3; // calculate here rather than in loop | - | ||||||||||||||||||
| 3970 | while (len--) {
| 0 | ||||||||||||||||||
| 3971 | // blend full words | - | ||||||||||||||||||
| 3972 | *target32 = c32 + BYTE_MUL_RGB16_32(*target32, salpha); | - | ||||||||||||||||||
| 3973 | ++target32; | - | ||||||||||||||||||
| 3974 | target += 2; | - | ||||||||||||||||||
| 3975 | } never executed: end of block | 0 | ||||||||||||||||||
| 3976 | if (post) {
| 0 | ||||||||||||||||||
| 3977 | // one last pixel beyond a full word | - | ||||||||||||||||||
| 3978 | *target = c + BYTE_MUL_RGB16(*target, ialpha); | - | ||||||||||||||||||
| 3979 | } never executed: end of block | 0 | ||||||||||||||||||
| 3980 | ++spans; | - | ||||||||||||||||||
| 3981 | } never executed: end of block | 0 | ||||||||||||||||||
| 3982 | return; never executed: return; | 0 | ||||||||||||||||||
| 3983 | } | - | ||||||||||||||||||
| 3984 | - | |||||||||||||||||||
| 3985 | blend_color_generic(count, spans, userData); | - | ||||||||||||||||||
| 3986 | } never executed: end of block | 0 | ||||||||||||||||||
| 3987 | - | |||||||||||||||||||
| 3988 | template <typename T> | - | ||||||||||||||||||
| 3989 | void handleSpans(int count, const QSpan *spans, const QSpanData *data, T &handler) | - | ||||||||||||||||||
| 3990 | { | - | ||||||||||||||||||
| 3991 | uint const_alpha = 256; | - | ||||||||||||||||||
| 3992 | if (data->type == QSpanData::Texture)
| 0 | ||||||||||||||||||
| 3993 | const_alpha = data->texture.const_alpha; never executed: const_alpha = data->texture.const_alpha; | 0 | ||||||||||||||||||
| 3994 | - | |||||||||||||||||||
| 3995 | int coverage = 0; | - | ||||||||||||||||||
| 3996 | while (count) {
| 0 | ||||||||||||||||||
| 3997 | int x = spans->x; | - | ||||||||||||||||||
| 3998 | const int y = spans->y; | - | ||||||||||||||||||
| 3999 | int right = x + spans->len; | - | ||||||||||||||||||
| 4000 | - | |||||||||||||||||||
| 4001 | // compute length of adjacent spans | - | ||||||||||||||||||
| 4002 | for (int i = 1; i < count && spans[i].y == y && spans[i].x == right; ++i)
| 0 | ||||||||||||||||||
| 4003 | right += spans[i].len; never executed: right += spans[i].len; | 0 | ||||||||||||||||||
| 4004 | int length = right - x; | - | ||||||||||||||||||
| 4005 | - | |||||||||||||||||||
| 4006 | while (length) {
| 0 | ||||||||||||||||||
| 4007 | int l = qMin(buffer_size, length); | - | ||||||||||||||||||
| 4008 | length -= l; | - | ||||||||||||||||||
| 4009 | - | |||||||||||||||||||
| 4010 | int process_length = l; | - | ||||||||||||||||||
| 4011 | int process_x = x; | - | ||||||||||||||||||
| 4012 | - | |||||||||||||||||||
| 4013 | const typename T::BlendType *src = handler.fetch(process_x, y, process_length); | - | ||||||||||||||||||
| 4014 | int offset = 0; | - | ||||||||||||||||||
| 4015 | while (l > 0) {
| 0 | ||||||||||||||||||
| 4016 | if (x == spans->x) // new span?
| 0 | ||||||||||||||||||
| 4017 | coverage = (spans->coverage * const_alpha) >> 8; never executed: coverage = (spans->coverage * const_alpha) >> 8; | 0 | ||||||||||||||||||
| 4018 | - | |||||||||||||||||||
| 4019 | int right = spans->x + spans->len; | - | ||||||||||||||||||
| 4020 | int len = qMin(l, right - x); | - | ||||||||||||||||||
| 4021 | - | |||||||||||||||||||
| 4022 | handler.process(x, y, len, coverage, src, offset); | - | ||||||||||||||||||
| 4023 | - | |||||||||||||||||||
| 4024 | l -= len; | - | ||||||||||||||||||
| 4025 | x += len; | - | ||||||||||||||||||
| 4026 | offset += len; | - | ||||||||||||||||||
| 4027 | - | |||||||||||||||||||
| 4028 | if (x == right) { // done with current span?
| 0 | ||||||||||||||||||
| 4029 | ++spans; | - | ||||||||||||||||||
| 4030 | --count; | - | ||||||||||||||||||
| 4031 | } never executed: end of block | 0 | ||||||||||||||||||
| 4032 | } never executed: end of block | 0 | ||||||||||||||||||
| 4033 | handler.store(process_x, y, process_length); | - | ||||||||||||||||||
| 4034 | } never executed: end of block | 0 | ||||||||||||||||||
| 4035 | } never executed: end of block | 0 | ||||||||||||||||||
| 4036 | } never executed: end of block | 0 | ||||||||||||||||||
| 4037 | - | |||||||||||||||||||
| 4038 | template<typename T> | - | ||||||||||||||||||
| 4039 | struct QBlendBase | - | ||||||||||||||||||
| 4040 | { | - | ||||||||||||||||||
| 4041 | typedef T BlendType; | - | ||||||||||||||||||
| 4042 | QBlendBase(QSpanData *d, Operator o) | - | ||||||||||||||||||
| 4043 | : data(d) | - | ||||||||||||||||||
| 4044 | , op(o) | - | ||||||||||||||||||
| 4045 | , dest(0) | - | ||||||||||||||||||
| 4046 | { | - | ||||||||||||||||||
| 4047 | } never executed: end of block | 0 | ||||||||||||||||||
| 4048 | - | |||||||||||||||||||
| 4049 | QSpanData *data; | - | ||||||||||||||||||
| 4050 | Operator op; | - | ||||||||||||||||||
| 4051 | - | |||||||||||||||||||
| 4052 | BlendType *dest; | - | ||||||||||||||||||
| 4053 | - | |||||||||||||||||||
| 4054 | BlendType buffer[buffer_size]; | - | ||||||||||||||||||
| 4055 | BlendType src_buffer[buffer_size]; | - | ||||||||||||||||||
| 4056 | }; | - | ||||||||||||||||||
| 4057 | - | |||||||||||||||||||
| 4058 | class BlendSrcGeneric : public QBlendBase<uint> | - | ||||||||||||||||||
| 4059 | { | - | ||||||||||||||||||
| 4060 | public: | - | ||||||||||||||||||
| 4061 | BlendSrcGeneric(QSpanData *d, Operator o) | - | ||||||||||||||||||
| 4062 | : QBlendBase<uint>(d, o) | - | ||||||||||||||||||
| 4063 | { | - | ||||||||||||||||||
| 4064 | } never executed: end of block | 0 | ||||||||||||||||||
| 4065 | - | |||||||||||||||||||
| 4066 | const uint *fetch(int x, int y, int len) | - | ||||||||||||||||||
| 4067 | { | - | ||||||||||||||||||
| 4068 | dest = op.destFetch ? op.destFetch(buffer, data->rasterBuffer, x, y, len) : buffer;
| 0 | ||||||||||||||||||
| 4069 | return op.srcFetch(src_buffer, &op, data, y, x, len); never executed: return op.srcFetch(src_buffer, &op, data, y, x, len); | 0 | ||||||||||||||||||
| 4070 | } | - | ||||||||||||||||||
| 4071 | - | |||||||||||||||||||
| 4072 | void process(int, int, int len, int coverage, const uint *src, int offset) | - | ||||||||||||||||||
| 4073 | { | - | ||||||||||||||||||
| 4074 | op.func(dest + offset, src + offset, len, coverage); | - | ||||||||||||||||||
| 4075 | } never executed: end of block | 0 | ||||||||||||||||||
| 4076 | - | |||||||||||||||||||
| 4077 | void store(int x, int y, int len) | - | ||||||||||||||||||
| 4078 | { | - | ||||||||||||||||||
| 4079 | if (op.destStore)
| 0 | ||||||||||||||||||
| 4080 | op.destStore(data->rasterBuffer, x, y, dest, len); never executed: op.destStore(data->rasterBuffer, x, y, dest, len); | 0 | ||||||||||||||||||
| 4081 | } never executed: end of block | 0 | ||||||||||||||||||
| 4082 | }; | - | ||||||||||||||||||
| 4083 | - | |||||||||||||||||||
| 4084 | class BlendSrcGenericRGB64 : public QBlendBase<QRgba64> | - | ||||||||||||||||||
| 4085 | { | - | ||||||||||||||||||
| 4086 | public: | - | ||||||||||||||||||
| 4087 | BlendSrcGenericRGB64(QSpanData *d, Operator o) | - | ||||||||||||||||||
| 4088 | : QBlendBase<QRgba64>(d, o) | - | ||||||||||||||||||
| 4089 | { | - | ||||||||||||||||||
| 4090 | } never executed: end of block | 0 | ||||||||||||||||||
| 4091 | - | |||||||||||||||||||
| 4092 | bool isSupported() const | - | ||||||||||||||||||
| 4093 | { | - | ||||||||||||||||||
| 4094 | return op.func64 && op.destFetch64 && op.destStore64; never executed: return op.func64 && op.destFetch64 && op.destStore64;
| 0 | ||||||||||||||||||
| 4095 | } | - | ||||||||||||||||||
| 4096 | - | |||||||||||||||||||
| 4097 | const QRgba64 *fetch(int x, int y, int len) | - | ||||||||||||||||||
| 4098 | { | - | ||||||||||||||||||
| 4099 | dest = op.destFetch64(buffer, data->rasterBuffer, x, y, len); | - | ||||||||||||||||||
| 4100 | return op.srcFetch64(src_buffer, &op, data, y, x, len); never executed: return op.srcFetch64(src_buffer, &op, data, y, x, len); | 0 | ||||||||||||||||||
| 4101 | } | - | ||||||||||||||||||
| 4102 | - | |||||||||||||||||||
| 4103 | void process(int, int, int len, int coverage, const QRgba64 *src, int offset) | - | ||||||||||||||||||
| 4104 | { | - | ||||||||||||||||||
| 4105 | op.func64(dest + offset, src + offset, len, coverage); | - | ||||||||||||||||||
| 4106 | } never executed: end of block | 0 | ||||||||||||||||||
| 4107 | - | |||||||||||||||||||
| 4108 | void store(int x, int y, int len) | - | ||||||||||||||||||
| 4109 | { | - | ||||||||||||||||||
| 4110 | op.destStore64(data->rasterBuffer, x, y, dest, len); | - | ||||||||||||||||||
| 4111 | } never executed: end of block | 0 | ||||||||||||||||||
| 4112 | }; | - | ||||||||||||||||||
| 4113 | - | |||||||||||||||||||
| 4114 | static void blend_src_generic(int count, const QSpan *spans, void *userData) | - | ||||||||||||||||||
| 4115 | { | - | ||||||||||||||||||
| 4116 | QSpanData *data = reinterpret_cast<QSpanData *>(userData); | - | ||||||||||||||||||
| 4117 | BlendSrcGeneric blend(data, getOperator(data, spans, count)); | - | ||||||||||||||||||
| 4118 | handleSpans(count, spans, data, blend); | - | ||||||||||||||||||
| 4119 | } never executed: end of block | 0 | ||||||||||||||||||
| 4120 | - | |||||||||||||||||||
| 4121 | static void blend_src_generic_rgb64(int count, const QSpan *spans, void *userData) | - | ||||||||||||||||||
| 4122 | { | - | ||||||||||||||||||
| 4123 | QSpanData *data = reinterpret_cast<QSpanData *>(userData); | - | ||||||||||||||||||
| 4124 | Operator op = getOperator(data, spans, count); | - | ||||||||||||||||||
| 4125 | BlendSrcGenericRGB64 blend64(data, op); | - | ||||||||||||||||||
| 4126 | if (blend64.isSupported())
| 0 | ||||||||||||||||||
| 4127 | handleSpans(count, spans, data, blend64); never executed: handleSpans(count, spans, data, blend64); | 0 | ||||||||||||||||||
| 4128 | else { | - | ||||||||||||||||||
| 4129 | qDebug("blend_src_generic_rgb64: unsupported 64-bit blend attempted"); | - | ||||||||||||||||||
| 4130 | BlendSrcGeneric blend32(data, op); | - | ||||||||||||||||||
| 4131 | handleSpans(count, spans, data, blend32); | - | ||||||||||||||||||
| 4132 | } never executed: end of block | 0 | ||||||||||||||||||
| 4133 | } | - | ||||||||||||||||||
| 4134 | - | |||||||||||||||||||
| 4135 | static void blend_untransformed_generic(int count, const QSpan *spans, void *userData) | - | ||||||||||||||||||
| 4136 | { | - | ||||||||||||||||||
| 4137 | QSpanData *data = reinterpret_cast<QSpanData *>(userData); | - | ||||||||||||||||||
| 4138 | - | |||||||||||||||||||
| 4139 | uint buffer[buffer_size]; | - | ||||||||||||||||||
| 4140 | uint src_buffer[buffer_size]; | - | ||||||||||||||||||
| 4141 | Operator op = getOperator(data, spans, count); | - | ||||||||||||||||||
| 4142 | - | |||||||||||||||||||
| 4143 | const int image_width = data->texture.width; | - | ||||||||||||||||||
| 4144 | const int image_height = data->texture.height; | - | ||||||||||||||||||
| 4145 | int xoff = -qRound(-data->dx); | - | ||||||||||||||||||
| 4146 | int yoff = -qRound(-data->dy); | - | ||||||||||||||||||
| 4147 | - | |||||||||||||||||||
| 4148 | while (count--) {
| 0 | ||||||||||||||||||
| 4149 | int x = spans->x; | - | ||||||||||||||||||
| 4150 | int length = spans->len; | - | ||||||||||||||||||
| 4151 | int sx = xoff + x; | - | ||||||||||||||||||
| 4152 | int sy = yoff + spans->y; | - | ||||||||||||||||||
| 4153 | if (sy >= 0 && sy < image_height && sx < image_width) {
| 0 | ||||||||||||||||||
| 4154 | if (sx < 0) {
| 0 | ||||||||||||||||||
| 4155 | x -= sx; | - | ||||||||||||||||||
| 4156 | length += sx; | - | ||||||||||||||||||
| 4157 | sx = 0; | - | ||||||||||||||||||
| 4158 | } never executed: end of block | 0 | ||||||||||||||||||
| 4159 | if (sx + length > image_width)
| 0 | ||||||||||||||||||
| 4160 | length = image_width - sx; never executed: length = image_width - sx; | 0 | ||||||||||||||||||
| 4161 | if (length > 0) {
| 0 | ||||||||||||||||||
| 4162 | const int coverage = (spans->coverage * data->texture.const_alpha) >> 8; | - | ||||||||||||||||||
| 4163 | while (length) {
| 0 | ||||||||||||||||||
| 4164 | int l = qMin(buffer_size, length); | - | ||||||||||||||||||
| 4165 | const uint *src = op.srcFetch(src_buffer, &op, data, sy, sx, l); | - | ||||||||||||||||||
| 4166 | uint *dest = op.destFetch ? op.destFetch(buffer, data->rasterBuffer, x, spans->y, l) : buffer;
| 0 | ||||||||||||||||||
| 4167 | op.func(dest, src, l, coverage); | - | ||||||||||||||||||
| 4168 | if (op.destStore)
| 0 | ||||||||||||||||||
| 4169 | op.destStore(data->rasterBuffer, x, spans->y, dest, l); never executed: op.destStore(data->rasterBuffer, x, spans->y, dest, l); | 0 | ||||||||||||||||||
| 4170 | x += l; | - | ||||||||||||||||||
| 4171 | sx += l; | - | ||||||||||||||||||
| 4172 | length -= l; | - | ||||||||||||||||||
| 4173 | } never executed: end of block | 0 | ||||||||||||||||||
| 4174 | } never executed: end of block | 0 | ||||||||||||||||||
| 4175 | } never executed: end of block | 0 | ||||||||||||||||||
| 4176 | ++spans; | - | ||||||||||||||||||
| 4177 | } never executed: end of block | 0 | ||||||||||||||||||
| 4178 | } never executed: end of block | 0 | ||||||||||||||||||
| 4179 | - | |||||||||||||||||||
| 4180 | static void blend_untransformed_generic_rgb64(int count, const QSpan *spans, void *userData) | - | ||||||||||||||||||
| 4181 | { | - | ||||||||||||||||||
| 4182 | QSpanData *data = reinterpret_cast<QSpanData *>(userData); | - | ||||||||||||||||||
| 4183 | - | |||||||||||||||||||
| 4184 | Operator op = getOperator(data, spans, count); | - | ||||||||||||||||||
| 4185 | if (!op.func64) {
| 0 | ||||||||||||||||||
| 4186 | qWarning("Unsupported blend"); | - | ||||||||||||||||||
| 4187 | return blend_untransformed_generic(count, spans, userData); never executed: return blend_untransformed_generic(count, spans, userData); | 0 | ||||||||||||||||||
| 4188 | } | - | ||||||||||||||||||
| 4189 | QRgba64 buffer[buffer_size]; | - | ||||||||||||||||||
| 4190 | QRgba64 src_buffer[buffer_size]; | - | ||||||||||||||||||
| 4191 | - | |||||||||||||||||||
| 4192 | const int image_width = data->texture.width; | - | ||||||||||||||||||
| 4193 | const int image_height = data->texture.height; | - | ||||||||||||||||||
| 4194 | int xoff = -qRound(-data->dx); | - | ||||||||||||||||||
| 4195 | int yoff = -qRound(-data->dy); | - | ||||||||||||||||||
| 4196 | - | |||||||||||||||||||
| 4197 | while (count--) {
| 0 | ||||||||||||||||||
| 4198 | int x = spans->x; | - | ||||||||||||||||||
| 4199 | int length = spans->len; | - | ||||||||||||||||||
| 4200 | int sx = xoff + x; | - | ||||||||||||||||||
| 4201 | int sy = yoff + spans->y; | - | ||||||||||||||||||
| 4202 | if (sy >= 0 && sy < image_height && sx < image_width) {
| 0 | ||||||||||||||||||
| 4203 | if (sx < 0) {
| 0 | ||||||||||||||||||
| 4204 | x -= sx; | - | ||||||||||||||||||
| 4205 | length += sx; | - | ||||||||||||||||||
| 4206 | sx = 0; | - | ||||||||||||||||||
| 4207 | } never executed: end of block | 0 | ||||||||||||||||||
| 4208 | if (sx + length > image_width)
| 0 | ||||||||||||||||||
| 4209 | length = image_width - sx; never executed: length = image_width - sx; | 0 | ||||||||||||||||||
| 4210 | if (length > 0) {
| 0 | ||||||||||||||||||
| 4211 | const int coverage = (spans->coverage * data->texture.const_alpha) >> 8; | - | ||||||||||||||||||
| 4212 | while (length) {
| 0 | ||||||||||||||||||
| 4213 | int l = qMin(buffer_size, length); | - | ||||||||||||||||||
| 4214 | const QRgba64 *src = op.srcFetch64(src_buffer, &op, data, sy, sx, l); | - | ||||||||||||||||||
| 4215 | QRgba64 *dest = op.destFetch64(buffer, data->rasterBuffer, x, spans->y, l); | - | ||||||||||||||||||
| 4216 | op.func64(dest, src, l, coverage); | - | ||||||||||||||||||
| 4217 | op.destStore64(data->rasterBuffer, x, spans->y, dest, l); | - | ||||||||||||||||||
| 4218 | x += l; | - | ||||||||||||||||||
| 4219 | sx += l; | - | ||||||||||||||||||
| 4220 | length -= l; | - | ||||||||||||||||||
| 4221 | } never executed: end of block | 0 | ||||||||||||||||||
| 4222 | } never executed: end of block | 0 | ||||||||||||||||||
| 4223 | } never executed: end of block | 0 | ||||||||||||||||||
| 4224 | ++spans; | - | ||||||||||||||||||
| 4225 | } never executed: end of block | 0 | ||||||||||||||||||
| 4226 | } never executed: end of block | 0 | ||||||||||||||||||
| 4227 | - | |||||||||||||||||||
| 4228 | static void blend_untransformed_argb(int count, const QSpan *spans, void *userData) | - | ||||||||||||||||||
| 4229 | { | - | ||||||||||||||||||
| 4230 | QSpanData *data = reinterpret_cast<QSpanData *>(userData); | - | ||||||||||||||||||
| 4231 | if (data->texture.format != QImage::Format_ARGB32_Premultiplied
| 0 | ||||||||||||||||||
| 4232 | && data->texture.format != QImage::Format_RGB32) {
| 0 | ||||||||||||||||||
| 4233 | blend_untransformed_generic(count, spans, userData); | - | ||||||||||||||||||
| 4234 | return; never executed: return; | 0 | ||||||||||||||||||
| 4235 | } | - | ||||||||||||||||||
| 4236 | - | |||||||||||||||||||
| 4237 | Operator op = getOperator(data, spans, count); | - | ||||||||||||||||||
| 4238 | - | |||||||||||||||||||
| 4239 | const int image_width = data->texture.width; | - | ||||||||||||||||||
| 4240 | const int image_height = data->texture.height; | - | ||||||||||||||||||
| 4241 | int xoff = -qRound(-data->dx); | - | ||||||||||||||||||
| 4242 | int yoff = -qRound(-data->dy); | - | ||||||||||||||||||
| 4243 | - | |||||||||||||||||||
| 4244 | while (count--) {
| 0 | ||||||||||||||||||
| 4245 | int x = spans->x; | - | ||||||||||||||||||
| 4246 | int length = spans->len; | - | ||||||||||||||||||
| 4247 | int sx = xoff + x; | - | ||||||||||||||||||
| 4248 | int sy = yoff + spans->y; | - | ||||||||||||||||||
| 4249 | if (sy >= 0 && sy < image_height && sx < image_width) {
| 0 | ||||||||||||||||||
| 4250 | if (sx < 0) {
| 0 | ||||||||||||||||||
| 4251 | x -= sx; | - | ||||||||||||||||||
| 4252 | length += sx; | - | ||||||||||||||||||
| 4253 | sx = 0; | - | ||||||||||||||||||
| 4254 | } never executed: end of block | 0 | ||||||||||||||||||
| 4255 | if (sx + length > image_width)
| 0 | ||||||||||||||||||
| 4256 | length = image_width - sx; never executed: length = image_width - sx; | 0 | ||||||||||||||||||
| 4257 | if (length > 0) {
| 0 | ||||||||||||||||||
| 4258 | const int coverage = (spans->coverage * data->texture.const_alpha) >> 8; | - | ||||||||||||||||||
| 4259 | const uint *src = (const uint *)data->texture.scanLine(sy) + sx; | - | ||||||||||||||||||
| 4260 | uint *dest = ((uint *)data->rasterBuffer->scanLine(spans->y)) + x; | - | ||||||||||||||||||
| 4261 | op.func(dest, src, length, coverage); | - | ||||||||||||||||||
| 4262 | } never executed: end of block | 0 | ||||||||||||||||||
| 4263 | } never executed: end of block | 0 | ||||||||||||||||||
| 4264 | ++spans; | - | ||||||||||||||||||
| 4265 | } never executed: end of block | 0 | ||||||||||||||||||
| 4266 | } never executed: end of block | 0 | ||||||||||||||||||
| 4267 | - | |||||||||||||||||||
| 4268 | static inline quint16 interpolate_pixel_rgb16_255(quint16 x, quint8 a, | - | ||||||||||||||||||
| 4269 | quint16 y, quint8 b) | - | ||||||||||||||||||
| 4270 | { | - | ||||||||||||||||||
| 4271 | quint16 t = ((((x & 0x07e0) * a) + ((y & 0x07e0) * b)) >> 5) & 0x07e0; | - | ||||||||||||||||||
| 4272 | t |= ((((x & 0xf81f) * a) + ((y & 0xf81f) * b)) >> 5) & 0xf81f; | - | ||||||||||||||||||
| 4273 | - | |||||||||||||||||||
| 4274 | return t; never executed: return t; | 0 | ||||||||||||||||||
| 4275 | } | - | ||||||||||||||||||
| 4276 | - | |||||||||||||||||||
| 4277 | static inline quint32 interpolate_pixel_rgb16x2_255(quint32 x, quint8 a, | - | ||||||||||||||||||
| 4278 | quint32 y, quint8 b) | - | ||||||||||||||||||
| 4279 | { | - | ||||||||||||||||||
| 4280 | uint t; | - | ||||||||||||||||||
| 4281 | t = ((((x & 0xf81f07e0) >> 5) * a) + (((y & 0xf81f07e0) >> 5) * b)) & 0xf81f07e0; | - | ||||||||||||||||||
| 4282 | t |= ((((x & 0x07e0f81f) * a) + ((y & 0x07e0f81f) * b)) >> 5) & 0x07e0f81f; | - | ||||||||||||||||||
| 4283 | return t; never executed: return t; | 0 | ||||||||||||||||||
| 4284 | } | - | ||||||||||||||||||
| 4285 | - | |||||||||||||||||||
| 4286 | static inline void blend_sourceOver_rgb16_rgb16(quint16 *Q_DECL_RESTRICT dest, | - | ||||||||||||||||||
| 4287 | const quint16 *Q_DECL_RESTRICT src, | - | ||||||||||||||||||
| 4288 | int length, | - | ||||||||||||||||||
| 4289 | const quint8 alpha, | - | ||||||||||||||||||
| 4290 | const quint8 ialpha) | - | ||||||||||||||||||
| 4291 | { | - | ||||||||||||||||||
| 4292 | const int dstAlign = ((quintptr)dest) & 0x3; | - | ||||||||||||||||||
| 4293 | if (dstAlign) {
| 0 | ||||||||||||||||||
| 4294 | *dest = interpolate_pixel_rgb16_255(*src, alpha, *dest, ialpha); | - | ||||||||||||||||||
| 4295 | ++dest; | - | ||||||||||||||||||
| 4296 | ++src; | - | ||||||||||||||||||
| 4297 | --length; | - | ||||||||||||||||||
| 4298 | } never executed: end of block | 0 | ||||||||||||||||||
| 4299 | const int srcAlign = ((quintptr)src) & 0x3; | - | ||||||||||||||||||
| 4300 | int length32 = length >> 1; | - | ||||||||||||||||||
| 4301 | if (length32 && srcAlign == 0) {
| 0 | ||||||||||||||||||
| 4302 | while (length32--) {
| 0 | ||||||||||||||||||
| 4303 | const quint32 *src32 = reinterpret_cast<const quint32*>(src); | - | ||||||||||||||||||
| 4304 | quint32 *dest32 = reinterpret_cast<quint32*>(dest); | - | ||||||||||||||||||
| 4305 | *dest32 = interpolate_pixel_rgb16x2_255(*src32, alpha, | - | ||||||||||||||||||
| 4306 | *dest32, ialpha); | - | ||||||||||||||||||
| 4307 | dest += 2; | - | ||||||||||||||||||
| 4308 | src += 2; | - | ||||||||||||||||||
| 4309 | } never executed: end of block | 0 | ||||||||||||||||||
| 4310 | length &= 0x1; | - | ||||||||||||||||||
| 4311 | } never executed: end of block | 0 | ||||||||||||||||||
| 4312 | while (length--) {
| 0 | ||||||||||||||||||
| 4313 | *dest = interpolate_pixel_rgb16_255(*src, alpha, *dest, ialpha); | - | ||||||||||||||||||
| 4314 | ++dest; | - | ||||||||||||||||||
| 4315 | ++src; | - | ||||||||||||||||||
| 4316 | } never executed: end of block | 0 | ||||||||||||||||||
| 4317 | } never executed: end of block | 0 | ||||||||||||||||||
| 4318 | - | |||||||||||||||||||
| 4319 | static void blend_untransformed_rgb565(int count, const QSpan *spans, void *userData) | - | ||||||||||||||||||
| 4320 | { | - | ||||||||||||||||||
| 4321 | QSpanData *data = reinterpret_cast<QSpanData*>(userData); | - | ||||||||||||||||||
| 4322 | QPainter::CompositionMode mode = data->rasterBuffer->compositionMode; | - | ||||||||||||||||||
| 4323 | - | |||||||||||||||||||
| 4324 | if (data->texture.format != QImage::Format_RGB16
| 0 | ||||||||||||||||||
| 4325 | || (mode != QPainter::CompositionMode_SourceOver
| 0 | ||||||||||||||||||
| 4326 | && mode != QPainter::CompositionMode_Source))
| 0 | ||||||||||||||||||
| 4327 | { | - | ||||||||||||||||||
| 4328 | blend_untransformed_generic(count, spans, userData); | - | ||||||||||||||||||
| 4329 | return; never executed: return; | 0 | ||||||||||||||||||
| 4330 | } | - | ||||||||||||||||||
| 4331 | - | |||||||||||||||||||
| 4332 | const int image_width = data->texture.width; | - | ||||||||||||||||||
| 4333 | const int image_height = data->texture.height; | - | ||||||||||||||||||
| 4334 | int xoff = -qRound(-data->dx); | - | ||||||||||||||||||
| 4335 | int yoff = -qRound(-data->dy); | - | ||||||||||||||||||
| 4336 | - | |||||||||||||||||||
| 4337 | while (count--) {
| 0 | ||||||||||||||||||
| 4338 | const quint8 coverage = (data->texture.const_alpha * spans->coverage) >> 8; | - | ||||||||||||||||||
| 4339 | if (coverage == 0) {
| 0 | ||||||||||||||||||
| 4340 | ++spans; | - | ||||||||||||||||||
| 4341 | continue; never executed: continue; | 0 | ||||||||||||||||||
| 4342 | } | - | ||||||||||||||||||
| 4343 | - | |||||||||||||||||||
| 4344 | int x = spans->x; | - | ||||||||||||||||||
| 4345 | int length = spans->len; | - | ||||||||||||||||||
| 4346 | int sx = xoff + x; | - | ||||||||||||||||||
| 4347 | int sy = yoff + spans->y; | - | ||||||||||||||||||
| 4348 | if (sy >= 0 && sy < image_height && sx < image_width) {
| 0 | ||||||||||||||||||
| 4349 | if (sx < 0) {
| 0 | ||||||||||||||||||
| 4350 | x -= sx; | - | ||||||||||||||||||
| 4351 | length += sx; | - | ||||||||||||||||||
| 4352 | sx = 0; | - | ||||||||||||||||||
| 4353 | } never executed: end of block | 0 | ||||||||||||||||||
| 4354 | if (sx + length > image_width)
| 0 | ||||||||||||||||||
| 4355 | length = image_width - sx; never executed: length = image_width - sx; | 0 | ||||||||||||||||||
| 4356 | if (length > 0) {
| 0 | ||||||||||||||||||
| 4357 | quint16 *dest = (quint16 *)data->rasterBuffer->scanLine(spans->y) + x; | - | ||||||||||||||||||
| 4358 | const quint16 *src = (const quint16 *)data->texture.scanLine(sy) + sx; | - | ||||||||||||||||||
| 4359 | if (coverage == 255) {
| 0 | ||||||||||||||||||
| 4360 | memcpy(dest, src, length * sizeof(quint16)); | - | ||||||||||||||||||
| 4361 | } else { never executed: end of block | 0 | ||||||||||||||||||
| 4362 | const quint8 alpha = (coverage + 1) >> 3; | - | ||||||||||||||||||
| 4363 | const quint8 ialpha = 0x20 - alpha; | - | ||||||||||||||||||
| 4364 | if (alpha > 0)
| 0 | ||||||||||||||||||
| 4365 | blend_sourceOver_rgb16_rgb16(dest, src, length, alpha, ialpha); never executed: blend_sourceOver_rgb16_rgb16(dest, src, length, alpha, ialpha); | 0 | ||||||||||||||||||
| 4366 | } never executed: end of block | 0 | ||||||||||||||||||
| 4367 | } | - | ||||||||||||||||||
| 4368 | } never executed: end of block | 0 | ||||||||||||||||||
| 4369 | ++spans; | - | ||||||||||||||||||
| 4370 | } never executed: end of block | 0 | ||||||||||||||||||
| 4371 | } never executed: end of block | 0 | ||||||||||||||||||
| 4372 | - | |||||||||||||||||||
| 4373 | static void blend_tiled_generic(int count, const QSpan *spans, void *userData) | - | ||||||||||||||||||
| 4374 | { | - | ||||||||||||||||||
| 4375 | QSpanData *data = reinterpret_cast<QSpanData *>(userData); | - | ||||||||||||||||||
| 4376 | - | |||||||||||||||||||
| 4377 | uint buffer[buffer_size]; | - | ||||||||||||||||||
| 4378 | uint src_buffer[buffer_size]; | - | ||||||||||||||||||
| 4379 | Operator op = getOperator(data, spans, count); | - | ||||||||||||||||||
| 4380 | - | |||||||||||||||||||
| 4381 | const int image_width = data->texture.width; | - | ||||||||||||||||||
| 4382 | const int image_height = data->texture.height; | - | ||||||||||||||||||
| 4383 | int xoff = -qRound(-data->dx) % image_width; | - | ||||||||||||||||||
| 4384 | int yoff = -qRound(-data->dy) % image_height; | - | ||||||||||||||||||
| 4385 | - | |||||||||||||||||||
| 4386 | if (xoff < 0)
| 0 | ||||||||||||||||||
| 4387 | xoff += image_width; never executed: xoff += image_width; | 0 | ||||||||||||||||||
| 4388 | if (yoff < 0)
| 0 | ||||||||||||||||||
| 4389 | yoff += image_height; never executed: yoff += image_height; | 0 | ||||||||||||||||||
| 4390 | - | |||||||||||||||||||
| 4391 | while (count--) {
| 0 | ||||||||||||||||||
| 4392 | int x = spans->x; | - | ||||||||||||||||||
| 4393 | int length = spans->len; | - | ||||||||||||||||||
| 4394 | int sx = (xoff + spans->x) % image_width; | - | ||||||||||||||||||
| 4395 | int sy = (spans->y + yoff) % image_height; | - | ||||||||||||||||||
| 4396 | if (sx < 0)
| 0 | ||||||||||||||||||
| 4397 | sx += image_width; never executed: sx += image_width; | 0 | ||||||||||||||||||
| 4398 | if (sy < 0)
| 0 | ||||||||||||||||||
| 4399 | sy += image_height; never executed: sy += image_height; | 0 | ||||||||||||||||||
| 4400 | - | |||||||||||||||||||
| 4401 | const int coverage = (spans->coverage * data->texture.const_alpha) >> 8; | - | ||||||||||||||||||
| 4402 | while (length) {
| 0 | ||||||||||||||||||
| 4403 | int l = qMin(image_width - sx, length); | - | ||||||||||||||||||
| 4404 | if (buffer_size < l)
| 0 | ||||||||||||||||||
| 4405 | l = buffer_size; never executed: l = buffer_size; | 0 | ||||||||||||||||||
| 4406 | const uint *src = op.srcFetch(src_buffer, &op, data, sy, sx, l); | - | ||||||||||||||||||
| 4407 | uint *dest = op.destFetch ? op.destFetch(buffer, data->rasterBuffer, x, spans->y, l) : buffer;
| 0 | ||||||||||||||||||
| 4408 | op.func(dest, src, l, coverage); | - | ||||||||||||||||||
| 4409 | if (op.destStore)
| 0 | ||||||||||||||||||
| 4410 | op.destStore(data->rasterBuffer, x, spans->y, dest, l); never executed: op.destStore(data->rasterBuffer, x, spans->y, dest, l); | 0 | ||||||||||||||||||
| 4411 | x += l; | - | ||||||||||||||||||
| 4412 | sx += l; | - | ||||||||||||||||||
| 4413 | length -= l; | - | ||||||||||||||||||
| 4414 | if (sx >= image_width)
| 0 | ||||||||||||||||||
| 4415 | sx = 0; never executed: sx = 0; | 0 | ||||||||||||||||||
| 4416 | } never executed: end of block | 0 | ||||||||||||||||||
| 4417 | ++spans; | - | ||||||||||||||||||
| 4418 | } never executed: end of block | 0 | ||||||||||||||||||
| 4419 | } never executed: end of block | 0 | ||||||||||||||||||
| 4420 | - | |||||||||||||||||||
| 4421 | static void blend_tiled_generic_rgb64(int count, const QSpan *spans, void *userData) | - | ||||||||||||||||||
| 4422 | { | - | ||||||||||||||||||
| 4423 | QSpanData *data = reinterpret_cast<QSpanData *>(userData); | - | ||||||||||||||||||
| 4424 | - | |||||||||||||||||||
| 4425 | Operator op = getOperator(data, spans, count); | - | ||||||||||||||||||
| 4426 | if (!op.func64) {
| 0 | ||||||||||||||||||
| 4427 | qDebug("unsupported rgb64 blend"); | - | ||||||||||||||||||
| 4428 | return blend_tiled_generic(count, spans, userData); never executed: return blend_tiled_generic(count, spans, userData); | 0 | ||||||||||||||||||
| 4429 | } | - | ||||||||||||||||||
| 4430 | QRgba64 buffer[buffer_size]; | - | ||||||||||||||||||
| 4431 | QRgba64 src_buffer[buffer_size]; | - | ||||||||||||||||||
| 4432 | - | |||||||||||||||||||
| 4433 | const int image_width = data->texture.width; | - | ||||||||||||||||||
| 4434 | const int image_height = data->texture.height; | - | ||||||||||||||||||
| 4435 | int xoff = -qRound(-data->dx) % image_width; | - | ||||||||||||||||||
| 4436 | int yoff = -qRound(-data->dy) % image_height; | - | ||||||||||||||||||
| 4437 | - | |||||||||||||||||||
| 4438 | if (xoff < 0)
| 0 | ||||||||||||||||||
| 4439 | xoff += image_width; never executed: xoff += image_width; | 0 | ||||||||||||||||||
| 4440 | if (yoff < 0)
| 0 | ||||||||||||||||||
| 4441 | yoff += image_height; never executed: yoff += image_height; | 0 | ||||||||||||||||||
| 4442 | - | |||||||||||||||||||
| 4443 | while (count--) {
| 0 | ||||||||||||||||||
| 4444 | int x = spans->x; | - | ||||||||||||||||||
| 4445 | int length = spans->len; | - | ||||||||||||||||||
| 4446 | int sx = (xoff + spans->x) % image_width; | - | ||||||||||||||||||
| 4447 | int sy = (spans->y + yoff) % image_height; | - | ||||||||||||||||||
| 4448 | if (sx < 0)
| 0 | ||||||||||||||||||
| 4449 | sx += image_width; never executed: sx += image_width; | 0 | ||||||||||||||||||
| 4450 | if (sy < 0)
| 0 | ||||||||||||||||||
| 4451 | sy += image_height; never executed: sy += image_height; | 0 | ||||||||||||||||||
| 4452 | - | |||||||||||||||||||
| 4453 | const int coverage = (spans->coverage * data->texture.const_alpha) >> 8; | - | ||||||||||||||||||
| 4454 | while (length) {
| 0 | ||||||||||||||||||
| 4455 | int l = qMin(image_width - sx, length); | - | ||||||||||||||||||
| 4456 | if (buffer_size < l)
| 0 | ||||||||||||||||||
| 4457 | l = buffer_size; never executed: l = buffer_size; | 0 | ||||||||||||||||||
| 4458 | const QRgba64 *src = op.srcFetch64(src_buffer, &op, data, sy, sx, l); | - | ||||||||||||||||||
| 4459 | QRgba64 *dest = op.destFetch64(buffer, data->rasterBuffer, x, spans->y, l); | - | ||||||||||||||||||
| 4460 | op.func64(dest, src, l, coverage); | - | ||||||||||||||||||
| 4461 | op.destStore64(data->rasterBuffer, x, spans->y, dest, l); | - | ||||||||||||||||||
| 4462 | x += l; | - | ||||||||||||||||||
| 4463 | sx += l; | - | ||||||||||||||||||
| 4464 | length -= l; | - | ||||||||||||||||||
| 4465 | if (sx >= image_width)
| 0 | ||||||||||||||||||
| 4466 | sx = 0; never executed: sx = 0; | 0 | ||||||||||||||||||
| 4467 | } never executed: end of block | 0 | ||||||||||||||||||
| 4468 | ++spans; | - | ||||||||||||||||||
| 4469 | } never executed: end of block | 0 | ||||||||||||||||||
| 4470 | } never executed: end of block | 0 | ||||||||||||||||||
| 4471 | - | |||||||||||||||||||
| 4472 | static void blend_tiled_argb(int count, const QSpan *spans, void *userData) | - | ||||||||||||||||||
| 4473 | { | - | ||||||||||||||||||
| 4474 | QSpanData *data = reinterpret_cast<QSpanData *>(userData); | - | ||||||||||||||||||
| 4475 | if (data->texture.format != QImage::Format_ARGB32_Premultiplied
| 0 | ||||||||||||||||||
| 4476 | && data->texture.format != QImage::Format_RGB32) {
| 0 | ||||||||||||||||||
| 4477 | blend_tiled_generic(count, spans, userData); | - | ||||||||||||||||||
| 4478 | return; never executed: return; | 0 | ||||||||||||||||||
| 4479 | } | - | ||||||||||||||||||
| 4480 | - | |||||||||||||||||||
| 4481 | Operator op = getOperator(data, spans, count); | - | ||||||||||||||||||
| 4482 | - | |||||||||||||||||||
| 4483 | int image_width = data->texture.width; | - | ||||||||||||||||||
| 4484 | int image_height = data->texture.height; | - | ||||||||||||||||||
| 4485 | int xoff = -qRound(-data->dx) % image_width; | - | ||||||||||||||||||
| 4486 | int yoff = -qRound(-data->dy) % image_height; | - | ||||||||||||||||||
| 4487 | - | |||||||||||||||||||
| 4488 | if (xoff < 0)
| 0 | ||||||||||||||||||
| 4489 | xoff += image_width; never executed: xoff += image_width; | 0 | ||||||||||||||||||
| 4490 | if (yoff < 0)
| 0 | ||||||||||||||||||
| 4491 | yoff += image_height; never executed: yoff += image_height; | 0 | ||||||||||||||||||
| 4492 | - | |||||||||||||||||||
| 4493 | while (count--) {
| 0 | ||||||||||||||||||
| 4494 | int x = spans->x; | - | ||||||||||||||||||
| 4495 | int length = spans->len; | - | ||||||||||||||||||
| 4496 | int sx = (xoff + spans->x) % image_width; | - | ||||||||||||||||||
| 4497 | int sy = (spans->y + yoff) % image_height; | - | ||||||||||||||||||
| 4498 | if (sx < 0)
| 0 | ||||||||||||||||||
| 4499 | sx += image_width; never executed: sx += image_width; | 0 | ||||||||||||||||||
| 4500 | if (sy < 0)
| 0 | ||||||||||||||||||
| 4501 | sy += image_height; never executed: sy += image_height; | 0 | ||||||||||||||||||
| 4502 | - | |||||||||||||||||||
| 4503 | const int coverage = (spans->coverage * data->texture.const_alpha) >> 8; | - | ||||||||||||||||||
| 4504 | while (length) {
| 0 | ||||||||||||||||||
| 4505 | int l = qMin(image_width - sx, length); | - | ||||||||||||||||||
| 4506 | if (buffer_size < l)
| 0 | ||||||||||||||||||
| 4507 | l = buffer_size; never executed: l = buffer_size; | 0 | ||||||||||||||||||
| 4508 | const uint *src = (const uint *)data->texture.scanLine(sy) + sx; | - | ||||||||||||||||||
| 4509 | uint *dest = ((uint *)data->rasterBuffer->scanLine(spans->y)) + x; | - | ||||||||||||||||||
| 4510 | op.func(dest, src, l, coverage); | - | ||||||||||||||||||
| 4511 | x += l; | - | ||||||||||||||||||
| 4512 | sx += l; | - | ||||||||||||||||||
| 4513 | length -= l; | - | ||||||||||||||||||
| 4514 | if (sx >= image_width)
| 0 | ||||||||||||||||||
| 4515 | sx = 0; never executed: sx = 0; | 0 | ||||||||||||||||||
| 4516 | } never executed: end of block | 0 | ||||||||||||||||||
| 4517 | ++spans; | - | ||||||||||||||||||
| 4518 | } never executed: end of block | 0 | ||||||||||||||||||
| 4519 | } never executed: end of block | 0 | ||||||||||||||||||
| 4520 | - | |||||||||||||||||||
| 4521 | static void blend_tiled_rgb565(int count, const QSpan *spans, void *userData) | - | ||||||||||||||||||
| 4522 | { | - | ||||||||||||||||||
| 4523 | QSpanData *data = reinterpret_cast<QSpanData*>(userData); | - | ||||||||||||||||||
| 4524 | QPainter::CompositionMode mode = data->rasterBuffer->compositionMode; | - | ||||||||||||||||||
| 4525 | - | |||||||||||||||||||
| 4526 | if (data->texture.format != QImage::Format_RGB16
| 0 | ||||||||||||||||||
| 4527 | || (mode != QPainter::CompositionMode_SourceOver
| 0 | ||||||||||||||||||
| 4528 | && mode != QPainter::CompositionMode_Source))
| 0 | ||||||||||||||||||
| 4529 | { | - | ||||||||||||||||||
| 4530 | blend_tiled_generic(count, spans, userData); | - | ||||||||||||||||||
| 4531 | return; never executed: return; | 0 | ||||||||||||||||||
| 4532 | } | - | ||||||||||||||||||
| 4533 | - | |||||||||||||||||||
| 4534 | const int image_width = data->texture.width; | - | ||||||||||||||||||
| 4535 | const int image_height = data->texture.height; | - | ||||||||||||||||||
| 4536 | int xoff = -qRound(-data->dx) % image_width; | - | ||||||||||||||||||
| 4537 | int yoff = -qRound(-data->dy) % image_height; | - | ||||||||||||||||||
| 4538 | - | |||||||||||||||||||
| 4539 | if (xoff < 0)
| 0 | ||||||||||||||||||
| 4540 | xoff += image_width; never executed: xoff += image_width; | 0 | ||||||||||||||||||
| 4541 | if (yoff < 0)
| 0 | ||||||||||||||||||
| 4542 | yoff += image_height; never executed: yoff += image_height; | 0 | ||||||||||||||||||
| 4543 | - | |||||||||||||||||||
| 4544 | while (count--) {
| 0 | ||||||||||||||||||
| 4545 | const quint8 coverage = (data->texture.const_alpha * spans->coverage) >> 8; | - | ||||||||||||||||||
| 4546 | if (coverage == 0) {
| 0 | ||||||||||||||||||
| 4547 | ++spans; | - | ||||||||||||||||||
| 4548 | continue; never executed: continue; | 0 | ||||||||||||||||||
| 4549 | } | - | ||||||||||||||||||
| 4550 | - | |||||||||||||||||||
| 4551 | int x = spans->x; | - | ||||||||||||||||||
| 4552 | int length = spans->len; | - | ||||||||||||||||||
| 4553 | int sx = (xoff + spans->x) % image_width; | - | ||||||||||||||||||
| 4554 | int sy = (spans->y + yoff) % image_height; | - | ||||||||||||||||||
| 4555 | if (sx < 0)
| 0 | ||||||||||||||||||
| 4556 | sx += image_width; never executed: sx += image_width; | 0 | ||||||||||||||||||
| 4557 | if (sy < 0)
| 0 | ||||||||||||||||||
| 4558 | sy += image_height; never executed: sy += image_height; | 0 | ||||||||||||||||||
| 4559 | - | |||||||||||||||||||
| 4560 | if (coverage == 255) {
| 0 | ||||||||||||||||||
| 4561 | // Copy the first texture block | - | ||||||||||||||||||
| 4562 | length = qMin(image_width,length); | - | ||||||||||||||||||
| 4563 | int tx = x; | - | ||||||||||||||||||
| 4564 | while (length) {
| 0 | ||||||||||||||||||
| 4565 | int l = qMin(image_width - sx, length); | - | ||||||||||||||||||
| 4566 | if (buffer_size < l)
| 0 | ||||||||||||||||||
| 4567 | l = buffer_size; never executed: l = buffer_size; | 0 | ||||||||||||||||||
| 4568 | quint16 *dest = ((quint16 *)data->rasterBuffer->scanLine(spans->y)) + tx; | - | ||||||||||||||||||
| 4569 | const quint16 *src = (const quint16 *)data->texture.scanLine(sy) + sx; | - | ||||||||||||||||||
| 4570 | memcpy(dest, src, l * sizeof(quint16)); | - | ||||||||||||||||||
| 4571 | length -= l; | - | ||||||||||||||||||
| 4572 | tx += l; | - | ||||||||||||||||||
| 4573 | sx += l; | - | ||||||||||||||||||
| 4574 | if (sx >= image_width)
| 0 | ||||||||||||||||||
| 4575 | sx = 0; never executed: sx = 0; | 0 | ||||||||||||||||||
| 4576 | } never executed: end of block | 0 | ||||||||||||||||||
| 4577 | - | |||||||||||||||||||
| 4578 | // Now use the rasterBuffer as the source of the texture, | - | ||||||||||||||||||
| 4579 | // We can now progressively copy larger blocks | - | ||||||||||||||||||
| 4580 | // - Less cpu time in code figuring out what to copy | - | ||||||||||||||||||
| 4581 | // We are dealing with one block of data | - | ||||||||||||||||||
| 4582 | // - More likely to fit in the cache | - | ||||||||||||||||||
| 4583 | // - can use memcpy | - | ||||||||||||||||||
| 4584 | int copy_image_width = qMin(image_width, int(spans->len)); | - | ||||||||||||||||||
| 4585 | length = spans->len - copy_image_width; | - | ||||||||||||||||||
| 4586 | quint16 *src = ((quint16 *)data->rasterBuffer->scanLine(spans->y)) + x; | - | ||||||||||||||||||
| 4587 | quint16 *dest = src + copy_image_width; | - | ||||||||||||||||||
| 4588 | while (copy_image_width < length) {
| 0 | ||||||||||||||||||
| 4589 | memcpy(dest, src, copy_image_width * sizeof(quint16)); | - | ||||||||||||||||||
| 4590 | dest += copy_image_width; | - | ||||||||||||||||||
| 4591 | length -= copy_image_width; | - | ||||||||||||||||||
| 4592 | copy_image_width *= 2; | - | ||||||||||||||||||
| 4593 | } never executed: end of block | 0 | ||||||||||||||||||
| 4594 | if (length > 0)
| 0 | ||||||||||||||||||
| 4595 | memcpy(dest, src, length * sizeof(quint16)); never executed: memcpy(dest, src, length * sizeof(quint16)); | 0 | ||||||||||||||||||
| 4596 | } else { never executed: end of block | 0 | ||||||||||||||||||
| 4597 | const quint8 alpha = (coverage + 1) >> 3; | - | ||||||||||||||||||
| 4598 | const quint8 ialpha = 0x20 - alpha; | - | ||||||||||||||||||
| 4599 | if (alpha > 0) {
| 0 | ||||||||||||||||||
| 4600 | while (length) {
| 0 | ||||||||||||||||||
| 4601 | int l = qMin(image_width - sx, length); | - | ||||||||||||||||||
| 4602 | if (buffer_size < l)
| 0 | ||||||||||||||||||
| 4603 | l = buffer_size; never executed: l = buffer_size; | 0 | ||||||||||||||||||
| 4604 | quint16 *dest = ((quint16 *)data->rasterBuffer->scanLine(spans->y)) + x; | - | ||||||||||||||||||
| 4605 | const quint16 *src = (const quint16 *)data->texture.scanLine(sy) + sx; | - | ||||||||||||||||||
| 4606 | blend_sourceOver_rgb16_rgb16(dest, src, l, alpha, ialpha); | - | ||||||||||||||||||
| 4607 | x += l; | - | ||||||||||||||||||
| 4608 | sx += l; | - | ||||||||||||||||||
| 4609 | length -= l; | - | ||||||||||||||||||
| 4610 | if (sx >= image_width)
| 0 | ||||||||||||||||||
| 4611 | sx = 0; never executed: sx = 0; | 0 | ||||||||||||||||||
| 4612 | } never executed: end of block | 0 | ||||||||||||||||||
| 4613 | } never executed: end of block | 0 | ||||||||||||||||||
| 4614 | } never executed: end of block | 0 | ||||||||||||||||||
| 4615 | ++spans; | - | ||||||||||||||||||
| 4616 | } never executed: end of block | 0 | ||||||||||||||||||
| 4617 | } never executed: end of block | 0 | ||||||||||||||||||
| 4618 | - | |||||||||||||||||||
| 4619 | static void blend_transformed_bilinear_rgb565(int count, const QSpan *spans, void *userData) | - | ||||||||||||||||||
| 4620 | { | - | ||||||||||||||||||
| 4621 | QSpanData *data = reinterpret_cast<QSpanData*>(userData); | - | ||||||||||||||||||
| 4622 | QPainter::CompositionMode mode = data->rasterBuffer->compositionMode; | - | ||||||||||||||||||
| 4623 | - | |||||||||||||||||||
| 4624 | if (data->texture.format != QImage::Format_RGB16
| 0 | ||||||||||||||||||
| 4625 | || (mode != QPainter::CompositionMode_SourceOver
| 0 | ||||||||||||||||||
| 4626 | && mode != QPainter::CompositionMode_Source))
| 0 | ||||||||||||||||||
| 4627 | { | - | ||||||||||||||||||
| 4628 | blend_src_generic(count, spans, userData); | - | ||||||||||||||||||
| 4629 | return; never executed: return; | 0 | ||||||||||||||||||
| 4630 | } | - | ||||||||||||||||||
| 4631 | - | |||||||||||||||||||
| 4632 | quint16 buffer[buffer_size]; | - | ||||||||||||||||||
| 4633 | - | |||||||||||||||||||
| 4634 | const int src_minx = data->texture.x1; | - | ||||||||||||||||||
| 4635 | const int src_miny = data->texture.y1; | - | ||||||||||||||||||
| 4636 | const int src_maxx = data->texture.x2 - 1; | - | ||||||||||||||||||
| 4637 | const int src_maxy = data->texture.y2 - 1; | - | ||||||||||||||||||
| 4638 | - | |||||||||||||||||||
| 4639 | if (data->fast_matrix) {
| 0 | ||||||||||||||||||
| 4640 | // The increment pr x in the scanline | - | ||||||||||||||||||
| 4641 | const int fdx = (int)(data->m11 * fixed_scale); | - | ||||||||||||||||||
| 4642 | const int fdy = (int)(data->m12 * fixed_scale); | - | ||||||||||||||||||
| 4643 | - | |||||||||||||||||||
| 4644 | while (count--) {
| 0 | ||||||||||||||||||
| 4645 | const quint8 coverage = (data->texture.const_alpha * spans->coverage) >> 8; | - | ||||||||||||||||||
| 4646 | const quint8 alpha = (coverage + 1) >> 3; | - | ||||||||||||||||||
| 4647 | const quint8 ialpha = 0x20 - alpha; | - | ||||||||||||||||||
| 4648 | if (alpha == 0) {
| 0 | ||||||||||||||||||
| 4649 | ++spans; | - | ||||||||||||||||||
| 4650 | continue; never executed: continue; | 0 | ||||||||||||||||||
| 4651 | } | - | ||||||||||||||||||
| 4652 | - | |||||||||||||||||||
| 4653 | quint16 *dest = (quint16 *)data->rasterBuffer->scanLine(spans->y) + spans->x; | - | ||||||||||||||||||
| 4654 | const qreal cx = spans->x + qreal(0.5); | - | ||||||||||||||||||
| 4655 | const qreal cy = spans->y + qreal(0.5); | - | ||||||||||||||||||
| 4656 | int x = int((data->m21 * cy | - | ||||||||||||||||||
| 4657 | + data->m11 * cx + data->dx) * fixed_scale) - half_point; | - | ||||||||||||||||||
| 4658 | int y = int((data->m22 * cy | - | ||||||||||||||||||
| 4659 | + data->m12 * cx + data->dy) * fixed_scale) - half_point; | - | ||||||||||||||||||
| 4660 | int length = spans->len; | - | ||||||||||||||||||
| 4661 | - | |||||||||||||||||||
| 4662 | while (length) {
| 0 | ||||||||||||||||||
| 4663 | int l; | - | ||||||||||||||||||
| 4664 | quint16 *b; | - | ||||||||||||||||||
| 4665 | if (ialpha == 0) {
| 0 | ||||||||||||||||||
| 4666 | l = length; | - | ||||||||||||||||||
| 4667 | b = dest; | - | ||||||||||||||||||
| 4668 | } else { never executed: end of block | 0 | ||||||||||||||||||
| 4669 | l = qMin(length, buffer_size); | - | ||||||||||||||||||
| 4670 | b = buffer; | - | ||||||||||||||||||
| 4671 | } never executed: end of block | 0 | ||||||||||||||||||
| 4672 | const quint16 *end = b + l; | - | ||||||||||||||||||
| 4673 | - | |||||||||||||||||||
| 4674 | while (b < end) {
| 0 | ||||||||||||||||||
| 4675 | int x1 = (x >> 16); | - | ||||||||||||||||||
| 4676 | int x2; | - | ||||||||||||||||||
| 4677 | int y1 = (y >> 16); | - | ||||||||||||||||||
| 4678 | int y2; | - | ||||||||||||||||||
| 4679 | - | |||||||||||||||||||
| 4680 | fetchTransformedBilinear_pixelBounds<BlendTransformedBilinear>(0, src_minx, src_maxx, x1, x2); | - | ||||||||||||||||||
| 4681 | fetchTransformedBilinear_pixelBounds<BlendTransformedBilinear>(0, src_miny, src_maxy, y1, y2); | - | ||||||||||||||||||
| 4682 | - | |||||||||||||||||||
| 4683 | const quint16 *src1 = (const quint16*)data->texture.scanLine(y1); | - | ||||||||||||||||||
| 4684 | const quint16 *src2 = (const quint16*)data->texture.scanLine(y2); | - | ||||||||||||||||||
| 4685 | quint16 tl = src1[x1]; | - | ||||||||||||||||||
| 4686 | const quint16 tr = src1[x2]; | - | ||||||||||||||||||
| 4687 | quint16 bl = src2[x1]; | - | ||||||||||||||||||
| 4688 | const quint16 br = src2[x2]; | - | ||||||||||||||||||
| 4689 | - | |||||||||||||||||||
| 4690 | const uint distxsl8 = x & 0xff00; | - | ||||||||||||||||||
| 4691 | const uint distysl8 = y & 0xff00; | - | ||||||||||||||||||
| 4692 | const uint distx = distxsl8 >> 8; | - | ||||||||||||||||||
| 4693 | const uint disty = distysl8 >> 8; | - | ||||||||||||||||||
| 4694 | const uint distxy = distx * disty; | - | ||||||||||||||||||
| 4695 | - | |||||||||||||||||||
| 4696 | const uint tlw = 0x10000 - distxsl8 - distysl8 + distxy; // (256 - distx) * (256 - disty) | - | ||||||||||||||||||
| 4697 | const uint trw = distxsl8 - distxy; // distx * (256 - disty) | - | ||||||||||||||||||
| 4698 | const uint blw = distysl8 - distxy; // (256 - distx) * disty | - | ||||||||||||||||||
| 4699 | const uint brw = distxy; // distx * disty | - | ||||||||||||||||||
| 4700 | uint red = ((tl & 0xf800) * tlw + (tr & 0xf800) * trw | - | ||||||||||||||||||
| 4701 | + (bl & 0xf800) * blw + (br & 0xf800) * brw) & 0xf8000000; | - | ||||||||||||||||||
| 4702 | uint green = ((tl & 0x07e0) * tlw + (tr & 0x07e0) * trw | - | ||||||||||||||||||
| 4703 | + (bl & 0x07e0) * blw + (br & 0x07e0) * brw) & 0x07e00000; | - | ||||||||||||||||||
| 4704 | uint blue = ((tl & 0x001f) * tlw + (tr & 0x001f) * trw | - | ||||||||||||||||||
| 4705 | + (bl & 0x001f) * blw + (br & 0x001f) * brw); | - | ||||||||||||||||||
| 4706 | *b = quint16((red | green | blue) >> 16); | - | ||||||||||||||||||
| 4707 | - | |||||||||||||||||||
| 4708 | ++b; | - | ||||||||||||||||||
| 4709 | x += fdx; | - | ||||||||||||||||||
| 4710 | y += fdy; | - | ||||||||||||||||||
| 4711 | } never executed: end of block | 0 | ||||||||||||||||||
| 4712 | - | |||||||||||||||||||
| 4713 | if (ialpha != 0)
| 0 | ||||||||||||||||||
| 4714 | blend_sourceOver_rgb16_rgb16(dest, buffer, l, alpha, ialpha); never executed: blend_sourceOver_rgb16_rgb16(dest, buffer, l, alpha, ialpha); | 0 | ||||||||||||||||||
| 4715 | - | |||||||||||||||||||
| 4716 | dest += l; | - | ||||||||||||||||||
| 4717 | length -= l; | - | ||||||||||||||||||
| 4718 | } never executed: end of block | 0 | ||||||||||||||||||
| 4719 | ++spans; | - | ||||||||||||||||||
| 4720 | } never executed: end of block | 0 | ||||||||||||||||||
| 4721 | } else { never executed: end of block | 0 | ||||||||||||||||||
| 4722 | const qreal fdx = data->m11; | - | ||||||||||||||||||
| 4723 | const qreal fdy = data->m12; | - | ||||||||||||||||||
| 4724 | const qreal fdw = data->m13; | - | ||||||||||||||||||
| 4725 | - | |||||||||||||||||||
| 4726 | while (count--) {
| 0 | ||||||||||||||||||
| 4727 | const quint8 coverage = (data->texture.const_alpha * spans->coverage) >> 8; | - | ||||||||||||||||||
| 4728 | const quint8 alpha = (coverage + 1) >> 3; | - | ||||||||||||||||||
| 4729 | const quint8 ialpha = 0x20 - alpha; | - | ||||||||||||||||||
| 4730 | if (alpha == 0) {
| 0 | ||||||||||||||||||
| 4731 | ++spans; | - | ||||||||||||||||||
| 4732 | continue; never executed: continue; | 0 | ||||||||||||||||||
| 4733 | } | - | ||||||||||||||||||
| 4734 | - | |||||||||||||||||||
| 4735 | quint16 *dest = (quint16 *)data->rasterBuffer->scanLine(spans->y) + spans->x; | - | ||||||||||||||||||
| 4736 | - | |||||||||||||||||||
| 4737 | const qreal cx = spans->x + qreal(0.5); | - | ||||||||||||||||||
| 4738 | const qreal cy = spans->y + qreal(0.5); | - | ||||||||||||||||||
| 4739 | - | |||||||||||||||||||
| 4740 | qreal x = data->m21 * cy + data->m11 * cx + data->dx; | - | ||||||||||||||||||
| 4741 | qreal y = data->m22 * cy + data->m12 * cx + data->dy; | - | ||||||||||||||||||
| 4742 | qreal w = data->m23 * cy + data->m13 * cx + data->m33; | - | ||||||||||||||||||
| 4743 | - | |||||||||||||||||||
| 4744 | int length = spans->len; | - | ||||||||||||||||||
| 4745 | while (length) {
| 0 | ||||||||||||||||||
| 4746 | int l; | - | ||||||||||||||||||
| 4747 | quint16 *b; | - | ||||||||||||||||||
| 4748 | if (ialpha == 0) {
| 0 | ||||||||||||||||||
| 4749 | l = length; | - | ||||||||||||||||||
| 4750 | b = dest; | - | ||||||||||||||||||
| 4751 | } else { never executed: end of block | 0 | ||||||||||||||||||
| 4752 | l = qMin(length, buffer_size); | - | ||||||||||||||||||
| 4753 | b = buffer; | - | ||||||||||||||||||
| 4754 | } never executed: end of block | 0 | ||||||||||||||||||
| 4755 | const quint16 *end = b + l; | - | ||||||||||||||||||
| 4756 | - | |||||||||||||||||||
| 4757 | while (b < end) {
| 0 | ||||||||||||||||||
| 4758 | const qreal iw = w == 0 ? 1 : 1 / w;
| 0 | ||||||||||||||||||
| 4759 | const qreal px = x * iw - qreal(0.5); | - | ||||||||||||||||||
| 4760 | const qreal py = y * iw - qreal(0.5); | - | ||||||||||||||||||
| 4761 | - | |||||||||||||||||||
| 4762 | int x1 = int(px) - (px < 0); | - | ||||||||||||||||||
| 4763 | int x2; | - | ||||||||||||||||||
| 4764 | int y1 = int(py) - (py < 0); | - | ||||||||||||||||||
| 4765 | int y2; | - | ||||||||||||||||||
| 4766 | - | |||||||||||||||||||
| 4767 | fetchTransformedBilinear_pixelBounds<BlendTransformedBilinear>(0, src_minx, src_maxx, x1, x2); | - | ||||||||||||||||||
| 4768 | fetchTransformedBilinear_pixelBounds<BlendTransformedBilinear>(0, src_miny, src_maxy, y1, y2); | - | ||||||||||||||||||
| 4769 | - | |||||||||||||||||||
| 4770 | const quint16 *src1 = (const quint16 *)data->texture.scanLine(y1); | - | ||||||||||||||||||
| 4771 | const quint16 *src2 = (const quint16 *)data->texture.scanLine(y2); | - | ||||||||||||||||||
| 4772 | quint16 tl = src1[x1]; | - | ||||||||||||||||||
| 4773 | const quint16 tr = src1[x2]; | - | ||||||||||||||||||
| 4774 | quint16 bl = src2[x1]; | - | ||||||||||||||||||
| 4775 | const quint16 br = src2[x2]; | - | ||||||||||||||||||
| 4776 | - | |||||||||||||||||||
| 4777 | const uint distx = uint((px - x1) * 256); | - | ||||||||||||||||||
| 4778 | const uint disty = uint((py - y1) * 256); | - | ||||||||||||||||||
| 4779 | const uint distxsl8 = distx << 8; | - | ||||||||||||||||||
| 4780 | const uint distysl8 = disty << 8; | - | ||||||||||||||||||
| 4781 | const uint distxy = distx * disty; | - | ||||||||||||||||||
| 4782 | - | |||||||||||||||||||
| 4783 | const uint tlw = 0x10000 - distxsl8 - distysl8 + distxy; // (256 - distx) * (256 - disty) | - | ||||||||||||||||||
| 4784 | const uint trw = distxsl8 - distxy; // distx * (256 - disty) | - | ||||||||||||||||||
| 4785 | const uint blw = distysl8 - distxy; // (256 - distx) * disty | - | ||||||||||||||||||
| 4786 | const uint brw = distxy; // distx * disty | - | ||||||||||||||||||
| 4787 | uint red = ((tl & 0xf800) * tlw + (tr & 0xf800) * trw | - | ||||||||||||||||||
| 4788 | + (bl & 0xf800) * blw + (br & 0xf800) * brw) & 0xf8000000; | - | ||||||||||||||||||
| 4789 | uint green = ((tl & 0x07e0) * tlw + (tr & 0x07e0) * trw | - | ||||||||||||||||||
| 4790 | + (bl & 0x07e0) * blw + (br & 0x07e0) * brw) & 0x07e00000; | - | ||||||||||||||||||
| 4791 | uint blue = ((tl & 0x001f) * tlw + (tr & 0x001f) * trw | - | ||||||||||||||||||
| 4792 | + (bl & 0x001f) * blw + (br & 0x001f) * brw); | - | ||||||||||||||||||
| 4793 | *b = quint16((red | green | blue) >> 16); | - | ||||||||||||||||||
| 4794 | - | |||||||||||||||||||
| 4795 | ++b; | - | ||||||||||||||||||
| 4796 | x += fdx; | - | ||||||||||||||||||
| 4797 | y += fdy; | - | ||||||||||||||||||
| 4798 | w += fdw; | - | ||||||||||||||||||
| 4799 | } never executed: end of block | 0 | ||||||||||||||||||
| 4800 | - | |||||||||||||||||||
| 4801 | if (ialpha != 0)
| 0 | ||||||||||||||||||
| 4802 | blend_sourceOver_rgb16_rgb16(dest, buffer, l, alpha, ialpha); never executed: blend_sourceOver_rgb16_rgb16(dest, buffer, l, alpha, ialpha); | 0 | ||||||||||||||||||
| 4803 | - | |||||||||||||||||||
| 4804 | dest += l; | - | ||||||||||||||||||
| 4805 | length -= l; | - | ||||||||||||||||||
| 4806 | } never executed: end of block | 0 | ||||||||||||||||||
| 4807 | ++spans; | - | ||||||||||||||||||
| 4808 | } never executed: end of block | 0 | ||||||||||||||||||
| 4809 | } never executed: end of block | 0 | ||||||||||||||||||
| 4810 | } | - | ||||||||||||||||||
| 4811 | - | |||||||||||||||||||
| 4812 | static void blend_transformed_argb(int count, const QSpan *spans, void *userData) | - | ||||||||||||||||||
| 4813 | { | - | ||||||||||||||||||
| 4814 | QSpanData *data = reinterpret_cast<QSpanData *>(userData); | - | ||||||||||||||||||
| 4815 | if (data->texture.format != QImage::Format_ARGB32_Premultiplied
| 0 | ||||||||||||||||||
| 4816 | && data->texture.format != QImage::Format_RGB32) {
| 0 | ||||||||||||||||||
| 4817 | blend_src_generic(count, spans, userData); | - | ||||||||||||||||||
| 4818 | return; never executed: return; | 0 | ||||||||||||||||||
| 4819 | } | - | ||||||||||||||||||
| 4820 | - | |||||||||||||||||||
| 4821 | CompositionFunction func = functionForMode[data->rasterBuffer->compositionMode]; | - | ||||||||||||||||||
| 4822 | uint buffer[buffer_size]; | - | ||||||||||||||||||
| 4823 | - | |||||||||||||||||||
| 4824 | int image_width = data->texture.width; | - | ||||||||||||||||||
| 4825 | int image_height = data->texture.height; | - | ||||||||||||||||||
| 4826 | - | |||||||||||||||||||
| 4827 | if (data->fast_matrix) {
| 0 | ||||||||||||||||||
| 4828 | // The increment pr x in the scanline | - | ||||||||||||||||||
| 4829 | int fdx = (int)(data->m11 * fixed_scale); | - | ||||||||||||||||||
| 4830 | int fdy = (int)(data->m12 * fixed_scale); | - | ||||||||||||||||||
| 4831 | - | |||||||||||||||||||
| 4832 | while (count--) {
| 0 | ||||||||||||||||||
| 4833 | void *t = data->rasterBuffer->scanLine(spans->y); | - | ||||||||||||||||||
| 4834 | - | |||||||||||||||||||
| 4835 | uint *target = ((uint *)t) + spans->x; | - | ||||||||||||||||||
| 4836 | - | |||||||||||||||||||
| 4837 | const qreal cx = spans->x + qreal(0.5); | - | ||||||||||||||||||
| 4838 | const qreal cy = spans->y + qreal(0.5); | - | ||||||||||||||||||
| 4839 | - | |||||||||||||||||||
| 4840 | int x = int((data->m21 * cy | - | ||||||||||||||||||
| 4841 | + data->m11 * cx + data->dx) * fixed_scale); | - | ||||||||||||||||||
| 4842 | int y = int((data->m22 * cy | - | ||||||||||||||||||
| 4843 | + data->m12 * cx + data->dy) * fixed_scale); | - | ||||||||||||||||||
| 4844 | - | |||||||||||||||||||
| 4845 | int length = spans->len; | - | ||||||||||||||||||
| 4846 | const int coverage = (spans->coverage * data->texture.const_alpha) >> 8; | - | ||||||||||||||||||
| 4847 | while (length) {
| 0 | ||||||||||||||||||
| 4848 | int l = qMin(length, buffer_size); | - | ||||||||||||||||||
| 4849 | const uint *end = buffer + l; | - | ||||||||||||||||||
| 4850 | uint *b = buffer; | - | ||||||||||||||||||
| 4851 | while (b < end) {
| 0 | ||||||||||||||||||
| 4852 | int px = qBound(0, x >> 16, image_width - 1); | - | ||||||||||||||||||
| 4853 | int py = qBound(0, y >> 16, image_height - 1); | - | ||||||||||||||||||
| 4854 | *b = reinterpret_cast<const uint *>(data->texture.scanLine(py))[px]; | - | ||||||||||||||||||
| 4855 | - | |||||||||||||||||||
| 4856 | x += fdx; | - | ||||||||||||||||||
| 4857 | y += fdy; | - | ||||||||||||||||||
| 4858 | ++b; | - | ||||||||||||||||||
| 4859 | } never executed: end of block | 0 | ||||||||||||||||||
| 4860 | func(target, buffer, l, coverage); | - | ||||||||||||||||||
| 4861 | target += l; | - | ||||||||||||||||||
| 4862 | length -= l; | - | ||||||||||||||||||
| 4863 | } never executed: end of block | 0 | ||||||||||||||||||
| 4864 | ++spans; | - | ||||||||||||||||||
| 4865 | } never executed: end of block | 0 | ||||||||||||||||||
| 4866 | } else { never executed: end of block | 0 | ||||||||||||||||||
| 4867 | const qreal fdx = data->m11; | - | ||||||||||||||||||
| 4868 | const qreal fdy = data->m12; | - | ||||||||||||||||||
| 4869 | const qreal fdw = data->m13; | - | ||||||||||||||||||
| 4870 | while (count--) {
| 0 | ||||||||||||||||||
| 4871 | void *t = data->rasterBuffer->scanLine(spans->y); | - | ||||||||||||||||||
| 4872 | - | |||||||||||||||||||
| 4873 | uint *target = ((uint *)t) + spans->x; | - | ||||||||||||||||||
| 4874 | - | |||||||||||||||||||
| 4875 | const qreal cx = spans->x + qreal(0.5); | - | ||||||||||||||||||
| 4876 | const qreal cy = spans->y + qreal(0.5); | - | ||||||||||||||||||
| 4877 | - | |||||||||||||||||||
| 4878 | qreal x = data->m21 * cy + data->m11 * cx + data->dx; | - | ||||||||||||||||||
| 4879 | qreal y = data->m22 * cy + data->m12 * cx + data->dy; | - | ||||||||||||||||||
| 4880 | qreal w = data->m23 * cy + data->m13 * cx + data->m33; | - | ||||||||||||||||||
| 4881 | - | |||||||||||||||||||
| 4882 | int length = spans->len; | - | ||||||||||||||||||
| 4883 | const int coverage = (spans->coverage * data->texture.const_alpha) >> 8; | - | ||||||||||||||||||
| 4884 | while (length) {
| 0 | ||||||||||||||||||
| 4885 | int l = qMin(length, buffer_size); | - | ||||||||||||||||||
| 4886 | const uint *end = buffer + l; | - | ||||||||||||||||||
| 4887 | uint *b = buffer; | - | ||||||||||||||||||
| 4888 | while (b < end) {
| 0 | ||||||||||||||||||
| 4889 | const qreal iw = w == 0 ? 1 : 1 / w;
| 0 | ||||||||||||||||||
| 4890 | const qreal tx = x * iw; | - | ||||||||||||||||||
| 4891 | const qreal ty = y * iw; | - | ||||||||||||||||||
| 4892 | const int px = qBound(0, int(tx) - (tx < 0), image_width - 1); | - | ||||||||||||||||||
| 4893 | const int py = qBound(0, int(ty) - (ty < 0), image_height - 1); | - | ||||||||||||||||||
| 4894 | - | |||||||||||||||||||
| 4895 | *b = reinterpret_cast<const uint *>(data->texture.scanLine(py))[px]; | - | ||||||||||||||||||
| 4896 | x += fdx; | - | ||||||||||||||||||
| 4897 | y += fdy; | - | ||||||||||||||||||
| 4898 | w += fdw; | - | ||||||||||||||||||
| 4899 | - | |||||||||||||||||||
| 4900 | ++b; | - | ||||||||||||||||||
| 4901 | } never executed: end of block | 0 | ||||||||||||||||||
| 4902 | func(target, buffer, l, coverage); | - | ||||||||||||||||||
| 4903 | target += l; | - | ||||||||||||||||||
| 4904 | length -= l; | - | ||||||||||||||||||
| 4905 | } never executed: end of block | 0 | ||||||||||||||||||
| 4906 | ++spans; | - | ||||||||||||||||||
| 4907 | } never executed: end of block | 0 | ||||||||||||||||||
| 4908 | } never executed: end of block | 0 | ||||||||||||||||||
| 4909 | } | - | ||||||||||||||||||
| 4910 | - | |||||||||||||||||||
| 4911 | static void blend_transformed_rgb565(int count, const QSpan *spans, void *userData) | - | ||||||||||||||||||
| 4912 | { | - | ||||||||||||||||||
| 4913 | QSpanData *data = reinterpret_cast<QSpanData*>(userData); | - | ||||||||||||||||||
| 4914 | QPainter::CompositionMode mode = data->rasterBuffer->compositionMode; | - | ||||||||||||||||||
| 4915 | - | |||||||||||||||||||
| 4916 | if (data->texture.format != QImage::Format_RGB16
| 0 | ||||||||||||||||||
| 4917 | || (mode != QPainter::CompositionMode_SourceOver
| 0 | ||||||||||||||||||
| 4918 | && mode != QPainter::CompositionMode_Source))
| 0 | ||||||||||||||||||
| 4919 | { | - | ||||||||||||||||||
| 4920 | blend_src_generic(count, spans, userData); | - | ||||||||||||||||||
| 4921 | return; never executed: return; | 0 | ||||||||||||||||||
| 4922 | } | - | ||||||||||||||||||
| 4923 | - | |||||||||||||||||||
| 4924 | quint16 buffer[buffer_size]; | - | ||||||||||||||||||
| 4925 | const int image_width = data->texture.width; | - | ||||||||||||||||||
| 4926 | const int image_height = data->texture.height; | - | ||||||||||||||||||
| 4927 | - | |||||||||||||||||||
| 4928 | if (data->fast_matrix) {
| 0 | ||||||||||||||||||
| 4929 | // The increment pr x in the scanline | - | ||||||||||||||||||
| 4930 | const int fdx = (int)(data->m11 * fixed_scale); | - | ||||||||||||||||||
| 4931 | const int fdy = (int)(data->m12 * fixed_scale); | - | ||||||||||||||||||
| 4932 | - | |||||||||||||||||||
| 4933 | while (count--) {
| 0 | ||||||||||||||||||
| 4934 | const quint8 coverage = (data->texture.const_alpha * spans->coverage) >> 8; | - | ||||||||||||||||||
| 4935 | const quint8 alpha = (coverage + 1) >> 3; | - | ||||||||||||||||||
| 4936 | const quint8 ialpha = 0x20 - alpha; | - | ||||||||||||||||||
| 4937 | if (alpha == 0) {
| 0 | ||||||||||||||||||
| 4938 | ++spans; | - | ||||||||||||||||||
| 4939 | continue; never executed: continue; | 0 | ||||||||||||||||||
| 4940 | } | - | ||||||||||||||||||
| 4941 | - | |||||||||||||||||||
| 4942 | quint16 *dest = (quint16 *)data->rasterBuffer->scanLine(spans->y) + spans->x; | - | ||||||||||||||||||
| 4943 | const qreal cx = spans->x + qreal(0.5); | - | ||||||||||||||||||
| 4944 | const qreal cy = spans->y + qreal(0.5); | - | ||||||||||||||||||
| 4945 | int x = int((data->m21 * cy | - | ||||||||||||||||||
| 4946 | + data->m11 * cx + data->dx) * fixed_scale); | - | ||||||||||||||||||
| 4947 | int y = int((data->m22 * cy | - | ||||||||||||||||||
| 4948 | + data->m12 * cx + data->dy) * fixed_scale); | - | ||||||||||||||||||
| 4949 | int length = spans->len; | - | ||||||||||||||||||
| 4950 | - | |||||||||||||||||||
| 4951 | while (length) {
| 0 | ||||||||||||||||||
| 4952 | int l; | - | ||||||||||||||||||
| 4953 | quint16 *b; | - | ||||||||||||||||||
| 4954 | if (ialpha == 0) {
| 0 | ||||||||||||||||||
| 4955 | l = length; | - | ||||||||||||||||||
| 4956 | b = dest; | - | ||||||||||||||||||
| 4957 | } else { never executed: end of block | 0 | ||||||||||||||||||
| 4958 | l = qMin(length, buffer_size); | - | ||||||||||||||||||
| 4959 | b = buffer; | - | ||||||||||||||||||
| 4960 | } never executed: end of block | 0 | ||||||||||||||||||
| 4961 | const quint16 *end = b + l; | - | ||||||||||||||||||
| 4962 | - | |||||||||||||||||||
| 4963 | while (b < end) {
| 0 | ||||||||||||||||||
| 4964 | const int px = qBound(0, x >> 16, image_width - 1); | - | ||||||||||||||||||
| 4965 | const int py = qBound(0, y >> 16, image_height - 1); | - | ||||||||||||||||||
| 4966 | - | |||||||||||||||||||
| 4967 | *b = ((const quint16 *)data->texture.scanLine(py))[px]; | - | ||||||||||||||||||
| 4968 | ++b; | - | ||||||||||||||||||
| 4969 | - | |||||||||||||||||||
| 4970 | x += fdx; | - | ||||||||||||||||||
| 4971 | y += fdy; | - | ||||||||||||||||||
| 4972 | } never executed: end of block | 0 | ||||||||||||||||||
| 4973 | - | |||||||||||||||||||
| 4974 | if (ialpha != 0)
| 0 | ||||||||||||||||||
| 4975 | blend_sourceOver_rgb16_rgb16(dest, buffer, l, alpha, ialpha); never executed: blend_sourceOver_rgb16_rgb16(dest, buffer, l, alpha, ialpha); | 0 | ||||||||||||||||||
| 4976 | - | |||||||||||||||||||
| 4977 | dest += l; | - | ||||||||||||||||||
| 4978 | length -= l; | - | ||||||||||||||||||
| 4979 | } never executed: end of block | 0 | ||||||||||||||||||
| 4980 | ++spans; | - | ||||||||||||||||||
| 4981 | } never executed: end of block | 0 | ||||||||||||||||||
| 4982 | } else { never executed: end of block | 0 | ||||||||||||||||||
| 4983 | const qreal fdx = data->m11; | - | ||||||||||||||||||
| 4984 | const qreal fdy = data->m12; | - | ||||||||||||||||||
| 4985 | const qreal fdw = data->m13; | - | ||||||||||||||||||
| 4986 | - | |||||||||||||||||||
| 4987 | while (count--) {
| 0 | ||||||||||||||||||
| 4988 | const quint8 coverage = (data->texture.const_alpha * spans->coverage) >> 8; | - | ||||||||||||||||||
| 4989 | const quint8 alpha = (coverage + 1) >> 3; | - | ||||||||||||||||||
| 4990 | const quint8 ialpha = 0x20 - alpha; | - | ||||||||||||||||||
| 4991 | if (alpha == 0) {
| 0 | ||||||||||||||||||
| 4992 | ++spans; | - | ||||||||||||||||||
| 4993 | continue; never executed: continue; | 0 | ||||||||||||||||||
| 4994 | } | - | ||||||||||||||||||
| 4995 | - | |||||||||||||||||||
| 4996 | quint16 *dest = (quint16 *)data->rasterBuffer->scanLine(spans->y) + spans->x; | - | ||||||||||||||||||
| 4997 | - | |||||||||||||||||||
| 4998 | const qreal cx = spans->x + qreal(0.5); | - | ||||||||||||||||||
| 4999 | const qreal cy = spans->y + qreal(0.5); | - | ||||||||||||||||||
| 5000 | - | |||||||||||||||||||
| 5001 | qreal x = data->m21 * cy + data->m11 * cx + data->dx; | - | ||||||||||||||||||
| 5002 | qreal y = data->m22 * cy + data->m12 * cx + data->dy; | - | ||||||||||||||||||
| 5003 | qreal w = data->m23 * cy + data->m13 * cx + data->m33; | - | ||||||||||||||||||
| 5004 | - | |||||||||||||||||||
| 5005 | int length = spans->len; | - | ||||||||||||||||||
| 5006 | while (length) {
| 0 | ||||||||||||||||||
| 5007 | int l; | - | ||||||||||||||||||
| 5008 | quint16 *b; | - | ||||||||||||||||||
| 5009 | if (ialpha == 0) {
| 0 | ||||||||||||||||||
| 5010 | l = length; | - | ||||||||||||||||||
| 5011 | b = dest; | - | ||||||||||||||||||
| 5012 | } else { never executed: end of block | 0 | ||||||||||||||||||
| 5013 | l = qMin(length, buffer_size); | - | ||||||||||||||||||
| 5014 | b = buffer; | - | ||||||||||||||||||
| 5015 | } never executed: end of block | 0 | ||||||||||||||||||
| 5016 | const quint16 *end = b + l; | - | ||||||||||||||||||
| 5017 | - | |||||||||||||||||||
| 5018 | while (b < end) {
| 0 | ||||||||||||||||||
| 5019 | const qreal iw = w == 0 ? 1 : 1 / w;
| 0 | ||||||||||||||||||
| 5020 | const qreal tx = x * iw; | - | ||||||||||||||||||
| 5021 | const qreal ty = y * iw; | - | ||||||||||||||||||
| 5022 | - | |||||||||||||||||||
| 5023 | const int px = qBound(0, int(tx) - (tx < 0), image_width - 1); | - | ||||||||||||||||||
| 5024 | const int py = qBound(0, int(ty) - (ty < 0), image_height - 1); | - | ||||||||||||||||||
| 5025 | - | |||||||||||||||||||
| 5026 | *b = ((const quint16 *)data->texture.scanLine(py))[px]; | - | ||||||||||||||||||
| 5027 | ++b; | - | ||||||||||||||||||
| 5028 | - | |||||||||||||||||||
| 5029 | x += fdx; | - | ||||||||||||||||||
| 5030 | y += fdy; | - | ||||||||||||||||||
| 5031 | w += fdw; | - | ||||||||||||||||||
| 5032 | } never executed: end of block | 0 | ||||||||||||||||||
| 5033 | - | |||||||||||||||||||
| 5034 | if (ialpha != 0)
| 0 | ||||||||||||||||||
| 5035 | blend_sourceOver_rgb16_rgb16(dest, buffer, l, alpha, ialpha); never executed: blend_sourceOver_rgb16_rgb16(dest, buffer, l, alpha, ialpha); | 0 | ||||||||||||||||||
| 5036 | - | |||||||||||||||||||
| 5037 | dest += l; | - | ||||||||||||||||||
| 5038 | length -= l; | - | ||||||||||||||||||
| 5039 | } never executed: end of block | 0 | ||||||||||||||||||
| 5040 | ++spans; | - | ||||||||||||||||||
| 5041 | } never executed: end of block | 0 | ||||||||||||||||||
| 5042 | } never executed: end of block | 0 | ||||||||||||||||||
| 5043 | } | - | ||||||||||||||||||
| 5044 | - | |||||||||||||||||||
| 5045 | static void blend_transformed_tiled_argb(int count, const QSpan *spans, void *userData) | - | ||||||||||||||||||
| 5046 | { | - | ||||||||||||||||||
| 5047 | QSpanData *data = reinterpret_cast<QSpanData *>(userData); | - | ||||||||||||||||||
| 5048 | if (data->texture.format != QImage::Format_ARGB32_Premultiplied
| 0 | ||||||||||||||||||
| 5049 | && data->texture.format != QImage::Format_RGB32) {
| 0 | ||||||||||||||||||
| 5050 | blend_src_generic(count, spans, userData); | - | ||||||||||||||||||
| 5051 | return; never executed: return; | 0 | ||||||||||||||||||
| 5052 | } | - | ||||||||||||||||||
| 5053 | - | |||||||||||||||||||
| 5054 | CompositionFunction func = functionForMode[data->rasterBuffer->compositionMode]; | - | ||||||||||||||||||
| 5055 | uint buffer[buffer_size]; | - | ||||||||||||||||||
| 5056 | - | |||||||||||||||||||
| 5057 | int image_width = data->texture.width; | - | ||||||||||||||||||
| 5058 | int image_height = data->texture.height; | - | ||||||||||||||||||
| 5059 | const int scanline_offset = data->texture.bytesPerLine / 4; | - | ||||||||||||||||||
| 5060 | - | |||||||||||||||||||
| 5061 | if (data->fast_matrix) {
| 0 | ||||||||||||||||||
| 5062 | // The increment pr x in the scanline | - | ||||||||||||||||||
| 5063 | int fdx = (int)(data->m11 * fixed_scale); | - | ||||||||||||||||||
| 5064 | int fdy = (int)(data->m12 * fixed_scale); | - | ||||||||||||||||||
| 5065 | - | |||||||||||||||||||
| 5066 | while (count--) {
| 0 | ||||||||||||||||||
| 5067 | void *t = data->rasterBuffer->scanLine(spans->y); | - | ||||||||||||||||||
| 5068 | - | |||||||||||||||||||
| 5069 | uint *target = ((uint *)t) + spans->x; | - | ||||||||||||||||||
| 5070 | const uint *image_bits = (const uint *)data->texture.imageData; | - | ||||||||||||||||||
| 5071 | - | |||||||||||||||||||
| 5072 | const qreal cx = spans->x + qreal(0.5); | - | ||||||||||||||||||
| 5073 | const qreal cy = spans->y + qreal(0.5); | - | ||||||||||||||||||
| 5074 | - | |||||||||||||||||||
| 5075 | int x = int((data->m21 * cy | - | ||||||||||||||||||
| 5076 | + data->m11 * cx + data->dx) * fixed_scale); | - | ||||||||||||||||||
| 5077 | int y = int((data->m22 * cy | - | ||||||||||||||||||
| 5078 | + data->m12 * cx + data->dy) * fixed_scale); | - | ||||||||||||||||||
| 5079 | - | |||||||||||||||||||
| 5080 | const int coverage = (spans->coverage * data->texture.const_alpha) >> 8; | - | ||||||||||||||||||
| 5081 | int length = spans->len; | - | ||||||||||||||||||
| 5082 | while (length) {
| 0 | ||||||||||||||||||
| 5083 | int l = qMin(length, buffer_size); | - | ||||||||||||||||||
| 5084 | const uint *end = buffer + l; | - | ||||||||||||||||||
| 5085 | uint *b = buffer; | - | ||||||||||||||||||
| 5086 | int px16 = x % (image_width << 16); | - | ||||||||||||||||||
| 5087 | int py16 = y % (image_height << 16); | - | ||||||||||||||||||
| 5088 | int px_delta = fdx % (image_width << 16); | - | ||||||||||||||||||
| 5089 | int py_delta = fdy % (image_height << 16); | - | ||||||||||||||||||
| 5090 | while (b < end) {
| 0 | ||||||||||||||||||
| 5091 | if (px16 < 0) px16 += image_width << 16; never executed: px16 += image_width << 16;
| 0 | ||||||||||||||||||
| 5092 | if (py16 < 0) py16 += image_height << 16; never executed: py16 += image_height << 16;
| 0 | ||||||||||||||||||
| 5093 | int px = px16 >> 16; | - | ||||||||||||||||||
| 5094 | int py = py16 >> 16; | - | ||||||||||||||||||
| 5095 | int y_offset = py * scanline_offset; | - | ||||||||||||||||||
| 5096 | - | |||||||||||||||||||
| 5097 | Q_ASSERT(px >= 0 && px < image_width); | - | ||||||||||||||||||
| 5098 | Q_ASSERT(py >= 0 && py < image_height); | - | ||||||||||||||||||
| 5099 | - | |||||||||||||||||||
| 5100 | *b = image_bits[y_offset + px]; | - | ||||||||||||||||||
| 5101 | x += fdx; | - | ||||||||||||||||||
| 5102 | y += fdy; | - | ||||||||||||||||||
| 5103 | px16 += px_delta; | - | ||||||||||||||||||
| 5104 | if (px16 >= image_width << 16)
| 0 | ||||||||||||||||||
| 5105 | px16 -= image_width << 16; never executed: px16 -= image_width << 16; | 0 | ||||||||||||||||||
| 5106 | py16 += py_delta; | - | ||||||||||||||||||
| 5107 | if (py16 >= image_height << 16)
| 0 | ||||||||||||||||||
| 5108 | py16 -= image_height << 16; never executed: py16 -= image_height << 16; | 0 | ||||||||||||||||||
| 5109 | ++b; | - | ||||||||||||||||||
| 5110 | } never executed: end of block | 0 | ||||||||||||||||||
| 5111 | func(target, buffer, l, coverage); | - | ||||||||||||||||||
| 5112 | target += l; | - | ||||||||||||||||||
| 5113 | length -= l; | - | ||||||||||||||||||
| 5114 | } never executed: end of block | 0 | ||||||||||||||||||
| 5115 | ++spans; | - | ||||||||||||||||||
| 5116 | } never executed: end of block | 0 | ||||||||||||||||||
| 5117 | } else { never executed: end of block | 0 | ||||||||||||||||||
| 5118 | const qreal fdx = data->m11; | - | ||||||||||||||||||
| 5119 | const qreal fdy = data->m12; | - | ||||||||||||||||||
| 5120 | const qreal fdw = data->m13; | - | ||||||||||||||||||
| 5121 | while (count--) {
| 0 | ||||||||||||||||||
| 5122 | void *t = data->rasterBuffer->scanLine(spans->y); | - | ||||||||||||||||||
| 5123 | - | |||||||||||||||||||
| 5124 | uint *target = ((uint *)t) + spans->x; | - | ||||||||||||||||||
| 5125 | const uint *image_bits = (const uint *)data->texture.imageData; | - | ||||||||||||||||||
| 5126 | - | |||||||||||||||||||
| 5127 | const qreal cx = spans->x + qreal(0.5); | - | ||||||||||||||||||
| 5128 | const qreal cy = spans->y + qreal(0.5); | - | ||||||||||||||||||
| 5129 | - | |||||||||||||||||||
| 5130 | qreal x = data->m21 * cy + data->m11 * cx + data->dx; | - | ||||||||||||||||||
| 5131 | qreal y = data->m22 * cy + data->m12 * cx + data->dy; | - | ||||||||||||||||||
| 5132 | qreal w = data->m23 * cy + data->m13 * cx + data->m33; | - | ||||||||||||||||||
| 5133 | - | |||||||||||||||||||
| 5134 | const int coverage = (spans->coverage * data->texture.const_alpha) >> 8; | - | ||||||||||||||||||
| 5135 | int length = spans->len; | - | ||||||||||||||||||
| 5136 | while (length) {
| 0 | ||||||||||||||||||
| 5137 | int l = qMin(length, buffer_size); | - | ||||||||||||||||||
| 5138 | const uint *end = buffer + l; | - | ||||||||||||||||||
| 5139 | uint *b = buffer; | - | ||||||||||||||||||
| 5140 | while (b < end) {
| 0 | ||||||||||||||||||
| 5141 | const qreal iw = w == 0 ? 1 : 1 / w;
| 0 | ||||||||||||||||||
| 5142 | const qreal tx = x * iw; | - | ||||||||||||||||||
| 5143 | const qreal ty = y * iw; | - | ||||||||||||||||||
| 5144 | int px = int(tx) - (tx < 0); | - | ||||||||||||||||||
| 5145 | int py = int(ty) - (ty < 0); | - | ||||||||||||||||||
| 5146 | - | |||||||||||||||||||
| 5147 | px %= image_width; | - | ||||||||||||||||||
| 5148 | py %= image_height; | - | ||||||||||||||||||
| 5149 | if (px < 0) px += image_width; never executed: px += image_width;
| 0 | ||||||||||||||||||
| 5150 | if (py < 0) py += image_height; never executed: py += image_height;
| 0 | ||||||||||||||||||
| 5151 | int y_offset = py * scanline_offset; | - | ||||||||||||||||||
| 5152 | - | |||||||||||||||||||
| 5153 | Q_ASSERT(px >= 0 && px < image_width); | - | ||||||||||||||||||
| 5154 | Q_ASSERT(py >= 0 && py < image_height); | - | ||||||||||||||||||
| 5155 | - | |||||||||||||||||||
| 5156 | *b = image_bits[y_offset + px]; | - | ||||||||||||||||||
| 5157 | x += fdx; | - | ||||||||||||||||||
| 5158 | y += fdy; | - | ||||||||||||||||||
| 5159 | w += fdw; | - | ||||||||||||||||||
| 5160 | //force increment to avoid /0 | - | ||||||||||||||||||
| 5161 | if (!w) {
| 0 | ||||||||||||||||||
| 5162 | w += fdw; | - | ||||||||||||||||||
| 5163 | } never executed: end of block | 0 | ||||||||||||||||||
| 5164 | ++b; | - | ||||||||||||||||||
| 5165 | } never executed: end of block | 0 | ||||||||||||||||||
| 5166 | func(target, buffer, l, coverage); | - | ||||||||||||||||||
| 5167 | target += l; | - | ||||||||||||||||||
| 5168 | length -= l; | - | ||||||||||||||||||
| 5169 | } never executed: end of block | 0 | ||||||||||||||||||
| 5170 | ++spans; | - | ||||||||||||||||||
| 5171 | } never executed: end of block | 0 | ||||||||||||||||||
| 5172 | } never executed: end of block | 0 | ||||||||||||||||||
| 5173 | } | - | ||||||||||||||||||
| 5174 | - | |||||||||||||||||||
| 5175 | static void blend_transformed_tiled_rgb565(int count, const QSpan *spans, void *userData) | - | ||||||||||||||||||
| 5176 | { | - | ||||||||||||||||||
| 5177 | QSpanData *data = reinterpret_cast<QSpanData*>(userData); | - | ||||||||||||||||||
| 5178 | QPainter::CompositionMode mode = data->rasterBuffer->compositionMode; | - | ||||||||||||||||||
| 5179 | - | |||||||||||||||||||
| 5180 | if (data->texture.format != QImage::Format_RGB16
| 0 | ||||||||||||||||||
| 5181 | || (mode != QPainter::CompositionMode_SourceOver
| 0 | ||||||||||||||||||
| 5182 | && mode != QPainter::CompositionMode_Source))
| 0 | ||||||||||||||||||
| 5183 | { | - | ||||||||||||||||||
| 5184 | blend_src_generic(count, spans, userData); | - | ||||||||||||||||||
| 5185 | return; never executed: return; | 0 | ||||||||||||||||||
| 5186 | } | - | ||||||||||||||||||
| 5187 | - | |||||||||||||||||||
| 5188 | quint16 buffer[buffer_size]; | - | ||||||||||||||||||
| 5189 | const int image_width = data->texture.width; | - | ||||||||||||||||||
| 5190 | const int image_height = data->texture.height; | - | ||||||||||||||||||
| 5191 | - | |||||||||||||||||||
| 5192 | if (data->fast_matrix) {
| 0 | ||||||||||||||||||
| 5193 | // The increment pr x in the scanline | - | ||||||||||||||||||
| 5194 | const int fdx = (int)(data->m11 * fixed_scale); | - | ||||||||||||||||||
| 5195 | const int fdy = (int)(data->m12 * fixed_scale); | - | ||||||||||||||||||
| 5196 | - | |||||||||||||||||||
| 5197 | while (count--) {
| 0 | ||||||||||||||||||
| 5198 | const quint8 coverage = (data->texture.const_alpha * spans->coverage) >> 8; | - | ||||||||||||||||||
| 5199 | const quint8 alpha = (coverage + 1) >> 3; | - | ||||||||||||||||||
| 5200 | const quint8 ialpha = 0x20 - alpha; | - | ||||||||||||||||||
| 5201 | if (alpha == 0) {
| 0 | ||||||||||||||||||
| 5202 | ++spans; | - | ||||||||||||||||||
| 5203 | continue; never executed: continue; | 0 | ||||||||||||||||||
| 5204 | } | - | ||||||||||||||||||
| 5205 | - | |||||||||||||||||||
| 5206 | quint16 *dest = (quint16 *)data->rasterBuffer->scanLine(spans->y) + spans->x; | - | ||||||||||||||||||
| 5207 | const qreal cx = spans->x + qreal(0.5); | - | ||||||||||||||||||
| 5208 | const qreal cy = spans->y + qreal(0.5); | - | ||||||||||||||||||
| 5209 | int x = int((data->m21 * cy | - | ||||||||||||||||||
| 5210 | + data->m11 * cx + data->dx) * fixed_scale); | - | ||||||||||||||||||
| 5211 | int y = int((data->m22 * cy | - | ||||||||||||||||||
| 5212 | + data->m12 * cx + data->dy) * fixed_scale); | - | ||||||||||||||||||
| 5213 | int length = spans->len; | - | ||||||||||||||||||
| 5214 | - | |||||||||||||||||||
| 5215 | while (length) {
| 0 | ||||||||||||||||||
| 5216 | int l; | - | ||||||||||||||||||
| 5217 | quint16 *b; | - | ||||||||||||||||||
| 5218 | if (ialpha == 0) {
| 0 | ||||||||||||||||||
| 5219 | l = length; | - | ||||||||||||||||||
| 5220 | b = dest; | - | ||||||||||||||||||
| 5221 | } else { never executed: end of block | 0 | ||||||||||||||||||
| 5222 | l = qMin(length, buffer_size); | - | ||||||||||||||||||
| 5223 | b = buffer; | - | ||||||||||||||||||
| 5224 | } never executed: end of block | 0 | ||||||||||||||||||
| 5225 | const quint16 *end = b + l; | - | ||||||||||||||||||
| 5226 | - | |||||||||||||||||||
| 5227 | while (b < end) {
| 0 | ||||||||||||||||||
| 5228 | int px = (x >> 16) % image_width; | - | ||||||||||||||||||
| 5229 | int py = (y >> 16) % image_height; | - | ||||||||||||||||||
| 5230 | - | |||||||||||||||||||
| 5231 | if (px < 0)
| 0 | ||||||||||||||||||
| 5232 | px += image_width; never executed: px += image_width; | 0 | ||||||||||||||||||
| 5233 | if (py < 0)
| 0 | ||||||||||||||||||
| 5234 | py += image_height; never executed: py += image_height; | 0 | ||||||||||||||||||
| 5235 | - | |||||||||||||||||||
| 5236 | *b = ((const quint16 *)data->texture.scanLine(py))[px]; | - | ||||||||||||||||||
| 5237 | ++b; | - | ||||||||||||||||||
| 5238 | - | |||||||||||||||||||
| 5239 | x += fdx; | - | ||||||||||||||||||
| 5240 | y += fdy; | - | ||||||||||||||||||
| 5241 | } never executed: end of block | 0 | ||||||||||||||||||
| 5242 | - | |||||||||||||||||||
| 5243 | if (ialpha != 0)
| 0 | ||||||||||||||||||
| 5244 | blend_sourceOver_rgb16_rgb16(dest, buffer, l, alpha, ialpha); never executed: blend_sourceOver_rgb16_rgb16(dest, buffer, l, alpha, ialpha); | 0 | ||||||||||||||||||
| 5245 | - | |||||||||||||||||||
| 5246 | dest += l; | - | ||||||||||||||||||
| 5247 | length -= l; | - | ||||||||||||||||||
| 5248 | } never executed: end of block | 0 | ||||||||||||||||||
| 5249 | ++spans; | - | ||||||||||||||||||
| 5250 | } never executed: end of block | 0 | ||||||||||||||||||
| 5251 | } else { never executed: end of block | 0 | ||||||||||||||||||
| 5252 | const qreal fdx = data->m11; | - | ||||||||||||||||||
| 5253 | const qreal fdy = data->m12; | - | ||||||||||||||||||
| 5254 | const qreal fdw = data->m13; | - | ||||||||||||||||||
| 5255 | - | |||||||||||||||||||
| 5256 | while (count--) {
| 0 | ||||||||||||||||||
| 5257 | const quint8 coverage = (data->texture.const_alpha * spans->coverage) >> 8; | - | ||||||||||||||||||
| 5258 | const quint8 alpha = (coverage + 1) >> 3; | - | ||||||||||||||||||
| 5259 | const quint8 ialpha = 0x20 - alpha; | - | ||||||||||||||||||
| 5260 | if (alpha == 0) {
| 0 | ||||||||||||||||||
| 5261 | ++spans; | - | ||||||||||||||||||
| 5262 | continue; never executed: continue; | 0 | ||||||||||||||||||
| 5263 | } | - | ||||||||||||||||||
| 5264 | - | |||||||||||||||||||
| 5265 | quint16 *dest = (quint16 *)data->rasterBuffer->scanLine(spans->y) + spans->x; | - | ||||||||||||||||||
| 5266 | - | |||||||||||||||||||
| 5267 | const qreal cx = spans->x + qreal(0.5); | - | ||||||||||||||||||
| 5268 | const qreal cy = spans->y + qreal(0.5); | - | ||||||||||||||||||
| 5269 | - | |||||||||||||||||||
| 5270 | qreal x = data->m21 * cy + data->m11 * cx + data->dx; | - | ||||||||||||||||||
| 5271 | qreal y = data->m22 * cy + data->m12 * cx + data->dy; | - | ||||||||||||||||||
| 5272 | qreal w = data->m23 * cy + data->m13 * cx + data->m33; | - | ||||||||||||||||||
| 5273 | - | |||||||||||||||||||
| 5274 | int length = spans->len; | - | ||||||||||||||||||
| 5275 | while (length) {
| 0 | ||||||||||||||||||
| 5276 | int l; | - | ||||||||||||||||||
| 5277 | quint16 *b; | - | ||||||||||||||||||
| 5278 | if (ialpha == 0) {
| 0 | ||||||||||||||||||
| 5279 | l = length; | - | ||||||||||||||||||
| 5280 | b = dest; | - | ||||||||||||||||||
| 5281 | } else { never executed: end of block | 0 | ||||||||||||||||||
| 5282 | l = qMin(length, buffer_size); | - | ||||||||||||||||||
| 5283 | b = buffer; | - | ||||||||||||||||||
| 5284 | } never executed: end of block | 0 | ||||||||||||||||||
| 5285 | const quint16 *end = b + l; | - | ||||||||||||||||||
| 5286 | - | |||||||||||||||||||
| 5287 | while (b < end) {
| 0 | ||||||||||||||||||
| 5288 | const qreal iw = w == 0 ? 1 : 1 / w;
| 0 | ||||||||||||||||||
| 5289 | const qreal tx = x * iw; | - | ||||||||||||||||||
| 5290 | const qreal ty = y * iw; | - | ||||||||||||||||||
| 5291 | - | |||||||||||||||||||
| 5292 | int px = int(tx) - (tx < 0); | - | ||||||||||||||||||
| 5293 | int py = int(ty) - (ty < 0); | - | ||||||||||||||||||
| 5294 | - | |||||||||||||||||||
| 5295 | px %= image_width; | - | ||||||||||||||||||
| 5296 | py %= image_height; | - | ||||||||||||||||||
| 5297 | if (px < 0)
| 0 | ||||||||||||||||||
| 5298 | px += image_width; never executed: px += image_width; | 0 | ||||||||||||||||||
| 5299 | if (py < 0)
| 0 | ||||||||||||||||||
| 5300 | py += image_height; never executed: py += image_height; | 0 | ||||||||||||||||||
| 5301 | - | |||||||||||||||||||
| 5302 | *b = ((const quint16 *)data->texture.scanLine(py))[px]; | - | ||||||||||||||||||
| 5303 | ++b; | - | ||||||||||||||||||
| 5304 | - | |||||||||||||||||||
| 5305 | x += fdx; | - | ||||||||||||||||||
| 5306 | y += fdy; | - | ||||||||||||||||||
| 5307 | w += fdw; | - | ||||||||||||||||||
| 5308 | // force increment to avoid /0 | - | ||||||||||||||||||
| 5309 | if (!w)
| 0 | ||||||||||||||||||
| 5310 | w += fdw; never executed: w += fdw; | 0 | ||||||||||||||||||
| 5311 | } never executed: end of block | 0 | ||||||||||||||||||
| 5312 | - | |||||||||||||||||||
| 5313 | if (ialpha != 0)
| 0 | ||||||||||||||||||
| 5314 | blend_sourceOver_rgb16_rgb16(dest, buffer, l, alpha, ialpha); never executed: blend_sourceOver_rgb16_rgb16(dest, buffer, l, alpha, ialpha); | 0 | ||||||||||||||||||
| 5315 | - | |||||||||||||||||||
| 5316 | dest += l; | - | ||||||||||||||||||
| 5317 | length -= l; | - | ||||||||||||||||||
| 5318 | } never executed: end of block | 0 | ||||||||||||||||||
| 5319 | ++spans; | - | ||||||||||||||||||
| 5320 | } never executed: end of block | 0 | ||||||||||||||||||
| 5321 | } never executed: end of block | 0 | ||||||||||||||||||
| 5322 | } | - | ||||||||||||||||||
| 5323 | - | |||||||||||||||||||
| 5324 | - | |||||||||||||||||||
| 5325 | /* Image formats here are target formats */ | - | ||||||||||||||||||
| 5326 | static const ProcessSpans processTextureSpans[NBlendTypes][QImage::NImageFormats] = { | - | ||||||||||||||||||
| 5327 | // Untransformed | - | ||||||||||||||||||
| 5328 | { | - | ||||||||||||||||||
| 5329 | 0, // Invalid | - | ||||||||||||||||||
| 5330 | blend_untransformed_generic, // Mono | - | ||||||||||||||||||
| 5331 | blend_untransformed_generic, // MonoLsb | - | ||||||||||||||||||
| 5332 | blend_untransformed_generic, // Indexed8 | - | ||||||||||||||||||
| 5333 | blend_untransformed_generic, // RGB32 | - | ||||||||||||||||||
| 5334 | blend_untransformed_generic, // ARGB32 | - | ||||||||||||||||||
| 5335 | blend_untransformed_argb, // ARGB32_Premultiplied | - | ||||||||||||||||||
| 5336 | blend_untransformed_rgb565, | - | ||||||||||||||||||
| 5337 | blend_untransformed_generic, | - | ||||||||||||||||||
| 5338 | blend_untransformed_generic, | - | ||||||||||||||||||
| 5339 | blend_untransformed_generic, | - | ||||||||||||||||||
| 5340 | blend_untransformed_generic, | - | ||||||||||||||||||
| 5341 | blend_untransformed_generic, | - | ||||||||||||||||||
| 5342 | blend_untransformed_generic, | - | ||||||||||||||||||
| 5343 | blend_untransformed_generic, | - | ||||||||||||||||||
| 5344 | blend_untransformed_generic, | - | ||||||||||||||||||
| 5345 | blend_untransformed_generic, | - | ||||||||||||||||||
| 5346 | blend_untransformed_generic, | - | ||||||||||||||||||
| 5347 | blend_untransformed_generic, | - | ||||||||||||||||||
| 5348 | blend_untransformed_generic_rgb64, | - | ||||||||||||||||||
| 5349 | blend_untransformed_generic_rgb64, | - | ||||||||||||||||||
| 5350 | blend_untransformed_generic_rgb64, | - | ||||||||||||||||||
| 5351 | blend_untransformed_generic_rgb64, | - | ||||||||||||||||||
| 5352 | blend_untransformed_generic, | - | ||||||||||||||||||
| 5353 | blend_untransformed_generic, | - | ||||||||||||||||||
| 5354 | }, | - | ||||||||||||||||||
| 5355 | // Tiled | - | ||||||||||||||||||
| 5356 | { | - | ||||||||||||||||||
| 5357 | 0, // Invalid | - | ||||||||||||||||||
| 5358 | blend_tiled_generic, // Mono | - | ||||||||||||||||||
| 5359 | blend_tiled_generic, // MonoLsb | - | ||||||||||||||||||
| 5360 | blend_tiled_generic, // Indexed8 | - | ||||||||||||||||||
| 5361 | blend_tiled_generic, // RGB32 | - | ||||||||||||||||||
| 5362 | blend_tiled_generic, // ARGB32 | - | ||||||||||||||||||
| 5363 | blend_tiled_argb, // ARGB32_Premultiplied | - | ||||||||||||||||||
| 5364 | blend_tiled_rgb565, | - | ||||||||||||||||||
| 5365 | blend_tiled_generic, | - | ||||||||||||||||||
| 5366 | blend_tiled_generic, | - | ||||||||||||||||||
| 5367 | blend_tiled_generic, | - | ||||||||||||||||||
| 5368 | blend_tiled_generic, | - | ||||||||||||||||||
| 5369 | blend_tiled_generic, | - | ||||||||||||||||||
| 5370 | blend_tiled_generic, | - | ||||||||||||||||||
| 5371 | blend_tiled_generic, | - | ||||||||||||||||||
| 5372 | blend_tiled_generic, | - | ||||||||||||||||||
| 5373 | blend_tiled_generic, | - | ||||||||||||||||||
| 5374 | blend_tiled_generic, | - | ||||||||||||||||||
| 5375 | blend_tiled_generic, | - | ||||||||||||||||||
| 5376 | blend_tiled_generic_rgb64, | - | ||||||||||||||||||
| 5377 | blend_tiled_generic_rgb64, | - | ||||||||||||||||||
| 5378 | blend_tiled_generic_rgb64, | - | ||||||||||||||||||
| 5379 | blend_tiled_generic_rgb64, | - | ||||||||||||||||||
| 5380 | blend_tiled_generic, | - | ||||||||||||||||||
| 5381 | blend_tiled_generic, | - | ||||||||||||||||||
| 5382 | }, | - | ||||||||||||||||||
| 5383 | // Transformed | - | ||||||||||||||||||
| 5384 | { | - | ||||||||||||||||||
| 5385 | 0, // Invalid | - | ||||||||||||||||||
| 5386 | blend_src_generic, // Mono | - | ||||||||||||||||||
| 5387 | blend_src_generic, // MonoLsb | - | ||||||||||||||||||
| 5388 | blend_src_generic, // Indexed8 | - | ||||||||||||||||||
| 5389 | blend_src_generic, // RGB32 | - | ||||||||||||||||||
| 5390 | blend_src_generic, // ARGB32 | - | ||||||||||||||||||
| 5391 | blend_transformed_argb, // ARGB32_Premultiplied | - | ||||||||||||||||||
| 5392 | blend_transformed_rgb565, | - | ||||||||||||||||||
| 5393 | blend_src_generic, // ARGB8565_Premultiplied | - | ||||||||||||||||||
| 5394 | blend_src_generic, // RGB666 | - | ||||||||||||||||||
| 5395 | blend_src_generic, // ARGB6666_Premultiplied | - | ||||||||||||||||||
| 5396 | blend_src_generic, // RGB555 | - | ||||||||||||||||||
| 5397 | blend_src_generic, // ARGB8555_Premultiplied | - | ||||||||||||||||||
| 5398 | blend_src_generic, // RGB888 | - | ||||||||||||||||||
| 5399 | blend_src_generic, // RGB444 | - | ||||||||||||||||||
| 5400 | blend_src_generic, // ARGB4444_Premultiplied | - | ||||||||||||||||||
| 5401 | blend_src_generic, // RGBX8888 | - | ||||||||||||||||||
| 5402 | blend_src_generic, // RGBA8888 | - | ||||||||||||||||||
| 5403 | blend_src_generic, // RGBA8888_Premultiplied | - | ||||||||||||||||||
| 5404 | blend_src_generic_rgb64, | - | ||||||||||||||||||
| 5405 | blend_src_generic_rgb64, | - | ||||||||||||||||||
| 5406 | blend_src_generic_rgb64, | - | ||||||||||||||||||
| 5407 | blend_src_generic_rgb64, | - | ||||||||||||||||||
| 5408 | blend_src_generic, | - | ||||||||||||||||||
| 5409 | blend_src_generic, | - | ||||||||||||||||||
| 5410 | }, | - | ||||||||||||||||||
| 5411 | // TransformedTiled | - | ||||||||||||||||||
| 5412 | { | - | ||||||||||||||||||
| 5413 | 0, | - | ||||||||||||||||||
| 5414 | blend_src_generic, // Mono | - | ||||||||||||||||||
| 5415 | blend_src_generic, // MonoLsb | - | ||||||||||||||||||
| 5416 | blend_src_generic, // Indexed8 | - | ||||||||||||||||||
| 5417 | blend_src_generic, // RGB32 | - | ||||||||||||||||||
| 5418 | blend_src_generic, // ARGB32 | - | ||||||||||||||||||
| 5419 | blend_transformed_tiled_argb, // ARGB32_Premultiplied | - | ||||||||||||||||||
| 5420 | blend_transformed_tiled_rgb565, | - | ||||||||||||||||||
| 5421 | blend_src_generic, // ARGB8565_Premultiplied | - | ||||||||||||||||||
| 5422 | blend_src_generic, // RGB666 | - | ||||||||||||||||||
| 5423 | blend_src_generic, // ARGB6666_Premultiplied | - | ||||||||||||||||||
| 5424 | blend_src_generic, // RGB555 | - | ||||||||||||||||||
| 5425 | blend_src_generic, // ARGB8555_Premultiplied | - | ||||||||||||||||||
| 5426 | blend_src_generic, // RGB888 | - | ||||||||||||||||||
| 5427 | blend_src_generic, // RGB444 | - | ||||||||||||||||||
| 5428 | blend_src_generic, // ARGB4444_Premultiplied | - | ||||||||||||||||||
| 5429 | blend_src_generic, // RGBX8888 | - | ||||||||||||||||||
| 5430 | blend_src_generic, // RGBA8888 | - | ||||||||||||||||||
| 5431 | blend_src_generic, // RGBA8888_Premultiplied | - | ||||||||||||||||||
| 5432 | blend_src_generic_rgb64, | - | ||||||||||||||||||
| 5433 | blend_src_generic_rgb64, | - | ||||||||||||||||||
| 5434 | blend_src_generic_rgb64, | - | ||||||||||||||||||
| 5435 | blend_src_generic_rgb64, | - | ||||||||||||||||||
| 5436 | blend_src_generic, | - | ||||||||||||||||||
| 5437 | blend_src_generic, | - | ||||||||||||||||||
| 5438 | }, | - | ||||||||||||||||||
| 5439 | // Bilinear | - | ||||||||||||||||||
| 5440 | { | - | ||||||||||||||||||
| 5441 | 0, | - | ||||||||||||||||||
| 5442 | blend_src_generic, // Mono | - | ||||||||||||||||||
| 5443 | blend_src_generic, // MonoLsb | - | ||||||||||||||||||
| 5444 | blend_src_generic, // Indexed8 | - | ||||||||||||||||||
| 5445 | blend_src_generic, // RGB32 | - | ||||||||||||||||||
| 5446 | blend_src_generic, // ARGB32 | - | ||||||||||||||||||
| 5447 | blend_src_generic, // ARGB32_Premultiplied | - | ||||||||||||||||||
| 5448 | blend_transformed_bilinear_rgb565, | - | ||||||||||||||||||
| 5449 | blend_src_generic, // ARGB8565_Premultiplied | - | ||||||||||||||||||
| 5450 | blend_src_generic, // RGB666 | - | ||||||||||||||||||
| 5451 | blend_src_generic, // ARGB6666_Premultiplied | - | ||||||||||||||||||
| 5452 | blend_src_generic, // RGB555 | - | ||||||||||||||||||
| 5453 | blend_src_generic, // ARGB8555_Premultiplied | - | ||||||||||||||||||
| 5454 | blend_src_generic, // RGB888 | - | ||||||||||||||||||
| 5455 | blend_src_generic, // RGB444 | - | ||||||||||||||||||
| 5456 | blend_src_generic, // ARGB4444_Premultiplied | - | ||||||||||||||||||
| 5457 | blend_src_generic, // RGBX8888 | - | ||||||||||||||||||
| 5458 | blend_src_generic, // RGBA8888 | - | ||||||||||||||||||
| 5459 | blend_src_generic, // RGBA8888_Premultiplied | - | ||||||||||||||||||
| 5460 | blend_src_generic_rgb64, | - | ||||||||||||||||||
| 5461 | blend_src_generic_rgb64, | - | ||||||||||||||||||
| 5462 | blend_src_generic_rgb64, | - | ||||||||||||||||||
| 5463 | blend_src_generic_rgb64, | - | ||||||||||||||||||
| 5464 | blend_src_generic, | - | ||||||||||||||||||
| 5465 | blend_src_generic, | - | ||||||||||||||||||
| 5466 | }, | - | ||||||||||||||||||
| 5467 | // BilinearTiled | - | ||||||||||||||||||
| 5468 | { | - | ||||||||||||||||||
| 5469 | 0, | - | ||||||||||||||||||
| 5470 | blend_src_generic, // Mono | - | ||||||||||||||||||
| 5471 | blend_src_generic, // MonoLsb | - | ||||||||||||||||||
| 5472 | blend_src_generic, // Indexed8 | - | ||||||||||||||||||
| 5473 | blend_src_generic, // RGB32 | - | ||||||||||||||||||
| 5474 | blend_src_generic, // ARGB32 | - | ||||||||||||||||||
| 5475 | blend_src_generic, // ARGB32_Premultiplied | - | ||||||||||||||||||
| 5476 | blend_src_generic, // RGB16 | - | ||||||||||||||||||
| 5477 | blend_src_generic, // ARGB8565_Premultiplied | - | ||||||||||||||||||
| 5478 | blend_src_generic, // RGB666 | - | ||||||||||||||||||
| 5479 | blend_src_generic, // ARGB6666_Premultiplied | - | ||||||||||||||||||
| 5480 | blend_src_generic, // RGB555 | - | ||||||||||||||||||
| 5481 | blend_src_generic, // ARGB8555_Premultiplied | - | ||||||||||||||||||
| 5482 | blend_src_generic, // RGB888 | - | ||||||||||||||||||
| 5483 | blend_src_generic, // RGB444 | - | ||||||||||||||||||
| 5484 | blend_src_generic, // ARGB4444_Premultiplied | - | ||||||||||||||||||
| 5485 | blend_src_generic, // RGBX8888 | - | ||||||||||||||||||
| 5486 | blend_src_generic, // RGBA8888 | - | ||||||||||||||||||
| 5487 | blend_src_generic, // RGBA8888_Premultiplied | - | ||||||||||||||||||
| 5488 | blend_src_generic_rgb64, // BGR30 | - | ||||||||||||||||||
| 5489 | blend_src_generic_rgb64, // A2BGR30_Premultiplied | - | ||||||||||||||||||
| 5490 | blend_src_generic_rgb64, // RGB30 | - | ||||||||||||||||||
| 5491 | blend_src_generic_rgb64, // A2RGB30_Premultiplied | - | ||||||||||||||||||
| 5492 | blend_src_generic, // Alpha8 | - | ||||||||||||||||||
| 5493 | blend_src_generic, // Grayscale8 | - | ||||||||||||||||||
| 5494 | } | - | ||||||||||||||||||
| 5495 | }; | - | ||||||||||||||||||
| 5496 | - | |||||||||||||||||||
| 5497 | void qBlendTexture(int count, const QSpan *spans, void *userData) | - | ||||||||||||||||||
| 5498 | { | - | ||||||||||||||||||
| 5499 | QSpanData *data = reinterpret_cast<QSpanData *>(userData); | - | ||||||||||||||||||
| 5500 | ProcessSpans proc = processTextureSpans[getBlendType(data)][data->rasterBuffer->format]; | - | ||||||||||||||||||
| 5501 | proc(count, spans, userData); | - | ||||||||||||||||||
| 5502 | } never executed: end of block | 0 | ||||||||||||||||||
| 5503 | - | |||||||||||||||||||
| 5504 | template <class DST> Q_STATIC_TEMPLATE_FUNCTION | - | ||||||||||||||||||
| 5505 | inline void qt_bitmapblit_template(QRasterBuffer *rasterBuffer, | - | ||||||||||||||||||
| 5506 | int x, int y, DST color, | - | ||||||||||||||||||
| 5507 | const uchar *map, | - | ||||||||||||||||||
| 5508 | int mapWidth, int mapHeight, int mapStride) | - | ||||||||||||||||||
| 5509 | { | - | ||||||||||||||||||
| 5510 | DST *dest = reinterpret_cast<DST *>(rasterBuffer->scanLine(y)) + x; | - | ||||||||||||||||||
| 5511 | const int destStride = rasterBuffer->bytesPerLine() / sizeof(DST); | - | ||||||||||||||||||
| 5512 | - | |||||||||||||||||||
| 5513 | if (mapWidth > 8) {
| 0 | ||||||||||||||||||
| 5514 | while (mapHeight--) {
| 0 | ||||||||||||||||||
| 5515 | int x0 = 0; | - | ||||||||||||||||||
| 5516 | int n = 0; | - | ||||||||||||||||||
| 5517 | for (int x = 0; x < mapWidth; x += 8) {
| 0 | ||||||||||||||||||
| 5518 | uchar s = map[x >> 3]; | - | ||||||||||||||||||
| 5519 | for (int i = 0; i < 8; ++i) {
| 0 | ||||||||||||||||||
| 5520 | if (s & 0x80) {
| 0 | ||||||||||||||||||
| 5521 | ++n; | - | ||||||||||||||||||
| 5522 | } else { never executed: end of block | 0 | ||||||||||||||||||
| 5523 | if (n) {
| 0 | ||||||||||||||||||
| 5524 | qt_memfill(dest + x0, color, n); | - | ||||||||||||||||||
| 5525 | x0 += n + 1; | - | ||||||||||||||||||
| 5526 | n = 0; | - | ||||||||||||||||||
| 5527 | } else { never executed: end of block | 0 | ||||||||||||||||||
| 5528 | ++x0; | - | ||||||||||||||||||
| 5529 | } never executed: end of block | 0 | ||||||||||||||||||
| 5530 | if (!s) {
| 0 | ||||||||||||||||||
| 5531 | x0 += 8 - 1 - i; | - | ||||||||||||||||||
| 5532 | break; never executed: break; | 0 | ||||||||||||||||||
| 5533 | } | - | ||||||||||||||||||
| 5534 | } never executed: end of block | 0 | ||||||||||||||||||
| 5535 | s <<= 1; | - | ||||||||||||||||||
| 5536 | } never executed: end of block | 0 | ||||||||||||||||||
| 5537 | } never executed: end of block | 0 | ||||||||||||||||||
| 5538 | if (n)
| 0 | ||||||||||||||||||
| 5539 | qt_memfill(dest + x0, color, n); never executed: qt_memfill(dest + x0, color, n); | 0 | ||||||||||||||||||
| 5540 | dest += destStride; | - | ||||||||||||||||||
| 5541 | map += mapStride; | - | ||||||||||||||||||
| 5542 | } never executed: end of block | 0 | ||||||||||||||||||
| 5543 | } else { never executed: end of block | 0 | ||||||||||||||||||
| 5544 | while (mapHeight--) {
| 0 | ||||||||||||||||||
| 5545 | int x0 = 0; | - | ||||||||||||||||||
| 5546 | int n = 0; | - | ||||||||||||||||||
| 5547 | for (uchar s = *map; s; s <<= 1) {
| 0 | ||||||||||||||||||
| 5548 | if (s & 0x80) {
| 0 | ||||||||||||||||||
| 5549 | ++n; | - | ||||||||||||||||||
| 5550 | } else if (n) { never executed: end of block
| 0 | ||||||||||||||||||
| 5551 | qt_memfill(dest + x0, color, n); | - | ||||||||||||||||||
| 5552 | x0 += n + 1; | - | ||||||||||||||||||
| 5553 | n = 0; | - | ||||||||||||||||||
| 5554 | } else { never executed: end of block | 0 | ||||||||||||||||||
| 5555 | ++x0; | - | ||||||||||||||||||
| 5556 | } never executed: end of block | 0 | ||||||||||||||||||
| 5557 | } | - | ||||||||||||||||||
| 5558 | if (n)
| 0 | ||||||||||||||||||
| 5559 | qt_memfill(dest + x0, color, n); never executed: qt_memfill(dest + x0, color, n); | 0 | ||||||||||||||||||
| 5560 | dest += destStride; | - | ||||||||||||||||||
| 5561 | map += mapStride; | - | ||||||||||||||||||
| 5562 | } never executed: end of block | 0 | ||||||||||||||||||
| 5563 | } never executed: end of block | 0 | ||||||||||||||||||
| 5564 | } | - | ||||||||||||||||||
| 5565 | - | |||||||||||||||||||
| 5566 | static void qt_gradient_argb32(int count, const QSpan *spans, void *userData) | - | ||||||||||||||||||
| 5567 | { | - | ||||||||||||||||||
| 5568 | QSpanData *data = reinterpret_cast<QSpanData *>(userData); | - | ||||||||||||||||||
| 5569 | - | |||||||||||||||||||
| 5570 | bool isVerticalGradient = | - | ||||||||||||||||||
| 5571 | data->txop <= QTransform::TxScale &&
| 0 | ||||||||||||||||||
| 5572 | data->type == QSpanData::LinearGradient &&
| 0 | ||||||||||||||||||
| 5573 | data->gradient.linear.end.x == data->gradient.linear.origin.x;
| 0 | ||||||||||||||||||
| 5574 | - | |||||||||||||||||||
| 5575 | if (isVerticalGradient) {
| 0 | ||||||||||||||||||
| 5576 | LinearGradientValues linear; | - | ||||||||||||||||||
| 5577 | getLinearGradientValues(&linear, data); | - | ||||||||||||||||||
| 5578 | - | |||||||||||||||||||
| 5579 | CompositionFunctionSolid funcSolid = | - | ||||||||||||||||||
| 5580 | functionForModeSolid[data->rasterBuffer->compositionMode]; | - | ||||||||||||||||||
| 5581 | - | |||||||||||||||||||
| 5582 | /* | - | ||||||||||||||||||
| 5583 | The logic for vertical gradient calculations is a mathematically | - | ||||||||||||||||||
| 5584 | reduced copy of that in fetchLinearGradient() - which is basically: | - | ||||||||||||||||||
| 5585 | - | |||||||||||||||||||
| 5586 | qreal ry = data->m22 * (y + 0.5) + data->dy; | - | ||||||||||||||||||
| 5587 | qreal t = linear.dy*ry + linear.off; | - | ||||||||||||||||||
| 5588 | t *= (GRADIENT_STOPTABLE_SIZE - 1); | - | ||||||||||||||||||
| 5589 | quint32 color = | - | ||||||||||||||||||
| 5590 | qt_gradient_pixel_fixed(&data->gradient, | - | ||||||||||||||||||
| 5591 | int(t * FIXPT_SIZE)); | - | ||||||||||||||||||
| 5592 | - | |||||||||||||||||||
| 5593 | This has then been converted to fixed point to improve performance. | - | ||||||||||||||||||
| 5594 | */ | - | ||||||||||||||||||
| 5595 | const int gss = GRADIENT_STOPTABLE_SIZE - 1; | - | ||||||||||||||||||
| 5596 | int yinc = int((linear.dy * data->m22 * gss) * FIXPT_SIZE); | - | ||||||||||||||||||
| 5597 | int off = int((((linear.dy * (data->m22 * qreal(0.5) + data->dy) + linear.off) * gss) * FIXPT_SIZE)); | - | ||||||||||||||||||
| 5598 | - | |||||||||||||||||||
| 5599 | while (count--) {
| 0 | ||||||||||||||||||
| 5600 | int y = spans->y; | - | ||||||||||||||||||
| 5601 | int x = spans->x; | - | ||||||||||||||||||
| 5602 | - | |||||||||||||||||||
| 5603 | quint32 *dst = (quint32 *)(data->rasterBuffer->scanLine(y)) + x; | - | ||||||||||||||||||
| 5604 | quint32 color = | - | ||||||||||||||||||
| 5605 | qt_gradient_pixel_fixed(&data->gradient, yinc * y + off); | - | ||||||||||||||||||
| 5606 | - | |||||||||||||||||||
| 5607 | funcSolid(dst, spans->len, color, spans->coverage); | - | ||||||||||||||||||
| 5608 | ++spans; | - | ||||||||||||||||||
| 5609 | } never executed: end of block | 0 | ||||||||||||||||||
| 5610 | - | |||||||||||||||||||
| 5611 | } else { never executed: end of block | 0 | ||||||||||||||||||
| 5612 | blend_src_generic(count, spans, userData); | - | ||||||||||||||||||
| 5613 | } never executed: end of block | 0 | ||||||||||||||||||
| 5614 | } | - | ||||||||||||||||||
| 5615 | - | |||||||||||||||||||
| 5616 | static void qt_gradient_quint16(int count, const QSpan *spans, void *userData) | - | ||||||||||||||||||
| 5617 | { | - | ||||||||||||||||||
| 5618 | QSpanData *data = reinterpret_cast<QSpanData *>(userData); | - | ||||||||||||||||||
| 5619 | - | |||||||||||||||||||
| 5620 | bool isVerticalGradient = | - | ||||||||||||||||||
| 5621 | data->txop <= QTransform::TxScale &&
| 0 | ||||||||||||||||||
| 5622 | data->type == QSpanData::LinearGradient &&
| 0 | ||||||||||||||||||
| 5623 | data->gradient.linear.end.x == data->gradient.linear.origin.x;
| 0 | ||||||||||||||||||
| 5624 | - | |||||||||||||||||||
| 5625 | if (isVerticalGradient) {
| 0 | ||||||||||||||||||
| 5626 | - | |||||||||||||||||||
| 5627 | LinearGradientValues linear; | - | ||||||||||||||||||
| 5628 | getLinearGradientValues(&linear, data); | - | ||||||||||||||||||
| 5629 | - | |||||||||||||||||||
| 5630 | /* | - | ||||||||||||||||||
| 5631 | The logic for vertical gradient calculations is a mathematically | - | ||||||||||||||||||
| 5632 | reduced copy of that in fetchLinearGradient() - which is basically: | - | ||||||||||||||||||
| 5633 | - | |||||||||||||||||||
| 5634 | qreal ry = data->m22 * (y + 0.5) + data->dy; | - | ||||||||||||||||||
| 5635 | qreal t = linear.dy*ry + linear.off; | - | ||||||||||||||||||
| 5636 | t *= (GRADIENT_STOPTABLE_SIZE - 1); | - | ||||||||||||||||||
| 5637 | quint32 color = | - | ||||||||||||||||||
| 5638 | qt_gradient_pixel_fixed(&data->gradient, | - | ||||||||||||||||||
| 5639 | int(t * FIXPT_SIZE)); | - | ||||||||||||||||||
| 5640 | - | |||||||||||||||||||
| 5641 | This has then been converted to fixed point to improve performance. | - | ||||||||||||||||||
| 5642 | */ | - | ||||||||||||||||||
| 5643 | const int gss = GRADIENT_STOPTABLE_SIZE - 1; | - | ||||||||||||||||||
| 5644 | int yinc = int((linear.dy * data->m22 * gss) * FIXPT_SIZE); | - | ||||||||||||||||||
| 5645 | int off = int((((linear.dy * (data->m22 * qreal(0.5) + data->dy) + linear.off) * gss) * FIXPT_SIZE)); | - | ||||||||||||||||||
| 5646 | - | |||||||||||||||||||
| 5647 | // Save the fillData since we overwrite it when setting solid.color. | - | ||||||||||||||||||
| 5648 | QGradientData gradient = data->gradient; | - | ||||||||||||||||||
| 5649 | while (count--) {
| 0 | ||||||||||||||||||
| 5650 | int y = spans->y; | - | ||||||||||||||||||
| 5651 | - | |||||||||||||||||||
| 5652 | data->solid.color = QRgba64::fromArgb32(qt_gradient_pixel_fixed(&gradient, yinc * y + off)); | - | ||||||||||||||||||
| 5653 | blend_color_rgb16(1, spans, userData); | - | ||||||||||||||||||
| 5654 | ++spans; | - | ||||||||||||||||||
| 5655 | } never executed: end of block | 0 | ||||||||||||||||||
| 5656 | data->gradient = gradient; | - | ||||||||||||||||||
| 5657 | - | |||||||||||||||||||
| 5658 | } else { never executed: end of block | 0 | ||||||||||||||||||
| 5659 | blend_src_generic(count, spans, userData); | - | ||||||||||||||||||
| 5660 | } never executed: end of block | 0 | ||||||||||||||||||
| 5661 | } | - | ||||||||||||||||||
| 5662 | - | |||||||||||||||||||
| 5663 | inline static void qt_bitmapblit_argb32(QRasterBuffer *rasterBuffer, | - | ||||||||||||||||||
| 5664 | int x, int y, const QRgba64 &color, | - | ||||||||||||||||||
| 5665 | const uchar *map, | - | ||||||||||||||||||
| 5666 | int mapWidth, int mapHeight, int mapStride) | - | ||||||||||||||||||
| 5667 | { | - | ||||||||||||||||||
| 5668 | qt_bitmapblit_template<quint32>(rasterBuffer, x, y, color.toArgb32(), | - | ||||||||||||||||||
| 5669 | map, mapWidth, mapHeight, mapStride); | - | ||||||||||||||||||
| 5670 | } never executed: end of block | 0 | ||||||||||||||||||
| 5671 | - | |||||||||||||||||||
| 5672 | inline static void qt_bitmapblit_rgba8888(QRasterBuffer *rasterBuffer, | - | ||||||||||||||||||
| 5673 | int x, int y, const QRgba64 &color, | - | ||||||||||||||||||
| 5674 | const uchar *map, | - | ||||||||||||||||||
| 5675 | int mapWidth, int mapHeight, int mapStride) | - | ||||||||||||||||||
| 5676 | { | - | ||||||||||||||||||
| 5677 | qt_bitmapblit_template<quint32>(rasterBuffer, x, y, ARGB2RGBA(color.toArgb32()), | - | ||||||||||||||||||
| 5678 | map, mapWidth, mapHeight, mapStride); | - | ||||||||||||||||||
| 5679 | } never executed: end of block | 0 | ||||||||||||||||||
| 5680 | - | |||||||||||||||||||
| 5681 | template<QtPixelOrder PixelOrder> | - | ||||||||||||||||||
| 5682 | inline static void qt_bitmapblit_rgb30(QRasterBuffer *rasterBuffer, | - | ||||||||||||||||||
| 5683 | int x, int y, const QRgba64 &color, | - | ||||||||||||||||||
| 5684 | const uchar *map, | - | ||||||||||||||||||
| 5685 | int mapWidth, int mapHeight, int mapStride) | - | ||||||||||||||||||
| 5686 | { | - | ||||||||||||||||||
| 5687 | qt_bitmapblit_template<quint32>(rasterBuffer, x, y, qConvertRgb64ToRgb30<PixelOrder>(color), | - | ||||||||||||||||||
| 5688 | map, mapWidth, mapHeight, mapStride); | - | ||||||||||||||||||
| 5689 | } never executed: end of block | 0 | ||||||||||||||||||
| 5690 | - | |||||||||||||||||||
| 5691 | inline static void qt_bitmapblit_quint16(QRasterBuffer *rasterBuffer, | - | ||||||||||||||||||
| 5692 | int x, int y, const QRgba64 &color, | - | ||||||||||||||||||
| 5693 | const uchar *map, | - | ||||||||||||||||||
| 5694 | int mapWidth, int mapHeight, int mapStride) | - | ||||||||||||||||||
| 5695 | { | - | ||||||||||||||||||
| 5696 | qt_bitmapblit_template<quint16>(rasterBuffer, x, y, color.toRgb16(), | - | ||||||||||||||||||
| 5697 | map, mapWidth, mapHeight, mapStride); | - | ||||||||||||||||||
| 5698 | } never executed: end of block | 0 | ||||||||||||||||||
| 5699 | - | |||||||||||||||||||
| 5700 | static void qt_alphamapblit_quint16(QRasterBuffer *rasterBuffer, | - | ||||||||||||||||||
| 5701 | int x, int y, const QRgba64 &color, | - | ||||||||||||||||||
| 5702 | const uchar *map, | - | ||||||||||||||||||
| 5703 | int mapWidth, int mapHeight, int mapStride, | - | ||||||||||||||||||
| 5704 | const QClipData *) | - | ||||||||||||||||||
| 5705 | { | - | ||||||||||||||||||
| 5706 | const quint16 c = color.toRgb16(); | - | ||||||||||||||||||
| 5707 | quint16 *dest = reinterpret_cast<quint16*>(rasterBuffer->scanLine(y)) + x; | - | ||||||||||||||||||
| 5708 | const int destStride = rasterBuffer->bytesPerLine() / sizeof(quint16); | - | ||||||||||||||||||
| 5709 | - | |||||||||||||||||||
| 5710 | while (mapHeight--) {
| 0 | ||||||||||||||||||
| 5711 | for (int i = 0; i < mapWidth; ++i) {
| 0 | ||||||||||||||||||
| 5712 | const int coverage = map[i]; | - | ||||||||||||||||||
| 5713 | - | |||||||||||||||||||
| 5714 | if (coverage == 0) {
| 0 | ||||||||||||||||||
| 5715 | // nothing | - | ||||||||||||||||||
| 5716 | } else if (coverage == 255) { never executed: end of block
| 0 | ||||||||||||||||||
| 5717 | dest[i] = c; | - | ||||||||||||||||||
| 5718 | } else { never executed: end of block | 0 | ||||||||||||||||||
| 5719 | int ialpha = 255 - coverage; | - | ||||||||||||||||||
| 5720 | dest[i] = BYTE_MUL_RGB16(c, coverage) | - | ||||||||||||||||||
| 5721 | + BYTE_MUL_RGB16(dest[i], ialpha); | - | ||||||||||||||||||
| 5722 | } never executed: end of block | 0 | ||||||||||||||||||
| 5723 | } | - | ||||||||||||||||||
| 5724 | dest += destStride; | - | ||||||||||||||||||
| 5725 | map += mapStride; | - | ||||||||||||||||||
| 5726 | } never executed: end of block | 0 | ||||||||||||||||||
| 5727 | } never executed: end of block | 0 | ||||||||||||||||||
| 5728 | - | |||||||||||||||||||
| 5729 | static inline void rgbBlendPixel(quint32 *dst, int coverage, int sr, int sg, int sb, const uchar *gamma, const uchar *invgamma) | - | ||||||||||||||||||
| 5730 | { | - | ||||||||||||||||||
| 5731 | // Do a gray alphablend... | - | ||||||||||||||||||
| 5732 | int da = qAlpha(*dst); | - | ||||||||||||||||||
| 5733 | int dr = qRed(*dst); | - | ||||||||||||||||||
| 5734 | int dg = qGreen(*dst); | - | ||||||||||||||||||
| 5735 | int db = qBlue(*dst); | - | ||||||||||||||||||
| 5736 | - | |||||||||||||||||||
| 5737 | if (da != 255
| 0 | ||||||||||||||||||
| 5738 | ) { | - | ||||||||||||||||||
| 5739 | - | |||||||||||||||||||
| 5740 | int a = qGray(coverage); | - | ||||||||||||||||||
| 5741 | sr = qt_div_255(invgamma[sr] * a); | - | ||||||||||||||||||
| 5742 | sg = qt_div_255(invgamma[sg] * a); | - | ||||||||||||||||||
| 5743 | sb = qt_div_255(invgamma[sb] * a); | - | ||||||||||||||||||
| 5744 | - | |||||||||||||||||||
| 5745 | int ia = 255 - a; | - | ||||||||||||||||||
| 5746 | dr = qt_div_255(dr * ia); | - | ||||||||||||||||||
| 5747 | dg = qt_div_255(dg * ia); | - | ||||||||||||||||||
| 5748 | db = qt_div_255(db * ia); | - | ||||||||||||||||||
| 5749 | - | |||||||||||||||||||
| 5750 | *dst = ((a + qt_div_255((255 - a) * da)) << 24) | - | ||||||||||||||||||
| 5751 | | ((sr + dr) << 16) | - | ||||||||||||||||||
| 5752 | | ((sg + dg) << 8) | - | ||||||||||||||||||
| 5753 | | ((sb + db)); | - | ||||||||||||||||||
| 5754 | return; never executed: return; | 0 | ||||||||||||||||||
| 5755 | } | - | ||||||||||||||||||
| 5756 | - | |||||||||||||||||||
| 5757 | int mr = qRed(coverage); | - | ||||||||||||||||||
| 5758 | int mg = qGreen(coverage); | - | ||||||||||||||||||
| 5759 | int mb = qBlue(coverage); | - | ||||||||||||||||||
| 5760 | - | |||||||||||||||||||
| 5761 | dr = gamma[dr]; | - | ||||||||||||||||||
| 5762 | dg = gamma[dg]; | - | ||||||||||||||||||
| 5763 | db = gamma[db]; | - | ||||||||||||||||||
| 5764 | - | |||||||||||||||||||
| 5765 | int nr = qt_div_255(sr * mr + dr * (255 - mr)); | - | ||||||||||||||||||
| 5766 | int ng = qt_div_255(sg * mg + dg * (255 - mg)); | - | ||||||||||||||||||
| 5767 | int nb = qt_div_255(sb * mb + db * (255 - mb)); | - | ||||||||||||||||||
| 5768 | - | |||||||||||||||||||
| 5769 | nr = invgamma[nr]; | - | ||||||||||||||||||
| 5770 | ng = invgamma[ng]; | - | ||||||||||||||||||
| 5771 | nb = invgamma[nb]; | - | ||||||||||||||||||
| 5772 | - | |||||||||||||||||||
| 5773 | *dst = qRgb(nr, ng, nb); | - | ||||||||||||||||||
| 5774 | } never executed: end of block | 0 | ||||||||||||||||||
| 5775 | - | |||||||||||||||||||
| 5776 | #if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) | - | ||||||||||||||||||
| 5777 | Q_GUI_EXPORT bool qt_needs_a8_gamma_correction = false; | - | ||||||||||||||||||
| 5778 | - | |||||||||||||||||||
| 5779 | static inline void grayBlendPixel(quint32 *dst, int coverage, int sr, int sg, int sb, const uint *gamma, const uchar *invgamma) | - | ||||||||||||||||||
| 5780 | { | - | ||||||||||||||||||
| 5781 | // Do a gammacorrected gray alphablend... | - | ||||||||||||||||||
| 5782 | int dr = qRed(*dst); | - | ||||||||||||||||||
| 5783 | int dg = qGreen(*dst); | - | ||||||||||||||||||
| 5784 | int db = qBlue(*dst); | - | ||||||||||||||||||
| 5785 | - | |||||||||||||||||||
| 5786 | dr = gamma[dr]; | - | ||||||||||||||||||
| 5787 | dg = gamma[dg]; | - | ||||||||||||||||||
| 5788 | db = gamma[db]; | - | ||||||||||||||||||
| 5789 | - | |||||||||||||||||||
| 5790 | int alpha = coverage; | - | ||||||||||||||||||
| 5791 | int ialpha = 255 - alpha; | - | ||||||||||||||||||
| 5792 | int nr = qt_div_255(sr * alpha + dr * ialpha); | - | ||||||||||||||||||
| 5793 | int ng = qt_div_255(sg * alpha + dg * ialpha); | - | ||||||||||||||||||
| 5794 | int nb = qt_div_255(sb * alpha + db * ialpha); | - | ||||||||||||||||||
| 5795 | - | |||||||||||||||||||
| 5796 | nr = invgamma[nr]; | - | ||||||||||||||||||
| 5797 | ng = invgamma[ng]; | - | ||||||||||||||||||
| 5798 | nb = invgamma[nb]; | - | ||||||||||||||||||
| 5799 | - | |||||||||||||||||||
| 5800 | *dst = qRgb(nr, ng, nb); | - | ||||||||||||||||||
| 5801 | } | - | ||||||||||||||||||
| 5802 | #endif | - | ||||||||||||||||||
| 5803 | - | |||||||||||||||||||
| 5804 | static void qt_alphamapblit_uint32(QRasterBuffer *rasterBuffer, | - | ||||||||||||||||||
| 5805 | int x, int y, quint32 color, | - | ||||||||||||||||||
| 5806 | const uchar *map, | - | ||||||||||||||||||
| 5807 | int mapWidth, int mapHeight, int mapStride, | - | ||||||||||||||||||
| 5808 | const QClipData *clip) | - | ||||||||||||||||||
| 5809 | { | - | ||||||||||||||||||
| 5810 | const quint32 c = color; | - | ||||||||||||||||||
| 5811 | const int destStride = rasterBuffer->bytesPerLine() / sizeof(quint32); | - | ||||||||||||||||||
| 5812 | - | |||||||||||||||||||
| 5813 | #if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) | - | ||||||||||||||||||
| 5814 | const QDrawHelperGammaTables *tables = QGuiApplicationPrivate::instance()->gammaTables(); | - | ||||||||||||||||||
| 5815 | if (!tables) | - | ||||||||||||||||||
| 5816 | return; | - | ||||||||||||||||||
| 5817 | - | |||||||||||||||||||
| 5818 | const uint *gamma = tables->qt_pow_gamma; | - | ||||||||||||||||||
| 5819 | const uchar *invgamma = tables->qt_pow_invgamma; | - | ||||||||||||||||||
| 5820 | - | |||||||||||||||||||
| 5821 | int sr = gamma[qRed(color)]; | - | ||||||||||||||||||
| 5822 | int sg = gamma[qGreen(color)]; | - | ||||||||||||||||||
| 5823 | int sb = gamma[qBlue(color)]; | - | ||||||||||||||||||
| 5824 | - | |||||||||||||||||||
| 5825 | bool opaque_src = (qAlpha(color) == 255); | - | ||||||||||||||||||
| 5826 | bool doGrayBlendPixel = opaque_src && qt_needs_a8_gamma_correction; | - | ||||||||||||||||||
| 5827 | #endif | - | ||||||||||||||||||
| 5828 | - | |||||||||||||||||||
| 5829 | if (!clip) {
| 0 | ||||||||||||||||||
| 5830 | quint32 *dest = reinterpret_cast<quint32*>(rasterBuffer->scanLine(y)) + x; | - | ||||||||||||||||||
| 5831 | while (mapHeight--) {
| 0 | ||||||||||||||||||
| 5832 | for (int i = 0; i < mapWidth; ++i) {
| 0 | ||||||||||||||||||
| 5833 | const int coverage = map[i]; | - | ||||||||||||||||||
| 5834 | - | |||||||||||||||||||
| 5835 | if (coverage == 0) {
| 0 | ||||||||||||||||||
| 5836 | // nothing | - | ||||||||||||||||||
| 5837 | } else if (coverage == 255) { never executed: end of block
| 0 | ||||||||||||||||||
| 5838 | dest[i] = c; | - | ||||||||||||||||||
| 5839 | } else { never executed: end of block | 0 | ||||||||||||||||||
| 5840 | #if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) | - | ||||||||||||||||||
| 5841 | if (QSysInfo::WindowsVersion >= QSysInfo::WV_XP && doGrayBlendPixel | - | ||||||||||||||||||
| 5842 | && qAlpha(dest[i]) == 255) { | - | ||||||||||||||||||
| 5843 | grayBlendPixel(dest+i, coverage, sr, sg, sb, gamma, invgamma); | - | ||||||||||||||||||
| 5844 | } else | - | ||||||||||||||||||
| 5845 | #endif | - | ||||||||||||||||||
| 5846 | { | - | ||||||||||||||||||
| 5847 | int ialpha = 255 - coverage; | - | ||||||||||||||||||
| 5848 | dest[i] = INTERPOLATE_PIXEL_255(c, coverage, dest[i], ialpha); | - | ||||||||||||||||||
| 5849 | } | - | ||||||||||||||||||
| 5850 | } never executed: end of block | 0 | ||||||||||||||||||
| 5851 | } | - | ||||||||||||||||||
| 5852 | dest += destStride; | - | ||||||||||||||||||
| 5853 | map += mapStride; | - | ||||||||||||||||||
| 5854 | } never executed: end of block | 0 | ||||||||||||||||||
| 5855 | } else { never executed: end of block | 0 | ||||||||||||||||||
| 5856 | int bottom = qMin(y + mapHeight, rasterBuffer->height()); | - | ||||||||||||||||||
| 5857 | - | |||||||||||||||||||
| 5858 | int top = qMax(y, 0); | - | ||||||||||||||||||
| 5859 | map += (top - y) * mapStride; | - | ||||||||||||||||||
| 5860 | - | |||||||||||||||||||
| 5861 | const_cast<QClipData *>(clip)->initialize(); | - | ||||||||||||||||||
| 5862 | for (int yp = top; yp<bottom; ++yp) {
| 0 | ||||||||||||||||||
| 5863 | const QClipData::ClipLine &line = clip->m_clipLines[yp]; | - | ||||||||||||||||||
| 5864 | - | |||||||||||||||||||
| 5865 | quint32 *dest = reinterpret_cast<quint32 *>(rasterBuffer->scanLine(yp)); | - | ||||||||||||||||||
| 5866 | - | |||||||||||||||||||
| 5867 | for (int i=0; i<line.count; ++i) {
| 0 | ||||||||||||||||||
| 5868 | const QSpan &clip = line.spans[i]; | - | ||||||||||||||||||
| 5869 | - | |||||||||||||||||||
| 5870 | int start = qMax<int>(x, clip.x); | - | ||||||||||||||||||
| 5871 | int end = qMin<int>(x + mapWidth, clip.x + clip.len); | - | ||||||||||||||||||
| 5872 | - | |||||||||||||||||||
| 5873 | for (int xp=start; xp<end; ++xp) {
| 0 | ||||||||||||||||||
| 5874 | const int coverage = map[xp - x]; | - | ||||||||||||||||||
| 5875 | - | |||||||||||||||||||
| 5876 | if (coverage == 0) {
| 0 | ||||||||||||||||||
| 5877 | // nothing | - | ||||||||||||||||||
| 5878 | } else if (coverage == 255) { never executed: end of block
| 0 | ||||||||||||||||||
| 5879 | dest[xp] = c; | - | ||||||||||||||||||
| 5880 | } else { never executed: end of block | 0 | ||||||||||||||||||
| 5881 | #if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) | - | ||||||||||||||||||
| 5882 | if (QSysInfo::WindowsVersion >= QSysInfo::WV_XP && doGrayBlendPixel | - | ||||||||||||||||||
| 5883 | && qAlpha(dest[xp]) == 255) { | - | ||||||||||||||||||
| 5884 | grayBlendPixel(dest+xp, coverage, sr, sg, sb, gamma, invgamma); | - | ||||||||||||||||||
| 5885 | } else | - | ||||||||||||||||||
| 5886 | #endif | - | ||||||||||||||||||
| 5887 | { | - | ||||||||||||||||||
| 5888 | int ialpha = 255 - coverage; | - | ||||||||||||||||||
| 5889 | dest[xp] = INTERPOLATE_PIXEL_255(c, coverage, dest[xp], ialpha); | - | ||||||||||||||||||
| 5890 | } | - | ||||||||||||||||||
| 5891 | } never executed: end of block | 0 | ||||||||||||||||||
| 5892 | - | |||||||||||||||||||
| 5893 | } // for (i -> line.count) | - | ||||||||||||||||||
| 5894 | } // for (yp -> bottom) never executed: end of block | 0 | ||||||||||||||||||
| 5895 | map += mapStride; | - | ||||||||||||||||||
| 5896 | } never executed: end of block | 0 | ||||||||||||||||||
| 5897 | } never executed: end of block | 0 | ||||||||||||||||||
| 5898 | } | - | ||||||||||||||||||
| 5899 | - | |||||||||||||||||||
| 5900 | - | |||||||||||||||||||
| 5901 | static void qt_alphamapblit_argb32(QRasterBuffer *rasterBuffer, | - | ||||||||||||||||||
| 5902 | int x, int y, const QRgba64 &color, | - | ||||||||||||||||||
| 5903 | const uchar *map, | - | ||||||||||||||||||
| 5904 | int mapWidth, int mapHeight, int mapStride, | - | ||||||||||||||||||
| 5905 | const QClipData *clip) | - | ||||||||||||||||||
| 5906 | { | - | ||||||||||||||||||
| 5907 | qt_alphamapblit_uint32(rasterBuffer, x, y, color.toArgb32(), map, mapWidth, mapHeight, mapStride, clip); | - | ||||||||||||||||||
| 5908 | } never executed: end of block | 0 | ||||||||||||||||||
| 5909 | - | |||||||||||||||||||
| 5910 | #if Q_BYTE_ORDER == Q_LITTLE_ENDIAN | - | ||||||||||||||||||
| 5911 | static void qt_alphamapblit_rgba8888(QRasterBuffer *rasterBuffer, | - | ||||||||||||||||||
| 5912 | int x, int y, const QRgba64 &color, | - | ||||||||||||||||||
| 5913 | const uchar *map, | - | ||||||||||||||||||
| 5914 | int mapWidth, int mapHeight, int mapStride, | - | ||||||||||||||||||
| 5915 | const QClipData *clip) | - | ||||||||||||||||||
| 5916 | { | - | ||||||||||||||||||
| 5917 | qt_alphamapblit_uint32(rasterBuffer, x, y, ARGB2RGBA(color.toArgb32()), map, mapWidth, mapHeight, mapStride, clip); | - | ||||||||||||||||||
| 5918 | } never executed: end of block | 0 | ||||||||||||||||||
| 5919 | #endif | - | ||||||||||||||||||
| 5920 | - | |||||||||||||||||||
| 5921 | static void qt_alphargbblit_argb32(QRasterBuffer *rasterBuffer, | - | ||||||||||||||||||
| 5922 | int x, int y, const QRgba64 &color, | - | ||||||||||||||||||
| 5923 | const uint *src, int mapWidth, int mapHeight, int srcStride, | - | ||||||||||||||||||
| 5924 | const QClipData *clip) | - | ||||||||||||||||||
| 5925 | { | - | ||||||||||||||||||
| 5926 | const quint32 c = color.toArgb32(); | - | ||||||||||||||||||
| 5927 | - | |||||||||||||||||||
| 5928 | int sr = qRed(c); | - | ||||||||||||||||||
| 5929 | int sg = qGreen(c); | - | ||||||||||||||||||
| 5930 | int sb = qBlue(c); | - | ||||||||||||||||||
| 5931 | int sa = qAlpha(c); | - | ||||||||||||||||||
| 5932 | - | |||||||||||||||||||
| 5933 | const QDrawHelperGammaTables *tables = QGuiApplicationPrivate::instance()->gammaTables(); | - | ||||||||||||||||||
| 5934 | if (!tables)
| 0 | ||||||||||||||||||
| 5935 | return; never executed: return; | 0 | ||||||||||||||||||
| 5936 | - | |||||||||||||||||||
| 5937 | const uchar *gamma = tables->qt_pow_rgb_gamma; | - | ||||||||||||||||||
| 5938 | const uchar *invgamma = tables->qt_pow_rgb_invgamma; | - | ||||||||||||||||||
| 5939 | - | |||||||||||||||||||
| 5940 | sr = gamma[sr]; | - | ||||||||||||||||||
| 5941 | sg = gamma[sg]; | - | ||||||||||||||||||
| 5942 | sb = gamma[sb]; | - | ||||||||||||||||||
| 5943 | - | |||||||||||||||||||
| 5944 | if (sa == 0)
| 0 | ||||||||||||||||||
| 5945 | return; never executed: return; | 0 | ||||||||||||||||||
| 5946 | - | |||||||||||||||||||
| 5947 | if (!clip) {
| 0 | ||||||||||||||||||
| 5948 | quint32 *dst = reinterpret_cast<quint32*>(rasterBuffer->scanLine(y)) + x; | - | ||||||||||||||||||
| 5949 | const int destStride = rasterBuffer->bytesPerLine() / sizeof(quint32); | - | ||||||||||||||||||
| 5950 | while (mapHeight--) {
| 0 | ||||||||||||||||||
| 5951 | for (int i = 0; i < mapWidth; ++i) {
| 0 | ||||||||||||||||||
| 5952 | const uint coverage = src[i]; | - | ||||||||||||||||||
| 5953 | if (coverage == 0xffffffff) {
| 0 | ||||||||||||||||||
| 5954 | dst[i] = c; | - | ||||||||||||||||||
| 5955 | } else if (coverage != 0xff000000) { never executed: end of block
| 0 | ||||||||||||||||||
| 5956 | rgbBlendPixel(dst+i, coverage, sr, sg, sb, gamma, invgamma); | - | ||||||||||||||||||
| 5957 | } never executed: end of block | 0 | ||||||||||||||||||
| 5958 | } never executed: end of block | 0 | ||||||||||||||||||
| 5959 | - | |||||||||||||||||||
| 5960 | dst += destStride; | - | ||||||||||||||||||
| 5961 | src += srcStride; | - | ||||||||||||||||||
| 5962 | } never executed: end of block | 0 | ||||||||||||||||||
| 5963 | } else { never executed: end of block | 0 | ||||||||||||||||||
| 5964 | int bottom = qMin(y + mapHeight, rasterBuffer->height()); | - | ||||||||||||||||||
| 5965 | - | |||||||||||||||||||
| 5966 | int top = qMax(y, 0); | - | ||||||||||||||||||
| 5967 | src += (top - y) * srcStride; | - | ||||||||||||||||||
| 5968 | - | |||||||||||||||||||
| 5969 | const_cast<QClipData *>(clip)->initialize(); | - | ||||||||||||||||||
| 5970 | for (int yp = top; yp<bottom; ++yp) {
| 0 | ||||||||||||||||||
| 5971 | const QClipData::ClipLine &line = clip->m_clipLines[yp]; | - | ||||||||||||||||||
| 5972 | - | |||||||||||||||||||
| 5973 | quint32 *dst = reinterpret_cast<quint32 *>(rasterBuffer->scanLine(yp)); | - | ||||||||||||||||||
| 5974 | - | |||||||||||||||||||
| 5975 | for (int i=0; i<line.count; ++i) {
| 0 | ||||||||||||||||||
| 5976 | const QSpan &clip = line.spans[i]; | - | ||||||||||||||||||
| 5977 | - | |||||||||||||||||||
| 5978 | int start = qMax<int>(x, clip.x); | - | ||||||||||||||||||
| 5979 | int end = qMin<int>(x + mapWidth, clip.x + clip.len); | - | ||||||||||||||||||
| 5980 | - | |||||||||||||||||||
| 5981 | for (int xp=start; xp<end; ++xp) {
| 0 | ||||||||||||||||||
| 5982 | const uint coverage = src[xp - x]; | - | ||||||||||||||||||
| 5983 | if (coverage == 0xffffffff) {
| 0 | ||||||||||||||||||
| 5984 | dst[xp] = c; | - | ||||||||||||||||||
| 5985 | } else if (coverage != 0xff000000) { never executed: end of block
| 0 | ||||||||||||||||||
| 5986 | rgbBlendPixel(dst+xp, coverage, sr, sg, sb, gamma, invgamma); | - | ||||||||||||||||||
| 5987 | } never executed: end of block | 0 | ||||||||||||||||||
| 5988 | } never executed: end of block | 0 | ||||||||||||||||||
| 5989 | } // for (i -> line.count) never executed: end of block | 0 | ||||||||||||||||||
| 5990 | src += srcStride; | - | ||||||||||||||||||
| 5991 | } // for (yp -> bottom) never executed: end of block | 0 | ||||||||||||||||||
| 5992 | - | |||||||||||||||||||
| 5993 | } never executed: end of block | 0 | ||||||||||||||||||
| 5994 | } | - | ||||||||||||||||||
| 5995 | - | |||||||||||||||||||
| 5996 | static void qt_rectfill_argb32(QRasterBuffer *rasterBuffer, | - | ||||||||||||||||||
| 5997 | int x, int y, int width, int height, | - | ||||||||||||||||||
| 5998 | const QRgba64 &color) | - | ||||||||||||||||||
| 5999 | { | - | ||||||||||||||||||
| 6000 | qt_rectfill<quint32>(reinterpret_cast<quint32 *>(rasterBuffer->buffer()), | - | ||||||||||||||||||
| 6001 | color.toArgb32(), x, y, width, height, rasterBuffer->bytesPerLine()); | - | ||||||||||||||||||
| 6002 | } never executed: end of block | 0 | ||||||||||||||||||
| 6003 | - | |||||||||||||||||||
| 6004 | static void qt_rectfill_quint16(QRasterBuffer *rasterBuffer, | - | ||||||||||||||||||
| 6005 | int x, int y, int width, int height, | - | ||||||||||||||||||
| 6006 | const QRgba64 &color) | - | ||||||||||||||||||
| 6007 | { | - | ||||||||||||||||||
| 6008 | qt_rectfill<quint16>(reinterpret_cast<quint16 *>(rasterBuffer->buffer()), | - | ||||||||||||||||||
| 6009 | color.toRgb16(), x, y, width, height, rasterBuffer->bytesPerLine()); | - | ||||||||||||||||||
| 6010 | } never executed: end of block | 0 | ||||||||||||||||||
| 6011 | - | |||||||||||||||||||
| 6012 | static void qt_rectfill_nonpremul_argb32(QRasterBuffer *rasterBuffer, | - | ||||||||||||||||||
| 6013 | int x, int y, int width, int height, | - | ||||||||||||||||||
| 6014 | const QRgba64 &color) | - | ||||||||||||||||||
| 6015 | { | - | ||||||||||||||||||
| 6016 | qt_rectfill<quint32>(reinterpret_cast<quint32 *>(rasterBuffer->buffer()), | - | ||||||||||||||||||
| 6017 | color.unpremultiplied().toArgb32(), x, y, width, height, rasterBuffer->bytesPerLine()); | - | ||||||||||||||||||
| 6018 | } never executed: end of block | 0 | ||||||||||||||||||
| 6019 | - | |||||||||||||||||||
| 6020 | static void qt_rectfill_rgba(QRasterBuffer *rasterBuffer, | - | ||||||||||||||||||
| 6021 | int x, int y, int width, int height, | - | ||||||||||||||||||
| 6022 | const QRgba64 &color) | - | ||||||||||||||||||
| 6023 | { | - | ||||||||||||||||||
| 6024 | qt_rectfill<quint32>(reinterpret_cast<quint32 *>(rasterBuffer->buffer()), | - | ||||||||||||||||||
| 6025 | ARGB2RGBA(color.toArgb32()), x, y, width, height, rasterBuffer->bytesPerLine()); | - | ||||||||||||||||||
| 6026 | } never executed: end of block | 0 | ||||||||||||||||||
| 6027 | - | |||||||||||||||||||
| 6028 | static void qt_rectfill_nonpremul_rgba(QRasterBuffer *rasterBuffer, | - | ||||||||||||||||||
| 6029 | int x, int y, int width, int height, | - | ||||||||||||||||||
| 6030 | const QRgba64 &color) | - | ||||||||||||||||||
| 6031 | { | - | ||||||||||||||||||
| 6032 | qt_rectfill<quint32>(reinterpret_cast<quint32 *>(rasterBuffer->buffer()), | - | ||||||||||||||||||
| 6033 | ARGB2RGBA(color.unpremultiplied().toArgb32()), x, y, width, height, rasterBuffer->bytesPerLine()); | - | ||||||||||||||||||
| 6034 | } never executed: end of block | 0 | ||||||||||||||||||
| 6035 | - | |||||||||||||||||||
| 6036 | template<QtPixelOrder PixelOrder> | - | ||||||||||||||||||
| 6037 | static void qt_rectfill_rgb30(QRasterBuffer *rasterBuffer, | - | ||||||||||||||||||
| 6038 | int x, int y, int width, int height, | - | ||||||||||||||||||
| 6039 | const QRgba64 &color) | - | ||||||||||||||||||
| 6040 | { | - | ||||||||||||||||||
| 6041 | qt_rectfill<quint32>(reinterpret_cast<quint32 *>(rasterBuffer->buffer()), | - | ||||||||||||||||||
| 6042 | qConvertRgb64ToRgb30<PixelOrder>(color), x, y, width, height, rasterBuffer->bytesPerLine()); | - | ||||||||||||||||||
| 6043 | } never executed: end of block | 0 | ||||||||||||||||||
| 6044 | - | |||||||||||||||||||
| 6045 | static void qt_rectfill_alpha(QRasterBuffer *rasterBuffer, | - | ||||||||||||||||||
| 6046 | int x, int y, int width, int height, | - | ||||||||||||||||||
| 6047 | const QRgba64 &color) | - | ||||||||||||||||||
| 6048 | { | - | ||||||||||||||||||
| 6049 | qt_rectfill<quint8>(reinterpret_cast<quint8 *>(rasterBuffer->buffer()), | - | ||||||||||||||||||
| 6050 | color.alpha() >> 8, x, y, width, height, rasterBuffer->bytesPerLine()); | - | ||||||||||||||||||
| 6051 | } never executed: end of block | 0 | ||||||||||||||||||
| 6052 | - | |||||||||||||||||||
| 6053 | static void qt_rectfill_gray(QRasterBuffer *rasterBuffer, | - | ||||||||||||||||||
| 6054 | int x, int y, int width, int height, | - | ||||||||||||||||||
| 6055 | const QRgba64 &color) | - | ||||||||||||||||||
| 6056 | { | - | ||||||||||||||||||
| 6057 | qt_rectfill<quint8>(reinterpret_cast<quint8 *>(rasterBuffer->buffer()), | - | ||||||||||||||||||
| 6058 | qGray(color.toArgb32()), x, y, width, height, rasterBuffer->bytesPerLine()); | - | ||||||||||||||||||
| 6059 | } never executed: end of block | 0 | ||||||||||||||||||
| 6060 | - | |||||||||||||||||||
| 6061 | // Map table for destination image format. Contains function pointers | - | ||||||||||||||||||
| 6062 | // for blends of various types unto the destination | - | ||||||||||||||||||
| 6063 | - | |||||||||||||||||||
| 6064 | DrawHelper qDrawHelper[QImage::NImageFormats] = | - | ||||||||||||||||||
| 6065 | { | - | ||||||||||||||||||
| 6066 | // Format_Invalid, | - | ||||||||||||||||||
| 6067 | { 0, 0, 0, 0, 0, 0 }, | - | ||||||||||||||||||
| 6068 | // Format_Mono, | - | ||||||||||||||||||
| 6069 | { | - | ||||||||||||||||||
| 6070 | blend_color_generic, | - | ||||||||||||||||||
| 6071 | blend_src_generic, | - | ||||||||||||||||||
| 6072 | 0, 0, 0, 0 | - | ||||||||||||||||||
| 6073 | }, | - | ||||||||||||||||||
| 6074 | // Format_MonoLSB, | - | ||||||||||||||||||
| 6075 | { | - | ||||||||||||||||||
| 6076 | blend_color_generic, | - | ||||||||||||||||||
| 6077 | blend_src_generic, | - | ||||||||||||||||||
| 6078 | 0, 0, 0, 0 | - | ||||||||||||||||||
| 6079 | }, | - | ||||||||||||||||||
| 6080 | // Format_Indexed8, | - | ||||||||||||||||||
| 6081 | { | - | ||||||||||||||||||
| 6082 | blend_color_generic, | - | ||||||||||||||||||
| 6083 | blend_src_generic, | - | ||||||||||||||||||
| 6084 | 0, 0, 0, 0 | - | ||||||||||||||||||
| 6085 | }, | - | ||||||||||||||||||
| 6086 | // Format_RGB32, | - | ||||||||||||||||||
| 6087 | { | - | ||||||||||||||||||
| 6088 | blend_color_argb, | - | ||||||||||||||||||
| 6089 | qt_gradient_argb32, | - | ||||||||||||||||||
| 6090 | qt_bitmapblit_argb32, | - | ||||||||||||||||||
| 6091 | qt_alphamapblit_argb32, | - | ||||||||||||||||||
| 6092 | qt_alphargbblit_argb32, | - | ||||||||||||||||||
| 6093 | qt_rectfill_argb32 | - | ||||||||||||||||||
| 6094 | }, | - | ||||||||||||||||||
| 6095 | // Format_ARGB32, | - | ||||||||||||||||||
| 6096 | { | - | ||||||||||||||||||
| 6097 | blend_color_generic, | - | ||||||||||||||||||
| 6098 | qt_gradient_argb32, | - | ||||||||||||||||||
| 6099 | qt_bitmapblit_argb32, | - | ||||||||||||||||||
| 6100 | qt_alphamapblit_argb32, | - | ||||||||||||||||||
| 6101 | qt_alphargbblit_argb32, | - | ||||||||||||||||||
| 6102 | qt_rectfill_nonpremul_argb32 | - | ||||||||||||||||||
| 6103 | }, | - | ||||||||||||||||||
| 6104 | // Format_ARGB32_Premultiplied | - | ||||||||||||||||||
| 6105 | { | - | ||||||||||||||||||
| 6106 | blend_color_argb, | - | ||||||||||||||||||
| 6107 | qt_gradient_argb32, | - | ||||||||||||||||||
| 6108 | qt_bitmapblit_argb32, | - | ||||||||||||||||||
| 6109 | qt_alphamapblit_argb32, | - | ||||||||||||||||||
| 6110 | qt_alphargbblit_argb32, | - | ||||||||||||||||||
| 6111 | qt_rectfill_argb32 | - | ||||||||||||||||||
| 6112 | }, | - | ||||||||||||||||||
| 6113 | // Format_RGB16 | - | ||||||||||||||||||
| 6114 | { | - | ||||||||||||||||||
| 6115 | blend_color_rgb16, | - | ||||||||||||||||||
| 6116 | qt_gradient_quint16, | - | ||||||||||||||||||
| 6117 | qt_bitmapblit_quint16, | - | ||||||||||||||||||
| 6118 | qt_alphamapblit_quint16, | - | ||||||||||||||||||
| 6119 | 0, | - | ||||||||||||||||||
| 6120 | qt_rectfill_quint16 | - | ||||||||||||||||||
| 6121 | }, | - | ||||||||||||||||||
| 6122 | // Format_ARGB8565_Premultiplied | - | ||||||||||||||||||
| 6123 | { | - | ||||||||||||||||||
| 6124 | blend_color_generic, | - | ||||||||||||||||||
| 6125 | blend_src_generic, | - | ||||||||||||||||||
| 6126 | 0, 0, 0, 0 | - | ||||||||||||||||||
| 6127 | }, | - | ||||||||||||||||||
| 6128 | // Format_RGB666 | - | ||||||||||||||||||
| 6129 | { | - | ||||||||||||||||||
| 6130 | blend_color_generic, | - | ||||||||||||||||||
| 6131 | blend_src_generic, | - | ||||||||||||||||||
| 6132 | 0, 0, 0, 0 | - | ||||||||||||||||||
| 6133 | }, | - | ||||||||||||||||||
| 6134 | // Format_ARGB6666_Premultiplied | - | ||||||||||||||||||
| 6135 | { | - | ||||||||||||||||||
| 6136 | blend_color_generic, | - | ||||||||||||||||||
| 6137 | blend_src_generic, | - | ||||||||||||||||||
| 6138 | 0, 0, 0, 0 | - | ||||||||||||||||||
| 6139 | }, | - | ||||||||||||||||||
| 6140 | // Format_RGB555 | - | ||||||||||||||||||
| 6141 | { | - | ||||||||||||||||||
| 6142 | blend_color_generic, | - | ||||||||||||||||||
| 6143 | blend_src_generic, | - | ||||||||||||||||||
| 6144 | 0, 0, 0, 0 | - | ||||||||||||||||||
| 6145 | }, | - | ||||||||||||||||||
| 6146 | // Format_ARGB8555_Premultiplied | - | ||||||||||||||||||
| 6147 | { | - | ||||||||||||||||||
| 6148 | blend_color_generic, | - | ||||||||||||||||||
| 6149 | blend_src_generic, | - | ||||||||||||||||||
| 6150 | 0, 0, 0, 0 | - | ||||||||||||||||||
| 6151 | }, | - | ||||||||||||||||||
| 6152 | // Format_RGB888 | - | ||||||||||||||||||
| 6153 | { | - | ||||||||||||||||||
| 6154 | blend_color_generic, | - | ||||||||||||||||||
| 6155 | blend_src_generic, | - | ||||||||||||||||||
| 6156 | 0, 0, 0, 0 | - | ||||||||||||||||||
| 6157 | }, | - | ||||||||||||||||||
| 6158 | // Format_RGB444 | - | ||||||||||||||||||
| 6159 | { | - | ||||||||||||||||||
| 6160 | blend_color_generic, | - | ||||||||||||||||||
| 6161 | blend_src_generic, | - | ||||||||||||||||||
| 6162 | 0, 0, 0, 0 | - | ||||||||||||||||||
| 6163 | }, | - | ||||||||||||||||||
| 6164 | // Format_ARGB4444_Premultiplied | - | ||||||||||||||||||
| 6165 | { | - | ||||||||||||||||||
| 6166 | blend_color_generic, | - | ||||||||||||||||||
| 6167 | blend_src_generic, | - | ||||||||||||||||||
| 6168 | 0, 0, 0, 0 | - | ||||||||||||||||||
| 6169 | }, | - | ||||||||||||||||||
| 6170 | // Format_RGBX8888 | - | ||||||||||||||||||
| 6171 | { | - | ||||||||||||||||||
| 6172 | blend_color_generic, | - | ||||||||||||||||||
| 6173 | blend_src_generic, | - | ||||||||||||||||||
| 6174 | qt_bitmapblit_rgba8888, | - | ||||||||||||||||||
| 6175 | #if Q_BYTE_ORDER == Q_LITTLE_ENDIAN | - | ||||||||||||||||||
| 6176 | qt_alphamapblit_rgba8888, | - | ||||||||||||||||||
| 6177 | #else | - | ||||||||||||||||||
| 6178 | 0, | - | ||||||||||||||||||
| 6179 | #endif | - | ||||||||||||||||||
| 6180 | 0, | - | ||||||||||||||||||
| 6181 | qt_rectfill_rgba | - | ||||||||||||||||||
| 6182 | }, | - | ||||||||||||||||||
| 6183 | // Format_RGBA8888 | - | ||||||||||||||||||
| 6184 | { | - | ||||||||||||||||||
| 6185 | blend_color_generic, | - | ||||||||||||||||||
| 6186 | blend_src_generic, | - | ||||||||||||||||||
| 6187 | qt_bitmapblit_rgba8888, | - | ||||||||||||||||||
| 6188 | #if Q_BYTE_ORDER == Q_LITTLE_ENDIAN | - | ||||||||||||||||||
| 6189 | qt_alphamapblit_rgba8888, | - | ||||||||||||||||||
| 6190 | #else | - | ||||||||||||||||||
| 6191 | 0, | - | ||||||||||||||||||
| 6192 | #endif | - | ||||||||||||||||||
| 6193 | 0, | - | ||||||||||||||||||
| 6194 | qt_rectfill_nonpremul_rgba | - | ||||||||||||||||||
| 6195 | }, | - | ||||||||||||||||||
| 6196 | // Format_RGB8888_Premultiplied | - | ||||||||||||||||||
| 6197 | { | - | ||||||||||||||||||
| 6198 | blend_color_generic, | - | ||||||||||||||||||
| 6199 | blend_src_generic, | - | ||||||||||||||||||
| 6200 | qt_bitmapblit_rgba8888, | - | ||||||||||||||||||
| 6201 | #if Q_BYTE_ORDER == Q_LITTLE_ENDIAN | - | ||||||||||||||||||
| 6202 | qt_alphamapblit_rgba8888, | - | ||||||||||||||||||
| 6203 | #else | - | ||||||||||||||||||
| 6204 | 0, | - | ||||||||||||||||||
| 6205 | #endif | - | ||||||||||||||||||
| 6206 | 0, | - | ||||||||||||||||||
| 6207 | qt_rectfill_rgba | - | ||||||||||||||||||
| 6208 | }, | - | ||||||||||||||||||
| 6209 | // Format_BGR30 | - | ||||||||||||||||||
| 6210 | { | - | ||||||||||||||||||
| 6211 | blend_color_generic_rgb64, | - | ||||||||||||||||||
| 6212 | blend_src_generic_rgb64, | - | ||||||||||||||||||
| 6213 | qt_bitmapblit_rgb30<PixelOrderBGR>, | - | ||||||||||||||||||
| 6214 | 0, | - | ||||||||||||||||||
| 6215 | 0, | - | ||||||||||||||||||
| 6216 | qt_rectfill_rgb30<PixelOrderBGR> | - | ||||||||||||||||||
| 6217 | }, | - | ||||||||||||||||||
| 6218 | // Format_A2BGR30_Premultiplied | - | ||||||||||||||||||
| 6219 | { | - | ||||||||||||||||||
| 6220 | blend_color_generic_rgb64, | - | ||||||||||||||||||
| 6221 | blend_src_generic_rgb64, | - | ||||||||||||||||||
| 6222 | qt_bitmapblit_rgb30<PixelOrderBGR>, | - | ||||||||||||||||||
| 6223 | 0, | - | ||||||||||||||||||
| 6224 | 0, | - | ||||||||||||||||||
| 6225 | qt_rectfill_rgb30<PixelOrderBGR> | - | ||||||||||||||||||
| 6226 | }, | - | ||||||||||||||||||
| 6227 | // Format_RGB30 | - | ||||||||||||||||||
| 6228 | { | - | ||||||||||||||||||
| 6229 | blend_color_generic_rgb64, | - | ||||||||||||||||||
| 6230 | blend_src_generic_rgb64, | - | ||||||||||||||||||
| 6231 | qt_bitmapblit_rgb30<PixelOrderRGB>, | - | ||||||||||||||||||
| 6232 | 0, | - | ||||||||||||||||||
| 6233 | 0, | - | ||||||||||||||||||
| 6234 | qt_rectfill_rgb30<PixelOrderRGB> | - | ||||||||||||||||||
| 6235 | }, | - | ||||||||||||||||||
| 6236 | // Format_A2RGB30_Premultiplied | - | ||||||||||||||||||
| 6237 | { | - | ||||||||||||||||||
| 6238 | blend_color_generic_rgb64, | - | ||||||||||||||||||
| 6239 | blend_src_generic_rgb64, | - | ||||||||||||||||||
| 6240 | qt_bitmapblit_rgb30<PixelOrderRGB>, | - | ||||||||||||||||||
| 6241 | 0, | - | ||||||||||||||||||
| 6242 | 0, | - | ||||||||||||||||||
| 6243 | qt_rectfill_rgb30<PixelOrderRGB> | - | ||||||||||||||||||
| 6244 | }, | - | ||||||||||||||||||
| 6245 | // Format_Alpha8 | - | ||||||||||||||||||
| 6246 | { | - | ||||||||||||||||||
| 6247 | blend_color_generic, | - | ||||||||||||||||||
| 6248 | blend_src_generic, | - | ||||||||||||||||||
| 6249 | 0, 0, 0, | - | ||||||||||||||||||
| 6250 | qt_rectfill_alpha | - | ||||||||||||||||||
| 6251 | }, | - | ||||||||||||||||||
| 6252 | // Format_Grayscale8 | - | ||||||||||||||||||
| 6253 | { | - | ||||||||||||||||||
| 6254 | blend_color_generic, | - | ||||||||||||||||||
| 6255 | blend_src_generic, | - | ||||||||||||||||||
| 6256 | 0, 0, 0, | - | ||||||||||||||||||
| 6257 | qt_rectfill_gray | - | ||||||||||||||||||
| 6258 | }, | - | ||||||||||||||||||
| 6259 | }; | - | ||||||||||||||||||
| 6260 | - | |||||||||||||||||||
| 6261 | #if defined(Q_CC_MSVC) && !defined(_MIPS_) | - | ||||||||||||||||||
| 6262 | template <class T> | - | ||||||||||||||||||
| 6263 | inline void qt_memfill_template(T *dest, T color, int count) | - | ||||||||||||||||||
| 6264 | { | - | ||||||||||||||||||
| 6265 | while (count--) | - | ||||||||||||||||||
| 6266 | *dest++ = color; | - | ||||||||||||||||||
| 6267 | } | - | ||||||||||||||||||
| 6268 | - | |||||||||||||||||||
| 6269 | #else | - | ||||||||||||||||||
| 6270 | - | |||||||||||||||||||
| 6271 | template <class T> | - | ||||||||||||||||||
| 6272 | inline void qt_memfill_template(T *dest, T color, int count) | - | ||||||||||||||||||
| 6273 | { | - | ||||||||||||||||||
| 6274 | int n = (count + 7) / 8; | - | ||||||||||||||||||
| 6275 | switch (count & 0x07) | - | ||||||||||||||||||
| 6276 | { | - | ||||||||||||||||||
| 6277 | case 0: do { *dest++ = color; never executed: case 0: | 0 | ||||||||||||||||||
| 6278 | case 7: *dest++ = color; code before this statement never executed: case 7:never executed: case 7: | 0 | ||||||||||||||||||
| 6279 | case 6: *dest++ = color; code before this statement never executed: case 6:never executed: case 6: | 0 | ||||||||||||||||||
| 6280 | case 5: *dest++ = color; code before this statement never executed: case 5:never executed: case 5: | 0 | ||||||||||||||||||
| 6281 | case 4: *dest++ = color; code before this statement never executed: case 4:never executed: case 4: | 0 | ||||||||||||||||||
| 6282 | case 3: *dest++ = color; code before this statement never executed: case 3:never executed: case 3: | 0 | ||||||||||||||||||
| 6283 | case 2: *dest++ = color; code before this statement never executed: case 2:never executed: case 2: | 0 | ||||||||||||||||||
| 6284 | case 1: *dest++ = color; code before this statement never executed: case 1:never executed: case 1: | 0 | ||||||||||||||||||
| 6285 | } while (--n > 0); never executed: end of block
| 0 | ||||||||||||||||||
| 6286 | } never executed: end of block | 0 | ||||||||||||||||||
| 6287 | } never executed: end of block | 0 | ||||||||||||||||||
| 6288 | - | |||||||||||||||||||
| 6289 | template <> | - | ||||||||||||||||||
| 6290 | inline void qt_memfill_template(quint16 *dest, quint16 value, int count) | - | ||||||||||||||||||
| 6291 | { | - | ||||||||||||||||||
| 6292 | if (count < 3) {
| 0 | ||||||||||||||||||
| 6293 | switch (count) { | - | ||||||||||||||||||
| 6294 | case 2: *dest++ = value; never executed: case 2: | 0 | ||||||||||||||||||
| 6295 | case 1: *dest = value; code before this statement never executed: case 1:never executed: case 1: | 0 | ||||||||||||||||||
| 6296 | } never executed: end of block | 0 | ||||||||||||||||||
| 6297 | return; never executed: return; | 0 | ||||||||||||||||||
| 6298 | } | - | ||||||||||||||||||
| 6299 | - | |||||||||||||||||||
| 6300 | const int align = (quintptr)(dest) & 0x3; | - | ||||||||||||||||||
| 6301 | switch (align) { | - | ||||||||||||||||||
| 6302 | case 2: *dest++ = value; --count; never executed: case 2: | 0 | ||||||||||||||||||
| 6303 | } never executed: end of block | 0 | ||||||||||||||||||
| 6304 | - | |||||||||||||||||||
| 6305 | const quint32 value32 = (value << 16) | value; | - | ||||||||||||||||||
| 6306 | qt_memfill(reinterpret_cast<quint32*>(dest), value32, count / 2); | - | ||||||||||||||||||
| 6307 | if (count & 0x1)
| 0 | ||||||||||||||||||
| 6308 | dest[count - 1] = value; never executed: dest[count - 1] = value; | 0 | ||||||||||||||||||
| 6309 | } never executed: end of block | 0 | ||||||||||||||||||
| 6310 | #endif | - | ||||||||||||||||||
| 6311 | - | |||||||||||||||||||
| 6312 | void qt_memfill64(quint64 *dest, quint64 color, int count) | - | ||||||||||||||||||
| 6313 | { | - | ||||||||||||||||||
| 6314 | qt_memfill_template<quint64>(dest, color, count); | - | ||||||||||||||||||
| 6315 | } never executed: end of block | 0 | ||||||||||||||||||
| 6316 | - | |||||||||||||||||||
| 6317 | #if !defined(__SSE2__) | - | ||||||||||||||||||
| 6318 | void qt_memfill16(quint16 *dest, quint16 color, int count) | - | ||||||||||||||||||
| 6319 | { | - | ||||||||||||||||||
| 6320 | qt_memfill_template<quint16>(dest, color, count); | - | ||||||||||||||||||
| 6321 | } | - | ||||||||||||||||||
| 6322 | #endif | - | ||||||||||||||||||
| 6323 | #if !defined(__SSE2__) && !defined(__ARM_NEON__) | - | ||||||||||||||||||
| 6324 | # ifdef QT_COMPILER_SUPPORTS_MIPS_DSP | - | ||||||||||||||||||
| 6325 | extern "C" void qt_memfill32_asm_mips_dsp(quint32 *, quint32, int); | - | ||||||||||||||||||
| 6326 | # endif | - | ||||||||||||||||||
| 6327 | - | |||||||||||||||||||
| 6328 | void qt_memfill32(quint32 *dest, quint32 color, int count) | - | ||||||||||||||||||
| 6329 | { | - | ||||||||||||||||||
| 6330 | # ifdef QT_COMPILER_SUPPORTS_MIPS_DSP | - | ||||||||||||||||||
| 6331 | qt_memfill32_asm_mips_dsp(dest, color, count); | - | ||||||||||||||||||
| 6332 | # else | - | ||||||||||||||||||
| 6333 | qt_memfill_template<quint32>(dest, color, count); | - | ||||||||||||||||||
| 6334 | # endif | - | ||||||||||||||||||
| 6335 | } | - | ||||||||||||||||||
| 6336 | #endif | - | ||||||||||||||||||
| 6337 | - | |||||||||||||||||||
| 6338 | #ifdef QT_COMPILER_SUPPORTS_SSE4_1 | - | ||||||||||||||||||
| 6339 | template<QtPixelOrder> const uint *QT_FASTCALL convertA2RGB30PMFromARGB32PM_sse4(uint *buffer, const uint *src, int count, const QPixelLayout *, const QRgb *); | - | ||||||||||||||||||
| 6340 | #endif | - | ||||||||||||||||||
| 6341 | - | |||||||||||||||||||
| 6342 | extern void qInitBlendFunctions(); | - | ||||||||||||||||||
| 6343 | - | |||||||||||||||||||
| 6344 | static void qInitDrawhelperFunctions() | - | ||||||||||||||||||
| 6345 | { | - | ||||||||||||||||||
| 6346 | // Set up basic blend function tables. | - | ||||||||||||||||||
| 6347 | qInitBlendFunctions(); | - | ||||||||||||||||||
| 6348 | - | |||||||||||||||||||
| 6349 | #ifdef __SSE2__ | - | ||||||||||||||||||
| 6350 | qDrawHelper[QImage::Format_RGB32].bitmapBlit = qt_bitmapblit32_sse2; | - | ||||||||||||||||||
| 6351 | qDrawHelper[QImage::Format_ARGB32].bitmapBlit = qt_bitmapblit32_sse2; | - | ||||||||||||||||||
| 6352 | qDrawHelper[QImage::Format_ARGB32_Premultiplied].bitmapBlit = qt_bitmapblit32_sse2; | - | ||||||||||||||||||
| 6353 | qDrawHelper[QImage::Format_RGB16].bitmapBlit = qt_bitmapblit16_sse2; | - | ||||||||||||||||||
| 6354 | qDrawHelper[QImage::Format_RGBX8888].bitmapBlit = qt_bitmapblit8888_sse2; | - | ||||||||||||||||||
| 6355 | qDrawHelper[QImage::Format_RGBA8888].bitmapBlit = qt_bitmapblit8888_sse2; | - | ||||||||||||||||||
| 6356 | qDrawHelper[QImage::Format_RGBA8888_Premultiplied].bitmapBlit = qt_bitmapblit8888_sse2; | - | ||||||||||||||||||
| 6357 | - | |||||||||||||||||||
| 6358 | extern void qt_scale_image_argb32_on_argb32_sse2(uchar *destPixels, int dbpl, | - | ||||||||||||||||||
| 6359 | const uchar *srcPixels, int sbpl, int srch, | - | ||||||||||||||||||
| 6360 | const QRectF &targetRect, | - | ||||||||||||||||||
| 6361 | const QRectF &sourceRect, | - | ||||||||||||||||||
| 6362 | const QRect &clip, | - | ||||||||||||||||||
| 6363 | int const_alpha); | - | ||||||||||||||||||
| 6364 | qScaleFunctions[QImage::Format_ARGB32_Premultiplied][QImage::Format_ARGB32_Premultiplied] = qt_scale_image_argb32_on_argb32_sse2; | - | ||||||||||||||||||
| 6365 | qScaleFunctions[QImage::Format_RGB32][QImage::Format_ARGB32_Premultiplied] = qt_scale_image_argb32_on_argb32_sse2; | - | ||||||||||||||||||
| 6366 | qScaleFunctions[QImage::Format_RGBA8888_Premultiplied][QImage::Format_RGBA8888_Premultiplied] = qt_scale_image_argb32_on_argb32_sse2; | - | ||||||||||||||||||
| 6367 | qScaleFunctions[QImage::Format_RGBX8888][QImage::Format_RGBA8888_Premultiplied] = qt_scale_image_argb32_on_argb32_sse2; | - | ||||||||||||||||||
| 6368 | - | |||||||||||||||||||
| 6369 | extern void qt_blend_rgb32_on_rgb32_sse2(uchar *destPixels, int dbpl, | - | ||||||||||||||||||
| 6370 | const uchar *srcPixels, int sbpl, | - | ||||||||||||||||||
| 6371 | int w, int h, | - | ||||||||||||||||||
| 6372 | int const_alpha); | - | ||||||||||||||||||
| 6373 | extern void qt_blend_argb32_on_argb32_sse2(uchar *destPixels, int dbpl, | - | ||||||||||||||||||
| 6374 | const uchar *srcPixels, int sbpl, | - | ||||||||||||||||||
| 6375 | int w, int h, | - | ||||||||||||||||||
| 6376 | int const_alpha); | - | ||||||||||||||||||
| 6377 | - | |||||||||||||||||||
| 6378 | qBlendFunctions[QImage::Format_RGB32][QImage::Format_RGB32] = qt_blend_rgb32_on_rgb32_sse2; | - | ||||||||||||||||||
| 6379 | qBlendFunctions[QImage::Format_ARGB32_Premultiplied][QImage::Format_RGB32] = qt_blend_rgb32_on_rgb32_sse2; | - | ||||||||||||||||||
| 6380 | qBlendFunctions[QImage::Format_RGB32][QImage::Format_ARGB32_Premultiplied] = qt_blend_argb32_on_argb32_sse2; | - | ||||||||||||||||||
| 6381 | qBlendFunctions[QImage::Format_ARGB32_Premultiplied][QImage::Format_ARGB32_Premultiplied] = qt_blend_argb32_on_argb32_sse2; | - | ||||||||||||||||||
| 6382 | qBlendFunctions[QImage::Format_RGBX8888][QImage::Format_RGBX8888] = qt_blend_rgb32_on_rgb32_sse2; | - | ||||||||||||||||||
| 6383 | qBlendFunctions[QImage::Format_RGBA8888_Premultiplied][QImage::Format_RGBX8888] = qt_blend_rgb32_on_rgb32_sse2; | - | ||||||||||||||||||
| 6384 | qBlendFunctions[QImage::Format_RGBX8888][QImage::Format_RGBA8888_Premultiplied] = qt_blend_argb32_on_argb32_sse2; | - | ||||||||||||||||||
| 6385 | qBlendFunctions[QImage::Format_RGBA8888_Premultiplied][QImage::Format_RGBA8888_Premultiplied] = qt_blend_argb32_on_argb32_sse2; | - | ||||||||||||||||||
| 6386 | - | |||||||||||||||||||
| 6387 | extern const uint * QT_FASTCALL qt_fetch_radial_gradient_sse2(uint *buffer, const Operator *op, const QSpanData *data, | - | ||||||||||||||||||
| 6388 | int y, int x, int length); | - | ||||||||||||||||||
| 6389 | - | |||||||||||||||||||
| 6390 | qt_fetch_radial_gradient = qt_fetch_radial_gradient_sse2; | - | ||||||||||||||||||
| 6391 | - | |||||||||||||||||||
| 6392 | #ifdef QT_COMPILER_SUPPORTS_SSSE3 | - | ||||||||||||||||||
| 6393 | if (qCpuHasFeature(SSSE3)) {
| 0 | ||||||||||||||||||
| 6394 | extern void qt_blend_argb32_on_argb32_ssse3(uchar *destPixels, int dbpl, | - | ||||||||||||||||||
| 6395 | const uchar *srcPixels, int sbpl, | - | ||||||||||||||||||
| 6396 | int w, int h, | - | ||||||||||||||||||
| 6397 | int const_alpha); | - | ||||||||||||||||||
| 6398 | - | |||||||||||||||||||
| 6399 | qBlendFunctions[QImage::Format_RGB32][QImage::Format_ARGB32_Premultiplied] = qt_blend_argb32_on_argb32_ssse3; | - | ||||||||||||||||||
| 6400 | qBlendFunctions[QImage::Format_ARGB32_Premultiplied][QImage::Format_ARGB32_Premultiplied] = qt_blend_argb32_on_argb32_ssse3; | - | ||||||||||||||||||
| 6401 | qBlendFunctions[QImage::Format_RGBX8888][QImage::Format_RGBA8888_Premultiplied] = qt_blend_argb32_on_argb32_ssse3; | - | ||||||||||||||||||
| 6402 | qBlendFunctions[QImage::Format_RGBA8888_Premultiplied][QImage::Format_RGBA8888_Premultiplied] = qt_blend_argb32_on_argb32_ssse3; | - | ||||||||||||||||||
| 6403 | } never executed: end of block | 0 | ||||||||||||||||||
| 6404 | #endif // SSSE3 | - | ||||||||||||||||||
| 6405 | - | |||||||||||||||||||
| 6406 | #if defined(QT_COMPILER_SUPPORTS_SSE4_1) | - | ||||||||||||||||||
| 6407 | if (qCpuHasFeature(SSE4_1)) {
| 0 | ||||||||||||||||||
| 6408 | #if !defined(__SSE4_1__) | - | ||||||||||||||||||
| 6409 | extern const uint *QT_FASTCALL convertARGB32ToARGB32PM_sse4(uint *buffer, const uint *src, int count, const QPixelLayout *, const QRgb *); | - | ||||||||||||||||||
| 6410 | extern const uint *QT_FASTCALL convertRGBA8888ToARGB32PM_sse4(uint *buffer, const uint *src, int count, const QPixelLayout *, const QRgb *); | - | ||||||||||||||||||
| 6411 | qPixelLayouts[QImage::Format_ARGB32].convertToARGB32PM = convertARGB32ToARGB32PM_sse4; | - | ||||||||||||||||||
| 6412 | qPixelLayouts[QImage::Format_RGBA8888].convertToARGB32PM = convertRGBA8888ToARGB32PM_sse4; | - | ||||||||||||||||||
| 6413 | #endif | - | ||||||||||||||||||
| 6414 | extern const uint *QT_FASTCALL convertARGB32FromARGB32PM_sse4(uint *buffer, const uint *src, int count, const QPixelLayout *, const QRgb *); | - | ||||||||||||||||||
| 6415 | extern const uint *QT_FASTCALL convertRGBA8888FromARGB32PM_sse4(uint *buffer, const uint *src, int count, const QPixelLayout *, const QRgb *); | - | ||||||||||||||||||
| 6416 | extern const uint *QT_FASTCALL convertRGBXFromARGB32PM_sse4(uint *buffer, const uint *src, int count, const QPixelLayout *, const QRgb *); | - | ||||||||||||||||||
| 6417 | qPixelLayouts[QImage::Format_ARGB32].convertFromARGB32PM = convertARGB32FromARGB32PM_sse4; | - | ||||||||||||||||||
| 6418 | qPixelLayouts[QImage::Format_RGBA8888].convertFromARGB32PM = convertRGBA8888FromARGB32PM_sse4; | - | ||||||||||||||||||
| 6419 | qPixelLayouts[QImage::Format_RGBX8888].convertFromARGB32PM = convertRGBXFromARGB32PM_sse4; | - | ||||||||||||||||||
| 6420 | qPixelLayouts[QImage::Format_A2BGR30_Premultiplied].convertFromARGB32PM = convertA2RGB30PMFromARGB32PM_sse4<PixelOrderBGR>; | - | ||||||||||||||||||
| 6421 | qPixelLayouts[QImage::Format_A2RGB30_Premultiplied].convertFromARGB32PM = convertA2RGB30PMFromARGB32PM_sse4<PixelOrderRGB>; | - | ||||||||||||||||||
| 6422 | } never executed: end of block | 0 | ||||||||||||||||||
| 6423 | #endif | - | ||||||||||||||||||
| 6424 | - | |||||||||||||||||||
| 6425 | #if defined(QT_COMPILER_SUPPORTS_AVX2) && !defined(__AVX2__) | - | ||||||||||||||||||
| 6426 | if (qCpuHasFeature(AVX2)) {
| 0 | ||||||||||||||||||
| 6427 | extern const uint *QT_FASTCALL convertARGB32ToARGB32PM_avx2(uint *buffer, const uint *src, int count, const QPixelLayout *, const QRgb *); | - | ||||||||||||||||||
| 6428 | extern const uint *QT_FASTCALL convertRGBA8888ToARGB32PM_avx2(uint *buffer, const uint *src, int count, const QPixelLayout *, const QRgb *); | - | ||||||||||||||||||
| 6429 | qPixelLayouts[QImage::Format_ARGB32].convertToARGB32PM = convertARGB32ToARGB32PM_avx2; | - | ||||||||||||||||||
| 6430 | qPixelLayouts[QImage::Format_RGBA8888].convertToARGB32PM = convertRGBA8888ToARGB32PM_avx2; | - | ||||||||||||||||||
| 6431 | } never executed: end of block | 0 | ||||||||||||||||||
| 6432 | #endif | - | ||||||||||||||||||
| 6433 | extern void QT_FASTCALL comp_func_SourceOver_sse2(uint *destPixels, const uint *srcPixels, int length, uint const_alpha); | - | ||||||||||||||||||
| 6434 | extern void QT_FASTCALL comp_func_solid_SourceOver_sse2(uint *destPixels, int length, uint color, uint const_alpha); | - | ||||||||||||||||||
| 6435 | extern void QT_FASTCALL comp_func_Source_sse2(uint *destPixels, const uint *srcPixels, int length, uint const_alpha); | - | ||||||||||||||||||
| 6436 | extern void QT_FASTCALL comp_func_Plus_sse2(uint *destPixels, const uint *srcPixels, int length, uint const_alpha); | - | ||||||||||||||||||
| 6437 | qt_functionForMode_C[QPainter::CompositionMode_SourceOver] = comp_func_SourceOver_sse2; | - | ||||||||||||||||||
| 6438 | qt_functionForModeSolid_C[QPainter::CompositionMode_SourceOver] = comp_func_solid_SourceOver_sse2; | - | ||||||||||||||||||
| 6439 | qt_functionForMode_C[QPainter::CompositionMode_Source] = comp_func_Source_sse2; | - | ||||||||||||||||||
| 6440 | qt_functionForMode_C[QPainter::CompositionMode_Plus] = comp_func_Plus_sse2; | - | ||||||||||||||||||
| 6441 | - | |||||||||||||||||||
| 6442 | #endif // SSE2 | - | ||||||||||||||||||
| 6443 | - | |||||||||||||||||||
| 6444 | #if defined(__ARM_NEON__) | - | ||||||||||||||||||
| 6445 | qBlendFunctions[QImage::Format_RGB32][QImage::Format_RGB32] = qt_blend_rgb32_on_rgb32_neon; | - | ||||||||||||||||||
| 6446 | qBlendFunctions[QImage::Format_ARGB32_Premultiplied][QImage::Format_RGB32] = qt_blend_rgb32_on_rgb32_neon; | - | ||||||||||||||||||
| 6447 | qBlendFunctions[QImage::Format_RGB32][QImage::Format_ARGB32_Premultiplied] = qt_blend_argb32_on_argb32_neon; | - | ||||||||||||||||||
| 6448 | qBlendFunctions[QImage::Format_ARGB32_Premultiplied][QImage::Format_ARGB32_Premultiplied] = qt_blend_argb32_on_argb32_neon; | - | ||||||||||||||||||
| 6449 | #if Q_BYTE_ORDER == Q_LITTLE_ENDIAN | - | ||||||||||||||||||
| 6450 | qBlendFunctions[QImage::Format_RGBX8888][QImage::Format_RGBX8888] = qt_blend_rgb32_on_rgb32_neon; | - | ||||||||||||||||||
| 6451 | qBlendFunctions[QImage::Format_RGBA8888_Premultiplied][QImage::Format_RGBX8888] = qt_blend_rgb32_on_rgb32_neon; | - | ||||||||||||||||||
| 6452 | qBlendFunctions[QImage::Format_RGBX8888][QImage::Format_RGBA8888_Premultiplied] = qt_blend_argb32_on_argb32_neon; | - | ||||||||||||||||||
| 6453 | qBlendFunctions[QImage::Format_RGBA8888_Premultiplied][QImage::Format_RGBA8888_Premultiplied] = qt_blend_argb32_on_argb32_neon; | - | ||||||||||||||||||
| 6454 | #endif | - | ||||||||||||||||||
| 6455 | - | |||||||||||||||||||
| 6456 | qt_functionForMode_C[QPainter::CompositionMode_SourceOver] = qt_blend_argb32_on_argb32_scanline_neon; | - | ||||||||||||||||||
| 6457 | qt_functionForModeSolid_C[QPainter::CompositionMode_SourceOver] = comp_func_solid_SourceOver_neon; | - | ||||||||||||||||||
| 6458 | qt_functionForMode_C[QPainter::CompositionMode_Plus] = comp_func_Plus_neon; | - | ||||||||||||||||||
| 6459 | - | |||||||||||||||||||
| 6460 | extern const uint * QT_FASTCALL qt_fetch_radial_gradient_neon(uint *buffer, const Operator *op, const QSpanData *data, | - | ||||||||||||||||||
| 6461 | int y, int x, int length); | - | ||||||||||||||||||
| 6462 | - | |||||||||||||||||||
| 6463 | qt_fetch_radial_gradient = qt_fetch_radial_gradient_neon; | - | ||||||||||||||||||
| 6464 | - | |||||||||||||||||||
| 6465 | #if defined(ENABLE_PIXMAN_DRAWHELPERS) | - | ||||||||||||||||||
| 6466 | // The RGB16 helpers are using Arm32 assemblythat has not been ported to AArch64 | - | ||||||||||||||||||
| 6467 | qBlendFunctions[QImage::Format_RGB16][QImage::Format_ARGB32_Premultiplied] = qt_blend_argb32_on_rgb16_neon; | - | ||||||||||||||||||
| 6468 | qBlendFunctions[QImage::Format_ARGB32_Premultiplied][QImage::Format_RGB16] = qt_blend_rgb16_on_argb32_neon; | - | ||||||||||||||||||
| 6469 | qBlendFunctions[QImage::Format_RGB16][QImage::Format_RGB16] = qt_blend_rgb16_on_rgb16_neon; | - | ||||||||||||||||||
| 6470 | - | |||||||||||||||||||
| 6471 | qScaleFunctions[QImage::Format_RGB16][QImage::Format_ARGB32_Premultiplied] = qt_scale_image_argb32_on_rgb16_neon; | - | ||||||||||||||||||
| 6472 | qScaleFunctions[QImage::Format_RGB16][QImage::Format_RGB16] = qt_scale_image_rgb16_on_rgb16_neon; | - | ||||||||||||||||||
| 6473 | - | |||||||||||||||||||
| 6474 | qTransformFunctions[QImage::Format_RGB16][QImage::Format_ARGB32_Premultiplied] = qt_transform_image_argb32_on_rgb16_neon; | - | ||||||||||||||||||
| 6475 | qTransformFunctions[QImage::Format_RGB16][QImage::Format_RGB16] = qt_transform_image_rgb16_on_rgb16_neon; | - | ||||||||||||||||||
| 6476 | - | |||||||||||||||||||
| 6477 | qDrawHelper[QImage::Format_RGB16].alphamapBlit = qt_alphamapblit_quint16_neon; | - | ||||||||||||||||||
| 6478 | - | |||||||||||||||||||
| 6479 | destFetchProc[QImage::Format_RGB16] = qt_destFetchRGB16_neon; | - | ||||||||||||||||||
| 6480 | destStoreProc[QImage::Format_RGB16] = qt_destStoreRGB16_neon; | - | ||||||||||||||||||
| 6481 | - | |||||||||||||||||||
| 6482 | qMemRotateFunctions[QImage::Format_RGB16][0] = qt_memrotate90_16_neon; | - | ||||||||||||||||||
| 6483 | qMemRotateFunctions[QImage::Format_RGB16][2] = qt_memrotate270_16_neon; | - | ||||||||||||||||||
| 6484 | #endif | - | ||||||||||||||||||
| 6485 | - | |||||||||||||||||||
| 6486 | #endif | - | ||||||||||||||||||
| 6487 | - | |||||||||||||||||||
| 6488 | #if defined(Q_PROCESSOR_MIPS_32) && defined(QT_COMPILER_SUPPORTS_MIPS_DSP) | - | ||||||||||||||||||
| 6489 | qt_memfill32 = qt_memfill32_asm_mips_dsp; | - | ||||||||||||||||||
| 6490 | #endif // Q_PROCESSOR_MIPS_32 | - | ||||||||||||||||||
| 6491 | - | |||||||||||||||||||
| 6492 | #if defined(QT_COMPILER_SUPPORTS_MIPS_DSP) || defined(QT_COMPILER_SUPPORTS_MIPS_DSPR2) | - | ||||||||||||||||||
| 6493 | if (qCpuHasFeature(DSP) && qCpuHasFeature(DSPR2)) { | - | ||||||||||||||||||
| 6494 | // Composition functions are all DSP r1 | - | ||||||||||||||||||
| 6495 | qt_functionForMode_C[QPainter::CompositionMode_SourceOver] = comp_func_SourceOver_asm_mips_dsp; | - | ||||||||||||||||||
| 6496 | qt_functionForMode_C[QPainter::CompositionMode_Source] = comp_func_Source_mips_dsp; | - | ||||||||||||||||||
| 6497 | qt_functionForMode_C[QPainter::CompositionMode_DestinationOver] = comp_func_DestinationOver_mips_dsp; | - | ||||||||||||||||||
| 6498 | qt_functionForMode_C[QPainter::CompositionMode_SourceIn] = comp_func_SourceIn_mips_dsp; | - | ||||||||||||||||||
| 6499 | qt_functionForMode_C[QPainter::CompositionMode_DestinationIn] = comp_func_DestinationIn_mips_dsp; | - | ||||||||||||||||||
| 6500 | qt_functionForMode_C[QPainter::CompositionMode_DestinationOut] = comp_func_DestinationOut_mips_dsp; | - | ||||||||||||||||||
| 6501 | qt_functionForMode_C[QPainter::CompositionMode_SourceAtop] = comp_func_SourceAtop_mips_dsp; | - | ||||||||||||||||||
| 6502 | qt_functionForMode_C[QPainter::CompositionMode_DestinationAtop] = comp_func_DestinationAtop_mips_dsp; | - | ||||||||||||||||||
| 6503 | qt_functionForMode_C[QPainter::CompositionMode_Xor] = comp_func_XOR_mips_dsp; | - | ||||||||||||||||||
| 6504 | qt_functionForMode_C[QPainter::CompositionMode_SourceOut] = comp_func_SourceOut_mips_dsp; | - | ||||||||||||||||||
| 6505 | - | |||||||||||||||||||
| 6506 | qt_functionForModeSolid_C[QPainter::CompositionMode_SourceOver] = comp_func_solid_SourceOver_mips_dsp; | - | ||||||||||||||||||
| 6507 | qt_functionForModeSolid_C[QPainter::CompositionMode_DestinationOver] = comp_func_solid_DestinationOver_mips_dsp; | - | ||||||||||||||||||
| 6508 | qt_functionForModeSolid_C[QPainter::CompositionMode_SourceIn] = comp_func_solid_SourceIn_mips_dsp; | - | ||||||||||||||||||
| 6509 | qt_functionForModeSolid_C[QPainter::CompositionMode_DestinationIn] = comp_func_solid_DestinationIn_mips_dsp; | - | ||||||||||||||||||
| 6510 | qt_functionForModeSolid_C[QPainter::CompositionMode_SourceAtop] = comp_func_solid_SourceAtop_mips_dsp; | - | ||||||||||||||||||
| 6511 | qt_functionForModeSolid_C[QPainter::CompositionMode_DestinationAtop] = comp_func_solid_DestinationAtop_mips_dsp; | - | ||||||||||||||||||
| 6512 | qt_functionForModeSolid_C[QPainter::CompositionMode_Xor] = comp_func_solid_XOR_mips_dsp; | - | ||||||||||||||||||
| 6513 | qt_functionForModeSolid_C[QPainter::CompositionMode_SourceOut] = comp_func_solid_SourceOut_mips_dsp; | - | ||||||||||||||||||
| 6514 | - | |||||||||||||||||||
| 6515 | qBlendFunctions[QImage::Format_RGB32][QImage::Format_RGB32] = qt_blend_rgb32_on_rgb32_mips_dsp; | - | ||||||||||||||||||
| 6516 | qBlendFunctions[QImage::Format_ARGB32_Premultiplied][QImage::Format_RGB32] = qt_blend_rgb32_on_rgb32_mips_dsp; | - | ||||||||||||||||||
| 6517 | qBlendFunctions[QImage::Format_RGB32][QImage::Format_ARGB32_Premultiplied] = qt_blend_argb32_on_argb32_mips_dsp; | - | ||||||||||||||||||
| 6518 | qBlendFunctions[QImage::Format_ARGB32_Premultiplied][QImage::Format_ARGB32_Premultiplied] = qt_blend_argb32_on_argb32_mips_dsp; | - | ||||||||||||||||||
| 6519 | - | |||||||||||||||||||
| 6520 | destFetchProc[QImage::Format_ARGB32] = qt_destFetchARGB32_mips_dsp; | - | ||||||||||||||||||
| 6521 | - | |||||||||||||||||||
| 6522 | destStoreProc[QImage::Format_ARGB32] = qt_destStoreARGB32_mips_dsp; | - | ||||||||||||||||||
| 6523 | - | |||||||||||||||||||
| 6524 | sourceFetch[BlendUntransformed][QImage::Format_RGB888] = qt_fetchUntransformed_888_mips_dsp; | - | ||||||||||||||||||
| 6525 | sourceFetch[BlendTiled][QImage::Format_RGB888] = qt_fetchUntransformed_888_mips_dsp; | - | ||||||||||||||||||
| 6526 | - | |||||||||||||||||||
| 6527 | sourceFetch[BlendUntransformed][QImage::Format_RGB444] = qt_fetchUntransformed_444_mips_dsp; | - | ||||||||||||||||||
| 6528 | sourceFetch[BlendTiled][QImage::Format_RGB444] = qt_fetchUntransformed_444_mips_dsp; | - | ||||||||||||||||||
| 6529 | - | |||||||||||||||||||
| 6530 | sourceFetch[BlendUntransformed][QImage::Format_ARGB8565_Premultiplied] = qt_fetchUntransformed_argb8565_premultiplied_mips_dsp; | - | ||||||||||||||||||
| 6531 | sourceFetch[BlendTiled][QImage::Format_ARGB8565_Premultiplied] = qt_fetchUntransformed_argb8565_premultiplied_mips_dsp; | - | ||||||||||||||||||
| 6532 | - | |||||||||||||||||||
| 6533 | #if defined(QT_COMPILER_SUPPORTS_MIPS_DSPR2) | - | ||||||||||||||||||
| 6534 | qBlendFunctions[QImage::Format_RGB16][QImage::Format_RGB16] = qt_blend_rgb16_on_rgb16_mips_dspr2; | - | ||||||||||||||||||
| 6535 | #else | - | ||||||||||||||||||
| 6536 | qBlendFunctions[QImage::Format_RGB16][QImage::Format_RGB16] = qt_blend_rgb16_on_rgb16_mips_dsp; | - | ||||||||||||||||||
| 6537 | #endif // QT_COMPILER_SUPPORTS_MIPS_DSPR2 | - | ||||||||||||||||||
| 6538 | } | - | ||||||||||||||||||
| 6539 | #endif // QT_COMPILER_SUPPORTS_MIPS_DSP || QT_COMPILER_SUPPORTS_MIPS_DSPR2 | - | ||||||||||||||||||
| 6540 | } never executed: end of block | 0 | ||||||||||||||||||
| 6541 | - | |||||||||||||||||||
| 6542 | // Ensure initialization if this object file is linked. | - | ||||||||||||||||||
| 6543 | Q_CONSTRUCTOR_FUNCTION(qInitDrawhelperFunctions); never executed: end of block | 0 | ||||||||||||||||||
| 6544 | - | |||||||||||||||||||
| 6545 | QT_END_NAMESPACE | - | ||||||||||||||||||
| Source code | Switch to Preprocessed file |