Line | Source Code | Coverage |
---|
1 | #pragma GCC optimize "O3" | - |
2 | | - |
3 | | - |
4 | | - |
5 | | - |
6 | | - |
7 | | - |
8 | | - |
9 | | - |
10 | | - |
11 | | - |
12 | | - |
13 | | - |
14 | | - |
15 | | - |
16 | | - |
17 | | - |
18 | | - |
19 | enum { | - |
20 | fixed_scale = 1 << 16, | - |
21 | half_point = 1 << 15 | - |
22 | }; | - |
23 | | - |
24 | | - |
25 | static const int buffer_size = 2048; | - |
26 | | - |
27 | | - |
28 | | - |
29 | | - |
30 | | - |
31 | static const uint * convertIndexedToARGB32PM(uint *buffer, const uint *src, int count, | - |
32 | const QPixelLayout *, const QRgb *clut) | - |
33 | { | - |
34 | for (int i = 0; i < count; ++i) evaluated: i < count yes Evaluation Count:69009 | yes Evaluation Count:3393 |
| 3393-69009 |
35 | buffer[i] = PREMUL(clut[src[i]]); executed: buffer[i] = PREMUL(clut[src[i]]); Execution Count:69009 | 69009 |
36 | return buffer; executed: return buffer; Execution Count:3393 | 3393 |
37 | } | - |
38 | | - |
39 | static const uint * convertPassThrough(uint *, const uint *src, int, | - |
40 | const QPixelLayout *, const QRgb *) | - |
41 | { | - |
42 | return src; executed: return src; Execution Count:42077 | 42077 |
43 | } | - |
44 | | - |
45 | static const uint * convertRGB16ToARGB32PM(uint *buffer, const uint *src, int count, | - |
46 | const QPixelLayout *, const QRgb *) | - |
47 | { | - |
48 | for (int i = 0; i < count; ++i) evaluated: i < count yes Evaluation Count:280794 | yes Evaluation Count:3041 |
| 3041-280794 |
49 | buffer[i] = qConvertRgb16To32(src[i]); executed: buffer[i] = qConvertRgb16To32(src[i]); Execution Count:280794 | 280794 |
50 | return buffer; executed: return buffer; Execution Count:3041 | 3041 |
51 | } | - |
52 | | - |
53 | static const uint * convertARGB32ToARGB32PM(uint *buffer, const uint *src, int count, | - |
54 | const QPixelLayout *, const QRgb *) | - |
55 | { | - |
56 | for (int i = 0; i < count; ++i) evaluated: i < count yes Evaluation Count:1431100 | yes Evaluation Count:16167 |
| 16167-1431100 |
57 | buffer[i] = PREMUL(src[i]); executed: buffer[i] = PREMUL(src[i]); Execution Count:1431100 | 1431100 |
58 | return buffer; executed: return buffer; Execution Count:16167 | 16167 |
59 | } | - |
60 | | - |
61 | static const uint * convertToRGB32(uint *buffer, const uint *src, int count, | - |
62 | const QPixelLayout *layout, const QRgb *) | - |
63 | { | - |
64 | qt_noop(); | - |
65 | qt_noop(); | - |
66 | qt_noop(); | - |
67 | qt_noop(); | - |
68 | | - |
69 | const uint redMask = ((1 << layout->redWidth) - 1); | - |
70 | const uint greenMask = ((1 << layout->greenWidth) - 1); | - |
71 | const uint blueMask = ((1 << layout->blueWidth) - 1); | - |
72 | | - |
73 | const uchar redLeftShift = 8 - layout->redWidth; | - |
74 | const uchar greenLeftShift = 8 - layout->greenWidth; | - |
75 | const uchar blueLeftShift = 8 - layout->blueWidth; | - |
76 | | - |
77 | const uchar redRightShift = 2 * layout->redWidth - 8; | - |
78 | const uchar greenRightShift = 2 * layout->greenWidth - 8; | - |
79 | const uchar blueRightShift = 2 * layout->blueWidth - 8; | - |
80 | | - |
81 | for (int i = 0; i < count; ++i) { evaluated: i < count yes Evaluation Count:6060419 | yes Evaluation Count:1087009 |
| 1087009-6060419 |
82 | uint red = (src[i] >> layout->redShift) & redMask; | - |
83 | uint green = (src[i] >> layout->greenShift) & greenMask; | - |
84 | uint blue = (src[i] >> layout->blueShift) & blueMask; | - |
85 | | - |
86 | red = ((red << redLeftShift) | (red >> redRightShift)) << 16; | - |
87 | green = ((green << greenLeftShift) | (green >> greenRightShift)) << 8; | - |
88 | blue = (blue << blueLeftShift) | (blue >> blueRightShift); | - |
89 | buffer[i] = 0xff000000 | red | green | blue; | - |
90 | } executed: } Execution Count:6060419 | 6060419 |
91 | | - |
92 | return buffer; executed: return buffer; Execution Count:1087009 | 1087009 |
93 | } | - |
94 | | - |
95 | static const uint * convertToARGB32PM(uint *buffer, const uint *src, int count, | - |
96 | const QPixelLayout *layout, const QRgb *) | - |
97 | { | - |
98 | qt_noop(); | - |
99 | qt_noop(); | - |
100 | qt_noop(); | - |
101 | qt_noop(); | - |
102 | | - |
103 | const uint redMask = ((1 << layout->redWidth) - 1); | - |
104 | const uint greenMask = ((1 << layout->greenWidth) - 1); | - |
105 | const uint blueMask = ((1 << layout->blueWidth) - 1); | - |
106 | | - |
107 | const uchar redLeftShift = 8 - layout->redWidth; | - |
108 | const uchar greenLeftShift = 8 - layout->greenWidth; | - |
109 | const uchar blueLeftShift = 8 - layout->blueWidth; | - |
110 | | - |
111 | const uchar redRightShift = 2 * layout->redWidth - 8; | - |
112 | const uchar greenRightShift = 2 * layout->greenWidth - 8; | - |
113 | const uchar blueRightShift = 2 * layout->blueWidth - 8; | - |
114 | | - |
115 | const uint alphaMask = ((1 << layout->alphaWidth) - 1); | - |
116 | const uchar alphaLeftShift = 8 - layout->alphaWidth; | - |
117 | const uchar alphaRightShift = 2 * layout->alphaWidth - 8; | - |
118 | | - |
119 | if (layout->premultiplied) { partially evaluated: layout->premultiplied yes Evaluation Count:449773 | no Evaluation Count:0 |
| 0-449773 |
120 | for (int i = 0; i < count; ++i) { evaluated: i < count yes Evaluation Count:3279420 | yes Evaluation Count:449773 |
| 449773-3279420 |
121 | uint alpha = (src[i] >> layout->alphaShift) & alphaMask; | - |
122 | uint red = (src[i] >> layout->redShift) & redMask; | - |
123 | uint green = (src[i] >> layout->greenShift) & greenMask; | - |
124 | uint blue = (src[i] >> layout->blueShift) & blueMask; | - |
125 | | - |
126 | alpha = (alpha << alphaLeftShift) | (alpha >> alphaRightShift); | - |
127 | red = qMin(alpha, (red << redLeftShift) | (red >> redRightShift)); | - |
128 | green = qMin(alpha, (green << greenLeftShift) | (green >> greenRightShift)); | - |
129 | blue = qMin(alpha, (blue << blueLeftShift) | (blue >> blueRightShift)); | - |
130 | buffer[i] = (alpha << 24) | (red << 16) | (green << 8) | blue; | - |
131 | } executed: } Execution Count:3279420 | 3279420 |
132 | } else { executed: } Execution Count:449773 | 449773 |
133 | for (int i = 0; i < count; ++i) { never evaluated: i < count | 0 |
134 | uint alpha = (src[i] >> layout->alphaShift) & alphaMask; | - |
135 | uint red = (src[i] >> layout->redShift) & redMask; | - |
136 | uint green = (src[i] >> layout->greenShift) & greenMask; | - |
137 | uint blue = (src[i] >> layout->blueShift) & blueMask; | - |
138 | | - |
139 | alpha = (alpha << alphaLeftShift) | (alpha >> alphaRightShift); | - |
140 | red = (red << redLeftShift) | (red >> redRightShift); | - |
141 | green = (green << greenLeftShift) | (green >> greenRightShift); | - |
142 | blue = (blue << blueLeftShift) | (blue >> blueRightShift); | - |
143 | buffer[i] = PREMUL((alpha << 24) | (red << 16) | (green << 8) | blue); | - |
144 | } | 0 |
145 | } | 0 |
146 | return buffer; executed: return buffer; Execution Count:449773 | 449773 |
147 | } | - |
148 | | - |
149 | static const uint * convertRGB16FromARGB32PM(uint *buffer, const uint *src, int count, | - |
150 | const QPixelLayout *, const QRgb *) | - |
151 | { | - |
152 | for (int i = 0; i < count; ++i) evaluated: i < count yes Evaluation Count:242710 | yes Evaluation Count:5005 |
| 5005-242710 |
153 | buffer[i] = qConvertRgb32To16((qAlpha(src[i]) == 0 ? 0 : ((qAlpha(src[i]) << 24) | (((255*qRed(src[i]))/ qAlpha(src[i])) << 16) | (((255*qGreen(src[i])) / qAlpha(src[i])) << 8) | ((255*qBlue(src[i])) / qAlpha(src[i]))))); executed: buffer[i] = qConvertRgb32To16((qAlpha(src[i]) == 0 ? 0 : ((qAlpha(src[i]) << 24) | (((255*qRed(src[i]))/ qAlpha(src[i])) << 16) | (((255*qGreen(src[i])) / qAlpha(src[i])) << 8) | ((255*qBlue(src[i])) / qAlpha(src[i]))))); Execution Count:242710 | 242710 |
154 | return buffer; executed: return buffer; Execution Count:5005 | 5005 |
155 | } | - |
156 | | - |
157 | static const uint * convertARGB32FromARGB32PM(uint *buffer, const uint *src, int count, | - |
158 | const QPixelLayout *, const QRgb *) | - |
159 | { | - |
160 | for (int i = 0; i < count; ++i) evaluated: i < count yes Evaluation Count:1798047 | yes Evaluation Count:42902 |
| 42902-1798047 |
161 | buffer[i] = (qAlpha(src[i]) == 0 ? 0 : ((qAlpha(src[i]) << 24) | (((255*qRed(src[i]))/ qAlpha(src[i])) << 16) | (((255*qGreen(src[i])) / qAlpha(src[i])) << 8) | ((255*qBlue(src[i])) / qAlpha(src[i])))); evaluated: qAlpha(src[i]) == 0 yes Evaluation Count:422700 | yes Evaluation Count:1375347 |
executed: buffer[i] = (qAlpha(src[i]) == 0 ? 0 : ((qAlpha(src[i]) << 24) | (((255*qRed(src[i]))/ qAlpha(src[i])) << 16) | (((255*qGreen(src[i])) / qAlpha(src[i])) << 8) | ((255*qBlue(src[i])) / qAlpha(src[i])))); Execution Count:1798047 | 422700-1798047 |
162 | return buffer; executed: return buffer; Execution Count:42902 | 42902 |
163 | } | - |
164 | | - |
165 | static const uint * convertFromARGB32PM(uint *buffer, const uint *src, int count, | - |
166 | const QPixelLayout *layout, const QRgb *) | - |
167 | { | - |
168 | qt_noop(); | - |
169 | qt_noop(); | - |
170 | qt_noop(); | - |
171 | qt_noop(); | - |
172 | | - |
173 | const uint redMask = (1 << layout->redWidth) - 1; | - |
174 | const uint greenMask = (1 << layout->greenWidth) - 1; | - |
175 | const uint blueMask = (1 << layout->blueWidth) - 1; | - |
176 | const uint alphaMask = (1 << layout->alphaWidth) - 1; | - |
177 | | - |
178 | const uchar redRightShift = 24 - layout->redWidth; | - |
179 | const uchar greenRightShift = 16 - layout->greenWidth; | - |
180 | const uchar blueRightShift = 8 - layout->blueWidth; | - |
181 | const uchar alphaRightShift = 32 - layout->alphaWidth; | - |
182 | | - |
183 | if (!layout->premultiplied) { evaluated: !layout->premultiplied yes Evaluation Count:104293 | yes Evaluation Count:62937 |
| 62937-104293 |
184 | for (int i = 0; i < count; ++i) evaluated: i < count yes Evaluation Count:8235233 | yes Evaluation Count:104293 |
| 104293-8235233 |
185 | buffer[i] = qAlpha(src[i]) == 255 ? src[i] : (qAlpha(src[i]) == 0 ? 0 : ((qAlpha(src[i]) << 24) | (((255*qRed(src[i]))/ qAlpha(src[i])) << 16) | (((255*qGreen(src[i])) / qAlpha(src[i])) << 8) | ((255*qBlue(src[i])) / qAlpha(src[i])))); evaluated: qAlpha(src[i]) == 255 yes Evaluation Count:7952693 | yes Evaluation Count:282540 |
executed: buffer[i] = qAlpha(src[i]) == 255 ? src[i] : (qAlpha(src[i]) == 0 ? 0 : ((qAlpha(src[i]) << 24) | (((255*qRed(src[i]))/ qAlpha(src[i])) << 16) | (((255*qGreen(src[i])) / qAlpha(src[i])) << 8) | ((255*qBlue(src[i])) / qAlpha(src[i])))); Execution Count:8235233 | 282540-8235233 |
186 | src = buffer; | - |
187 | } executed: } Execution Count:104293 | 104293 |
188 | for (int i = 0; i < count; ++i) { evaluated: i < count yes Evaluation Count:12486467 | yes Evaluation Count:167230 |
| 167230-12486467 |
189 | uint red = ((src[i] >> redRightShift) & redMask) << layout->redShift; | - |
190 | uint green = ((src[i] >> greenRightShift) & greenMask) << layout->greenShift; | - |
191 | uint blue = ((src[i] >> blueRightShift) & blueMask) << layout->blueShift; | - |
192 | uint alpha = ((src[i] >> alphaRightShift) & alphaMask) << layout->alphaShift; | - |
193 | buffer[i] = red | green | blue | alpha; | - |
194 | } executed: } Execution Count:12486467 | 12486467 |
195 | return buffer; executed: return buffer; Execution Count:167230 | 167230 |
196 | } | - |
197 | | - |
198 | template <QPixelLayout::BPP bpp> static | - |
199 | uint fetchPixel(const uchar *src, int index); | - |
200 | | - |
201 | template <> | - |
202 | inline uint fetchPixel<QPixelLayout::BPP1LSB>(const uchar *src, int index) | - |
203 | { | - |
204 | return (src[index >> 3] >> (index & 7)) & 1; executed: return (src[index >> 3] >> (index & 7)) & 1; Execution Count:22984 | 22984 |
205 | } | - |
206 | | - |
207 | template <> | - |
208 | inline uint fetchPixel<QPixelLayout::BPP1MSB>(const uchar *src, int index) | - |
209 | { | - |
210 | return (src[index >> 3] >> (~index & 7)) & 1; executed: return (src[index >> 3] >> (~index & 7)) & 1; Execution Count:23065 | 23065 |
211 | } | - |
212 | | - |
213 | template <> | - |
214 | inline uint fetchPixel<QPixelLayout::BPP8>(const uchar *src, int index) | - |
215 | { | - |
216 | return src[index]; executed: return src[index]; Execution Count:22960 | 22960 |
217 | } | - |
218 | | - |
219 | template <> | - |
220 | inline uint fetchPixel<QPixelLayout::BPP16>(const uchar *src, int index) | - |
221 | { | - |
222 | return reinterpret_cast<const quint16 *>(src)[index]; executed: return reinterpret_cast<const quint16 *>(src)[index]; Execution Count:2919303 | 2919303 |
223 | } | - |
224 | | - |
225 | template <> | - |
226 | inline uint fetchPixel<QPixelLayout::BPP24>(const uchar *src, int index) | - |
227 | { | - |
228 | return reinterpret_cast<const quint24 *>(src)[index]; executed: return reinterpret_cast<const quint24 *>(src)[index]; Execution Count:6702930 | 6702930 |
229 | } | - |
230 | | - |
231 | template <> | - |
232 | inline uint fetchPixel<QPixelLayout::BPP32>(const uchar *src, int index) | - |
233 | { | - |
234 | return reinterpret_cast<const uint *>(src)[index]; never executed: return reinterpret_cast<const uint *>(src)[index]; | 0 |
235 | } | - |
236 | | - |
237 | template <QPixelLayout::BPP bpp> | - |
238 | inline const uint * fetchPixels(uint *buffer, const uchar *src, int index, int count) | - |
239 | { | - |
240 | for (int i = 0; i < count; ++i) evaluated: i < count yes Evaluation Count:9689113 | yes Evaluation Count:1543159 |
| 1543159-9689113 |
241 | buffer[i] = fetchPixel<bpp>(src, index + i); executed: buffer[i] = fetchPixel<bpp>(src, index + i); Execution Count:9689113 | 9689113 |
242 | return buffer; executed: return buffer; Execution Count:1543159 | 1543159 |
243 | } | - |
244 | | - |
245 | template <> | - |
246 | inline const uint * fetchPixels<QPixelLayout::BPP32>(uint *, const uchar *src, int index, int) | - |
247 | { | - |
248 | return reinterpret_cast<const uint *>(src) + index; executed: return reinterpret_cast<const uint *>(src) + index; Execution Count:50906 | 50906 |
249 | } | - |
250 | | - |
251 | template <QPixelLayout::BPP width> static | - |
252 | void storePixel(uchar *dest, int index, uint pixel); | - |
253 | | - |
254 | template <> | - |
255 | inline void storePixel<QPixelLayout::BPP1LSB>(uchar *dest, int index, uint pixel) | - |
256 | { | - |
257 | if (pixel) | 0 |
258 | dest[index >> 3] |= 1 << (index & 7); never executed: dest[index >> 3] |= 1 << (index & 7); | 0 |
259 | else | - |
260 | dest[index >> 3] &= ~(1 << (index & 7)); never executed: dest[index >> 3] &= ~(1 << (index & 7)); | 0 |
261 | } | - |
262 | | - |
263 | template <> | - |
264 | inline void storePixel<QPixelLayout::BPP1MSB>(uchar *dest, int index, uint pixel) | - |
265 | { | - |
266 | if (pixel) | 0 |
267 | dest[index >> 3] |= 1 << (~index & 7); never executed: dest[index >> 3] |= 1 << (~index & 7); | 0 |
268 | else | - |
269 | dest[index >> 3] &= ~(1 << (~index & 7)); never executed: dest[index >> 3] &= ~(1 << (~index & 7)); | 0 |
270 | } | - |
271 | | - |
272 | template <> | - |
273 | inline void storePixel<QPixelLayout::BPP8>(uchar *dest, int index, uint pixel) | - |
274 | { | - |
275 | dest[index] = uchar(pixel); | - |
276 | } | 0 |
277 | | - |
278 | template <> | - |
279 | inline void storePixel<QPixelLayout::BPP16>(uchar *dest, int index, uint pixel) | - |
280 | { | - |
281 | reinterpret_cast<quint16 *>(dest)[index] = quint16(pixel); | - |
282 | } executed: } Execution Count:3419198 | 3419198 |
283 | | - |
284 | template <> | - |
285 | inline void storePixel<QPixelLayout::BPP24>(uchar *dest, int index, uint pixel) | - |
286 | { | - |
287 | reinterpret_cast<quint24 *>(dest)[index] = quint24(pixel); | - |
288 | } executed: } Execution Count:9311579 | 9311579 |
289 | | - |
290 | template <> | - |
291 | inline void storePixel<QPixelLayout::BPP32>(uchar *dest, int index, uint pixel) | - |
292 | { | - |
293 | reinterpret_cast<uint *>(dest)[index] = pixel; | - |
294 | } | 0 |
295 | | - |
296 | template <QPixelLayout::BPP width> | - |
297 | inline void storePixels(uchar *dest, const uint *src, int index, int count) | - |
298 | { | - |
299 | for (int i = 0; i < count; ++i) evaluated: i < count yes Evaluation Count:12730777 | yes Evaluation Count:172251 |
| 172251-12730777 |
300 | storePixel<width>(dest, index + i, src[i]); executed: storePixel<width>(dest, index + i, src[i]); Execution Count:12730777 | 12730777 |
301 | } executed: } Execution Count:172251 | 172251 |
302 | | - |
303 | template <> | - |
304 | inline void storePixels<QPixelLayout::BPP32>(uchar *dest, const uint *src, int index, int count) | - |
305 | { | - |
306 | memcpy(reinterpret_cast<uint *>(dest) + index, src, count * sizeof(uint)); | - |
307 | } executed: } Execution Count:49891 | 49891 |
308 | | - |
309 | | - |
310 | | - |
311 | | - |
312 | | - |
313 | QPixelLayout qPixelLayouts[QImage::NImageFormats] = { | - |
314 | { 0, 0, 0, 0, 0, 0, 0, 0, false, QPixelLayout::BPPNone, 0, 0 }, | - |
315 | { 0, 0, 0, 0, 0, 0, 0, 0, false, QPixelLayout::BPP1MSB, convertIndexedToARGB32PM, 0 }, | - |
316 | { 0, 0, 0, 0, 0, 0, 0, 0, false, QPixelLayout::BPP1LSB, convertIndexedToARGB32PM, 0 }, | - |
317 | { 0, 0, 0, 0, 0, 0, 0, 0, false, QPixelLayout::BPP8, convertIndexedToARGB32PM, 0 }, | - |
318 | { 8, 16, 8, 8, 8, 0, 0, 0, false, QPixelLayout::BPP32, convertPassThrough, convertPassThrough }, | - |
319 | { 8, 16, 8, 8, 8, 0, 8, 24, false, QPixelLayout::BPP32, convertARGB32ToARGB32PM, convertARGB32FromARGB32PM }, | - |
320 | { 8, 16, 8, 8, 8, 0, 8, 24, true, QPixelLayout::BPP32, convertPassThrough, convertPassThrough }, | - |
321 | { 5, 11, 6, 5, 5, 0, 0, 0, false, QPixelLayout::BPP16, convertRGB16ToARGB32PM, convertRGB16FromARGB32PM }, | - |
322 | { 5, 19, 6, 13, 5, 8, 8, 0, true, QPixelLayout::BPP24, convertToARGB32PM, convertFromARGB32PM }, | - |
323 | { 6, 12, 6, 6, 6, 0, 0, 0, false, QPixelLayout::BPP24, convertToRGB32, convertFromARGB32PM }, | - |
324 | { 6, 12, 6, 6, 6, 0, 6, 18, true, QPixelLayout::BPP24, convertToARGB32PM, convertFromARGB32PM }, | - |
325 | { 5, 10, 5, 5, 5, 0, 0, 0, false, QPixelLayout::BPP16, convertToRGB32, convertFromARGB32PM }, | - |
326 | { 5, 18, 5, 13, 5, 8, 8, 0, true, QPixelLayout::BPP24, convertToARGB32PM, convertFromARGB32PM }, | - |
327 | { 8, 16, 8, 8, 8, 0, 0, 0, false, QPixelLayout::BPP24, convertToRGB32, convertFromARGB32PM }, | - |
328 | { 4, 8, 4, 4, 4, 0, 0, 0, false, QPixelLayout::BPP16, convertToRGB32, convertFromARGB32PM }, | - |
329 | { 4, 8, 4, 4, 4, 0, 4, 12, true, QPixelLayout::BPP16, convertToARGB32PM, convertFromARGB32PM } | - |
330 | }; | - |
331 | | - |
332 | FetchPixelsFunc qFetchPixels[QPixelLayout::BPPCount] = { | - |
333 | 0, | - |
334 | fetchPixels<QPixelLayout::BPP1MSB>, | - |
335 | fetchPixels<QPixelLayout::BPP1LSB>, | - |
336 | fetchPixels<QPixelLayout::BPP8>, | - |
337 | fetchPixels<QPixelLayout::BPP16>, | - |
338 | fetchPixels<QPixelLayout::BPP24>, | - |
339 | fetchPixels<QPixelLayout::BPP32> | - |
340 | }; | - |
341 | | - |
342 | StorePixelsFunc qStorePixels[QPixelLayout::BPPCount] = { | - |
343 | 0, | - |
344 | storePixels<QPixelLayout::BPP1MSB>, | - |
345 | storePixels<QPixelLayout::BPP1LSB>, | - |
346 | storePixels<QPixelLayout::BPP8>, | - |
347 | storePixels<QPixelLayout::BPP16>, | - |
348 | storePixels<QPixelLayout::BPP24>, | - |
349 | storePixels<QPixelLayout::BPP32> | - |
350 | }; | - |
351 | | - |
352 | typedef uint ( *FetchPixelFunc)(const uchar *src, int index); | - |
353 | | - |
354 | FetchPixelFunc qFetchPixel[QPixelLayout::BPPCount] = { | - |
355 | 0, | - |
356 | fetchPixel<QPixelLayout::BPP1MSB>, | - |
357 | fetchPixel<QPixelLayout::BPP1LSB>, | - |
358 | fetchPixel<QPixelLayout::BPP8>, | - |
359 | fetchPixel<QPixelLayout::BPP16>, | - |
360 | fetchPixel<QPixelLayout::BPP24>, | - |
361 | fetchPixel<QPixelLayout::BPP32> | - |
362 | }; | - |
363 | | - |
364 | | - |
365 | | - |
366 | | - |
367 | | - |
368 | | - |
369 | static uint * destFetchMono(uint *buffer, QRasterBuffer *rasterBuffer, int x, int y, int length) | - |
370 | { | - |
371 | uchar *__restrict__ data = (uchar *)rasterBuffer->scanLine(y); | - |
372 | uint *start = buffer; | - |
373 | const uint *end = buffer + length; | - |
374 | while (buffer < end) { evaluated: buffer < end yes Evaluation Count:9885 | yes Evaluation Count:501 |
| 501-9885 |
375 | *buffer = data[x>>3] & (0x80 >> (x & 7)) ? rasterBuffer->destColor1 : rasterBuffer->destColor0; evaluated: data[x>>3] & (0x80 >> (x & 7)) yes Evaluation Count:27 | yes Evaluation Count:9858 |
| 27-9858 |
376 | ++buffer; | - |
377 | ++x; | - |
378 | } executed: } Execution Count:9885 | 9885 |
379 | return start; executed: return start; Execution Count:501 | 501 |
380 | } | - |
381 | | - |
382 | static uint * destFetchMonoLsb(uint *buffer, QRasterBuffer *rasterBuffer, int x, int y, int length) | - |
383 | { | - |
384 | uchar *__restrict__ data = (uchar *)rasterBuffer->scanLine(y); | - |
385 | uint *start = buffer; | - |
386 | const uint *end = buffer + length; | - |
387 | while (buffer < end) { evaluated: buffer < end yes Evaluation Count:107917 | yes Evaluation Count:98539 |
| 98539-107917 |
388 | *buffer = data[x>>3] & (0x1 << (x & 7)) ? rasterBuffer->destColor1 : rasterBuffer->destColor0; evaluated: data[x>>3] & (0x1 << (x & 7)) yes Evaluation Count:4381 | yes Evaluation Count:103536 |
| 4381-103536 |
389 | ++buffer; | - |
390 | ++x; | - |
391 | } executed: } Execution Count:107917 | 107917 |
392 | return start; executed: return start; Execution Count:98539 | 98539 |
393 | } | - |
394 | | - |
395 | static uint * destFetchARGB32P(uint *, QRasterBuffer *rasterBuffer, int x, int y, int) | - |
396 | { | - |
397 | return (uint *)rasterBuffer->scanLine(y) + x; executed: return (uint *)rasterBuffer->scanLine(y) + x; Execution Count:88114 | 88114 |
398 | } | - |
399 | | - |
400 | static uint * destFetchRGB16(uint *buffer, QRasterBuffer *rasterBuffer, int x, int y, int length) | - |
401 | { | - |
402 | const ushort *__restrict__ data = (const ushort *)rasterBuffer->scanLine(y) + x; | - |
403 | for (int i = 0; i < length; ++i) evaluated: i < length yes Evaluation Count:1786111 | yes Evaluation Count:353478 |
| 353478-1786111 |
404 | buffer[i] = qConvertRgb16To32(data[i]); executed: buffer[i] = qConvertRgb16To32(data[i]); Execution Count:1786111 | 1786111 |
405 | return buffer; executed: return buffer; Execution Count:353478 | 353478 |
406 | } | - |
407 | | - |
408 | static uint * destFetch(uint *buffer, QRasterBuffer *rasterBuffer, int x, int y, int length) | - |
409 | { | - |
410 | const QPixelLayout *layout = &qPixelLayouts[rasterBuffer->format]; | - |
411 | const uint *ptr = qFetchPixels[layout->bpp](buffer, rasterBuffer->scanLine(y), x, length); | - |
412 | return const_cast<uint *>(layout->convertToARGB32PM(buffer, ptr, length, layout, 0)); executed: return const_cast<uint *>(layout->convertToARGB32PM(buffer, ptr, length, layout, 0)); Execution Count:44952 | 44952 |
413 | } | - |
414 | | - |
415 | | - |
416 | static DestFetchProc destFetchProc[QImage::NImageFormats] = | - |
417 | { | - |
418 | 0, | - |
419 | destFetchMono, | - |
420 | destFetchMonoLsb, | - |
421 | 0, | - |
422 | destFetchARGB32P, | - |
423 | destFetch, | - |
424 | destFetchARGB32P, | - |
425 | destFetchRGB16, | - |
426 | destFetch, | - |
427 | destFetch, | - |
428 | destFetch, | - |
429 | destFetch, | - |
430 | destFetch, | - |
431 | destFetch, | - |
432 | destFetch, | - |
433 | destFetch | - |
434 | }; | - |
435 | | - |
436 | | - |
437 | | - |
438 | | - |
439 | | - |
440 | static inline QRgb findNearestColor(QRgb color, QRasterBuffer *rbuf) | - |
441 | { | - |
442 | QRgb color_0 = PREMUL(rbuf->destColor0); | - |
443 | QRgb color_1 = PREMUL(rbuf->destColor1); | - |
444 | color = PREMUL(color); | - |
445 | | - |
446 | int r = qRed(color); | - |
447 | int g = qGreen(color); | - |
448 | int b = qBlue(color); | - |
449 | int rx, gx, bx; | - |
450 | int dist_0, dist_1; | - |
451 | | - |
452 | rx = r - qRed(color_0); | - |
453 | gx = g - qGreen(color_0); | - |
454 | bx = b - qBlue(color_0); | - |
455 | dist_0 = rx*rx + gx*gx + bx*bx; | - |
456 | | - |
457 | rx = r - qRed(color_1); | - |
458 | gx = g - qGreen(color_1); | - |
459 | bx = b - qBlue(color_1); | - |
460 | dist_1 = rx*rx + gx*gx + bx*bx; | - |
461 | | - |
462 | if (dist_0 < dist_1) partially evaluated: dist_0 < dist_1 no Evaluation Count:0 | yes Evaluation Count:4399 |
| 0-4399 |
463 | return color_0; never executed: return color_0; | 0 |
464 | return color_1; executed: return color_1; Execution Count:4399 | 4399 |
465 | } | - |
466 | | - |
467 | | - |
468 | | - |
469 | | - |
470 | | - |
471 | static void destStoreMono(QRasterBuffer *rasterBuffer, int x, int y, const uint *buffer, int length) | - |
472 | { | - |
473 | uchar *__restrict__ data = (uchar *)rasterBuffer->scanLine(y); | - |
474 | if (rasterBuffer->monoDestinationWithClut) { partially evaluated: rasterBuffer->monoDestinationWithClut yes Evaluation Count:1288 | no Evaluation Count:0 |
| 0-1288 |
475 | for (int i = 0; i < length; ++i) { evaluated: i < length yes Evaluation Count:45095 | yes Evaluation Count:1288 |
| 1288-45095 |
476 | if (buffer[i] == rasterBuffer->destColor0) { evaluated: buffer[i] == rasterBuffer->destColor0 yes Evaluation Count:82 | yes Evaluation Count:45013 |
| 82-45013 |
477 | data[x >> 3] &= ~(0x80 >> (x & 7)); | - |
478 | } else if (buffer[i] == rasterBuffer->destColor1) { executed: } Execution Count:82 evaluated: buffer[i] == rasterBuffer->destColor1 yes Evaluation Count:44977 | yes Evaluation Count:36 |
| 36-44977 |
479 | data[x >> 3] |= 0x80 >> (x & 7); | - |
480 | } else if (findNearestColor(buffer[i], rasterBuffer) == rasterBuffer->destColor0) { executed: } Execution Count:44977 partially evaluated: findNearestColor(buffer[i], rasterBuffer) == rasterBuffer->destColor0 yes Evaluation Count:36 | no Evaluation Count:0 |
| 0-44977 |
481 | data[x >> 3] &= ~(0x80 >> (x & 7)); | - |
482 | } else { executed: } Execution Count:36 | 36 |
483 | data[x >> 3] |= 0x80 >> (x & 7); | - |
484 | } | 0 |
485 | ++x; | - |
486 | } executed: } Execution Count:45095 | 45095 |
487 | } else { executed: } Execution Count:1288 | 1288 |
488 | for (int i = 0; i < length; ++i) { never evaluated: i < length | 0 |
489 | if (qGray(buffer[i]) < int(qt_bayer_matrix[y & 15][x & 15])) never evaluated: qGray(buffer[i]) < int(qt_bayer_matrix[y & 15][x & 15]) | 0 |
490 | data[x >> 3] |= 0x80 >> (x & 7); never executed: data[x >> 3] |= 0x80 >> (x & 7); | 0 |
491 | else | - |
492 | data[x >> 3] &= ~(0x80 >> (x & 7)); never executed: data[x >> 3] &= ~(0x80 >> (x & 7)); | 0 |
493 | ++x; | - |
494 | } | 0 |
495 | } | 0 |
496 | } | - |
497 | | - |
498 | static void destStoreMonoLsb(QRasterBuffer *rasterBuffer, int x, int y, const uint *buffer, int length) | - |
499 | { | - |
500 | uchar *__restrict__ data = (uchar *)rasterBuffer->scanLine(y); | - |
501 | if (rasterBuffer->monoDestinationWithClut) { partially evaluated: rasterBuffer->monoDestinationWithClut yes Evaluation Count:133696 | no Evaluation Count:0 |
| 0-133696 |
502 | for (int i = 0; i < length; ++i) { evaluated: i < length yes Evaluation Count:214899 | yes Evaluation Count:133696 |
| 133696-214899 |
503 | if (buffer[i] == rasterBuffer->destColor0) { evaluated: buffer[i] == rasterBuffer->destColor0 yes Evaluation Count:159254 | yes Evaluation Count:55645 |
| 55645-159254 |
504 | data[x >> 3] &= ~(1 << (x & 7)); | - |
505 | } else if (buffer[i] == rasterBuffer->destColor1) { executed: } Execution Count:159254 evaluated: buffer[i] == rasterBuffer->destColor1 yes Evaluation Count:51282 | yes Evaluation Count:4363 |
| 4363-159254 |
506 | data[x >> 3] |= 1 << (x & 7); | - |
507 | } else if (findNearestColor(buffer[i], rasterBuffer) == rasterBuffer->destColor0) { executed: } Execution Count:51282 partially evaluated: findNearestColor(buffer[i], rasterBuffer) == rasterBuffer->destColor0 no Evaluation Count:0 | yes Evaluation Count:4363 |
| 0-51282 |
508 | data[x >> 3] &= ~(1 << (x & 7)); | - |
509 | } else { | 0 |
510 | data[x >> 3] |= 1 << (x & 7); | - |
511 | } executed: } Execution Count:4363 | 4363 |
512 | ++x; | - |
513 | } executed: } Execution Count:214899 | 214899 |
514 | } else { executed: } Execution Count:133696 | 133696 |
515 | for (int i = 0; i < length; ++i) { never evaluated: i < length | 0 |
516 | if (qGray(buffer[i]) < int(qt_bayer_matrix[y & 15][x & 15])) never evaluated: qGray(buffer[i]) < int(qt_bayer_matrix[y & 15][x & 15]) | 0 |
517 | data[x >> 3] |= 1 << (x & 7); never executed: data[x >> 3] |= 1 << (x & 7); | 0 |
518 | else | - |
519 | data[x >> 3] &= ~(1 << (x & 7)); never executed: data[x >> 3] &= ~(1 << (x & 7)); | 0 |
520 | ++x; | - |
521 | } | 0 |
522 | } | 0 |
523 | } | - |
524 | | - |
525 | static void destStoreRGB16(QRasterBuffer *rasterBuffer, int x, int y, const uint *buffer, int length) | - |
526 | { | - |
527 | quint16 *data = (quint16*)rasterBuffer->scanLine(y) + x; | - |
528 | for (int i = 0; i < length; ++i) evaluated: i < length yes Evaluation Count:1891063 | yes Evaluation Count:354815 |
| 354815-1891063 |
529 | data[i] = qConvertRgb32To16(buffer[i]); executed: data[i] = qConvertRgb32To16(buffer[i]); Execution Count:1891063 | 1891063 |
530 | } executed: } Execution Count:354815 | 354815 |
531 | | - |
532 | static void destStore(QRasterBuffer *rasterBuffer, int x, int y, const uint *buffer, int length) | - |
533 | { | - |
534 | uint buf[buffer_size]; | - |
535 | const QPixelLayout *layout = &qPixelLayouts[rasterBuffer->format]; | - |
536 | StorePixelsFunc store = qStorePixels[layout->bpp]; | - |
537 | uchar *dest = rasterBuffer->scanLine(y); | - |
538 | while (length) { evaluated: length yes Evaluation Count:147575 | yes Evaluation Count:147575 |
| 147575 |
539 | int l = qMin(length, buffer_size); | - |
540 | const uint *ptr = layout->convertFromARGB32PM(buf, buffer, l, layout, 0); | - |
541 | store(dest, ptr, x, l); | - |
542 | length -= l; | - |
543 | buffer += l; | - |
544 | x += l; | - |
545 | } executed: } Execution Count:147575 | 147575 |
546 | } executed: } Execution Count:147575 | 147575 |
547 | | - |
548 | static DestStoreProc destStoreProc[QImage::NImageFormats] = | - |
549 | { | - |
550 | 0, | - |
551 | destStoreMono, | - |
552 | destStoreMonoLsb, | - |
553 | 0, | - |
554 | 0, | - |
555 | destStore, | - |
556 | 0, | - |
557 | destStoreRGB16, | - |
558 | destStore, | - |
559 | destStore, | - |
560 | destStore, | - |
561 | destStore, | - |
562 | destStore, | - |
563 | destStore, | - |
564 | destStore, | - |
565 | destStore | - |
566 | }; | - |
567 | enum TextureBlendType { | - |
568 | BlendUntransformed, | - |
569 | BlendTiled, | - |
570 | BlendTransformed, | - |
571 | BlendTransformedTiled, | - |
572 | BlendTransformedBilinear, | - |
573 | BlendTransformedBilinearTiled, | - |
574 | NBlendTypes | - |
575 | }; | - |
576 | | - |
577 | static const uint * fetchUntransformed(uint *buffer, const Operator *, | - |
578 | const QSpanData *data, int y, int x, int length) | - |
579 | { | - |
580 | const QPixelLayout *layout = &qPixelLayouts[data->texture.format]; | - |
581 | const uint *ptr = qFetchPixels[layout->bpp](buffer, data->texture.scanLine(y), x, length); | - |
582 | const QRgb *clut = data->texture.colorTable ? data->texture.colorTable->constData() : 0; evaluated: data->texture.colorTable yes Evaluation Count:3384 | yes Evaluation Count:53928 |
| 3384-53928 |
583 | return layout->convertToARGB32PM(buffer, ptr, length, layout, clut); executed: return layout->convertToARGB32PM(buffer, ptr, length, layout, clut); Execution Count:57312 | 57312 |
584 | } | - |
585 | | - |
586 | static const uint * fetchUntransformedARGB32PM(uint *, const Operator *, | - |
587 | const QSpanData *data, int y, int x, int) | - |
588 | { | - |
589 | const uchar *scanLine = data->texture.scanLine(y); | - |
590 | return ((const uint *)scanLine) + x; executed: return ((const uint *)scanLine) + x; Execution Count:417370 | 417370 |
591 | } | - |
592 | | - |
593 | static const uint * fetchUntransformedRGB16(uint *buffer, const Operator *, | - |
594 | const QSpanData *data, int y, int x, | - |
595 | int length) | - |
596 | { | - |
597 | const quint16 *scanLine = (const quint16 *)data->texture.scanLine(y) + x; | - |
598 | | - |
599 | | - |
600 | | - |
601 | for (int i = 0; i < length; ++i) evaluated: i < length yes Evaluation Count:279512 | yes Evaluation Count:4124 |
| 4124-279512 |
602 | buffer[i] = qConvertRgb16To32(scanLine[i]); executed: buffer[i] = qConvertRgb16To32(scanLine[i]); Execution Count:279512 | 279512 |
603 | | - |
604 | return buffer; executed: return buffer; Execution Count:4124 | 4124 |
605 | } | - |
606 | | - |
607 | | - |
608 | template<TextureBlendType blendType> | - |
609 | static const uint * fetchTransformedARGB32PM(uint *buffer, const Operator *, const QSpanData *data, | - |
610 | int y, int x, int length) | - |
611 | { | - |
612 | int image_width = data->texture.width; | - |
613 | int image_height = data->texture.height; | - |
614 | | - |
615 | const qreal cx = x + qreal(0.5); | - |
616 | const qreal cy = y + qreal(0.5); | - |
617 | | - |
618 | const uint *end = buffer + length; | - |
619 | uint *b = buffer; | - |
620 | if (data->fast_matrix) { never evaluated: data->fast_matrix | 0 |
621 | | - |
622 | int fdx = (int)(data->m11 * fixed_scale); | - |
623 | int fdy = (int)(data->m12 * fixed_scale); | - |
624 | | - |
625 | int fx = int((data->m21 * cy | - |
626 | + data->m11 * cx + data->dx) * fixed_scale); | - |
627 | int fy = int((data->m22 * cy | - |
628 | + data->m12 * cx + data->dy) * fixed_scale); | - |
629 | | - |
630 | while (b < end) { | 0 |
631 | int px = fx >> 16; | - |
632 | int py = fy >> 16; | - |
633 | | - |
634 | if (blendType == BlendTransformedTiled) { never evaluated: blendType == BlendTransformedTiled | 0 |
635 | px %= image_width; | - |
636 | py %= image_height; | - |
637 | if (px < 0) px += image_width; never executed: px += image_width; | 0 |
638 | if (py < 0) py += image_height; never executed: py += image_height; | 0 |
639 | } else { | 0 |
640 | px = qBound(0, px, image_width - 1); | - |
641 | py = qBound(0, py, image_height - 1); | - |
642 | } | 0 |
643 | *b = reinterpret_cast<const uint *>(data->texture.scanLine(py))[px]; | - |
644 | | - |
645 | fx += fdx; | - |
646 | fy += fdy; | - |
647 | ++b; | - |
648 | } | 0 |
649 | } else { | 0 |
650 | const qreal fdx = data->m11; | - |
651 | const qreal fdy = data->m12; | - |
652 | const qreal fdw = data->m13; | - |
653 | | - |
654 | qreal fx = data->m21 * cy + data->m11 * cx + data->dx; | - |
655 | qreal fy = data->m22 * cy + data->m12 * cx + data->dy; | - |
656 | qreal fw = data->m23 * cy + data->m13 * cx + data->m33; | - |
657 | | - |
658 | while (b < end) { | 0 |
659 | const qreal iw = fw == 0 ? 1 : 1 / fw; | 0 |
660 | const qreal tx = fx * iw; | - |
661 | const qreal ty = fy * iw; | - |
662 | int px = int(tx) - (tx < 0); | - |
663 | int py = int(ty) - (ty < 0); | - |
664 | | - |
665 | if (blendType == BlendTransformedTiled) { never evaluated: blendType == BlendTransformedTiled | 0 |
666 | px %= image_width; | - |
667 | py %= image_height; | - |
668 | if (px < 0) px += image_width; never executed: px += image_width; | 0 |
669 | if (py < 0) py += image_height; never executed: py += image_height; | 0 |
670 | } else { | 0 |
671 | px = qBound(0, px, image_width - 1); | - |
672 | py = qBound(0, py, image_height - 1); | - |
673 | } | 0 |
674 | *b = reinterpret_cast<const uint *>(data->texture.scanLine(py))[px]; | - |
675 | | - |
676 | fx += fdx; | - |
677 | fy += fdy; | - |
678 | fw += fdw; | - |
679 | | - |
680 | if (!fw) { | 0 |
681 | fw += fdw; | - |
682 | } | 0 |
683 | ++b; | - |
684 | } | 0 |
685 | } | 0 |
686 | return buffer; never executed: return buffer; | 0 |
687 | } | - |
688 | | - |
689 | template<TextureBlendType blendType> | - |
690 | static const uint * fetchTransformed(uint *buffer, const Operator *, const QSpanData *data, | - |
691 | int y, int x, int length) | - |
692 | { | - |
693 | int image_width = data->texture.width; | - |
694 | int image_height = data->texture.height; | - |
695 | | - |
696 | const qreal cx = x + qreal(0.5); | - |
697 | const qreal cy = y + qreal(0.5); | - |
698 | | - |
699 | const QPixelLayout *layout = &qPixelLayouts[data->texture.format]; | - |
700 | FetchPixelFunc fetch = qFetchPixel[layout->bpp]; | - |
701 | | - |
702 | const uint *end = buffer + length; | - |
703 | uint *b = buffer; | - |
704 | if (data->fast_matrix) { partially evaluated: data->fast_matrix yes Evaluation Count:73 | no Evaluation Count:0 |
| 0-73 |
705 | | - |
706 | int fdx = (int)(data->m11 * fixed_scale); | - |
707 | int fdy = (int)(data->m12 * fixed_scale); | - |
708 | | - |
709 | int fx = int((data->m21 * cy | - |
710 | + data->m11 * cx + data->dx) * fixed_scale); | - |
711 | int fy = int((data->m22 * cy | - |
712 | + data->m12 * cx + data->dy) * fixed_scale); | - |
713 | | - |
714 | while (b < end) { evaluated: b < end yes Evaluation Count:2129 | yes Evaluation Count:73 |
| 73-2129 |
715 | int px = fx >> 16; | - |
716 | int py = fy >> 16; | - |
717 | | - |
718 | if (blendType == BlendTransformedTiled) { partially evaluated: blendType == BlendTransformedTiled no Evaluation Count:0 | yes Evaluation Count:2129 |
| 0-2129 |
719 | px %= image_width; | - |
720 | py %= image_height; | - |
721 | if (px < 0) px += image_width; never executed: px += image_width; | 0 |
722 | if (py < 0) py += image_height; never executed: py += image_height; | 0 |
723 | } else { | 0 |
724 | px = qBound(0, px, image_width - 1); | - |
725 | py = qBound(0, py, image_height - 1); | - |
726 | } executed: } Execution Count:2129 | 2129 |
727 | *b = fetch(data->texture.scanLine(py), px); | - |
728 | | - |
729 | fx += fdx; | - |
730 | fy += fdy; | - |
731 | ++b; | - |
732 | } executed: } Execution Count:2129 | 2129 |
733 | } else { executed: } Execution Count:73 | 73 |
734 | const qreal fdx = data->m11; | - |
735 | const qreal fdy = data->m12; | - |
736 | const qreal fdw = data->m13; | - |
737 | | - |
738 | qreal fx = data->m21 * cy + data->m11 * cx + data->dx; | - |
739 | qreal fy = data->m22 * cy + data->m12 * cx + data->dy; | - |
740 | qreal fw = data->m23 * cy + data->m13 * cx + data->m33; | - |
741 | | - |
742 | while (b < end) { | 0 |
743 | const qreal iw = fw == 0 ? 1 : 1 / fw; | 0 |
744 | const qreal tx = fx * iw; | - |
745 | const qreal ty = fy * iw; | - |
746 | int px = int(tx) - (tx < 0); | - |
747 | int py = int(ty) - (ty < 0); | - |
748 | | - |
749 | if (blendType == BlendTransformedTiled) { never evaluated: blendType == BlendTransformedTiled | 0 |
750 | px %= image_width; | - |
751 | py %= image_height; | - |
752 | if (px < 0) px += image_width; never executed: px += image_width; | 0 |
753 | if (py < 0) py += image_height; never executed: py += image_height; | 0 |
754 | } else { | 0 |
755 | px = qBound(0, px, image_width - 1); | - |
756 | py = qBound(0, py, image_height - 1); | - |
757 | } | 0 |
758 | *b = fetch(data->texture.scanLine(py), px); | - |
759 | | - |
760 | fx += fdx; | - |
761 | fy += fdy; | - |
762 | fw += fdw; | - |
763 | | - |
764 | if (!fw) { | 0 |
765 | fw += fdw; | - |
766 | } | 0 |
767 | ++b; | - |
768 | } | 0 |
769 | } | 0 |
770 | const QRgb *clut = data->texture.colorTable ? data->texture.colorTable->constData() : 0; evaluated: data->texture.colorTable yes Evaluation Count:9 | yes Evaluation Count:64 |
| 9-64 |
771 | return layout->convertToARGB32PM(buffer, buffer, length, layout, clut); executed: return layout->convertToARGB32PM(buffer, buffer, length, layout, clut); Execution Count:73 | 73 |
772 | } | - |
773 | | - |
774 | | - |
775 | | - |
776 | | - |
777 | | - |
778 | static inline uint interpolate_4_pixels_16(uint tl, uint tr, uint bl, uint br, int distx, int disty) | - |
779 | { | - |
780 | uint distxy = distx * disty; | - |
781 | | - |
782 | | - |
783 | uint tlrb = (tl & 0x00ff00ff) * (16*16 - 16*distx - 16*disty + distxy); | - |
784 | uint tlag = ((tl & 0xff00ff00) >> 8) * (16*16 - 16*distx - 16*disty + distxy); | - |
785 | uint trrb = ((tr & 0x00ff00ff) * (distx*16 - distxy)); | - |
786 | uint trag = (((tr & 0xff00ff00) >> 8) * (distx*16 - distxy)); | - |
787 | uint blrb = ((bl & 0x00ff00ff) * (disty*16 - distxy)); | - |
788 | uint blag = (((bl & 0xff00ff00) >> 8) * (disty*16 - distxy)); | - |
789 | uint brrb = ((br & 0x00ff00ff) * (distxy)); | - |
790 | uint brag = (((br & 0xff00ff00) >> 8) * (distxy)); | - |
791 | return (((tlrb + trrb + blrb + brrb) >> 8) & 0x00ff00ff) | ((tlag + trag + blag + brag) & 0xff00ff00); executed: return (((tlrb + trrb + blrb + brrb) >> 8) & 0x00ff00ff) | ((tlag + trag + blag + brag) & 0xff00ff00); Execution Count:66942 | 66942 |
792 | } | - |
793 | template<TextureBlendType blendType> | - |
794 | void fetchTransformedBilinear_pixelBounds(int max, int l1, int l2, int &v1, int &v2); | - |
795 | | - |
796 | template<> | - |
797 | inline void fetchTransformedBilinear_pixelBounds<BlendTransformedBilinearTiled>(int max, int, int, int &v1, int &v2) | - |
798 | { | - |
799 | v1 %= max; | - |
800 | if (v1 < 0) evaluated: v1 < 0 yes Evaluation Count:10780 | yes Evaluation Count:13422 |
| 10780-13422 |
801 | v1 += max; executed: v1 += max; Execution Count:10780 | 10780 |
802 | v2 = v1 + 1; | - |
803 | if (v2 == max) evaluated: v2 == max yes Evaluation Count:3300 | yes Evaluation Count:20902 |
| 3300-20902 |
804 | v2 = 0; executed: v2 = 0; Execution Count:3300 | 3300 |
805 | qt_noop(); | - |
806 | qt_noop(); | - |
807 | } executed: } Execution Count:24202 | 24202 |
808 | | - |
809 | template<> | - |
810 | inline void fetchTransformedBilinear_pixelBounds<BlendTransformedBilinear>(int, int l1, int l2, int &v1, int &v2) | - |
811 | { | - |
812 | if (v1 < l1) evaluated: v1 < l1 yes Evaluation Count:2219 | yes Evaluation Count:253099 |
| 2219-253099 |
813 | v2 = v1 = l1; executed: v2 = v1 = l1; Execution Count:2219 | 2219 |
814 | else if (v1 >= l2) evaluated: v1 >= l2 yes Evaluation Count:1568 | yes Evaluation Count:251531 |
| 1568-251531 |
815 | v2 = v1 = l2; executed: v2 = v1 = l2; Execution Count:1568 | 1568 |
816 | else | - |
817 | v2 = v1 + 1; executed: v2 = v1 + 1; Execution Count:251531 | 251531 |
818 | qt_noop(); | - |
819 | qt_noop(); | - |
820 | } executed: } Execution Count:255318 | 255318 |
821 | | - |
822 | template<TextureBlendType blendType> | - |
823 | static const uint * fetchTransformedBilinearARGB32PM(uint *buffer, const Operator *, | - |
824 | const QSpanData *data, int y, int x, | - |
825 | int length) | - |
826 | { | - |
827 | int image_width = data->texture.width; | - |
828 | int image_height = data->texture.height; | - |
829 | | - |
830 | int image_x1 = data->texture.x1; | - |
831 | int image_y1 = data->texture.y1; | - |
832 | int image_x2 = data->texture.x2 - 1; | - |
833 | int image_y2 = data->texture.y2 - 1; | - |
834 | | - |
835 | const qreal cx = x + qreal(0.5); | - |
836 | const qreal cy = y + qreal(0.5); | - |
837 | | - |
838 | uint *end = buffer + length; | - |
839 | uint *b = buffer; | - |
840 | if (data->fast_matrix) { evaluated: data->fast_matrix yes Evaluation Count:1606 | yes Evaluation Count:583 |
| 583-1606 |
841 | | - |
842 | int fdx = (int)(data->m11 * fixed_scale); | - |
843 | int fdy = (int)(data->m12 * fixed_scale); | - |
844 | | - |
845 | int fx = int((data->m21 * cy | - |
846 | + data->m11 * cx + data->dx) * fixed_scale); | - |
847 | int fy = int((data->m22 * cy | - |
848 | + data->m12 * cx + data->dy) * fixed_scale); | - |
849 | | - |
850 | fx -= half_point; | - |
851 | fy -= half_point; | - |
852 | | - |
853 | if (fdy == 0) { evaluated: fdy == 0 yes Evaluation Count:994 | yes Evaluation Count:612 |
| 612-994 |
854 | int y1 = (fy >> 16); | - |
855 | int y2; | - |
856 | fetchTransformedBilinear_pixelBounds<blendType>(image_height, image_y1, image_y2, y1, y2); | - |
857 | const uint *s1 = (const uint *)data->texture.scanLine(y1); | - |
858 | const uint *s2 = (const uint *)data->texture.scanLine(y2); | - |
859 | | - |
860 | if (fdx <= fixed_scale && fdx > 0) { evaluated: fdx <= fixed_scale yes Evaluation Count:930 | yes Evaluation Count:64 |
evaluated: fdx > 0 yes Evaluation Count:802 | yes Evaluation Count:128 |
| 64-930 |
861 | int disty = (fy & 0x0000ffff) >> 8; | - |
862 | int idisty = 256 - disty; | - |
863 | int x = fx >> 16; | - |
864 | | - |
865 | | - |
866 | | - |
867 | | - |
868 | | - |
869 | | - |
870 | quint32 intermediate_buffer[2][buffer_size + 2]; | - |
871 | | - |
872 | int count = qCeil(length * data->m11) + 2; | - |
873 | qt_noop(); | - |
874 | int f = 0; | - |
875 | int lim = count; | - |
876 | if (blendType == BlendTransformedBilinearTiled) { partially evaluated: blendType == BlendTransformedBilinearTiled no Evaluation Count:0 | yes Evaluation Count:802 |
| 0-802 |
877 | x %= image_width; | - |
878 | if (x < 0) x += image_width; never executed: x += image_width; | 0 |
879 | } else { | 0 |
880 | lim = qMin(count, image_x2-x+1); | - |
881 | if (x < image_x1) { partially evaluated: x < image_x1 yes Evaluation Count:802 | no Evaluation Count:0 |
| 0-802 |
882 | qt_noop(); | - |
883 | uint t = s1[image_x1]; | - |
884 | uint b = s2[image_x1]; | - |
885 | quint32 rb = (((t & 0xff00ff) * idisty + (b & 0xff00ff) * disty) >> 8) & 0xff00ff; | - |
886 | quint32 ag = ((((t>>8) & 0xff00ff) * idisty + ((b>>8) & 0xff00ff) * disty) >> 8) & 0xff00ff; | - |
887 | do { | - |
888 | intermediate_buffer[0][f] = rb; | - |
889 | intermediate_buffer[1][f] = ag; | - |
890 | f++; | - |
891 | x++; | - |
892 | } while (x < image_x1 && f < lim); executed: } Execution Count:802 partially evaluated: x < image_x1 no Evaluation Count:0 | yes Evaluation Count:802 |
| 0-802 |
893 | } executed: } Execution Count:802 | 802 |
894 | } executed: } Execution Count:802 | 802 |
895 | | - |
896 | if (blendType != BlendTransformedBilinearTiled) { partially evaluated: blendType != BlendTransformedBilinearTiled yes Evaluation Count:802 | no Evaluation Count:0 |
| 0-802 |
897 | | - |
898 | const __m128i disty_ = _mm_set1_epi16(disty); | - |
899 | const __m128i idisty_ = _mm_set1_epi16(idisty); | - |
900 | const __m128i colorMask = _mm_set1_epi32(0x00ff00ff); | - |
901 | | - |
902 | lim -= 3; | - |
903 | for (; f < lim; x += 4, f += 4) { evaluated: f < lim yes Evaluation Count:15770 | yes Evaluation Count:802 |
| 802-15770 |
904 | | - |
905 | __m128i top = _mm_loadu_si128((__m128i*)((const uint *)(s1)+x)); | - |
906 | __m128i topAG = _mm_srli_epi16(top, 8); | - |
907 | __m128i topRB = _mm_and_si128(top, colorMask); | - |
908 | | - |
909 | topAG = _mm_mullo_epi16 (topAG, idisty_); | - |
910 | topRB = _mm_mullo_epi16 (topRB, idisty_); | - |
911 | | - |
912 | | - |
913 | __m128i bottom = _mm_loadu_si128((__m128i*)((const uint *)(s2)+x)); | - |
914 | __m128i bottomAG = _mm_srli_epi16(bottom, 8); | - |
915 | __m128i bottomRB = _mm_and_si128(bottom, colorMask); | - |
916 | bottomAG = _mm_mullo_epi16 (bottomAG, disty_); | - |
917 | bottomRB = _mm_mullo_epi16 (bottomRB, disty_); | - |
918 | | - |
919 | | - |
920 | __m128i rAG =_mm_add_epi16(topAG, bottomAG); | - |
921 | rAG = _mm_srli_epi16(rAG, 8); | - |
922 | _mm_storeu_si128((__m128i*)(&intermediate_buffer[1][f]), rAG); | - |
923 | __m128i rRB =_mm_add_epi16(topRB, bottomRB); | - |
924 | rRB = _mm_srli_epi16(rRB, 8); | - |
925 | _mm_storeu_si128((__m128i*)(&intermediate_buffer[0][f]), rRB); | - |
926 | } executed: } Execution Count:15770 | 15770 |
927 | } executed: } Execution Count:802 | 802 |
928 | for (; f < count; f++) { evaluated: f < count yes Evaluation Count:970 | yes Evaluation Count:802 |
| 802-970 |
929 | if (blendType == BlendTransformedBilinearTiled) { partially evaluated: blendType == BlendTransformedBilinearTiled no Evaluation Count:0 | yes Evaluation Count:970 |
| 0-970 |
930 | if (x >= image_width) x -= image_width; never executed: x -= image_width; never evaluated: x >= image_width | 0 |
931 | } else { | 0 |
932 | x = qMin(x, image_x2); | - |
933 | } executed: } Execution Count:970 | 970 |
934 | | - |
935 | uint t = s1[x]; | - |
936 | uint b = s2[x]; | - |
937 | | - |
938 | intermediate_buffer[0][f] = (((t & 0xff00ff) * idisty + (b & 0xff00ff) * disty) >> 8) & 0xff00ff; | - |
939 | intermediate_buffer[1][f] = ((((t>>8) & 0xff00ff) * idisty + ((b>>8) & 0xff00ff) * disty) >> 8) & 0xff00ff; | - |
940 | x++; | - |
941 | } executed: } Execution Count:970 | 970 |
942 | | - |
943 | fx &= fixed_scale - 1; | - |
944 | qt_noop(); | - |
945 | while (b < end) { evaluated: b < end yes Evaluation Count:138364 | yes Evaluation Count:802 |
| 802-138364 |
946 | register int x1 = (fx >> 16); | - |
947 | register int x2 = x1 + 1; | - |
948 | qt_noop(); | - |
949 | qt_noop(); | - |
950 | | - |
951 | register int distx = (fx & 0x0000ffff) >> 8; | - |
952 | register int idistx = 256 - distx; | - |
953 | int rb = ((intermediate_buffer[0][x1] * idistx + intermediate_buffer[0][x2] * distx) >> 8) & 0xff00ff; | - |
954 | int ag = (intermediate_buffer[1][x1] * idistx + intermediate_buffer[1][x2] * distx) & 0xff00ff00; | - |
955 | *b = rb | ag; | - |
956 | b++; | - |
957 | fx += fdx; | - |
958 | } executed: } Execution Count:138364 | 138364 |
959 | } else if ((fdx < 0 && fdx > -(fixed_scale / 8)) || fabs(data->m22) < (1./8.)) { evaluated: fdx < 0 yes Evaluation Count:128 | yes Evaluation Count:64 |
partially evaluated: fdx > -(fixed_scale / 8) no Evaluation Count:0 | yes Evaluation Count:128 |
partially evaluated: fabs(data->m22) < (1./8.) no Evaluation Count:0 | yes Evaluation Count:192 |
executed: } Execution Count:802 | 0-802 |
960 | int y1 = (fy >> 16); | - |
961 | int y2; | - |
962 | fetchTransformedBilinear_pixelBounds<blendType>(image_height, image_y1, image_y2, y1, y2); | - |
963 | const uint *s1 = (const uint *)data->texture.scanLine(y1); | - |
964 | const uint *s2 = (const uint *)data->texture.scanLine(y2); | - |
965 | int disty = (fy & 0x0000ffff) >> 8; | - |
966 | int idisty = 256 - disty; | - |
967 | while (b < end) { | 0 |
968 | int x1 = (fx >> 16); | - |
969 | int x2; | - |
970 | fetchTransformedBilinear_pixelBounds<blendType>(image_width, image_x1, image_x2, x1, x2); | - |
971 | uint tl = s1[x1]; | - |
972 | uint tr = s1[x2]; | - |
973 | uint bl = s2[x1]; | - |
974 | uint br = s2[x2]; | - |
975 | | - |
976 | int distx = (fx & 0x0000ffff) >> 8; | - |
977 | int idistx = 256 - distx; | - |
978 | | - |
979 | uint xtop = INTERPOLATE_PIXEL_256(tl, idistx, tr, distx); | - |
980 | uint xbot = INTERPOLATE_PIXEL_256(bl, idistx, br, distx); | - |
981 | *b = INTERPOLATE_PIXEL_256(xtop, idisty, xbot, disty); | - |
982 | | - |
983 | fx += fdx; | - |
984 | ++b; | - |
985 | } | 0 |
986 | } else { | 0 |
987 | int y1 = (fy >> 16); | - |
988 | int y2; | - |
989 | fetchTransformedBilinear_pixelBounds<blendType>(image_height, image_y1, image_y2, y1, y2); | - |
990 | const uint *s1 = (const uint *)data->texture.scanLine(y1); | - |
991 | const uint *s2 = (const uint *)data->texture.scanLine(y2); | - |
992 | int disty = (fy & 0x0000ffff) >> 12; | - |
993 | | - |
994 | if (blendType != BlendTransformedBilinearTiled) { partially evaluated: blendType != BlendTransformedBilinearTiled yes Evaluation Count:192 | no Evaluation Count:0 |
| 0-192 |
995 | while (b < end) { int x1 = (fx >> 16); int x2; fetchTransformedBilinear_pixelBounds<blendType>(image_width, image_x1, image_x2, x1, x2); if (x1 != x2) break; uint tl = s1[x1]; uint tr = s1[x2]; uint bl = s2[x1]; uint br = s2[x2]; int distx = (fx & 0x0000ffff) >> 12; *b = interpolate_4_pixels_16(tl, tr, bl, br, distx, disty); fx += fdx; ++b; } uint *boundedEnd; if (fdx > 0) boundedEnd = qMin(end, buffer + uint((image_x2 - (fx >> 16)) / data->m11)); else boundedEnd = qMin(end, buffer + uint((image_x1 - (fx >> 16)) / data->m11)); boundedEnd -= 3; partially evaluated: b < end yes Evaluation Count:192 | no Evaluation Count:0 |
executed: break; Execution Count:192 executed: boundedEnd = qMin(end, buffer + uint((image_x2 - (fx >> 16)) / data->m11)); Execution Count:64 executed: boundedEnd = qMin(end, buffer + uint((image_x1 - (fx >> 16)) / data->m11)); Execution Count:128 partially evaluated: x1 != x2 yes Evaluation Count:192 | no Evaluation Count:0 |
evaluated: fdx > 0 yes Evaluation Count:64 | yes Evaluation Count:128 |
| 0-192 |
996 | | - |
997 | const __m128i colorMask = _mm_set1_epi32(0x00ff00ff); | - |
998 | const __m128i v_256 = _mm_set1_epi16(256); | - |
999 | const __m128i v_disty = _mm_set1_epi16(disty); | - |
1000 | __m128i v_fdx = _mm_set1_epi32(fdx*4); | - |
1001 | | - |
1002 | ptrdiff_t secondLine = reinterpret_cast<const uint *>(s2) - reinterpret_cast<const uint *>(s1); | - |
1003 | | - |
1004 | union Vect_buffer { __m128i vect; quint32 i[4]; }; | - |
1005 | Vect_buffer v_fx; | - |
1006 | | - |
1007 | for (int i = 0; i < 4; i++) { evaluated: i < 4 yes Evaluation Count:768 | yes Evaluation Count:192 |
| 192-768 |
1008 | v_fx.i[i] = fx; | - |
1009 | fx += fdx; | - |
1010 | } executed: } Execution Count:768 | 768 |
1011 | | - |
1012 | while (b < boundedEnd) { evaluated: b < boundedEnd yes Evaluation Count:4928 | yes Evaluation Count:192 |
| 192-4928 |
1013 | | - |
1014 | Vect_buffer tl, tr, bl, br; | - |
1015 | | - |
1016 | for (int i = 0; i < 4; i++) { evaluated: i < 4 yes Evaluation Count:19712 | yes Evaluation Count:4928 |
| 4928-19712 |
1017 | int x1 = v_fx.i[i] >> 16; | - |
1018 | const uint *addr_tl = reinterpret_cast<const uint *>(s1) + x1; | - |
1019 | const uint *addr_tr = addr_tl + 1; | - |
1020 | tl.i[i] = *addr_tl; | - |
1021 | tr.i[i] = *addr_tr; | - |
1022 | bl.i[i] = *(addr_tl+secondLine); | - |
1023 | br.i[i] = *(addr_tr+secondLine); | - |
1024 | } executed: } Execution Count:19712 | 19712 |
1025 | __m128i v_distx = _mm_srli_epi16(v_fx.vect, 12); | - |
1026 | v_distx = _mm_shufflehi_epi16(v_distx, (((2) << 6) | ((2) << 4) | ((0) << 2) | (0))); | - |
1027 | v_distx = _mm_shufflelo_epi16(v_distx, (((2) << 6) | ((2) << 4) | ((0) << 2) | (0))); | - |
1028 | | - |
1029 | { const __m128i dxdy = _mm_mullo_epi16 (v_distx, v_disty); const __m128i distx_ = _mm_slli_epi16(v_distx, 4); const __m128i disty_ = _mm_slli_epi16(v_disty, 4); const __m128i idxidy = _mm_add_epi16(dxdy, _mm_sub_epi16(v_256, _mm_add_epi16(distx_, disty_))); const __m128i dxidy = _mm_sub_epi16(distx_, dxdy); const __m128i idxdy = _mm_sub_epi16(disty_, dxdy); __m128i tlAG = _mm_srli_epi16(tl.vect, 8); __m128i tlRB = _mm_and_si128(tl.vect, colorMask); __m128i trAG = _mm_srli_epi16(tr.vect, 8); __m128i trRB = _mm_and_si128(tr.vect, colorMask); __m128i blAG = _mm_srli_epi16(bl.vect, 8); __m128i blRB = _mm_and_si128(bl.vect, colorMask); __m128i brAG = _mm_srli_epi16(br.vect, 8); __m128i brRB = _mm_and_si128(br.vect, colorMask); tlAG = _mm_mullo_epi16(tlAG, idxidy); tlRB = _mm_mullo_epi16(tlRB, idxidy); trAG = _mm_mullo_epi16(trAG, dxidy); trRB = _mm_mullo_epi16(trRB, dxidy); blAG = _mm_mullo_epi16(blAG, idxdy); blRB = _mm_mullo_epi16(blRB, idxdy); brAG = _mm_mullo_epi16(brAG, dxdy); brRB = _mm_mullo_epi16(brRB, dxdy); __m128i rAG =_mm_add_epi16(_mm_add_epi16(tlAG, trAG), _mm_add_epi16(blAG, brAG)); __m128i rRB =_mm_add_epi16(_mm_add_epi16(tlRB, trRB), _mm_add_epi16(blRB, brRB)); rAG = _mm_andnot_si128(colorMask, rAG); rRB = _mm_srli_epi16(rRB, 8); _mm_storeu_si128((__m128i*)(b), _mm_or_si128(rAG, rRB)); }; | - |
1030 | b+=4; | - |
1031 | v_fx.vect = _mm_add_epi32(v_fx.vect, v_fdx); | - |
1032 | } executed: } Execution Count:4928 | 4928 |
1033 | fx = v_fx.i[0]; | - |
1034 | } executed: } Execution Count:192 | 192 |
1035 | | - |
1036 | while (b < end) { evaluated: b < end yes Evaluation Count:768 | yes Evaluation Count:192 |
| 192-768 |
1037 | int x1 = (fx >> 16); | - |
1038 | int x2; | - |
1039 | fetchTransformedBilinear_pixelBounds<blendType>(image_width, image_x1, image_x2, x1, x2); | - |
1040 | uint tl = s1[x1]; | - |
1041 | uint tr = s1[x2]; | - |
1042 | uint bl = s2[x1]; | - |
1043 | uint br = s2[x2]; | - |
1044 | int distx = (fx & 0x0000ffff) >> 12; | - |
1045 | *b = interpolate_4_pixels_16(tl, tr, bl, br, distx, disty); | - |
1046 | fx += fdx; | - |
1047 | ++b; | - |
1048 | } executed: } Execution Count:768 | 768 |
1049 | } executed: } Execution Count:192 | 192 |
1050 | } else { | - |
1051 | if (fabs(data->m11) > 8 || fabs(data->m22) > 8) { partially evaluated: fabs(data->m11) > 8 no Evaluation Count:0 | yes Evaluation Count:612 |
partially evaluated: fabs(data->m22) > 8 no Evaluation Count:0 | yes Evaluation Count:612 |
| 0-612 |
1052 | | - |
1053 | while (b < end) { | 0 |
1054 | int x1 = (fx >> 16); | - |
1055 | int x2; | - |
1056 | int y1 = (fy >> 16); | - |
1057 | int y2; | - |
1058 | | - |
1059 | fetchTransformedBilinear_pixelBounds<blendType>(image_width, image_x1, image_x2, x1, x2); | - |
1060 | fetchTransformedBilinear_pixelBounds<blendType>(image_height, image_y1, image_y2, y1, y2); | - |
1061 | | - |
1062 | const uint *s1 = (const uint *)data->texture.scanLine(y1); | - |
1063 | const uint *s2 = (const uint *)data->texture.scanLine(y2); | - |
1064 | | - |
1065 | uint tl = s1[x1]; | - |
1066 | uint tr = s1[x2]; | - |
1067 | uint bl = s2[x1]; | - |
1068 | uint br = s2[x2]; | - |
1069 | | - |
1070 | int distx = (fx & 0x0000ffff) >> 8; | - |
1071 | int disty = (fy & 0x0000ffff) >> 8; | - |
1072 | int idistx = 256 - distx; | - |
1073 | int idisty = 256 - disty; | - |
1074 | | - |
1075 | uint xtop = INTERPOLATE_PIXEL_256(tl, idistx, tr, distx); | - |
1076 | uint xbot = INTERPOLATE_PIXEL_256(bl, idistx, br, distx); | - |
1077 | *b = INTERPOLATE_PIXEL_256(xtop, idisty, xbot, disty); | - |
1078 | | - |
1079 | fx += fdx; | - |
1080 | fy += fdy; | - |
1081 | ++b; | - |
1082 | } | 0 |
1083 | } else { | 0 |
1084 | | - |
1085 | while (b < end) { evaluated: b < end yes Evaluation Count:66174 | yes Evaluation Count:612 |
| 612-66174 |
1086 | int x1 = (fx >> 16); | - |
1087 | int x2; | - |
1088 | int y1 = (fy >> 16); | - |
1089 | int y2; | - |
1090 | | - |
1091 | fetchTransformedBilinear_pixelBounds<blendType>(image_width, image_x1, image_x2, x1, x2); | - |
1092 | fetchTransformedBilinear_pixelBounds<blendType>(image_height, image_y1, image_y2, y1, y2); | - |
1093 | | - |
1094 | const uint *s1 = (const uint *)data->texture.scanLine(y1); | - |
1095 | const uint *s2 = (const uint *)data->texture.scanLine(y2); | - |
1096 | | - |
1097 | uint tl = s1[x1]; | - |
1098 | uint tr = s1[x2]; | - |
1099 | uint bl = s2[x1]; | - |
1100 | uint br = s2[x2]; | - |
1101 | | - |
1102 | int distx = (fx & 0x0000ffff) >> 12; | - |
1103 | int disty = (fy & 0x0000ffff) >> 12; | - |
1104 | | - |
1105 | *b = interpolate_4_pixels_16(tl, tr, bl, br, distx, disty); | - |
1106 | | - |
1107 | fx += fdx; | - |
1108 | fy += fdy; | - |
1109 | ++b; | - |
1110 | } executed: } Execution Count:66174 | 66174 |
1111 | } executed: } Execution Count:612 | 612 |
1112 | } | - |
1113 | } else { | - |
1114 | const qreal fdx = data->m11; | - |
1115 | const qreal fdy = data->m12; | - |
1116 | const qreal fdw = data->m13; | - |
1117 | | - |
1118 | qreal fx = data->m21 * cy + data->m11 * cx + data->dx; | - |
1119 | qreal fy = data->m22 * cy + data->m12 * cx + data->dy; | - |
1120 | qreal fw = data->m23 * cy + data->m13 * cx + data->m33; | - |
1121 | | - |
1122 | while (b < end) { evaluated: b < end yes Evaluation Count:72513 | yes Evaluation Count:583 |
| 583-72513 |
1123 | const qreal iw = fw == 0 ? 1 : 1 / fw; partially evaluated: fw == 0 no Evaluation Count:0 | yes Evaluation Count:72513 |
| 0-72513 |
1124 | const qreal px = fx * iw - qreal(0.5); | - |
1125 | const qreal py = fy * iw - qreal(0.5); | - |
1126 | | - |
1127 | int x1 = int(px) - (px < 0); | - |
1128 | int x2; | - |
1129 | int y1 = int(py) - (py < 0); | - |
1130 | int y2; | - |
1131 | | - |
1132 | int distx = int((px - x1) * 256); | - |
1133 | int disty = int((py - y1) * 256); | - |
1134 | int idistx = 256 - distx; | - |
1135 | int idisty = 256 - disty; | - |
1136 | | - |
1137 | fetchTransformedBilinear_pixelBounds<blendType>(image_width, image_x1, image_x2, x1, x2); | - |
1138 | fetchTransformedBilinear_pixelBounds<blendType>(image_height, image_y1, image_y2, y1, y2); | - |
1139 | | - |
1140 | const uint *s1 = (const uint *)data->texture.scanLine(y1); | - |
1141 | const uint *s2 = (const uint *)data->texture.scanLine(y2); | - |
1142 | | - |
1143 | uint tl = s1[x1]; | - |
1144 | uint tr = s1[x2]; | - |
1145 | uint bl = s2[x1]; | - |
1146 | uint br = s2[x2]; | - |
1147 | | - |
1148 | uint xtop = INTERPOLATE_PIXEL_256(tl, idistx, tr, distx); | - |
1149 | uint xbot = INTERPOLATE_PIXEL_256(bl, idistx, br, distx); | - |
1150 | *b = INTERPOLATE_PIXEL_256(xtop, idisty, xbot, disty); | - |
1151 | | - |
1152 | fx += fdx; | - |
1153 | fy += fdy; | - |
1154 | fw += fdw; | - |
1155 | | - |
1156 | if (!fw) { partially evaluated: !fw no Evaluation Count:0 | yes Evaluation Count:72513 |
| 0-72513 |
1157 | fw += fdw; | - |
1158 | } | 0 |
1159 | ++b; | - |
1160 | } executed: } Execution Count:72513 | 72513 |
1161 | } executed: } Execution Count:583 | 583 |
1162 | | - |
1163 | return buffer; executed: return buffer; Execution Count:2189 | 2189 |
1164 | } | - |
1165 | | - |
1166 | | - |
1167 | template<TextureBlendType blendType> | - |
1168 | static const uint * fetchTransformedBilinear(uint *buffer, const Operator *, | - |
1169 | const QSpanData *data, int y, int x, int length) | - |
1170 | { | - |
1171 | const QPixelLayout *layout = &qPixelLayouts[data->texture.format]; | - |
1172 | const QRgb *clut = data->texture.colorTable ? data->texture.colorTable->constData() : 0; never evaluated: data->texture.colorTable | 0 |
1173 | | - |
1174 | int image_width = data->texture.width; | - |
1175 | int image_height = data->texture.height; | - |
1176 | | - |
1177 | int image_x1 = data->texture.x1; | - |
1178 | int image_y1 = data->texture.y1; | - |
1179 | int image_x2 = data->texture.x2 - 1; | - |
1180 | int image_y2 = data->texture.y2 - 1; | - |
1181 | | - |
1182 | const qreal cx = x + qreal(0.5); | - |
1183 | const qreal cy = y + qreal(0.5); | - |
1184 | | - |
1185 | if (data->fast_matrix) { never evaluated: data->fast_matrix | 0 |
1186 | | - |
1187 | int fdx = (int)(data->m11 * fixed_scale); | - |
1188 | int fdy = (int)(data->m12 * fixed_scale); | - |
1189 | | - |
1190 | int fx = int((data->m21 * cy + data->m11 * cx + data->dx) * fixed_scale); | - |
1191 | int fy = int((data->m22 * cy + data->m12 * cx + data->dy) * fixed_scale); | - |
1192 | | - |
1193 | fx -= half_point; | - |
1194 | fy -= half_point; | - |
1195 | | - |
1196 | if (fdy == 0) { never evaluated: fdy == 0 | 0 |
1197 | int y1 = (fy >> 16); | - |
1198 | int y2; | - |
1199 | fetchTransformedBilinear_pixelBounds<blendType>(image_height, image_y1, image_y2, y1, y2); | - |
1200 | const uchar *s1 = data->texture.scanLine(y1); | - |
1201 | const uchar *s2 = data->texture.scanLine(y2); | - |
1202 | | - |
1203 | if (fdx <= fixed_scale && fdx > 0) { never evaluated: fdx <= fixed_scale | 0 |
1204 | int disty = (fy & 0x0000ffff) >> 8; | - |
1205 | int idisty = 256 - disty; | - |
1206 | int x = fx >> 16; | - |
1207 | | - |
1208 | | - |
1209 | | - |
1210 | FetchPixelsFunc fetch = qFetchPixels[layout->bpp]; | - |
1211 | uint buf1[buffer_size + 2]; | - |
1212 | uint buf2[buffer_size + 2]; | - |
1213 | const uint *ptr1; | - |
1214 | const uint *ptr2; | - |
1215 | | - |
1216 | int count = qCeil(length * data->m11) + 2; | - |
1217 | qt_noop(); | - |
1218 | | - |
1219 | if (blendType == BlendTransformedBilinearTiled) { never evaluated: blendType == BlendTransformedBilinearTiled | 0 |
1220 | x %= image_width; | - |
1221 | if (x < 0) | 0 |
1222 | x += image_width; never executed: x += image_width; | 0 |
1223 | int len1 = qMin(count, image_width - x); | - |
1224 | int len2 = qMin(x, count - len1); | - |
1225 | | - |
1226 | ptr1 = fetch(buf1, s1, x, len1); | - |
1227 | ptr1 = layout->convertToARGB32PM(buf1, ptr1, len1, layout, clut); | - |
1228 | ptr2 = fetch(buf2, s2, x, len1); | - |
1229 | ptr2 = layout->convertToARGB32PM(buf2, ptr2, len1, layout, clut); | - |
1230 | for (int i = 0; i < len1; ++i) { never evaluated: i < len1 | 0 |
1231 | uint t = ptr1[i]; | - |
1232 | uint b = ptr2[i]; | - |
1233 | buf1[i] = (((t & 0xff00ff) * idisty + (b & 0xff00ff) * disty) >> 8) & 0xff00ff; | - |
1234 | buf2[i] = ((((t >> 8) & 0xff00ff) * idisty + ((b >> 8) & 0xff00ff) * disty) >> 8) & 0xff00ff; | - |
1235 | } | 0 |
1236 | | - |
1237 | if (len2) { | 0 |
1238 | ptr1 = fetch(buf1 + len1, s1, 0, len2); | - |
1239 | ptr1 = layout->convertToARGB32PM(buf1 + len1, ptr1, len2, layout, clut); | - |
1240 | ptr2 = fetch(buf2 + len1, s2, 0, len2); | - |
1241 | ptr2 = layout->convertToARGB32PM(buf2 + len1, ptr2, len2, layout, clut); | - |
1242 | for (int i = 0; i < len2; ++i) { never evaluated: i < len2 | 0 |
1243 | uint t = ptr1[i]; | - |
1244 | uint b = ptr2[i]; | - |
1245 | buf1[i + len1] = (((t & 0xff00ff) * idisty + (b & 0xff00ff) * disty) >> 8) & 0xff00ff; | - |
1246 | buf2[i + len1] = ((((t >> 8) & 0xff00ff) * idisty + ((b >> 8) & 0xff00ff) * disty) >> 8) & 0xff00ff; | - |
1247 | } | 0 |
1248 | } | 0 |
1249 | for (int i = image_width; i < count; ++i) { never evaluated: i < count | 0 |
1250 | buf1[i] = buf1[i - image_width]; | - |
1251 | buf2[i] = buf2[i - image_width]; | - |
1252 | } | 0 |
1253 | } else { | 0 |
1254 | int start = qMax(x, image_x1); | - |
1255 | int end = qMin(x + count, image_x2 + 1); | - |
1256 | int len = qMax(1, end - start); | - |
1257 | int leading = start - x; | - |
1258 | | - |
1259 | ptr1 = fetch(buf1 + leading, s1, start, len); | - |
1260 | ptr1 = layout->convertToARGB32PM(buf1 + leading, ptr1, len, layout, clut); | - |
1261 | ptr2 = fetch(buf2 + leading, s2, start, len); | - |
1262 | ptr2 = layout->convertToARGB32PM(buf2 + leading, ptr2, len, layout, clut); | - |
1263 | | - |
1264 | for (int i = 0; i < len; ++i) { | 0 |
1265 | uint t = ptr1[i]; | - |
1266 | uint b = ptr2[i]; | - |
1267 | buf1[i + leading] = (((t & 0xff00ff) * idisty + (b & 0xff00ff) * disty) >> 8) & 0xff00ff; | - |
1268 | buf2[i + leading] = ((((t >> 8) & 0xff00ff) * idisty + ((b >> 8) & 0xff00ff) * disty) >> 8) & 0xff00ff; | - |
1269 | } | 0 |
1270 | | - |
1271 | for (int i = 0; i < leading; ++i) { never evaluated: i < leading | 0 |
1272 | buf1[i] = buf1[leading]; | - |
1273 | buf2[i] = buf2[leading]; | - |
1274 | } | 0 |
1275 | for (int i = leading + len; i < count; ++i) { never evaluated: i < count | 0 |
1276 | buf1[i] = buf1[i - 1]; | - |
1277 | buf2[i] = buf2[i - 1]; | - |
1278 | } | 0 |
1279 | } | 0 |
1280 | | - |
1281 | | - |
1282 | fx &= fixed_scale - 1; | - |
1283 | qt_noop(); | - |
1284 | for (int i = 0; i < length; ++i) { never evaluated: i < length | 0 |
1285 | register int x1 = (fx >> 16); | - |
1286 | register int x2 = x1 + 1; | - |
1287 | qt_noop(); | - |
1288 | qt_noop(); | - |
1289 | | - |
1290 | register int distx = (fx & 0x0000ffff) >> 8; | - |
1291 | register int idistx = 256 - distx; | - |
1292 | int rb = ((buf1[x1] * idistx + buf1[x2] * distx) >> 8) & 0xff00ff; | - |
1293 | int ag = (buf2[x1] * idistx + buf2[x2] * distx) & 0xff00ff00; | - |
1294 | buffer[i] = rb | ag; | - |
1295 | fx += fdx; | - |
1296 | } | 0 |
1297 | } else { | 0 |
1298 | FetchPixelFunc fetch = qFetchPixel[layout->bpp]; | - |
1299 | uint buf1[buffer_size]; | - |
1300 | uint buf2[buffer_size]; | - |
1301 | uint *b = buffer; | - |
1302 | while (length) { | 0 |
1303 | int len = qMin(length, buffer_size / 2); | - |
1304 | int fracX = fx; | - |
1305 | for (int i = 0; i < len; ++i) { | 0 |
1306 | int x1 = (fx >> 16); | - |
1307 | int x2; | - |
1308 | fetchTransformedBilinear_pixelBounds<blendType>(image_width, image_x1, image_x2, x1, x2); | - |
1309 | | - |
1310 | buf1[i * 2 + 0] = fetch(s1, x1); | - |
1311 | buf1[i * 2 + 1] = fetch(s1, x2); | - |
1312 | buf2[i * 2 + 0] = fetch(s2, x1); | - |
1313 | buf2[i * 2 + 1] = fetch(s2, x2); | - |
1314 | | - |
1315 | fx += fdx; | - |
1316 | } | 0 |
1317 | layout->convertToARGB32PM(buf1, buf1, len * 2, layout, clut); | - |
1318 | layout->convertToARGB32PM(buf2, buf2, len * 2, layout, clut); | - |
1319 | | - |
1320 | if ((fdx < 0 && fdx > -(fixed_scale / 8)) || fabs(data->m22) < (1./8.)) { never evaluated: fdx > -(fixed_scale / 8) never evaluated: fabs(data->m22) < (1./8.) | 0 |
1321 | int disty = (fy & 0x0000ffff) >> 8; | - |
1322 | int idisty = 256 - disty; | - |
1323 | for (int i = 0; i < len; ++i) { | 0 |
1324 | uint tl = buf1[i * 2 + 0]; | - |
1325 | uint tr = buf1[i * 2 + 1]; | - |
1326 | uint bl = buf2[i * 2 + 0]; | - |
1327 | uint br = buf2[i * 2 + 1]; | - |
1328 | int distx = (fracX & 0x0000ffff) >> 8; | - |
1329 | int idistx = 256 - distx; | - |
1330 | uint xtop = INTERPOLATE_PIXEL_256(tl, idistx, tr, distx); | - |
1331 | uint xbot = INTERPOLATE_PIXEL_256(bl, idistx, br, distx); | - |
1332 | b[i] = INTERPOLATE_PIXEL_256(xtop, idisty, xbot, disty); | - |
1333 | fracX += fdx; | - |
1334 | } | 0 |
1335 | } else { | 0 |
1336 | int disty = (fy & 0x0000ffff) >> 12; | - |
1337 | for (int i = 0; i < len; ++i) { | 0 |
1338 | uint tl = buf1[i * 2 + 0]; | - |
1339 | uint tr = buf1[i * 2 + 1]; | - |
1340 | uint bl = buf2[i * 2 + 0]; | - |
1341 | uint br = buf2[i * 2 + 1]; | - |
1342 | int distx = (fracX & 0x0000ffff) >> 12; | - |
1343 | b[i] = interpolate_4_pixels_16(tl, tr, bl, br, distx, disty); | - |
1344 | fracX += fdx; | - |
1345 | } | 0 |
1346 | } | 0 |
1347 | length -= len; | - |
1348 | b += len; | - |
1349 | } | 0 |
1350 | } | 0 |
1351 | } else { | - |
1352 | FetchPixelFunc fetch = qFetchPixel[layout->bpp]; | - |
1353 | uint buf1[buffer_size]; | - |
1354 | uint buf2[buffer_size]; | - |
1355 | uint *b = buffer; | - |
1356 | | - |
1357 | while (length) { | 0 |
1358 | int len = qMin(length, buffer_size / 2); | - |
1359 | int fracX = fx; | - |
1360 | int fracY = fy; | - |
1361 | for (int i = 0; i < len; ++i) { | 0 |
1362 | int x1 = (fx >> 16); | - |
1363 | int x2; | - |
1364 | int y1 = (fy >> 16); | - |
1365 | int y2; | - |
1366 | fetchTransformedBilinear_pixelBounds<blendType>(image_width, image_x1, image_x2, x1, x2); | - |
1367 | fetchTransformedBilinear_pixelBounds<blendType>(image_height, image_y1, image_y2, y1, y2); | - |
1368 | | - |
1369 | const uchar *s1 = data->texture.scanLine(y1); | - |
1370 | const uchar *s2 = data->texture.scanLine(y2); | - |
1371 | | - |
1372 | buf1[i * 2 + 0] = fetch(s1, x1); | - |
1373 | buf1[i * 2 + 1] = fetch(s1, x2); | - |
1374 | buf2[i * 2 + 0] = fetch(s2, x1); | - |
1375 | buf2[i * 2 + 1] = fetch(s2, x2); | - |
1376 | | - |
1377 | fx += fdx; | - |
1378 | fy += fdy; | - |
1379 | } | 0 |
1380 | layout->convertToARGB32PM(buf1, buf1, len * 2, layout, clut); | - |
1381 | layout->convertToARGB32PM(buf2, buf2, len * 2, layout, clut); | - |
1382 | | - |
1383 | if (fabs(data->m11) > 8 || fabs(data->m22) > 8) { never evaluated: fabs(data->m11) > 8 never evaluated: fabs(data->m22) > 8 | 0 |
1384 | | - |
1385 | for (int i = 0; i < len; ++i) { | 0 |
1386 | uint tl = buf1[i * 2 + 0]; | - |
1387 | uint tr = buf1[i * 2 + 1]; | - |
1388 | uint bl = buf2[i * 2 + 0]; | - |
1389 | uint br = buf2[i * 2 + 1]; | - |
1390 | | - |
1391 | int distx = (fracX & 0x0000ffff) >> 8; | - |
1392 | int disty = (fracY & 0x0000ffff) >> 8; | - |
1393 | int idistx = 256 - distx; | - |
1394 | int idisty = 256 - disty; | - |
1395 | | - |
1396 | uint xtop = INTERPOLATE_PIXEL_256(tl, idistx, tr, distx); | - |
1397 | uint xbot = INTERPOLATE_PIXEL_256(bl, idistx, br, distx); | - |
1398 | b[i] = INTERPOLATE_PIXEL_256(xtop, idisty, xbot, disty); | - |
1399 | fracX += fdx; | - |
1400 | fracY += fdy; | - |
1401 | } | 0 |
1402 | } else { | 0 |
1403 | | - |
1404 | for (int i = 0; i < len; ++i) { | 0 |
1405 | uint tl = buf1[i * 2 + 0]; | - |
1406 | uint tr = buf1[i * 2 + 1]; | - |
1407 | uint bl = buf2[i * 2 + 0]; | - |
1408 | uint br = buf2[i * 2 + 1]; | - |
1409 | | - |
1410 | int distx = (fracX & 0x0000ffff) >> 12; | - |
1411 | int disty = (fracY & 0x0000ffff) >> 12; | - |
1412 | | - |
1413 | b[i] = interpolate_4_pixels_16(tl, tr, bl, br, distx, disty); | - |
1414 | fracX += fdx; | - |
1415 | fracY += fdy; | - |
1416 | } | 0 |
1417 | } | 0 |
1418 | | - |
1419 | length -= len; | - |
1420 | b += len; | - |
1421 | } | 0 |
1422 | } | 0 |
1423 | } else { | - |
1424 | const qreal fdx = data->m11; | - |
1425 | const qreal fdy = data->m12; | - |
1426 | const qreal fdw = data->m13; | - |
1427 | | - |
1428 | qreal fx = data->m21 * cy + data->m11 * cx + data->dx; | - |
1429 | qreal fy = data->m22 * cy + data->m12 * cx + data->dy; | - |
1430 | qreal fw = data->m23 * cy + data->m13 * cx + data->m33; | - |
1431 | | - |
1432 | FetchPixelFunc fetch = qFetchPixel[layout->bpp]; | - |
1433 | uint buf1[buffer_size]; | - |
1434 | uint buf2[buffer_size]; | - |
1435 | uint *b = buffer; | - |
1436 | | - |
1437 | int distxs[buffer_size / 2]; | - |
1438 | int distys[buffer_size / 2]; | - |
1439 | | - |
1440 | while (length) { | 0 |
1441 | int len = qMin(length, buffer_size / 2); | - |
1442 | for (int i = 0; i < len; ++i) { | 0 |
1443 | const qreal iw = fw == 0 ? 1 : 1 / fw; | 0 |
1444 | const qreal px = fx * iw - qreal(0.5); | - |
1445 | const qreal py = fy * iw - qreal(0.5); | - |
1446 | | - |
1447 | int x1 = int(px) - (px < 0); | - |
1448 | int x2; | - |
1449 | int y1 = int(py) - (py < 0); | - |
1450 | int y2; | - |
1451 | | - |
1452 | distxs[i] = int((px - x1) * 256); | - |
1453 | distys[i] = int((py - y1) * 256); | - |
1454 | | - |
1455 | fetchTransformedBilinear_pixelBounds<blendType>(image_width, image_x1, image_x2, x1, x2); | - |
1456 | fetchTransformedBilinear_pixelBounds<blendType>(image_height, image_y1, image_y2, y1, y2); | - |
1457 | | - |
1458 | const uchar *s1 = data->texture.scanLine(y1); | - |
1459 | const uchar *s2 = data->texture.scanLine(y2); | - |
1460 | | - |
1461 | buf1[i * 2 + 0] = fetch(s1, x1); | - |
1462 | buf1[i * 2 + 1] = fetch(s1, x2); | - |
1463 | buf2[i * 2 + 0] = fetch(s2, x1); | - |
1464 | buf2[i * 2 + 1] = fetch(s2, x2); | - |
1465 | | - |
1466 | fx += fdx; | - |
1467 | fy += fdy; | - |
1468 | fw += fdw; | - |
1469 | | - |
1470 | if (!fw) | 0 |
1471 | fw += fdw; never executed: fw += fdw; | 0 |
1472 | } | 0 |
1473 | | - |
1474 | layout->convertToARGB32PM(buf1, buf1, len * 2, layout, clut); | - |
1475 | layout->convertToARGB32PM(buf2, buf2, len * 2, layout, clut); | - |
1476 | | - |
1477 | for (int i = 0; i < len; ++i) { | 0 |
1478 | int distx = distxs[i]; | - |
1479 | int disty = distys[i]; | - |
1480 | int idistx = 256 - distx; | - |
1481 | int idisty = 256 - disty; | - |
1482 | | - |
1483 | uint tl = buf1[i * 2 + 0]; | - |
1484 | uint tr = buf1[i * 2 + 1]; | - |
1485 | uint bl = buf2[i * 2 + 0]; | - |
1486 | uint br = buf2[i * 2 + 1]; | - |
1487 | | - |
1488 | uint xtop = INTERPOLATE_PIXEL_256(tl, idistx, tr, distx); | - |
1489 | uint xbot = INTERPOLATE_PIXEL_256(bl, idistx, br, distx); | - |
1490 | b[i] = INTERPOLATE_PIXEL_256(xtop, idisty, xbot, disty); | - |
1491 | } | 0 |
1492 | length -= len; | - |
1493 | b += len; | - |
1494 | } | 0 |
1495 | } | 0 |
1496 | | - |
1497 | return buffer; never executed: return buffer; | 0 |
1498 | } | - |
1499 | | - |
1500 | static const SourceFetchProc sourceFetch[NBlendTypes][QImage::NImageFormats] = { | - |
1501 | | - |
1502 | { | - |
1503 | 0, | - |
1504 | fetchUntransformed, | - |
1505 | fetchUntransformed, | - |
1506 | fetchUntransformed, | - |
1507 | fetchUntransformedARGB32PM, | - |
1508 | fetchUntransformed, | - |
1509 | fetchUntransformedARGB32PM, | - |
1510 | fetchUntransformedRGB16, | - |
1511 | fetchUntransformed, | - |
1512 | fetchUntransformed, | - |
1513 | fetchUntransformed, | - |
1514 | fetchUntransformed, | - |
1515 | fetchUntransformed, | - |
1516 | fetchUntransformed, | - |
1517 | fetchUntransformed, | - |
1518 | fetchUntransformed | - |
1519 | }, | - |
1520 | | - |
1521 | { | - |
1522 | 0, | - |
1523 | fetchUntransformed, | - |
1524 | fetchUntransformed, | - |
1525 | fetchUntransformed, | - |
1526 | fetchUntransformedARGB32PM, | - |
1527 | fetchUntransformed, | - |
1528 | fetchUntransformedARGB32PM, | - |
1529 | fetchUntransformedRGB16, | - |
1530 | fetchUntransformed, | - |
1531 | fetchUntransformed, | - |
1532 | fetchUntransformed, | - |
1533 | fetchUntransformed, | - |
1534 | fetchUntransformed, | - |
1535 | fetchUntransformed, | - |
1536 | fetchUntransformed, | - |
1537 | fetchUntransformed | - |
1538 | }, | - |
1539 | | - |
1540 | { | - |
1541 | 0, | - |
1542 | fetchTransformed<BlendTransformed>, | - |
1543 | fetchTransformed<BlendTransformed>, | - |
1544 | fetchTransformed<BlendTransformed>, | - |
1545 | fetchTransformedARGB32PM<BlendTransformed>, | - |
1546 | fetchTransformed<BlendTransformed>, | - |
1547 | fetchTransformedARGB32PM<BlendTransformed>, | - |
1548 | fetchTransformed<BlendTransformed>, | - |
1549 | fetchTransformed<BlendTransformed>, | - |
1550 | fetchTransformed<BlendTransformed>, | - |
1551 | fetchTransformed<BlendTransformed>, | - |
1552 | fetchTransformed<BlendTransformed>, | - |
1553 | fetchTransformed<BlendTransformed>, | - |
1554 | fetchTransformed<BlendTransformed>, | - |
1555 | fetchTransformed<BlendTransformed>, | - |
1556 | fetchTransformed<BlendTransformed>, | - |
1557 | }, | - |
1558 | { | - |
1559 | 0, | - |
1560 | fetchTransformed<BlendTransformedTiled>, | - |
1561 | fetchTransformed<BlendTransformedTiled>, | - |
1562 | fetchTransformed<BlendTransformedTiled>, | - |
1563 | fetchTransformedARGB32PM<BlendTransformedTiled>, | - |
1564 | fetchTransformed<BlendTransformedTiled>, | - |
1565 | fetchTransformedARGB32PM<BlendTransformedTiled>, | - |
1566 | fetchTransformed<BlendTransformedTiled>, | - |
1567 | fetchTransformed<BlendTransformedTiled>, | - |
1568 | fetchTransformed<BlendTransformedTiled>, | - |
1569 | fetchTransformed<BlendTransformedTiled>, | - |
1570 | fetchTransformed<BlendTransformedTiled>, | - |
1571 | fetchTransformed<BlendTransformedTiled>, | - |
1572 | fetchTransformed<BlendTransformedTiled>, | - |
1573 | fetchTransformed<BlendTransformedTiled>, | - |
1574 | fetchTransformed<BlendTransformedTiled>, | - |
1575 | }, | - |
1576 | { | - |
1577 | 0, | - |
1578 | fetchTransformedBilinear<BlendTransformedBilinear>, | - |
1579 | fetchTransformedBilinear<BlendTransformedBilinear>, | - |
1580 | fetchTransformedBilinear<BlendTransformedBilinear>, | - |
1581 | fetchTransformedBilinearARGB32PM<BlendTransformedBilinear>, | - |
1582 | fetchTransformedBilinear<BlendTransformedBilinear>, | - |
1583 | fetchTransformedBilinearARGB32PM<BlendTransformedBilinear>, | - |
1584 | fetchTransformedBilinear<BlendTransformedBilinear>, | - |
1585 | fetchTransformedBilinear<BlendTransformedBilinear>, | - |
1586 | fetchTransformedBilinear<BlendTransformedBilinear>, | - |
1587 | fetchTransformedBilinear<BlendTransformedBilinear>, | - |
1588 | fetchTransformedBilinear<BlendTransformedBilinear>, | - |
1589 | fetchTransformedBilinear<BlendTransformedBilinear>, | - |
1590 | fetchTransformedBilinear<BlendTransformedBilinear>, | - |
1591 | fetchTransformedBilinear<BlendTransformedBilinear>, | - |
1592 | fetchTransformedBilinear<BlendTransformedBilinear> | - |
1593 | }, | - |
1594 | { | - |
1595 | 0, | - |
1596 | fetchTransformedBilinear<BlendTransformedBilinearTiled>, | - |
1597 | fetchTransformedBilinear<BlendTransformedBilinearTiled>, | - |
1598 | fetchTransformedBilinear<BlendTransformedBilinearTiled>, | - |
1599 | fetchTransformedBilinearARGB32PM<BlendTransformedBilinearTiled>, | - |
1600 | fetchTransformedBilinear<BlendTransformedBilinearTiled>, | - |
1601 | fetchTransformedBilinearARGB32PM<BlendTransformedBilinearTiled>, | - |
1602 | fetchTransformedBilinear<BlendTransformedBilinearTiled>, | - |
1603 | fetchTransformedBilinear<BlendTransformedBilinearTiled>, | - |
1604 | fetchTransformedBilinear<BlendTransformedBilinearTiled>, | - |
1605 | fetchTransformedBilinear<BlendTransformedBilinearTiled>, | - |
1606 | fetchTransformedBilinear<BlendTransformedBilinearTiled>, | - |
1607 | fetchTransformedBilinear<BlendTransformedBilinearTiled>, | - |
1608 | fetchTransformedBilinear<BlendTransformedBilinearTiled>, | - |
1609 | fetchTransformedBilinear<BlendTransformedBilinearTiled>, | - |
1610 | fetchTransformedBilinear<BlendTransformedBilinearTiled> | - |
1611 | }, | - |
1612 | }; | - |
1613 | | - |
1614 | | - |
1615 | | - |
1616 | | - |
1617 | static uint qt_gradient_pixel_fixed(const QGradientData *data, int fixed_pos) | - |
1618 | { | - |
1619 | int ipos = (fixed_pos + ((1<<8) / 2)) >> 8; | - |
1620 | return data->colorTable[qt_gradient_clamp(data, ipos)]; executed: return data->colorTable[qt_gradient_clamp(data, ipos)]; Execution Count:380193 | 380193 |
1621 | } | - |
1622 | | - |
1623 | static void getLinearGradientValues(LinearGradientValues *v, const QSpanData *data) | - |
1624 | { | - |
1625 | v->dx = data->gradient.linear.end.x - data->gradient.linear.origin.x; | - |
1626 | v->dy = data->gradient.linear.end.y - data->gradient.linear.origin.y; | - |
1627 | v->l = v->dx * v->dx + v->dy * v->dy; | - |
1628 | v->off = 0; | - |
1629 | if (v->l != 0) { partially evaluated: v->l != 0 yes Evaluation Count:16262 | no Evaluation Count:0 |
| 0-16262 |
1630 | v->dx /= v->l; | - |
1631 | v->dy /= v->l; | - |
1632 | v->off = -v->dx * data->gradient.linear.origin.x - v->dy * data->gradient.linear.origin.y; | - |
1633 | } executed: } Execution Count:16262 | 16262 |
1634 | } executed: } Execution Count:16294 | 16294 |
1635 | | - |
1636 | static const uint * qt_fetch_linear_gradient(uint *buffer, const Operator *op, const QSpanData *data, | - |
1637 | int y, int x, int length) | - |
1638 | { | - |
1639 | const uint *b = buffer; | - |
1640 | qreal t, inc; | - |
1641 | | - |
1642 | bool affine = true; | - |
1643 | qreal rx=0, ry=0; | - |
1644 | if (op->linear.l == 0) { partially evaluated: op->linear.l == 0 no Evaluation Count:0 | yes Evaluation Count:19446 |
| 0-19446 |
1645 | t = inc = 0; | - |
1646 | } else { | 0 |
1647 | rx = data->m21 * (y + qreal(0.5)) + data->m11 * (x + qreal(0.5)) + data->dx; | - |
1648 | ry = data->m22 * (y + qreal(0.5)) + data->m12 * (x + qreal(0.5)) + data->dy; | - |
1649 | t = op->linear.dx*rx + op->linear.dy*ry + op->linear.off; | - |
1650 | inc = op->linear.dx * data->m11 + op->linear.dy * data->m12; | - |
1651 | affine = !data->m13 && !data->m23; partially evaluated: !data->m13 yes Evaluation Count:19438 | no Evaluation Count:0 |
partially evaluated: !data->m23 yes Evaluation Count:19458 | no Evaluation Count:0 |
| 0-19458 |
1652 | | - |
1653 | if (affine) { partially evaluated: affine yes Evaluation Count:19461 | no Evaluation Count:0 |
| 0-19461 |
1654 | t *= (1024 - 1); | - |
1655 | inc *= (1024 - 1); | - |
1656 | } executed: } Execution Count:19457 | 19457 |
1657 | } executed: } Execution Count:19462 | 19462 |
1658 | | - |
1659 | const uint *end = buffer + length; | - |
1660 | if (affine) { partially evaluated: affine yes Evaluation Count:19456 | no Evaluation Count:0 |
| 0-19456 |
1661 | if (inc > qreal(-1e-5) && inc < qreal(1e-5)) { partially evaluated: inc > qreal(-1e-5) yes Evaluation Count:19463 | no Evaluation Count:0 |
partially evaluated: inc < qreal(1e-5) no Evaluation Count:0 | yes Evaluation Count:19484 |
| 0-19484 |
1662 | qt_memfill<quint32>(buffer, qt_gradient_pixel_fixed(&data->gradient, int(t * (1<<8))), length);; | - |
1663 | } else { | 0 |
1664 | if (t+inc*length < qreal(2147483647 >> (8 + 1)) && partially evaluated: t+inc*length < qreal(2147483647 >> (8 + 1)) yes Evaluation Count:19473 | no Evaluation Count:0 |
| 0-19473 |
1665 | t+inc*length > qreal((-2147483647 - 1) >> (8 + 1))) { partially evaluated: t+inc*length > qreal((-2147483647 - 1) >> (8 + 1)) yes Evaluation Count:19486 | no Evaluation Count:0 |
| 0-19486 |
1666 | | - |
1667 | int t_fixed = int(t * (1<<8)); | - |
1668 | int inc_fixed = int(inc * (1<<8)); | - |
1669 | while (buffer < end) { evaluated: buffer < end yes Evaluation Count:374027 | yes Evaluation Count:19475 |
| 19475-374027 |
1670 | *buffer = qt_gradient_pixel_fixed(&data->gradient, t_fixed); | - |
1671 | t_fixed += inc_fixed; | - |
1672 | ++buffer; | - |
1673 | } executed: } Execution Count:374017 | 374017 |
1674 | } else { executed: } Execution Count:19478 | 19478 |
1675 | | - |
1676 | while (buffer < end) { never evaluated: buffer < end | 0 |
1677 | *buffer = qt_gradient_pixel(&data->gradient, t/1024); | - |
1678 | t += inc; | - |
1679 | ++buffer; | - |
1680 | } | 0 |
1681 | } | 0 |
1682 | } | - |
1683 | } else { | - |
1684 | qreal rw = data->m23 * (y + qreal(0.5)) + data->m13 * (x + qreal(0.5)) + data->m33; | - |
1685 | while (buffer < end) { never evaluated: buffer < end | 0 |
1686 | qreal x = rx/rw; | - |
1687 | qreal y = ry/rw; | - |
1688 | t = (op->linear.dx*x + op->linear.dy *y) + op->linear.off; | - |
1689 | | - |
1690 | *buffer = qt_gradient_pixel(&data->gradient, t); | - |
1691 | rx += data->m11; | - |
1692 | ry += data->m12; | - |
1693 | rw += data->m13; | - |
1694 | if (!rw) { | 0 |
1695 | rw += data->m13; | - |
1696 | } | 0 |
1697 | ++buffer; | - |
1698 | } | 0 |
1699 | } | 0 |
1700 | | - |
1701 | return b; executed: return b; Execution Count:19479 | 19479 |
1702 | } | - |
1703 | | - |
1704 | static void getRadialGradientValues(RadialGradientValues *v, const QSpanData *data) | - |
1705 | { | - |
1706 | v->dx = data->gradient.radial.center.x - data->gradient.radial.focal.x; | - |
1707 | v->dy = data->gradient.radial.center.y - data->gradient.radial.focal.y; | - |
1708 | | - |
1709 | v->dr = data->gradient.radial.center.radius - data->gradient.radial.focal.radius; | - |
1710 | v->sqrfr = data->gradient.radial.focal.radius * data->gradient.radial.focal.radius; | - |
1711 | | - |
1712 | v->a = v->dr * v->dr - v->dx*v->dx - v->dy*v->dy; | - |
1713 | v->inv2a = 1 / (2 * v->a); | - |
1714 | | - |
1715 | v->extended = !qFuzzyIsNull(data->gradient.radial.focal.radius) || v->a <= 0; partially evaluated: !qFuzzyIsNull(data->gradient.radial.focal.radius) no Evaluation Count:0 | yes Evaluation Count:17 |
partially evaluated: v->a <= 0 no Evaluation Count:0 | yes Evaluation Count:17 |
| 0-17 |
1716 | } executed: } Execution Count:17 | 17 |
1717 | | - |
1718 | class RadialFetchPlain | - |
1719 | { | - |
1720 | public: | - |
1721 | static inline void fetch(uint *buffer, uint *end, const Operator *op, const QSpanData *data, qreal det, | - |
1722 | qreal delta_det, qreal delta_delta_det, qreal b, qreal delta_b) | - |
1723 | { | - |
1724 | if (op->radial.extended) { never evaluated: op->radial.extended | 0 |
1725 | while (buffer < end) { never evaluated: buffer < end | 0 |
1726 | quint32 result = 0; | - |
1727 | if (det >= 0) { never evaluated: det >= 0 | 0 |
1728 | qreal w = qSqrt(det) - b; | - |
1729 | if (data->gradient.radial.focal.radius + op->radial.dr * w >= 0) never evaluated: data->gradient.radial.focal.radius + op->radial.dr * w >= 0 | 0 |
1730 | result = qt_gradient_pixel(&data->gradient, w); never executed: result = qt_gradient_pixel(&data->gradient, w); | 0 |
1731 | } | 0 |
1732 | | - |
1733 | *buffer = result; | - |
1734 | | - |
1735 | det += delta_det; | - |
1736 | delta_det += delta_delta_det; | - |
1737 | b += delta_b; | - |
1738 | | - |
1739 | ++buffer; | - |
1740 | } | 0 |
1741 | } else { | 0 |
1742 | while (buffer < end) { never evaluated: buffer < end | 0 |
1743 | *buffer++ = qt_gradient_pixel(&data->gradient, qSqrt(det) - b); | - |
1744 | | - |
1745 | det += delta_det; | - |
1746 | delta_det += delta_delta_det; | - |
1747 | b += delta_b; | - |
1748 | } | 0 |
1749 | } | 0 |
1750 | } | - |
1751 | }; | - |
1752 | | - |
1753 | const uint * qt_fetch_radial_gradient_plain(uint *buffer, const Operator *op, const QSpanData *data, | - |
1754 | int y, int x, int length) | - |
1755 | { | - |
1756 | return qt_fetch_radial_gradient_template<RadialFetchPlain>(buffer, op, data, y, x, length); never executed: return qt_fetch_radial_gradient_template<RadialFetchPlain>(buffer, op, data, y, x, length); | 0 |
1757 | } | - |
1758 | | - |
1759 | static SourceFetchProc qt_fetch_radial_gradient = qt_fetch_radial_gradient_plain; | - |
1760 | | - |
1761 | static const uint * qt_fetch_conical_gradient(uint *buffer, const Operator *, const QSpanData *data, | - |
1762 | int y, int x, int length) | - |
1763 | { | - |
1764 | const uint *b = buffer; | - |
1765 | qreal rx = data->m21 * (y + qreal(0.5)) | - |
1766 | + data->dx + data->m11 * (x + qreal(0.5)); | - |
1767 | qreal ry = data->m22 * (y + qreal(0.5)) | - |
1768 | + data->dy + data->m12 * (x + qreal(0.5)); | - |
1769 | bool affine = !data->m13 && !data->m23; never evaluated: !data->m13 never evaluated: !data->m23 | 0 |
1770 | | - |
1771 | const uint *end = buffer + length; | - |
1772 | if (affine) { | 0 |
1773 | rx -= data->gradient.conical.center.x; | - |
1774 | ry -= data->gradient.conical.center.y; | - |
1775 | while (buffer < end) { never evaluated: buffer < end | 0 |
1776 | qreal angle = qAtan2(ry, rx) + data->gradient.conical.angle; | - |
1777 | | - |
1778 | *buffer = qt_gradient_pixel(&data->gradient, 1 - angle / (2*Q_PI)); | - |
1779 | | - |
1780 | rx += data->m11; | - |
1781 | ry += data->m12; | - |
1782 | ++buffer; | - |
1783 | } | 0 |
1784 | } else { | 0 |
1785 | qreal rw = data->m23 * (y + qreal(0.5)) | - |
1786 | + data->m33 + data->m13 * (x + qreal(0.5)); | - |
1787 | if (!rw) | 0 |
1788 | rw = 1; | 0 |
1789 | while (buffer < end) { never evaluated: buffer < end | 0 |
1790 | qreal angle = qAtan2(ry/rw - data->gradient.conical.center.x, | - |
1791 | rx/rw - data->gradient.conical.center.y) | - |
1792 | + data->gradient.conical.angle; | - |
1793 | | - |
1794 | *buffer = qt_gradient_pixel(&data->gradient, 1. - angle / (2*Q_PI)); | - |
1795 | | - |
1796 | rx += data->m11; | - |
1797 | ry += data->m12; | - |
1798 | rw += data->m13; | - |
1799 | if (!rw) { | 0 |
1800 | rw += data->m13; | - |
1801 | } | 0 |
1802 | ++buffer; | - |
1803 | } | 0 |
1804 | } | 0 |
1805 | return b; never executed: return b; | 0 |
1806 | } | - |
1807 | void comp_func_solid_Clear(uint *dest, int length, uint, uint const_alpha) | - |
1808 | { | - |
1809 | { if (const_alpha == 255) { qt_memfill<quint32>(dest, 0, length);; } else { int ialpha = 255 - const_alpha; for (int i = 0; i < length; ++i) { dest[i] = BYTE_MUL(dest[i], ialpha); } }}; never evaluated: i < length never evaluated: const_alpha == 255 | 0 |
1810 | } | - |
1811 | | - |
1812 | void comp_func_Clear(uint *dest, const uint *, int length, uint const_alpha) | - |
1813 | { | - |
1814 | { if (const_alpha == 255) { qt_memfill<quint32>(dest, 0, length);; } else { int ialpha = 255 - const_alpha; for (int i = 0; i < length; ++i) { dest[i] = BYTE_MUL(dest[i], ialpha); } }}; never evaluated: i < length never evaluated: const_alpha == 255 | 0 |
1815 | } | - |
1816 | | - |
1817 | | - |
1818 | | - |
1819 | | - |
1820 | | - |
1821 | void comp_func_solid_Source(uint *dest, int length, uint color, uint const_alpha) | - |
1822 | { | - |
1823 | if (const_alpha == 255) { evaluated: const_alpha == 255 yes Evaluation Count:158770 | yes Evaluation Count:65302 |
| 65302-158770 |
1824 | qt_memfill<quint32>(dest, color, length);; | - |
1825 | } else { executed: } Execution Count:158770 | 158770 |
1826 | int ialpha = 255 - const_alpha; | - |
1827 | color = BYTE_MUL(color, const_alpha); | - |
1828 | | - |
1829 | for (int i = 0; i < length; ++i) { evaluated: i < length yes Evaluation Count:65302 | yes Evaluation Count:65302 |
| 65302 |
1830 | | - |
1831 | dest[i] = color + BYTE_MUL(dest[i], ialpha); | - |
1832 | } executed: } Execution Count:65302 | 65302 |
1833 | } executed: } Execution Count:65302 | 65302 |
1834 | } | - |
1835 | | - |
1836 | void comp_func_Source(uint *__restrict__ dest, const uint *__restrict__ src, int length, uint const_alpha) | - |
1837 | { | - |
1838 | if (const_alpha == 255) { never evaluated: const_alpha == 255 | 0 |
1839 | ::memcpy(dest, src, length * sizeof(uint)); | - |
1840 | } else { | 0 |
1841 | int ialpha = 255 - const_alpha; | - |
1842 | | - |
1843 | for (int i = 0; i < length; ++i) { never evaluated: i < length | 0 |
1844 | | - |
1845 | dest[i] = INTERPOLATE_PIXEL_255(src[i], const_alpha, dest[i], ialpha); | - |
1846 | } | 0 |
1847 | } | 0 |
1848 | } | - |
1849 | | - |
1850 | void comp_func_solid_Destination(uint *, int, uint, uint) | - |
1851 | { | - |
1852 | } | - |
1853 | | - |
1854 | void comp_func_Destination(uint *, const uint *, int, uint) | - |
1855 | { | - |
1856 | } | - |
1857 | | - |
1858 | | - |
1859 | | - |
1860 | | - |
1861 | | - |
1862 | | - |
1863 | | - |
1864 | void comp_func_solid_SourceOver(uint *dest, int length, uint color, uint const_alpha) | - |
1865 | { | - |
1866 | if ((const_alpha & qAlpha(color)) == 255) { never evaluated: (const_alpha & qAlpha(color)) == 255 | 0 |
1867 | qt_memfill<quint32>(dest, color, length);; | - |
1868 | } else { | 0 |
1869 | if (const_alpha != 255) never evaluated: const_alpha != 255 | 0 |
1870 | color = BYTE_MUL(color, const_alpha); never executed: color = BYTE_MUL(color, const_alpha); | 0 |
1871 | | - |
1872 | for (int i = 0; i < length; ++i) { never evaluated: i < length | 0 |
1873 | | - |
1874 | dest[i] = color + BYTE_MUL(dest[i], qAlpha(~color)); | - |
1875 | } | 0 |
1876 | } | 0 |
1877 | } | - |
1878 | | - |
1879 | void comp_func_SourceOver(uint *__restrict__ dest, const uint *__restrict__ src, int length, uint const_alpha) | - |
1880 | { | - |
1881 | | - |
1882 | if (const_alpha == 255) { never evaluated: const_alpha == 255 | 0 |
1883 | for (int i = 0; i < length; ++i) { never evaluated: i < length | 0 |
1884 | | - |
1885 | uint s = src[i]; | - |
1886 | if (s >= 0xff000000) never evaluated: s >= 0xff000000 | 0 |
1887 | dest[i] = s; never executed: dest[i] = s; | 0 |
1888 | else if (s != 0) | 0 |
1889 | dest[i] = s + BYTE_MUL(dest[i], qAlpha(~s)); never executed: dest[i] = s + BYTE_MUL(dest[i], qAlpha(~s)); | 0 |
1890 | } | - |
1891 | } else { | 0 |
1892 | for (int i = 0; i < length; ++i) { never evaluated: i < length | 0 |
1893 | | - |
1894 | uint s = BYTE_MUL(src[i], const_alpha); | - |
1895 | dest[i] = s + BYTE_MUL(dest[i], qAlpha(~s)); | - |
1896 | } | 0 |
1897 | } | 0 |
1898 | } | - |
1899 | | - |
1900 | | - |
1901 | | - |
1902 | | - |
1903 | | - |
1904 | | - |
1905 | void comp_func_solid_DestinationOver(uint *dest, int length, uint color, uint const_alpha) | - |
1906 | { | - |
1907 | if (const_alpha != 255) never evaluated: const_alpha != 255 | 0 |
1908 | color = BYTE_MUL(color, const_alpha); never executed: color = BYTE_MUL(color, const_alpha); | 0 |
1909 | | - |
1910 | for (int i = 0; i < length; ++i) { never evaluated: i < length | 0 |
1911 | | - |
1912 | uint d = dest[i]; | - |
1913 | dest[i] = d + BYTE_MUL(color, qAlpha(~d)); | - |
1914 | } | 0 |
1915 | } | 0 |
1916 | | - |
1917 | void comp_func_DestinationOver(uint *__restrict__ dest, const uint *__restrict__ src, int length, uint const_alpha) | - |
1918 | { | - |
1919 | | - |
1920 | if (const_alpha == 255) { never evaluated: const_alpha == 255 | 0 |
1921 | for (int i = 0; i < length; ++i) { never evaluated: i < length | 0 |
1922 | | - |
1923 | uint d = dest[i]; | - |
1924 | dest[i] = d + BYTE_MUL(src[i], qAlpha(~d)); | - |
1925 | } | 0 |
1926 | } else { | 0 |
1927 | for (int i = 0; i < length; ++i) { never evaluated: i < length | 0 |
1928 | | - |
1929 | uint d = dest[i]; | - |
1930 | uint s = BYTE_MUL(src[i], const_alpha); | - |
1931 | dest[i] = d + BYTE_MUL(s, qAlpha(~d)); | - |
1932 | } | 0 |
1933 | } | 0 |
1934 | } | - |
1935 | | - |
1936 | | - |
1937 | | - |
1938 | | - |
1939 | | - |
1940 | void comp_func_solid_SourceIn(uint *dest, int length, uint color, uint const_alpha) | - |
1941 | { | - |
1942 | | - |
1943 | if (const_alpha == 255) { partially evaluated: const_alpha == 255 yes Evaluation Count:2663 | no Evaluation Count:0 |
| 0-2663 |
1944 | for (int i = 0; i < length; ++i) { evaluated: i < length yes Evaluation Count:441657 | yes Evaluation Count:2663 |
| 2663-441657 |
1945 | | - |
1946 | dest[i] = BYTE_MUL(color, qAlpha(dest[i])); | - |
1947 | } executed: } Execution Count:441657 | 441657 |
1948 | } else { executed: } Execution Count:2663 | 2663 |
1949 | color = BYTE_MUL(color, const_alpha); | - |
1950 | uint cia = 255 - const_alpha; | - |
1951 | for (int i = 0; i < length; ++i) { never evaluated: i < length | 0 |
1952 | | - |
1953 | uint d = dest[i]; | - |
1954 | dest[i] = INTERPOLATE_PIXEL_255(color, qAlpha(d), d, cia); | - |
1955 | } | 0 |
1956 | } | 0 |
1957 | } | - |
1958 | | - |
1959 | void comp_func_SourceIn(uint *__restrict__ dest, const uint *__restrict__ src, int length, uint const_alpha) | - |
1960 | { | - |
1961 | | - |
1962 | if (const_alpha == 255) { never evaluated: const_alpha == 255 | 0 |
1963 | for (int i = 0; i < length; ++i) { never evaluated: i < length | 0 |
1964 | | - |
1965 | dest[i] = BYTE_MUL(src[i], qAlpha(dest[i])); | - |
1966 | } | 0 |
1967 | } else { | 0 |
1968 | uint cia = 255 - const_alpha; | - |
1969 | for (int i = 0; i < length; ++i) { never evaluated: i < length | 0 |
1970 | | - |
1971 | uint d = dest[i]; | - |
1972 | uint s = BYTE_MUL(src[i], const_alpha); | - |
1973 | dest[i] = INTERPOLATE_PIXEL_255(s, qAlpha(d), d, cia); | - |
1974 | } | 0 |
1975 | } | 0 |
1976 | } | - |
1977 | | - |
1978 | | - |
1979 | | - |
1980 | | - |
1981 | | - |
1982 | | - |
1983 | void comp_func_solid_DestinationIn(uint *dest, int length, uint color, uint const_alpha) | - |
1984 | { | - |
1985 | uint a = qAlpha(color); | - |
1986 | if (const_alpha != 255) { never evaluated: const_alpha != 255 | 0 |
1987 | a = BYTE_MUL(a, const_alpha) + 255 - const_alpha; | - |
1988 | } | 0 |
1989 | | - |
1990 | for (int i = 0; i < length; ++i) { never evaluated: i < length | 0 |
1991 | | - |
1992 | dest[i] = BYTE_MUL(dest[i], a); | - |
1993 | } | 0 |
1994 | } | 0 |
1995 | | - |
1996 | void comp_func_DestinationIn(uint *__restrict__ dest, const uint *__restrict__ src, int length, uint const_alpha) | - |
1997 | { | - |
1998 | | - |
1999 | if (const_alpha == 255) { never evaluated: const_alpha == 255 | 0 |
2000 | for (int i = 0; i < length; ++i) { never evaluated: i < length | 0 |
2001 | | - |
2002 | dest[i] = BYTE_MUL(dest[i], qAlpha(src[i])); | - |
2003 | } | 0 |
2004 | } else { | 0 |
2005 | int cia = 255 - const_alpha; | - |
2006 | for (int i = 0; i < length; ++i) { never evaluated: i < length | 0 |
2007 | | - |
2008 | uint a = BYTE_MUL(qAlpha(src[i]), const_alpha) + cia; | - |
2009 | dest[i] = BYTE_MUL(dest[i], a); | - |
2010 | } | 0 |
2011 | } | 0 |
2012 | } | - |
2013 | | - |
2014 | | - |
2015 | | - |
2016 | | - |
2017 | | - |
2018 | | - |
2019 | void comp_func_solid_SourceOut(uint *dest, int length, uint color, uint const_alpha) | - |
2020 | { | - |
2021 | | - |
2022 | if (const_alpha == 255) { never evaluated: const_alpha == 255 | 0 |
2023 | for (int i = 0; i < length; ++i) { never evaluated: i < length | 0 |
2024 | | - |
2025 | dest[i] = BYTE_MUL(color, qAlpha(~dest[i])); | - |
2026 | } | 0 |
2027 | } else { | 0 |
2028 | color = BYTE_MUL(color, const_alpha); | - |
2029 | int cia = 255 - const_alpha; | - |
2030 | for (int i = 0; i < length; ++i) { never evaluated: i < length | 0 |
2031 | | - |
2032 | uint d = dest[i]; | - |
2033 | dest[i] = INTERPOLATE_PIXEL_255(color, qAlpha(~d), d, cia); | - |
2034 | } | 0 |
2035 | } | 0 |
2036 | } | - |
2037 | | - |
2038 | void comp_func_SourceOut(uint *__restrict__ dest, const uint *__restrict__ src, int length, uint const_alpha) | - |
2039 | { | - |
2040 | | - |
2041 | if (const_alpha == 255) { never evaluated: const_alpha == 255 | 0 |
2042 | for (int i = 0; i < length; ++i) { never evaluated: i < length | 0 |
2043 | | - |
2044 | dest[i] = BYTE_MUL(src[i], qAlpha(~dest[i])); | - |
2045 | } | 0 |
2046 | } else { | 0 |
2047 | int cia = 255 - const_alpha; | - |
2048 | for (int i = 0; i < length; ++i) { never evaluated: i < length | 0 |
2049 | | - |
2050 | uint s = BYTE_MUL(src[i], const_alpha); | - |
2051 | uint d = dest[i]; | - |
2052 | dest[i] = INTERPOLATE_PIXEL_255(s, qAlpha(~d), d, cia); | - |
2053 | } | 0 |
2054 | } | 0 |
2055 | } | - |
2056 | | - |
2057 | | - |
2058 | | - |
2059 | | - |
2060 | | - |
2061 | | - |
2062 | void comp_func_solid_DestinationOut(uint *dest, int length, uint color, uint const_alpha) | - |
2063 | { | - |
2064 | uint a = qAlpha(~color); | - |
2065 | if (const_alpha != 255) never evaluated: const_alpha != 255 | 0 |
2066 | a = BYTE_MUL(a, const_alpha) + 255 - const_alpha; never executed: a = BYTE_MUL(a, const_alpha) + 255 - const_alpha; | 0 |
2067 | | - |
2068 | for (int i = 0; i < length; ++i) { never evaluated: i < length | 0 |
2069 | | - |
2070 | dest[i] = BYTE_MUL(dest[i], a); | - |
2071 | } | 0 |
2072 | } | 0 |
2073 | | - |
2074 | void comp_func_DestinationOut(uint *__restrict__ dest, const uint *__restrict__ src, int length, uint const_alpha) | - |
2075 | { | - |
2076 | | - |
2077 | if (const_alpha == 255) { never evaluated: const_alpha == 255 | 0 |
2078 | for (int i = 0; i < length; ++i) { never evaluated: i < length | 0 |
2079 | | - |
2080 | dest[i] = BYTE_MUL(dest[i], qAlpha(~src[i])); | - |
2081 | } | 0 |
2082 | } else { | 0 |
2083 | int cia = 255 - const_alpha; | - |
2084 | for (int i = 0; i < length; ++i) { never evaluated: i < length | 0 |
2085 | | - |
2086 | uint sia = BYTE_MUL(qAlpha(~src[i]), const_alpha) + cia; | - |
2087 | dest[i] = BYTE_MUL(dest[i], sia); | - |
2088 | } | 0 |
2089 | } | 0 |
2090 | } | - |
2091 | | - |
2092 | | - |
2093 | | - |
2094 | | - |
2095 | | - |
2096 | | - |
2097 | | - |
2098 | void comp_func_solid_SourceAtop(uint *dest, int length, uint color, uint const_alpha) | - |
2099 | { | - |
2100 | if (const_alpha != 255) { partially evaluated: const_alpha != 255 no Evaluation Count:0 | yes Evaluation Count:79 |
| 0-79 |
2101 | color = BYTE_MUL(color, const_alpha); | - |
2102 | } | 0 |
2103 | uint sia = qAlpha(~color); | - |
2104 | | - |
2105 | for (int i = 0; i < length; ++i) { evaluated: i < length yes Evaluation Count:1203 | yes Evaluation Count:79 |
| 79-1203 |
2106 | | - |
2107 | dest[i] = INTERPOLATE_PIXEL_255(color, qAlpha(dest[i]), dest[i], sia); | - |
2108 | } executed: } Execution Count:1203 | 1203 |
2109 | } executed: } Execution Count:79 | 79 |
2110 | | - |
2111 | void comp_func_SourceAtop(uint *__restrict__ dest, const uint *__restrict__ src, int length, uint const_alpha) | - |
2112 | { | - |
2113 | | - |
2114 | if (const_alpha == 255) { never evaluated: const_alpha == 255 | 0 |
2115 | for (int i = 0; i < length; ++i) { never evaluated: i < length | 0 |
2116 | | - |
2117 | uint s = src[i]; | - |
2118 | uint d = dest[i]; | - |
2119 | dest[i] = INTERPOLATE_PIXEL_255(s, qAlpha(d), d, qAlpha(~s)); | - |
2120 | } | 0 |
2121 | } else { | 0 |
2122 | for (int i = 0; i < length; ++i) { never evaluated: i < length | 0 |
2123 | | - |
2124 | uint s = BYTE_MUL(src[i], const_alpha); | - |
2125 | uint d = dest[i]; | - |
2126 | dest[i] = INTERPOLATE_PIXEL_255(s, qAlpha(d), d, qAlpha(~s)); | - |
2127 | } | 0 |
2128 | } | 0 |
2129 | } | - |
2130 | | - |
2131 | | - |
2132 | | - |
2133 | | - |
2134 | | - |
2135 | | - |
2136 | void comp_func_solid_DestinationAtop(uint *dest, int length, uint color, uint const_alpha) | - |
2137 | { | - |
2138 | uint a = qAlpha(color); | - |
2139 | if (const_alpha != 255) { never evaluated: const_alpha != 255 | 0 |
2140 | color = BYTE_MUL(color, const_alpha); | - |
2141 | a = qAlpha(color) + 255 - const_alpha; | - |
2142 | } | 0 |
2143 | | - |
2144 | for (int i = 0; i < length; ++i) { never evaluated: i < length | 0 |
2145 | | - |
2146 | uint d = dest[i]; | - |
2147 | dest[i] = INTERPOLATE_PIXEL_255(d, a, color, qAlpha(~d)); | - |
2148 | } | 0 |
2149 | } | 0 |
2150 | | - |
2151 | void comp_func_DestinationAtop(uint *__restrict__ dest, const uint *__restrict__ src, int length, uint const_alpha) | - |
2152 | { | - |
2153 | | - |
2154 | if (const_alpha == 255) { never evaluated: const_alpha == 255 | 0 |
2155 | for (int i = 0; i < length; ++i) { never evaluated: i < length | 0 |
2156 | | - |
2157 | uint s = src[i]; | - |
2158 | uint d = dest[i]; | - |
2159 | dest[i] = INTERPOLATE_PIXEL_255(d, qAlpha(s), s, qAlpha(~d)); | - |
2160 | } | 0 |
2161 | } else { | 0 |
2162 | int cia = 255 - const_alpha; | - |
2163 | for (int i = 0; i < length; ++i) { never evaluated: i < length | 0 |
2164 | | - |
2165 | uint s = BYTE_MUL(src[i], const_alpha); | - |
2166 | uint d = dest[i]; | - |
2167 | uint a = qAlpha(s) + cia; | - |
2168 | dest[i] = INTERPOLATE_PIXEL_255(d, a, s, qAlpha(~d)); | - |
2169 | } | 0 |
2170 | } | 0 |
2171 | } | - |
2172 | | - |
2173 | | - |
2174 | | - |
2175 | | - |
2176 | | - |
2177 | | - |
2178 | | - |
2179 | void comp_func_solid_XOR(uint *dest, int length, uint color, uint const_alpha) | - |
2180 | { | - |
2181 | if (const_alpha != 255) never evaluated: const_alpha != 255 | 0 |
2182 | color = BYTE_MUL(color, const_alpha); never executed: color = BYTE_MUL(color, const_alpha); | 0 |
2183 | uint sia = qAlpha(~color); | - |
2184 | | - |
2185 | | - |
2186 | for (int i = 0; i < length; ++i) { never evaluated: i < length | 0 |
2187 | | - |
2188 | uint d = dest[i]; | - |
2189 | dest[i] = INTERPOLATE_PIXEL_255(color, qAlpha(~d), d, sia); | - |
2190 | } | 0 |
2191 | } | 0 |
2192 | | - |
2193 | void comp_func_XOR(uint *__restrict__ dest, const uint *__restrict__ src, int length, uint const_alpha) | - |
2194 | { | - |
2195 | | - |
2196 | if (const_alpha == 255) { never evaluated: const_alpha == 255 | 0 |
2197 | for (int i = 0; i < length; ++i) { never evaluated: i < length | 0 |
2198 | | - |
2199 | uint d = dest[i]; | - |
2200 | uint s = src[i]; | - |
2201 | dest[i] = INTERPOLATE_PIXEL_255(s, qAlpha(~d), d, qAlpha(~s)); | - |
2202 | } | 0 |
2203 | } else { | 0 |
2204 | for (int i = 0; i < length; ++i) { never evaluated: i < length | 0 |
2205 | | - |
2206 | uint d = dest[i]; | - |
2207 | uint s = BYTE_MUL(src[i], const_alpha); | - |
2208 | dest[i] = INTERPOLATE_PIXEL_255(s, qAlpha(~d), d, qAlpha(~s)); | - |
2209 | } | 0 |
2210 | } | 0 |
2211 | } | - |
2212 | | - |
2213 | struct QFullCoverage { | - |
2214 | inline void store(uint *dest, const uint src) const | - |
2215 | { | - |
2216 | *dest = src; | - |
2217 | } executed: } Execution Count:871472 | 871472 |
2218 | }; | - |
2219 | | - |
2220 | struct QPartialCoverage { | - |
2221 | inline QPartialCoverage(uint const_alpha) | - |
2222 | : ca(const_alpha) | - |
2223 | , ica(255 - const_alpha) | - |
2224 | { | - |
2225 | } | 0 |
2226 | | - |
2227 | inline void store(uint *dest, const uint src) const | - |
2228 | { | - |
2229 | *dest = INTERPOLATE_PIXEL_255(src, ca, *dest, ica); | - |
2230 | } | 0 |
2231 | | - |
2232 | private: | - |
2233 | const uint ca; | - |
2234 | const uint ica; | - |
2235 | }; | - |
2236 | | - |
2237 | static inline int mix_alpha(int da, int sa) | - |
2238 | { | - |
2239 | return 255 - ((255 - sa) * (255 - da) >> 8); executed: return 255 - ((255 - sa) * (255 - da) >> 8); Execution Count:701472 | 701472 |
2240 | } | - |
2241 | | - |
2242 | | - |
2243 | | - |
2244 | | - |
2245 | | - |
2246 | template <typename T> | - |
2247 | static __attribute__((always_inline)) inline void comp_func_solid_Plus_impl(uint *dest, int length, uint color, const T &coverage) | - |
2248 | { | - |
2249 | uint s = color; | - |
2250 | | - |
2251 | | - |
2252 | for (int i = 0; i < length; ++i) { evaluated: i < length yes Evaluation Count:170000 | yes Evaluation Count:1700 |
| 1700-170000 |
2253 | | - |
2254 | uint d = dest[i]; | - |
2255 | d = comp_func_Plus_one_pixel(d, s); | - |
2256 | coverage.store(&dest[i], d); | - |
2257 | } executed: } Execution Count:170000 | 170000 |
2258 | } executed: } Execution Count:1700 | 1700 |
2259 | | - |
2260 | void comp_func_solid_Plus(uint *dest, int length, uint color, uint const_alpha) | - |
2261 | { | - |
2262 | if (const_alpha == 255) partially evaluated: const_alpha == 255 yes Evaluation Count:1700 | no Evaluation Count:0 |
| 0-1700 |
2263 | comp_func_solid_Plus_impl(dest, length, color, QFullCoverage()); executed: comp_func_solid_Plus_impl(dest, length, color, QFullCoverage()); Execution Count:1700 | 1700 |
2264 | else | - |
2265 | comp_func_solid_Plus_impl(dest, length, color, QPartialCoverage(const_alpha)); never executed: comp_func_solid_Plus_impl(dest, length, color, QPartialCoverage(const_alpha)); | 0 |
2266 | } | - |
2267 | | - |
2268 | template <typename T> | - |
2269 | static __attribute__((always_inline)) inline void comp_func_Plus_impl(uint *__restrict__ dest, const uint *__restrict__ src, int length, const T &coverage) | - |
2270 | { | - |
2271 | | - |
2272 | for (int i = 0; i < length; ++i) { never evaluated: i < length | 0 |
2273 | | - |
2274 | uint d = dest[i]; | - |
2275 | uint s = src[i]; | - |
2276 | | - |
2277 | d = comp_func_Plus_one_pixel(d, s); | - |
2278 | | - |
2279 | coverage.store(&dest[i], d); | - |
2280 | } | 0 |
2281 | } | 0 |
2282 | | - |
2283 | void comp_func_Plus(uint *__restrict__ dest, const uint *__restrict__ src, int length, uint const_alpha) | - |
2284 | { | - |
2285 | if (const_alpha == 255) never evaluated: const_alpha == 255 | 0 |
2286 | comp_func_Plus_impl(dest, src, length, QFullCoverage()); never executed: comp_func_Plus_impl(dest, src, length, QFullCoverage()); | 0 |
2287 | else | - |
2288 | comp_func_Plus_impl(dest, src, length, QPartialCoverage(const_alpha)); never executed: comp_func_Plus_impl(dest, src, length, QPartialCoverage(const_alpha)); | 0 |
2289 | } | - |
2290 | | - |
2291 | | - |
2292 | | - |
2293 | | - |
2294 | static inline int multiply_op(int dst, int src, int da, int sa) | - |
2295 | { | - |
2296 | return qt_div_255(src * dst + src * (255 - da) + dst * (255 - sa)); executed: return qt_div_255(src * dst + src * (255 - da) + dst * (255 - sa)); Execution Count:210000 | 210000 |
2297 | } | - |
2298 | | - |
2299 | template <typename T> | - |
2300 | static __attribute__((always_inline)) inline void comp_func_solid_Multiply_impl(uint *dest, int length, uint color, const T &coverage) | - |
2301 | { | - |
2302 | int sa = qAlpha(color); | - |
2303 | int sr = qRed(color); | - |
2304 | int sg = qGreen(color); | - |
2305 | int sb = qBlue(color); | - |
2306 | | - |
2307 | | - |
2308 | for (int i = 0; i < length; ++i) { evaluated: i < length yes Evaluation Count:70000 | yes Evaluation Count:700 |
| 700-70000 |
2309 | | - |
2310 | uint d = dest[i]; | - |
2311 | int da = qAlpha(d); | - |
2312 | | - |
2313 | | - |
2314 | int r = multiply_op(qRed(d), sr, da, sa); | - |
2315 | int b = multiply_op(qBlue(d), sb, da, sa); | - |
2316 | int g = multiply_op(qGreen(d), sg, da, sa); | - |
2317 | int a = mix_alpha(da, sa); | - |
2318 | | - |
2319 | | - |
2320 | coverage.store(&dest[i], qRgba(r, g, b, a)); | - |
2321 | } executed: } Execution Count:70000 | 70000 |
2322 | } executed: } Execution Count:700 | 700 |
2323 | | - |
2324 | void comp_func_solid_Multiply(uint *dest, int length, uint color, uint const_alpha) | - |
2325 | { | - |
2326 | if (const_alpha == 255) partially evaluated: const_alpha == 255 yes Evaluation Count:700 | no Evaluation Count:0 |
| 0-700 |
2327 | comp_func_solid_Multiply_impl(dest, length, color, QFullCoverage()); executed: comp_func_solid_Multiply_impl(dest, length, color, QFullCoverage()); Execution Count:700 | 700 |
2328 | else | - |
2329 | comp_func_solid_Multiply_impl(dest, length, color, QPartialCoverage(const_alpha)); never executed: comp_func_solid_Multiply_impl(dest, length, color, QPartialCoverage(const_alpha)); | 0 |
2330 | } | - |
2331 | | - |
2332 | template <typename T> | - |
2333 | static __attribute__((always_inline)) inline void comp_func_Multiply_impl(uint *__restrict__ dest, const uint *__restrict__ src, int length, const T &coverage) | - |
2334 | { | - |
2335 | | - |
2336 | for (int i = 0; i < length; ++i) { never evaluated: i < length | 0 |
2337 | | - |
2338 | uint d = dest[i]; | - |
2339 | uint s = src[i]; | - |
2340 | | - |
2341 | int da = qAlpha(d); | - |
2342 | int sa = qAlpha(s); | - |
2343 | | - |
2344 | | - |
2345 | int r = multiply_op(qRed(d), qRed(s), da, sa); | - |
2346 | int b = multiply_op(qBlue(d), qBlue(s), da, sa); | - |
2347 | int g = multiply_op(qGreen(d), qGreen(s), da, sa); | - |
2348 | int a = mix_alpha(da, sa); | - |
2349 | | - |
2350 | | - |
2351 | coverage.store(&dest[i], qRgba(r, g, b, a)); | - |
2352 | } | 0 |
2353 | } | 0 |
2354 | | - |
2355 | void comp_func_Multiply(uint *__restrict__ dest, const uint *__restrict__ src, int length, uint const_alpha) | - |
2356 | { | - |
2357 | if (const_alpha == 255) never evaluated: const_alpha == 255 | 0 |
2358 | comp_func_Multiply_impl(dest, src, length, QFullCoverage()); never executed: comp_func_Multiply_impl(dest, src, length, QFullCoverage()); | 0 |
2359 | else | - |
2360 | comp_func_Multiply_impl(dest, src, length, QPartialCoverage(const_alpha)); never executed: comp_func_Multiply_impl(dest, src, length, QPartialCoverage(const_alpha)); | 0 |
2361 | } | - |
2362 | | - |
2363 | | - |
2364 | | - |
2365 | | - |
2366 | | - |
2367 | template <typename T> | - |
2368 | static __attribute__((always_inline)) inline void comp_func_solid_Screen_impl(uint *dest, int length, uint color, const T &coverage) | - |
2369 | { | - |
2370 | int sa = qAlpha(color); | - |
2371 | int sr = qRed(color); | - |
2372 | int sg = qGreen(color); | - |
2373 | int sb = qBlue(color); | - |
2374 | | - |
2375 | | - |
2376 | for (int i = 0; i < length; ++i) { evaluated: i < length yes Evaluation Count:111472 | yes Evaluation Count:988 |
| 988-111472 |
2377 | | - |
2378 | uint d = dest[i]; | - |
2379 | int da = qAlpha(d); | - |
2380 | | - |
2381 | | - |
2382 | int r = 255 - qt_div_255((255-qRed(d)) * (255-sr)); | - |
2383 | int b = 255 - qt_div_255((255-qBlue(d)) * (255-sb)); | - |
2384 | int g = 255 - qt_div_255((255-qGreen(d)) * (255-sg)); | - |
2385 | int a = mix_alpha(da, sa); | - |
2386 | | - |
2387 | | - |
2388 | coverage.store(&dest[i], qRgba(r, g, b, a)); | - |
2389 | } executed: } Execution Count:111472 | 111472 |
2390 | } executed: } Execution Count:988 | 988 |
2391 | | - |
2392 | void comp_func_solid_Screen(uint *dest, int length, uint color, uint const_alpha) | - |
2393 | { | - |
2394 | if (const_alpha == 255) partially evaluated: const_alpha == 255 yes Evaluation Count:988 | no Evaluation Count:0 |
| 0-988 |
2395 | comp_func_solid_Screen_impl(dest, length, color, QFullCoverage()); executed: comp_func_solid_Screen_impl(dest, length, color, QFullCoverage()); Execution Count:988 | 988 |
2396 | else | - |
2397 | comp_func_solid_Screen_impl(dest, length, color, QPartialCoverage(const_alpha)); never executed: comp_func_solid_Screen_impl(dest, length, color, QPartialCoverage(const_alpha)); | 0 |
2398 | } | - |
2399 | | - |
2400 | template <typename T> | - |
2401 | static __attribute__((always_inline)) inline void comp_func_Screen_impl(uint *__restrict__ dest, const uint *__restrict__ src, int length, const T &coverage) | - |
2402 | { | - |
2403 | | - |
2404 | for (int i = 0; i < length; ++i) { never evaluated: i < length | 0 |
2405 | | - |
2406 | uint d = dest[i]; | - |
2407 | uint s = src[i]; | - |
2408 | | - |
2409 | int da = qAlpha(d); | - |
2410 | int sa = qAlpha(s); | - |
2411 | | - |
2412 | | - |
2413 | int r = 255 - (((255-qRed(d)) * (255-qRed(s))) >> 8); | - |
2414 | int b = 255 - (((255-qBlue(d)) * (255-qBlue(s))) >> 8); | - |
2415 | int g = 255 - (((255-qGreen(d)) * (255-qGreen(s))) >> 8); | - |
2416 | int a = mix_alpha(da, sa); | - |
2417 | | - |
2418 | | - |
2419 | coverage.store(&dest[i], qRgba(r, g, b, a)); | - |
2420 | } | 0 |
2421 | } | 0 |
2422 | | - |
2423 | void comp_func_Screen(uint *dest, const uint *src, int length, uint const_alpha) | - |
2424 | { | - |
2425 | if (const_alpha == 255) never evaluated: const_alpha == 255 | 0 |
2426 | comp_func_Screen_impl(dest, src, length, QFullCoverage()); never executed: comp_func_Screen_impl(dest, src, length, QFullCoverage()); | 0 |
2427 | else | - |
2428 | comp_func_Screen_impl(dest, src, length, QPartialCoverage(const_alpha)); never executed: comp_func_Screen_impl(dest, src, length, QPartialCoverage(const_alpha)); | 0 |
2429 | } | - |
2430 | | - |
2431 | | - |
2432 | | - |
2433 | | - |
2434 | | - |
2435 | | - |
2436 | | - |
2437 | static inline int overlay_op(int dst, int src, int da, int sa) | - |
2438 | { | - |
2439 | const int temp = src * (255 - da) + dst * (255 - sa); | - |
2440 | if (2 * dst < da) evaluated: 2 * dst < da yes Evaluation Count:60000 | yes Evaluation Count:60000 |
| 60000 |
2441 | return qt_div_255(2 * src * dst + temp); executed: return qt_div_255(2 * src * dst + temp); Execution Count:60000 | 60000 |
2442 | else | - |
2443 | return qt_div_255(sa * da - 2 * (da - dst) * (sa - src) + temp); executed: return qt_div_255(sa * da - 2 * (da - dst) * (sa - src) + temp); Execution Count:60000 | 60000 |
2444 | } | - |
2445 | | - |
2446 | template <typename T> | - |
2447 | static __attribute__((always_inline)) inline void comp_func_solid_Overlay_impl(uint *dest, int length, uint color, const T &coverage) | - |
2448 | { | - |
2449 | int sa = qAlpha(color); | - |
2450 | int sr = qRed(color); | - |
2451 | int sg = qGreen(color); | - |
2452 | int sb = qBlue(color); | - |
2453 | | - |
2454 | | - |
2455 | for (int i = 0; i < length; ++i) { evaluated: i < length yes Evaluation Count:40000 | yes Evaluation Count:400 |
| 400-40000 |
2456 | | - |
2457 | uint d = dest[i]; | - |
2458 | int da = qAlpha(d); | - |
2459 | | - |
2460 | | - |
2461 | int r = overlay_op(qRed(d), sr, da, sa); | - |
2462 | int b = overlay_op(qBlue(d), sb, da, sa); | - |
2463 | int g = overlay_op(qGreen(d), sg, da, sa); | - |
2464 | int a = mix_alpha(da, sa); | - |
2465 | | - |
2466 | | - |
2467 | coverage.store(&dest[i], qRgba(r, g, b, a)); | - |
2468 | } executed: } Execution Count:40000 | 40000 |
2469 | } executed: } Execution Count:400 | 400 |
2470 | | - |
2471 | void comp_func_solid_Overlay(uint *dest, int length, uint color, uint const_alpha) | - |
2472 | { | - |
2473 | if (const_alpha == 255) partially evaluated: const_alpha == 255 yes Evaluation Count:400 | no Evaluation Count:0 |
| 0-400 |
2474 | comp_func_solid_Overlay_impl(dest, length, color, QFullCoverage()); executed: comp_func_solid_Overlay_impl(dest, length, color, QFullCoverage()); Execution Count:400 | 400 |
2475 | else | - |
2476 | comp_func_solid_Overlay_impl(dest, length, color, QPartialCoverage(const_alpha)); never executed: comp_func_solid_Overlay_impl(dest, length, color, QPartialCoverage(const_alpha)); | 0 |
2477 | } | - |
2478 | | - |
2479 | template <typename T> | - |
2480 | static __attribute__((always_inline)) inline void comp_func_Overlay_impl(uint *__restrict__ dest, const uint *__restrict__ src, int length, const T &coverage) | - |
2481 | { | - |
2482 | | - |
2483 | for (int i = 0; i < length; ++i) { never evaluated: i < length | 0 |
2484 | | - |
2485 | uint d = dest[i]; | - |
2486 | uint s = src[i]; | - |
2487 | | - |
2488 | int da = qAlpha(d); | - |
2489 | int sa = qAlpha(s); | - |
2490 | | - |
2491 | | - |
2492 | int r = overlay_op(qRed(d), qRed(s), da, sa); | - |
2493 | int b = overlay_op(qBlue(d), qBlue(s), da, sa); | - |
2494 | int g = overlay_op(qGreen(d), qGreen(s), da, sa); | - |
2495 | int a = mix_alpha(da, sa); | - |
2496 | | - |
2497 | | - |
2498 | coverage.store(&dest[i], qRgba(r, g, b, a)); | - |
2499 | } | 0 |
2500 | } | 0 |
2501 | | - |
2502 | void comp_func_Overlay(uint *__restrict__ dest, const uint *__restrict__ src, int length, uint const_alpha) | - |
2503 | { | - |
2504 | if (const_alpha == 255) never evaluated: const_alpha == 255 | 0 |
2505 | comp_func_Overlay_impl(dest, src, length, QFullCoverage()); never executed: comp_func_Overlay_impl(dest, src, length, QFullCoverage()); | 0 |
2506 | else | - |
2507 | comp_func_Overlay_impl(dest, src, length, QPartialCoverage(const_alpha)); never executed: comp_func_Overlay_impl(dest, src, length, QPartialCoverage(const_alpha)); | 0 |
2508 | } | - |
2509 | | - |
2510 | | - |
2511 | | - |
2512 | | - |
2513 | | - |
2514 | static inline int darken_op(int dst, int src, int da, int sa) | - |
2515 | { | - |
2516 | return qt_div_255(qMin(src * da, dst * sa) + src * (255 - da) + dst * (255 - sa)); executed: return qt_div_255(qMin(src * da, dst * sa) + src * (255 - da) + dst * (255 - sa)); Execution Count:210000 | 210000 |
2517 | } | - |
2518 | | - |
2519 | template <typename T> | - |
2520 | static __attribute__((always_inline)) inline void comp_func_solid_Darken_impl(uint *dest, int length, uint color, const T &coverage) | - |
2521 | { | - |
2522 | int sa = qAlpha(color); | - |
2523 | int sr = qRed(color); | - |
2524 | int sg = qGreen(color); | - |
2525 | int sb = qBlue(color); | - |
2526 | | - |
2527 | | - |
2528 | for (int i = 0; i < length; ++i) { evaluated: i < length yes Evaluation Count:70000 | yes Evaluation Count:700 |
| 700-70000 |
2529 | | - |
2530 | uint d = dest[i]; | - |
2531 | int da = qAlpha(d); | - |
2532 | | - |
2533 | | - |
2534 | int r = darken_op(qRed(d), sr, da, sa); | - |
2535 | int b = darken_op(qBlue(d), sb, da, sa); | - |
2536 | int g = darken_op(qGreen(d), sg, da, sa); | - |
2537 | int a = mix_alpha(da, sa); | - |
2538 | | - |
2539 | | - |
2540 | coverage.store(&dest[i], qRgba(r, g, b, a)); | - |
2541 | } executed: } Execution Count:70000 | 70000 |
2542 | } executed: } Execution Count:700 | 700 |
2543 | | - |
2544 | void comp_func_solid_Darken(uint *dest, int length, uint color, uint const_alpha) | - |
2545 | { | - |
2546 | if (const_alpha == 255) partially evaluated: const_alpha == 255 yes Evaluation Count:700 | no Evaluation Count:0 |
| 0-700 |
2547 | comp_func_solid_Darken_impl(dest, length, color, QFullCoverage()); executed: comp_func_solid_Darken_impl(dest, length, color, QFullCoverage()); Execution Count:700 | 700 |
2548 | else | - |
2549 | comp_func_solid_Darken_impl(dest, length, color, QPartialCoverage(const_alpha)); never executed: comp_func_solid_Darken_impl(dest, length, color, QPartialCoverage(const_alpha)); | 0 |
2550 | } | - |
2551 | | - |
2552 | template <typename T> | - |
2553 | static __attribute__((always_inline)) inline void comp_func_Darken_impl(uint *__restrict__ dest, const uint *__restrict__ src, int length, const T &coverage) | - |
2554 | { | - |
2555 | | - |
2556 | for (int i = 0; i < length; ++i) { never evaluated: i < length | 0 |
2557 | | - |
2558 | uint d = dest[i]; | - |
2559 | uint s = src[i]; | - |
2560 | | - |
2561 | int da = qAlpha(d); | - |
2562 | int sa = qAlpha(s); | - |
2563 | | - |
2564 | | - |
2565 | int r = darken_op(qRed(d), qRed(s), da, sa); | - |
2566 | int b = darken_op(qBlue(d), qBlue(s), da, sa); | - |
2567 | int g = darken_op(qGreen(d), qGreen(s), da, sa); | - |
2568 | int a = mix_alpha(da, sa); | - |
2569 | | - |
2570 | | - |
2571 | coverage.store(&dest[i], qRgba(r, g, b, a)); | - |
2572 | } | 0 |
2573 | } | 0 |
2574 | | - |
2575 | void comp_func_Darken(uint *__restrict__ dest, const uint *__restrict__ src, int length, uint const_alpha) | - |
2576 | { | - |
2577 | if (const_alpha == 255) never evaluated: const_alpha == 255 | 0 |
2578 | comp_func_Darken_impl(dest, src, length, QFullCoverage()); never executed: comp_func_Darken_impl(dest, src, length, QFullCoverage()); | 0 |
2579 | else | - |
2580 | comp_func_Darken_impl(dest, src, length, QPartialCoverage(const_alpha)); never executed: comp_func_Darken_impl(dest, src, length, QPartialCoverage(const_alpha)); | 0 |
2581 | } | - |
2582 | | - |
2583 | | - |
2584 | | - |
2585 | | - |
2586 | | - |
2587 | static inline int lighten_op(int dst, int src, int da, int sa) | - |
2588 | { | - |
2589 | return qt_div_255(qMax(src * da, dst * sa) + src * (255 - da) + dst * (255 - sa)); executed: return qt_div_255(qMax(src * da, dst * sa) + src * (255 - da) + dst * (255 - sa)); Execution Count:210000 | 210000 |
2590 | } | - |
2591 | | - |
2592 | template <typename T> | - |
2593 | static __attribute__((always_inline)) inline void comp_func_solid_Lighten_impl(uint *dest, int length, uint color, const T &coverage) | - |
2594 | { | - |
2595 | int sa = qAlpha(color); | - |
2596 | int sr = qRed(color); | - |
2597 | int sg = qGreen(color); | - |
2598 | int sb = qBlue(color); | - |
2599 | | - |
2600 | | - |
2601 | for (int i = 0; i < length; ++i) { evaluated: i < length yes Evaluation Count:70000 | yes Evaluation Count:700 |
| 700-70000 |
2602 | | - |
2603 | uint d = dest[i]; | - |
2604 | int da = qAlpha(d); | - |
2605 | | - |
2606 | | - |
2607 | int r = lighten_op(qRed(d), sr, da, sa); | - |
2608 | int b = lighten_op(qBlue(d), sb, da, sa); | - |
2609 | int g = lighten_op(qGreen(d), sg, da, sa); | - |
2610 | int a = mix_alpha(da, sa); | - |
2611 | | - |
2612 | | - |
2613 | coverage.store(&dest[i], qRgba(r, g, b, a)); | - |
2614 | } executed: } Execution Count:70000 | 70000 |
2615 | } executed: } Execution Count:700 | 700 |
2616 | | - |
2617 | void comp_func_solid_Lighten(uint *dest, int length, uint color, uint const_alpha) | - |
2618 | { | - |
2619 | if (const_alpha == 255) partially evaluated: const_alpha == 255 yes Evaluation Count:700 | no Evaluation Count:0 |
| 0-700 |
2620 | comp_func_solid_Lighten_impl(dest, length, color, QFullCoverage()); executed: comp_func_solid_Lighten_impl(dest, length, color, QFullCoverage()); Execution Count:700 | 700 |
2621 | else | - |
2622 | comp_func_solid_Lighten_impl(dest, length, color, QPartialCoverage(const_alpha)); never executed: comp_func_solid_Lighten_impl(dest, length, color, QPartialCoverage(const_alpha)); | 0 |
2623 | } | - |
2624 | | - |
2625 | template <typename T> | - |
2626 | static __attribute__((always_inline)) inline void comp_func_Lighten_impl(uint *__restrict__ dest, const uint *__restrict__ src, int length, const T &coverage) | - |
2627 | { | - |
2628 | | - |
2629 | for (int i = 0; i < length; ++i) { never evaluated: i < length | 0 |
2630 | | - |
2631 | uint d = dest[i]; | - |
2632 | uint s = src[i]; | - |
2633 | | - |
2634 | int da = qAlpha(d); | - |
2635 | int sa = qAlpha(s); | - |
2636 | | - |
2637 | | - |
2638 | int r = lighten_op(qRed(d), qRed(s), da, sa); | - |
2639 | int b = lighten_op(qBlue(d), qBlue(s), da, sa); | - |
2640 | int g = lighten_op(qGreen(d), qGreen(s), da, sa); | - |
2641 | int a = mix_alpha(da, sa); | - |
2642 | | - |
2643 | | - |
2644 | coverage.store(&dest[i], qRgba(r, g, b, a)); | - |
2645 | } | 0 |
2646 | } | 0 |
2647 | | - |
2648 | void comp_func_Lighten(uint *__restrict__ dest, const uint *__restrict__ src, int length, uint const_alpha) | - |
2649 | { | - |
2650 | if (const_alpha == 255) never evaluated: const_alpha == 255 | 0 |
2651 | comp_func_Lighten_impl(dest, src, length, QFullCoverage()); never executed: comp_func_Lighten_impl(dest, src, length, QFullCoverage()); | 0 |
2652 | else | - |
2653 | comp_func_Lighten_impl(dest, src, length, QPartialCoverage(const_alpha)); never executed: comp_func_Lighten_impl(dest, src, length, QPartialCoverage(const_alpha)); | 0 |
2654 | } | - |
2655 | | - |
2656 | | - |
2657 | | - |
2658 | | - |
2659 | | - |
2660 | | - |
2661 | | - |
2662 | static inline int color_dodge_op(int dst, int src, int da, int sa) | - |
2663 | { | - |
2664 | const int sa_da = sa * da; | - |
2665 | const int dst_sa = dst * sa; | - |
2666 | const int src_da = src * da; | - |
2667 | | - |
2668 | const int temp = src * (255 - da) + dst * (255 - sa); | - |
2669 | if (src_da + dst_sa >= sa_da) evaluated: src_da + dst_sa >= sa_da yes Evaluation Count:90000 | yes Evaluation Count:60000 |
| 60000-90000 |
2670 | return qt_div_255(sa_da + temp); executed: return qt_div_255(sa_da + temp); Execution Count:90000 | 90000 |
2671 | else | - |
2672 | return qt_div_255(255 * dst_sa / (255 - 255 * src / sa) + temp); executed: return qt_div_255(255 * dst_sa / (255 - 255 * src / sa) + temp); Execution Count:60000 | 60000 |
2673 | } | - |
2674 | | - |
2675 | template <typename T> | - |
2676 | static __attribute__((always_inline)) inline void comp_func_solid_ColorDodge_impl(uint *dest, int length, uint color, const T &coverage) | - |
2677 | { | - |
2678 | int sa = qAlpha(color); | - |
2679 | int sr = qRed(color); | - |
2680 | int sg = qGreen(color); | - |
2681 | int sb = qBlue(color); | - |
2682 | | - |
2683 | | - |
2684 | for (int i = 0; i < length; ++i) { evaluated: i < length yes Evaluation Count:50000 | yes Evaluation Count:500 |
| 500-50000 |
2685 | | - |
2686 | uint d = dest[i]; | - |
2687 | int da = qAlpha(d); | - |
2688 | | - |
2689 | | - |
2690 | int r = color_dodge_op(qRed(d), sr, da, sa); | - |
2691 | int b = color_dodge_op(qBlue(d), sb, da, sa); | - |
2692 | int g = color_dodge_op(qGreen(d), sg, da, sa); | - |
2693 | int a = mix_alpha(da, sa); | - |
2694 | | - |
2695 | | - |
2696 | coverage.store(&dest[i], qRgba(r, g, b, a)); | - |
2697 | } executed: } Execution Count:50000 | 50000 |
2698 | } executed: } Execution Count:500 | 500 |
2699 | | - |
2700 | void comp_func_solid_ColorDodge(uint *dest, int length, uint color, uint const_alpha) | - |
2701 | { | - |
2702 | if (const_alpha == 255) partially evaluated: const_alpha == 255 yes Evaluation Count:500 | no Evaluation Count:0 |
| 0-500 |
2703 | comp_func_solid_ColorDodge_impl(dest, length, color, QFullCoverage()); executed: comp_func_solid_ColorDodge_impl(dest, length, color, QFullCoverage()); Execution Count:500 | 500 |
2704 | else | - |
2705 | comp_func_solid_ColorDodge_impl(dest, length, color, QPartialCoverage(const_alpha)); never executed: comp_func_solid_ColorDodge_impl(dest, length, color, QPartialCoverage(const_alpha)); | 0 |
2706 | } | - |
2707 | | - |
2708 | template <typename T> | - |
2709 | static __attribute__((always_inline)) inline void comp_func_ColorDodge_impl(uint *__restrict__ dest, const uint *__restrict__ src, int length, const T &coverage) | - |
2710 | { | - |
2711 | | - |
2712 | for (int i = 0; i < length; ++i) { never evaluated: i < length | 0 |
2713 | | - |
2714 | uint d = dest[i]; | - |
2715 | uint s = src[i]; | - |
2716 | | - |
2717 | int da = qAlpha(d); | - |
2718 | int sa = qAlpha(s); | - |
2719 | | - |
2720 | | - |
2721 | int r = color_dodge_op(qRed(d), qRed(s), da, sa); | - |
2722 | int b = color_dodge_op(qBlue(d), qBlue(s), da, sa); | - |
2723 | int g = color_dodge_op(qGreen(d), qGreen(s), da, sa); | - |
2724 | int a = mix_alpha(da, sa); | - |
2725 | | - |
2726 | | - |
2727 | coverage.store(&dest[i], qRgba(r, g, b, a)); | - |
2728 | } | 0 |
2729 | } | 0 |
2730 | | - |
2731 | void comp_func_ColorDodge(uint *__restrict__ dest, const uint *__restrict__ src, int length, uint const_alpha) | - |
2732 | { | - |
2733 | if (const_alpha == 255) never evaluated: const_alpha == 255 | 0 |
2734 | comp_func_ColorDodge_impl(dest, src, length, QFullCoverage()); never executed: comp_func_ColorDodge_impl(dest, src, length, QFullCoverage()); | 0 |
2735 | else | - |
2736 | comp_func_ColorDodge_impl(dest, src, length, QPartialCoverage(const_alpha)); never executed: comp_func_ColorDodge_impl(dest, src, length, QPartialCoverage(const_alpha)); | 0 |
2737 | } | - |
2738 | | - |
2739 | | - |
2740 | | - |
2741 | | - |
2742 | | - |
2743 | | - |
2744 | | - |
2745 | static inline int color_burn_op(int dst, int src, int da, int sa) | - |
2746 | { | - |
2747 | const int src_da = src * da; | - |
2748 | const int dst_sa = dst * sa; | - |
2749 | const int sa_da = sa * da; | - |
2750 | | - |
2751 | const int temp = src * (255 - da) + dst * (255 - sa); | - |
2752 | | - |
2753 | if (src == 0 || src_da + dst_sa <= sa_da) evaluated: src == 0 yes Evaluation Count:30000 | yes Evaluation Count:120000 |
evaluated: src_da + dst_sa <= sa_da yes Evaluation Count:30000 | yes Evaluation Count:90000 |
| 30000-120000 |
2754 | return qt_div_255(temp); executed: return qt_div_255(temp); Execution Count:60000 | 60000 |
2755 | return qt_div_255(sa * (src_da + dst_sa - sa_da) / src + temp); executed: return qt_div_255(sa * (src_da + dst_sa - sa_da) / src + temp); Execution Count:90000 | 90000 |
2756 | } | - |
2757 | | - |
2758 | template <typename T> | - |
2759 | static __attribute__((always_inline)) inline void comp_func_solid_ColorBurn_impl(uint *dest, int length, uint color, const T &coverage) | - |
2760 | { | - |
2761 | int sa = qAlpha(color); | - |
2762 | int sr = qRed(color); | - |
2763 | int sg = qGreen(color); | - |
2764 | int sb = qBlue(color); | - |
2765 | | - |
2766 | | - |
2767 | for (int i = 0; i < length; ++i) { evaluated: i < length yes Evaluation Count:50000 | yes Evaluation Count:500 |
| 500-50000 |
2768 | | - |
2769 | uint d = dest[i]; | - |
2770 | int da = qAlpha(d); | - |
2771 | | - |
2772 | | - |
2773 | int r = color_burn_op(qRed(d), sr, da, sa); | - |
2774 | int b = color_burn_op(qBlue(d), sb, da, sa); | - |
2775 | int g = color_burn_op(qGreen(d), sg, da, sa); | - |
2776 | int a = mix_alpha(da, sa); | - |
2777 | | - |
2778 | | - |
2779 | coverage.store(&dest[i], qRgba(r, g, b, a)); | - |
2780 | } executed: } Execution Count:50000 | 50000 |
2781 | } executed: } Execution Count:500 | 500 |
2782 | | - |
2783 | void comp_func_solid_ColorBurn(uint *dest, int length, uint color, uint const_alpha) | - |
2784 | { | - |
2785 | if (const_alpha == 255) partially evaluated: const_alpha == 255 yes Evaluation Count:500 | no Evaluation Count:0 |
| 0-500 |
2786 | comp_func_solid_ColorBurn_impl(dest, length, color, QFullCoverage()); executed: comp_func_solid_ColorBurn_impl(dest, length, color, QFullCoverage()); Execution Count:500 | 500 |
2787 | else | - |
2788 | comp_func_solid_ColorBurn_impl(dest, length, color, QPartialCoverage(const_alpha)); never executed: comp_func_solid_ColorBurn_impl(dest, length, color, QPartialCoverage(const_alpha)); | 0 |
2789 | } | - |
2790 | | - |
2791 | template <typename T> | - |
2792 | static __attribute__((always_inline)) inline void comp_func_ColorBurn_impl(uint *__restrict__ dest, const uint *__restrict__ src, int length, const T &coverage) | - |
2793 | { | - |
2794 | | - |
2795 | for (int i = 0; i < length; ++i) { never evaluated: i < length | 0 |
2796 | | - |
2797 | uint d = dest[i]; | - |
2798 | uint s = src[i]; | - |
2799 | | - |
2800 | int da = qAlpha(d); | - |
2801 | int sa = qAlpha(s); | - |
2802 | | - |
2803 | | - |
2804 | int r = color_burn_op(qRed(d), qRed(s), da, sa); | - |
2805 | int b = color_burn_op(qBlue(d), qBlue(s), da, sa); | - |
2806 | int g = color_burn_op(qGreen(d), qGreen(s), da, sa); | - |
2807 | int a = mix_alpha(da, sa); | - |
2808 | | - |
2809 | | - |
2810 | coverage.store(&dest[i], qRgba(r, g, b, a)); | - |
2811 | } | 0 |
2812 | } | 0 |
2813 | | - |
2814 | void comp_func_ColorBurn(uint *__restrict__ dest, const uint *__restrict__ src, int length, uint const_alpha) | - |
2815 | { | - |
2816 | if (const_alpha == 255) never evaluated: const_alpha == 255 | 0 |
2817 | comp_func_ColorBurn_impl(dest, src, length, QFullCoverage()); never executed: comp_func_ColorBurn_impl(dest, src, length, QFullCoverage()); | 0 |
2818 | else | - |
2819 | comp_func_ColorBurn_impl(dest, src, length, QPartialCoverage(const_alpha)); never executed: comp_func_ColorBurn_impl(dest, src, length, QPartialCoverage(const_alpha)); | 0 |
2820 | } | - |
2821 | | - |
2822 | | - |
2823 | | - |
2824 | | - |
2825 | | - |
2826 | | - |
2827 | | - |
2828 | static inline uint hardlight_op(int dst, int src, int da, int sa) | - |
2829 | { | - |
2830 | const uint temp = src * (255 - da) + dst * (255 - sa); | - |
2831 | | - |
2832 | if (2 * src < sa) evaluated: 2 * src < sa yes Evaluation Count:120000 | yes Evaluation Count:30000 |
| 30000-120000 |
2833 | return qt_div_255(2 * src * dst + temp); executed: return qt_div_255(2 * src * dst + temp); Execution Count:120000 | 120000 |
2834 | else | - |
2835 | return qt_div_255(sa * da - 2 * (da - dst) * (sa - src) + temp); executed: return qt_div_255(sa * da - 2 * (da - dst) * (sa - src) + temp); Execution Count:30000 | 30000 |
2836 | } | - |
2837 | | - |
2838 | template <typename T> | - |
2839 | static __attribute__((always_inline)) inline void comp_func_solid_HardLight_impl(uint *dest, int length, uint color, const T &coverage) | - |
2840 | { | - |
2841 | int sa = qAlpha(color); | - |
2842 | int sr = qRed(color); | - |
2843 | int sg = qGreen(color); | - |
2844 | int sb = qBlue(color); | - |
2845 | | - |
2846 | | - |
2847 | for (int i = 0; i < length; ++i) { evaluated: i < length yes Evaluation Count:50000 | yes Evaluation Count:500 |
| 500-50000 |
2848 | | - |
2849 | uint d = dest[i]; | - |
2850 | int da = qAlpha(d); | - |
2851 | | - |
2852 | | - |
2853 | int r = hardlight_op(qRed(d), sr, da, sa); | - |
2854 | int b = hardlight_op(qBlue(d), sb, da, sa); | - |
2855 | int g = hardlight_op(qGreen(d), sg, da, sa); | - |
2856 | int a = mix_alpha(da, sa); | - |
2857 | | - |
2858 | | - |
2859 | coverage.store(&dest[i], qRgba(r, g, b, a)); | - |
2860 | } executed: } Execution Count:50000 | 50000 |
2861 | } executed: } Execution Count:500 | 500 |
2862 | | - |
2863 | void comp_func_solid_HardLight(uint *dest, int length, uint color, uint const_alpha) | - |
2864 | { | - |
2865 | if (const_alpha == 255) partially evaluated: const_alpha == 255 yes Evaluation Count:500 | no Evaluation Count:0 |
| 0-500 |
2866 | comp_func_solid_HardLight_impl(dest, length, color, QFullCoverage()); executed: comp_func_solid_HardLight_impl(dest, length, color, QFullCoverage()); Execution Count:500 | 500 |
2867 | else | - |
2868 | comp_func_solid_HardLight_impl(dest, length, color, QPartialCoverage(const_alpha)); never executed: comp_func_solid_HardLight_impl(dest, length, color, QPartialCoverage(const_alpha)); | 0 |
2869 | } | - |
2870 | | - |
2871 | template <typename T> | - |
2872 | static __attribute__((always_inline)) inline void comp_func_HardLight_impl(uint *__restrict__ dest, const uint *__restrict__ src, int length, const T &coverage) | - |
2873 | { | - |
2874 | | - |
2875 | for (int i = 0; i < length; ++i) { never evaluated: i < length | 0 |
2876 | | - |
2877 | uint d = dest[i]; | - |
2878 | uint s = src[i]; | - |
2879 | | - |
2880 | int da = qAlpha(d); | - |
2881 | int sa = qAlpha(s); | - |
2882 | | - |
2883 | | - |
2884 | int r = hardlight_op(qRed(d), qRed(s), da, sa); | - |
2885 | int b = hardlight_op(qBlue(d), qBlue(s), da, sa); | - |
2886 | int g = hardlight_op(qGreen(d), qGreen(s), da, sa); | - |
2887 | int a = mix_alpha(da, sa); | - |
2888 | | - |
2889 | | - |
2890 | coverage.store(&dest[i], qRgba(r, g, b, a)); | - |
2891 | } | 0 |
2892 | } | 0 |
2893 | | - |
2894 | void comp_func_HardLight(uint *__restrict__ dest, const uint *__restrict__ src, int length, uint const_alpha) | - |
2895 | { | - |
2896 | if (const_alpha == 255) never evaluated: const_alpha == 255 | 0 |
2897 | comp_func_HardLight_impl(dest, src, length, QFullCoverage()); never executed: comp_func_HardLight_impl(dest, src, length, QFullCoverage()); | 0 |
2898 | else | - |
2899 | comp_func_HardLight_impl(dest, src, length, QPartialCoverage(const_alpha)); never executed: comp_func_HardLight_impl(dest, src, length, QPartialCoverage(const_alpha)); | 0 |
2900 | } | - |
2901 | static inline int soft_light_op(int dst, int src, int da, int sa) | - |
2902 | { | - |
2903 | const int src2 = src << 1; | - |
2904 | const int dst_np = da != 0 ? (255 * dst) / da : 0; partially evaluated: da != 0 yes Evaluation Count:150000 | no Evaluation Count:0 |
| 0-150000 |
2905 | const int temp = (src * (255 - da) + dst * (255 - sa)) * 255; | - |
2906 | | - |
2907 | if (src2 < sa) evaluated: src2 < sa yes Evaluation Count:120000 | yes Evaluation Count:30000 |
| 30000-120000 |
2908 | return (dst * (sa * 255 + (src2 - sa) * (255 - dst_np)) + temp) / 65025; executed: return (dst * (sa * 255 + (src2 - sa) * (255 - dst_np)) + temp) / 65025; Execution Count:120000 | 120000 |
2909 | else if (4 * dst <= da) partially evaluated: 4 * dst <= da no Evaluation Count:0 | yes Evaluation Count:30000 |
| 0-30000 |
2910 | return (dst * sa * 255 + da * (src2 - sa) * ((((16 * dst_np - 12 * 255) * dst_np + 3 * 65025) * dst_np) / 65025) + temp) / 65025; never executed: return (dst * sa * 255 + da * (src2 - sa) * ((((16 * dst_np - 12 * 255) * dst_np + 3 * 65025) * dst_np) / 65025) + temp) / 65025; | 0 |
2911 | else { | - |
2912 | | - |
2913 | | - |
2914 | | - |
2915 | return (dst * sa * 255 + da * (src2 - sa) * (int(qSqrt(qreal(dst_np * 255))) - dst_np) + temp) / 65025; executed: return (dst * sa * 255 + da * (src2 - sa) * (int(qSqrt(qreal(dst_np * 255))) - dst_np) + temp) / 65025; Execution Count:30000 | 30000 |
2916 | | - |
2917 | } | - |
2918 | } | - |
2919 | | - |
2920 | template <typename T> | - |
2921 | static __attribute__((always_inline)) inline void comp_func_solid_SoftLight_impl(uint *dest, int length, uint color, const T &coverage) | - |
2922 | { | - |
2923 | int sa = qAlpha(color); | - |
2924 | int sr = qRed(color); | - |
2925 | int sg = qGreen(color); | - |
2926 | int sb = qBlue(color); | - |
2927 | | - |
2928 | | - |
2929 | for (int i = 0; i < length; ++i) { evaluated: i < length yes Evaluation Count:50000 | yes Evaluation Count:500 |
| 500-50000 |
2930 | | - |
2931 | uint d = dest[i]; | - |
2932 | int da = qAlpha(d); | - |
2933 | | - |
2934 | | - |
2935 | int r = soft_light_op(qRed(d), sr, da, sa); | - |
2936 | int b = soft_light_op(qBlue(d), sb, da, sa); | - |
2937 | int g = soft_light_op(qGreen(d), sg, da, sa); | - |
2938 | int a = mix_alpha(da, sa); | - |
2939 | | - |
2940 | | - |
2941 | coverage.store(&dest[i], qRgba(r, g, b, a)); | - |
2942 | } executed: } Execution Count:50000 | 50000 |
2943 | } executed: } Execution Count:500 | 500 |
2944 | | - |
2945 | void comp_func_solid_SoftLight(uint *dest, int length, uint color, uint const_alpha) | - |
2946 | { | - |
2947 | if (const_alpha == 255) partially evaluated: const_alpha == 255 yes Evaluation Count:500 | no Evaluation Count:0 |
| 0-500 |
2948 | comp_func_solid_SoftLight_impl(dest, length, color, QFullCoverage()); executed: comp_func_solid_SoftLight_impl(dest, length, color, QFullCoverage()); Execution Count:500 | 500 |
2949 | else | - |
2950 | comp_func_solid_SoftLight_impl(dest, length, color, QPartialCoverage(const_alpha)); never executed: comp_func_solid_SoftLight_impl(dest, length, color, QPartialCoverage(const_alpha)); | 0 |
2951 | } | - |
2952 | | - |
2953 | template <typename T> | - |
2954 | static __attribute__((always_inline)) inline void comp_func_SoftLight_impl(uint *__restrict__ dest, const uint *__restrict__ src, int length, const T &coverage) | - |
2955 | { | - |
2956 | | - |
2957 | for (int i = 0; i < length; ++i) { never evaluated: i < length | 0 |
2958 | | - |
2959 | uint d = dest[i]; | - |
2960 | uint s = src[i]; | - |
2961 | | - |
2962 | int da = qAlpha(d); | - |
2963 | int sa = qAlpha(s); | - |
2964 | | - |
2965 | | - |
2966 | int r = soft_light_op(qRed(d), qRed(s), da, sa); | - |
2967 | int b = soft_light_op(qBlue(d), qBlue(s), da, sa); | - |
2968 | int g = soft_light_op(qGreen(d), qGreen(s), da, sa); | - |
2969 | int a = mix_alpha(da, sa); | - |
2970 | | - |
2971 | | - |
2972 | coverage.store(&dest[i], qRgba(r, g, b, a)); | - |
2973 | } | 0 |
2974 | } | 0 |
2975 | | - |
2976 | void comp_func_SoftLight(uint *__restrict__ dest, const uint *__restrict__ src, int length, uint const_alpha) | - |
2977 | { | - |
2978 | if (const_alpha == 255) never evaluated: const_alpha == 255 | 0 |
2979 | comp_func_SoftLight_impl(dest, src, length, QFullCoverage()); never executed: comp_func_SoftLight_impl(dest, src, length, QFullCoverage()); | 0 |
2980 | else | - |
2981 | comp_func_SoftLight_impl(dest, src, length, QPartialCoverage(const_alpha)); never executed: comp_func_SoftLight_impl(dest, src, length, QPartialCoverage(const_alpha)); | 0 |
2982 | } | - |
2983 | | - |
2984 | | - |
2985 | | - |
2986 | | - |
2987 | | - |
2988 | static inline int difference_op(int dst, int src, int da, int sa) | - |
2989 | { | - |
2990 | return src + dst - qt_div_255(2 * qMin(src * da, dst * sa)); executed: return src + dst - qt_div_255(2 * qMin(src * da, dst * sa)); Execution Count:210000 | 210000 |
2991 | } | - |
2992 | | - |
2993 | template <typename T> | - |
2994 | static __attribute__((always_inline)) inline void comp_func_solid_Difference_impl(uint *dest, int length, uint color, const T &coverage) | - |
2995 | { | - |
2996 | int sa = qAlpha(color); | - |
2997 | int sr = qRed(color); | - |
2998 | int sg = qGreen(color); | - |
2999 | int sb = qBlue(color); | - |
3000 | | - |
3001 | | - |
3002 | for (int i = 0; i < length; ++i) { evaluated: i < length yes Evaluation Count:70000 | yes Evaluation Count:700 |
| 700-70000 |
3003 | | - |
3004 | uint d = dest[i]; | - |
3005 | int da = qAlpha(d); | - |
3006 | | - |
3007 | | - |
3008 | int r = difference_op(qRed(d), sr, da, sa); | - |
3009 | int b = difference_op(qBlue(d), sb, da, sa); | - |
3010 | int g = difference_op(qGreen(d), sg, da, sa); | - |
3011 | int a = mix_alpha(da, sa); | - |
3012 | | - |
3013 | | - |
3014 | coverage.store(&dest[i], qRgba(r, g, b, a)); | - |
3015 | } executed: } Execution Count:70000 | 70000 |
3016 | } executed: } Execution Count:700 | 700 |
3017 | | - |
3018 | void comp_func_solid_Difference(uint *dest, int length, uint color, uint const_alpha) | - |
3019 | { | - |
3020 | if (const_alpha == 255) partially evaluated: const_alpha == 255 yes Evaluation Count:700 | no Evaluation Count:0 |
| 0-700 |
3021 | comp_func_solid_Difference_impl(dest, length, color, QFullCoverage()); executed: comp_func_solid_Difference_impl(dest, length, color, QFullCoverage()); Execution Count:700 | 700 |
3022 | else | - |
3023 | comp_func_solid_Difference_impl(dest, length, color, QPartialCoverage(const_alpha)); never executed: comp_func_solid_Difference_impl(dest, length, color, QPartialCoverage(const_alpha)); | 0 |
3024 | } | - |
3025 | | - |
3026 | template <typename T> | - |
3027 | static __attribute__((always_inline)) inline void comp_func_Difference_impl(uint *__restrict__ dest, const uint *__restrict__ src, int length, const T &coverage) | - |
3028 | { | - |
3029 | | - |
3030 | for (int i = 0; i < length; ++i) { never evaluated: i < length | 0 |
3031 | | - |
3032 | uint d = dest[i]; | - |
3033 | uint s = src[i]; | - |
3034 | | - |
3035 | int da = qAlpha(d); | - |
3036 | int sa = qAlpha(s); | - |
3037 | | - |
3038 | | - |
3039 | int r = difference_op(qRed(d), qRed(s), da, sa); | - |
3040 | int b = difference_op(qBlue(d), qBlue(s), da, sa); | - |
3041 | int g = difference_op(qGreen(d), qGreen(s), da, sa); | - |
3042 | int a = mix_alpha(da, sa); | - |
3043 | | - |
3044 | | - |
3045 | coverage.store(&dest[i], qRgba(r, g, b, a)); | - |
3046 | } | 0 |
3047 | } | 0 |
3048 | | - |
3049 | void comp_func_Difference(uint *__restrict__ dest, const uint *__restrict__ src, int length, uint const_alpha) | - |
3050 | { | - |
3051 | if (const_alpha == 255) never evaluated: const_alpha == 255 | 0 |
3052 | comp_func_Difference_impl(dest, src, length, QFullCoverage()); never executed: comp_func_Difference_impl(dest, src, length, QFullCoverage()); | 0 |
3053 | else | - |
3054 | comp_func_Difference_impl(dest, src, length, QPartialCoverage(const_alpha)); never executed: comp_func_Difference_impl(dest, src, length, QPartialCoverage(const_alpha)); | 0 |
3055 | } | - |
3056 | | - |
3057 | | - |
3058 | | - |
3059 | | - |
3060 | template <typename T> | - |
3061 | static __attribute__((always_inline)) inline void comp_func_solid_Exclusion_impl(uint *dest, int length, uint color, const T &coverage) | - |
3062 | { | - |
3063 | int sa = qAlpha(color); | - |
3064 | int sr = qRed(color); | - |
3065 | int sg = qGreen(color); | - |
3066 | int sb = qBlue(color); | - |
3067 | | - |
3068 | | - |
3069 | for (int i = 0; i < length; ++i) { evaluated: i < length yes Evaluation Count:70000 | yes Evaluation Count:700 |
| 700-70000 |
3070 | | - |
3071 | uint d = dest[i]; | - |
3072 | int da = qAlpha(d); | - |
3073 | | - |
3074 | | - |
3075 | int r = (qRed(d) + sr - qt_div_255(2*(qRed(d)*sr))); | - |
3076 | int b = (qBlue(d) + sb - qt_div_255(2*(qBlue(d)*sb))); | - |
3077 | int g = (qGreen(d) + sg - qt_div_255(2*(qGreen(d)*sg))); | - |
3078 | int a = mix_alpha(da, sa); | - |
3079 | | - |
3080 | | - |
3081 | coverage.store(&dest[i], qRgba(r, g, b, a)); | - |
3082 | } executed: } Execution Count:70000 | 70000 |
3083 | } executed: } Execution Count:700 | 700 |
3084 | | - |
3085 | void comp_func_solid_Exclusion(uint *dest, int length, uint color, uint const_alpha) | - |
3086 | { | - |
3087 | if (const_alpha == 255) partially evaluated: const_alpha == 255 yes Evaluation Count:700 | no Evaluation Count:0 |
| 0-700 |
3088 | comp_func_solid_Exclusion_impl(dest, length, color, QFullCoverage()); executed: comp_func_solid_Exclusion_impl(dest, length, color, QFullCoverage()); Execution Count:700 | 700 |
3089 | else | - |
3090 | comp_func_solid_Exclusion_impl(dest, length, color, QPartialCoverage(const_alpha)); never executed: comp_func_solid_Exclusion_impl(dest, length, color, QPartialCoverage(const_alpha)); | 0 |
3091 | } | - |
3092 | | - |
3093 | template <typename T> | - |
3094 | static __attribute__((always_inline)) inline void comp_func_Exclusion_impl(uint *__restrict__ dest, const uint *__restrict__ src, int length, const T &coverage) | - |
3095 | { | - |
3096 | | - |
3097 | for (int i = 0; i < length; ++i) { never evaluated: i < length | 0 |
3098 | | - |
3099 | uint d = dest[i]; | - |
3100 | uint s = src[i]; | - |
3101 | | - |
3102 | int da = qAlpha(d); | - |
3103 | int sa = qAlpha(s); | - |
3104 | | - |
3105 | | - |
3106 | int r = (qRed(d) + qRed(s) - ((qRed(d)*qRed(s)) >> 7)); | - |
3107 | int b = (qBlue(d) + qBlue(s) - ((qBlue(d)*qBlue(s)) >> 7)); | - |
3108 | int g = (qGreen(d) + qGreen(s) - ((qGreen(d)*qGreen(s)) >> 7)); | - |
3109 | int a = mix_alpha(da, sa); | - |
3110 | | - |
3111 | | - |
3112 | coverage.store(&dest[i], qRgba(r, g, b, a)); | - |
3113 | } | 0 |
3114 | } | 0 |
3115 | | - |
3116 | void comp_func_Exclusion(uint *__restrict__ dest, const uint *__restrict__ src, int length, uint const_alpha) | - |
3117 | { | - |
3118 | if (const_alpha == 255) never evaluated: const_alpha == 255 | 0 |
3119 | comp_func_Exclusion_impl(dest, src, length, QFullCoverage()); never executed: comp_func_Exclusion_impl(dest, src, length, QFullCoverage()); | 0 |
3120 | else | - |
3121 | comp_func_Exclusion_impl(dest, src, length, QPartialCoverage(const_alpha)); never executed: comp_func_Exclusion_impl(dest, src, length, QPartialCoverage(const_alpha)); | 0 |
3122 | } | - |
3123 | | - |
3124 | | - |
3125 | | - |
3126 | | - |
3127 | | - |
3128 | | - |
3129 | void rasterop_solid_SourceOrDestination(uint *dest, | - |
3130 | int length, | - |
3131 | uint color, | - |
3132 | uint const_alpha) | - |
3133 | { | - |
3134 | (void)const_alpha;; | - |
3135 | while (length--) never evaluated: length-- | 0 |
3136 | *dest++ |= color; never executed: *dest++ |= color; | 0 |
3137 | } | 0 |
3138 | | - |
3139 | void rasterop_SourceOrDestination(uint *__restrict__ dest, | - |
3140 | const uint *__restrict__ src, | - |
3141 | int length, | - |
3142 | uint const_alpha) | - |
3143 | { | - |
3144 | (void)const_alpha;; | - |
3145 | while (length--) never evaluated: length-- | 0 |
3146 | *dest++ |= *src++; never executed: *dest++ |= *src++; | 0 |
3147 | } | 0 |
3148 | | - |
3149 | void rasterop_solid_SourceAndDestination(uint *dest, | - |
3150 | int length, | - |
3151 | uint color, | - |
3152 | uint const_alpha) | - |
3153 | { | - |
3154 | (void)const_alpha;; | - |
3155 | color |= 0xff000000; | - |
3156 | while (length--) never evaluated: length-- | 0 |
3157 | *dest++ &= color; never executed: *dest++ &= color; | 0 |
3158 | } | 0 |
3159 | | - |
3160 | void rasterop_SourceAndDestination(uint *__restrict__ dest, | - |
3161 | const uint *__restrict__ src, | - |
3162 | int length, | - |
3163 | uint const_alpha) | - |
3164 | { | - |
3165 | (void)const_alpha;; | - |
3166 | while (length--) { never evaluated: length-- | 0 |
3167 | *dest = (*src & *dest) | 0xff000000; | - |
3168 | ++dest; ++src; | - |
3169 | } | 0 |
3170 | } | 0 |
3171 | | - |
3172 | void rasterop_solid_SourceXorDestination(uint *dest, | - |
3173 | int length, | - |
3174 | uint color, | - |
3175 | uint const_alpha) | - |
3176 | { | - |
3177 | (void)const_alpha;; | - |
3178 | color &= 0x00ffffff; | - |
3179 | while (length--) never evaluated: length-- | 0 |
3180 | *dest++ ^= color; never executed: *dest++ ^= color; | 0 |
3181 | } | 0 |
3182 | | - |
3183 | void rasterop_SourceXorDestination(uint *__restrict__ dest, | - |
3184 | const uint *__restrict__ src, | - |
3185 | int length, | - |
3186 | uint const_alpha) | - |
3187 | { | - |
3188 | (void)const_alpha;; | - |
3189 | while (length--) { never evaluated: length-- | 0 |
3190 | *dest = (*src ^ *dest) | 0xff000000; | - |
3191 | ++dest; ++src; | - |
3192 | } | 0 |
3193 | } | 0 |
3194 | | - |
3195 | void rasterop_solid_NotSourceAndNotDestination(uint *dest, | - |
3196 | int length, | - |
3197 | uint color, | - |
3198 | uint const_alpha) | - |
3199 | { | - |
3200 | (void)const_alpha;; | - |
3201 | color = ~color; | - |
3202 | while (length--) { never evaluated: length-- | 0 |
3203 | *dest = (color & ~(*dest)) | 0xff000000; | - |
3204 | ++dest; | - |
3205 | } | 0 |
3206 | } | 0 |
3207 | | - |
3208 | void rasterop_NotSourceAndNotDestination(uint *__restrict__ dest, | - |
3209 | const uint *__restrict__ src, | - |
3210 | int length, | - |
3211 | uint const_alpha) | - |
3212 | { | - |
3213 | (void)const_alpha;; | - |
3214 | while (length--) { never evaluated: length-- | 0 |
3215 | *dest = (~(*src) & ~(*dest)) | 0xff000000; | - |
3216 | ++dest; ++src; | - |
3217 | } | 0 |
3218 | } | 0 |
3219 | | - |
3220 | void rasterop_solid_NotSourceOrNotDestination(uint *dest, | - |
3221 | int length, | - |
3222 | uint color, | - |
3223 | uint const_alpha) | - |
3224 | { | - |
3225 | (void)const_alpha;; | - |
3226 | color = ~color | 0xff000000; | - |
3227 | while (length--) { never evaluated: length-- | 0 |
3228 | *dest = color | ~(*dest); | - |
3229 | ++dest; | - |
3230 | } | 0 |
3231 | } | 0 |
3232 | | - |
3233 | void rasterop_NotSourceOrNotDestination(uint *__restrict__ dest, | - |
3234 | const uint *__restrict__ src, | - |
3235 | int length, | - |
3236 | uint const_alpha) | - |
3237 | { | - |
3238 | (void)const_alpha;; | - |
3239 | while (length--) { never evaluated: length-- | 0 |
3240 | *dest = ~(*src) | ~(*dest) | 0xff000000; | - |
3241 | ++dest; ++src; | - |
3242 | } | 0 |
3243 | } | 0 |
3244 | | - |
3245 | void rasterop_solid_NotSourceXorDestination(uint *dest, | - |
3246 | int length, | - |
3247 | uint color, | - |
3248 | uint const_alpha) | - |
3249 | { | - |
3250 | (void)const_alpha;; | - |
3251 | color = ~color & 0x00ffffff; | - |
3252 | while (length--) { never evaluated: length-- | 0 |
3253 | *dest = color ^ (*dest); | - |
3254 | ++dest; | - |
3255 | } | 0 |
3256 | } | 0 |
3257 | | - |
3258 | void rasterop_NotSourceXorDestination(uint *__restrict__ dest, | - |
3259 | const uint *__restrict__ src, | - |
3260 | int length, | - |
3261 | uint const_alpha) | - |
3262 | { | - |
3263 | (void)const_alpha;; | - |
3264 | while (length--) { never evaluated: length-- | 0 |
3265 | *dest = ((~(*src)) ^ (*dest)) | 0xff000000; | - |
3266 | ++dest; ++src; | - |
3267 | } | 0 |
3268 | } | 0 |
3269 | | - |
3270 | void rasterop_solid_NotSource(uint *dest, int length, | - |
3271 | uint color, uint const_alpha) | - |
3272 | { | - |
3273 | (void)const_alpha;; | - |
3274 | qt_memfill(dest, ~color | 0xff000000, length); | - |
3275 | } | 0 |
3276 | | - |
3277 | void rasterop_NotSource(uint *__restrict__ dest, const uint *__restrict__ src, | - |
3278 | int length, uint const_alpha) | - |
3279 | { | - |
3280 | (void)const_alpha;; | - |
3281 | while (length--) never evaluated: length-- | 0 |
3282 | *dest++ = ~(*src++) | 0xff000000; never executed: *dest++ = ~(*src++) | 0xff000000; | 0 |
3283 | } | 0 |
3284 | | - |
3285 | void rasterop_solid_NotSourceAndDestination(uint *dest, | - |
3286 | int length, | - |
3287 | uint color, | - |
3288 | uint const_alpha) | - |
3289 | { | - |
3290 | (void)const_alpha;; | - |
3291 | color = ~color | 0xff000000; | - |
3292 | while (length--) { never evaluated: length-- | 0 |
3293 | *dest = color & *dest; | - |
3294 | ++dest; | - |
3295 | } | 0 |
3296 | } | 0 |
3297 | | - |
3298 | void rasterop_NotSourceAndDestination(uint *__restrict__ dest, | - |
3299 | const uint *__restrict__ src, | - |
3300 | int length, | - |
3301 | uint const_alpha) | - |
3302 | { | - |
3303 | (void)const_alpha;; | - |
3304 | while (length--) { never evaluated: length-- | 0 |
3305 | *dest = (~(*src) & *dest) | 0xff000000; | - |
3306 | ++dest; ++src; | - |
3307 | } | 0 |
3308 | } | 0 |
3309 | | - |
3310 | void rasterop_solid_SourceAndNotDestination(uint *dest, | - |
3311 | int length, | - |
3312 | uint color, | - |
3313 | uint const_alpha) | - |
3314 | { | - |
3315 | (void)const_alpha;; | - |
3316 | while (length--) { never evaluated: length-- | 0 |
3317 | *dest = (color & ~(*dest)) | 0xff000000; | - |
3318 | ++dest; | - |
3319 | } | 0 |
3320 | } | 0 |
3321 | | - |
3322 | void rasterop_SourceAndNotDestination(uint *__restrict__ dest, | - |
3323 | const uint *__restrict__ src, | - |
3324 | int length, | - |
3325 | uint const_alpha) | - |
3326 | { | - |
3327 | (void)const_alpha;; | - |
3328 | while (length--) { never evaluated: length-- | 0 |
3329 | *dest = (*src & ~(*dest)) | 0xff000000; | - |
3330 | ++dest; ++src; | - |
3331 | } | 0 |
3332 | } | 0 |
3333 | | - |
3334 | void rasterop_NotSourceOrDestination(uint *__restrict__ dest, | - |
3335 | const uint *__restrict__ src, | - |
3336 | int length, | - |
3337 | uint const_alpha) | - |
3338 | { | - |
3339 | (void)const_alpha;; | - |
3340 | while (length--) { never evaluated: length-- | 0 |
3341 | *dest = (~(*src) | *dest) | 0xff000000; | - |
3342 | ++dest; ++src; | - |
3343 | } | 0 |
3344 | } | 0 |
3345 | | - |
3346 | void rasterop_solid_NotSourceOrDestination(uint *__restrict__ dest, | - |
3347 | int length, | - |
3348 | uint color, | - |
3349 | uint const_alpha) | - |
3350 | { | - |
3351 | (void)const_alpha;; | - |
3352 | color = ~color | 0xff000000; | - |
3353 | while (length--) never evaluated: length-- | 0 |
3354 | *dest++ |= color; never executed: *dest++ |= color; | 0 |
3355 | } | 0 |
3356 | | - |
3357 | void rasterop_SourceOrNotDestination(uint *__restrict__ dest, | - |
3358 | const uint *__restrict__ src, | - |
3359 | int length, | - |
3360 | uint const_alpha) | - |
3361 | { | - |
3362 | (void)const_alpha;; | - |
3363 | while (length--) { never evaluated: length-- | 0 |
3364 | *dest = (*src | ~(*dest)) | 0xff000000; | - |
3365 | ++dest; ++src; | - |
3366 | } | 0 |
3367 | } | 0 |
3368 | | - |
3369 | void rasterop_solid_SourceOrNotDestination(uint *__restrict__ dest, | - |
3370 | int length, | - |
3371 | uint color, | - |
3372 | uint const_alpha) | - |
3373 | { | - |
3374 | (void)const_alpha;; | - |
3375 | while (length--) { never evaluated: length-- | 0 |
3376 | *dest = (color | ~(*dest)) | 0xff000000; | - |
3377 | ++dest; | - |
3378 | } | 0 |
3379 | } | 0 |
3380 | | - |
3381 | void rasterop_ClearDestination(uint *__restrict__ dest, | - |
3382 | const uint *__restrict__ src, | - |
3383 | int length, | - |
3384 | uint const_alpha) | - |
3385 | { | - |
3386 | (void)src;; | - |
3387 | comp_func_solid_SourceOver (dest, length, 0xff000000, const_alpha); | - |
3388 | } | 0 |
3389 | | - |
3390 | void rasterop_solid_ClearDestination(uint *__restrict__ dest, | - |
3391 | int length, | - |
3392 | uint color, | - |
3393 | uint const_alpha) | - |
3394 | { | - |
3395 | (void)color;; | - |
3396 | comp_func_solid_SourceOver (dest, length, 0xff000000, const_alpha); | - |
3397 | } | 0 |
3398 | | - |
3399 | void rasterop_SetDestination(uint *__restrict__ dest, | - |
3400 | const uint *__restrict__ src, | - |
3401 | int length, | - |
3402 | uint const_alpha) | - |
3403 | { | - |
3404 | (void)src;; | - |
3405 | comp_func_solid_SourceOver (dest, length, 0xffffffff, const_alpha); | - |
3406 | } | 0 |
3407 | | - |
3408 | void rasterop_solid_SetDestination(uint *__restrict__ dest, | - |
3409 | int length, | - |
3410 | uint color, | - |
3411 | uint const_alpha) | - |
3412 | { | - |
3413 | (void)color;; | - |
3414 | comp_func_solid_SourceOver (dest, length, 0xffffffff, const_alpha); | - |
3415 | } | 0 |
3416 | | - |
3417 | void rasterop_NotDestination(uint *__restrict__ dest, | - |
3418 | const uint *__restrict__ src, | - |
3419 | int length, | - |
3420 | uint const_alpha) | - |
3421 | { | - |
3422 | (void)src;; | - |
3423 | rasterop_solid_SourceXorDestination (dest, length, 0x00ffffff, const_alpha); | - |
3424 | } | 0 |
3425 | | - |
3426 | void rasterop_solid_NotDestination(uint *__restrict__ dest, | - |
3427 | int length, | - |
3428 | uint color, | - |
3429 | uint const_alpha) | - |
3430 | { | - |
3431 | (void)color;; | - |
3432 | rasterop_solid_SourceXorDestination (dest, length, 0x00ffffff, const_alpha); | - |
3433 | } | 0 |
3434 | | - |
3435 | static CompositionFunctionSolid functionForModeSolid_C[] = { | - |
3436 | comp_func_solid_SourceOver, | - |
3437 | comp_func_solid_DestinationOver, | - |
3438 | comp_func_solid_Clear, | - |
3439 | comp_func_solid_Source, | - |
3440 | comp_func_solid_Destination, | - |
3441 | comp_func_solid_SourceIn, | - |
3442 | comp_func_solid_DestinationIn, | - |
3443 | comp_func_solid_SourceOut, | - |
3444 | comp_func_solid_DestinationOut, | - |
3445 | comp_func_solid_SourceAtop, | - |
3446 | comp_func_solid_DestinationAtop, | - |
3447 | comp_func_solid_XOR, | - |
3448 | comp_func_solid_Plus, | - |
3449 | comp_func_solid_Multiply, | - |
3450 | comp_func_solid_Screen, | - |
3451 | comp_func_solid_Overlay, | - |
3452 | comp_func_solid_Darken, | - |
3453 | comp_func_solid_Lighten, | - |
3454 | comp_func_solid_ColorDodge, | - |
3455 | comp_func_solid_ColorBurn, | - |
3456 | comp_func_solid_HardLight, | - |
3457 | comp_func_solid_SoftLight, | - |
3458 | comp_func_solid_Difference, | - |
3459 | comp_func_solid_Exclusion, | - |
3460 | rasterop_solid_SourceOrDestination, | - |
3461 | rasterop_solid_SourceAndDestination, | - |
3462 | rasterop_solid_SourceXorDestination, | - |
3463 | rasterop_solid_NotSourceAndNotDestination, | - |
3464 | rasterop_solid_NotSourceOrNotDestination, | - |
3465 | rasterop_solid_NotSourceXorDestination, | - |
3466 | rasterop_solid_NotSource, | - |
3467 | rasterop_solid_NotSourceAndDestination, | - |
3468 | rasterop_solid_SourceAndNotDestination, | - |
3469 | rasterop_solid_SourceAndNotDestination, | - |
3470 | rasterop_solid_NotSourceOrDestination, | - |
3471 | rasterop_solid_SourceOrNotDestination, | - |
3472 | rasterop_solid_ClearDestination, | - |
3473 | rasterop_solid_SetDestination, | - |
3474 | rasterop_solid_NotDestination | - |
3475 | }; | - |
3476 | | - |
3477 | static const CompositionFunctionSolid *functionForModeSolid = functionForModeSolid_C; | - |
3478 | | - |
3479 | static CompositionFunction functionForMode_C[] = { | - |
3480 | comp_func_SourceOver, | - |
3481 | comp_func_DestinationOver, | - |
3482 | comp_func_Clear, | - |
3483 | comp_func_Source, | - |
3484 | comp_func_Destination, | - |
3485 | comp_func_SourceIn, | - |
3486 | comp_func_DestinationIn, | - |
3487 | comp_func_SourceOut, | - |
3488 | comp_func_DestinationOut, | - |
3489 | comp_func_SourceAtop, | - |
3490 | comp_func_DestinationAtop, | - |
3491 | comp_func_XOR, | - |
3492 | comp_func_Plus, | - |
3493 | comp_func_Multiply, | - |
3494 | comp_func_Screen, | - |
3495 | comp_func_Overlay, | - |
3496 | comp_func_Darken, | - |
3497 | comp_func_Lighten, | - |
3498 | comp_func_ColorDodge, | - |
3499 | comp_func_ColorBurn, | - |
3500 | comp_func_HardLight, | - |
3501 | comp_func_SoftLight, | - |
3502 | comp_func_Difference, | - |
3503 | comp_func_Exclusion, | - |
3504 | rasterop_SourceOrDestination, | - |
3505 | rasterop_SourceAndDestination, | - |
3506 | rasterop_SourceXorDestination, | - |
3507 | rasterop_NotSourceAndNotDestination, | - |
3508 | rasterop_NotSourceOrNotDestination, | - |
3509 | rasterop_NotSourceXorDestination, | - |
3510 | rasterop_NotSource, | - |
3511 | rasterop_NotSourceAndDestination, | - |
3512 | rasterop_SourceAndNotDestination, | - |
3513 | rasterop_SourceAndNotDestination, | - |
3514 | rasterop_NotSourceOrDestination, | - |
3515 | rasterop_SourceOrNotDestination, | - |
3516 | rasterop_ClearDestination, | - |
3517 | rasterop_SetDestination, | - |
3518 | rasterop_NotDestination | - |
3519 | }; | - |
3520 | | - |
3521 | static const CompositionFunction *functionForMode = functionForMode_C; | - |
3522 | | - |
3523 | static TextureBlendType getBlendType(const QSpanData *data) | - |
3524 | { | - |
3525 | TextureBlendType ft; | - |
3526 | if (data->txop <= QTransform::TxTranslate) evaluated: data->txop <= QTransform::TxTranslate yes Evaluation Count:26018 | yes Evaluation Count:62 |
| 62-26018 |
3527 | if (data->texture.type == QTextureData::Tiled) evaluated: data->texture.type == QTextureData::Tiled yes Evaluation Count:23576 | yes Evaluation Count:2442 |
| 2442-23576 |
3528 | ft = BlendTiled; executed: ft = BlendTiled; Execution Count:23576 | 23576 |
3529 | else | - |
3530 | ft = BlendUntransformed; executed: ft = BlendUntransformed; Execution Count:2442 | 2442 |
3531 | else if (data->bilinear) evaluated: data->bilinear yes Evaluation Count:54 | yes Evaluation Count:8 |
| 8-54 |
3532 | if (data->texture.type == QTextureData::Tiled) evaluated: data->texture.type == QTextureData::Tiled yes Evaluation Count:4 | yes Evaluation Count:50 |
| 4-50 |
3533 | ft = BlendTransformedBilinearTiled; executed: ft = BlendTransformedBilinearTiled; Execution Count:4 | 4 |
3534 | else | - |
3535 | ft = BlendTransformedBilinear; executed: ft = BlendTransformedBilinear; Execution Count:50 | 50 |
3536 | else | - |
3537 | if (data->texture.type == QTextureData::Tiled) evaluated: data->texture.type == QTextureData::Tiled yes Evaluation Count:2 | yes Evaluation Count:6 |
| 2-6 |
3538 | ft = BlendTransformedTiled; executed: ft = BlendTransformedTiled; Execution Count:2 | 2 |
3539 | else | - |
3540 | ft = BlendTransformed; executed: ft = BlendTransformed; Execution Count:6 | 6 |
3541 | return ft; executed: return ft; Execution Count:26080 | 26080 |
3542 | } | - |
3543 | | - |
3544 | static inline Operator getOperator(const QSpanData *data, const QSpan *spans, int spanCount) | - |
3545 | { | - |
3546 | Operator op; | - |
3547 | bool solidSource = false; | - |
3548 | | - |
3549 | switch(data->type) { | - |
3550 | case QSpanData::Solid: | - |
3551 | solidSource = (qAlpha(data->solid.color) == 255); | - |
3552 | break; executed: break; Execution Count:209044 | 209044 |
3553 | case QSpanData::LinearGradient: | - |
3554 | solidSource = !data->gradient.alphaColor; | - |
3555 | getLinearGradientValues(&op.linear, data); | - |
3556 | op.src_fetch = qt_fetch_linear_gradient; | - |
3557 | break; executed: break; Execution Count:16028 | 16028 |
3558 | case QSpanData::RadialGradient: | - |
3559 | solidSource = !data->gradient.alphaColor; | - |
3560 | getRadialGradientValues(&op.radial, data); | - |
3561 | op.src_fetch = qt_fetch_radial_gradient; | - |
3562 | break; executed: break; Execution Count:17 | 17 |
3563 | case QSpanData::ConicalGradient: | - |
3564 | solidSource = !data->gradient.alphaColor; | - |
3565 | op.src_fetch = qt_fetch_conical_gradient; | - |
3566 | break; | 0 |
3567 | case QSpanData::Texture: | - |
3568 | op.src_fetch = sourceFetch[getBlendType(data)][data->texture.format]; | - |
3569 | solidSource = !data->texture.hasAlpha; | - |
3570 | default: | - |
3571 | break; executed: break; Execution Count:13035 | 13035 |
3572 | } | - |
3573 | | - |
3574 | op.mode = data->rasterBuffer->compositionMode; | - |
3575 | if (op.mode == QPainter::CompositionMode_SourceOver && solidSource) evaluated: op.mode == QPainter::CompositionMode_SourceOver yes Evaluation Count:137211 | yes Evaluation Count:100910 |
evaluated: solidSource yes Evaluation Count:118900 | yes Evaluation Count:18312 |
| 18312-137211 |
3576 | op.mode = QPainter::CompositionMode_Source; executed: op.mode = QPainter::CompositionMode_Source; Execution Count:118890 | 118890 |
3577 | | - |
3578 | op.dest_fetch = destFetchProc[data->rasterBuffer->format]; | - |
3579 | if (op.mode == QPainter::CompositionMode_Source) { evaluated: op.mode == QPainter::CompositionMode_Source yes Evaluation Count:119795 | yes Evaluation Count:118306 |
| 118306-119795 |
3580 | switch (data->rasterBuffer->format) { | - |
3581 | case QImage::Format_RGB32: | - |
3582 | case QImage::Format_ARGB32_Premultiplied: | - |
3583 | | - |
3584 | break; executed: break; Execution Count:117006 | 117006 |
3585 | default: { | - |
3586 | if (data->type == QSpanData::Texture && data->texture.const_alpha != 256) evaluated: data->type == QSpanData::Texture yes Evaluation Count:448 | yes Evaluation Count:2350 |
partially evaluated: data->texture.const_alpha != 256 no Evaluation Count:0 | yes Evaluation Count:448 |
| 0-2350 |
3587 | break; | 0 |
3588 | const QSpan *lastSpan = spans + spanCount; | - |
3589 | bool alphaSpans = false; | - |
3590 | while (spans < lastSpan) { evaluated: spans < lastSpan yes Evaluation Count:138875 | yes Evaluation Count:2415 |
| 2415-138875 |
3591 | if (spans->coverage != 255) { evaluated: spans->coverage != 255 yes Evaluation Count:383 | yes Evaluation Count:138492 |
| 383-138492 |
3592 | alphaSpans = true; | - |
3593 | break; executed: break; Execution Count:383 | 383 |
3594 | } | - |
3595 | ++spans; | - |
3596 | } executed: } Execution Count:138492 | 138492 |
3597 | if (!alphaSpans) evaluated: !alphaSpans yes Evaluation Count:2415 | yes Evaluation Count:383 |
| 383-2415 |
3598 | op.dest_fetch = 0; executed: op.dest_fetch = 0; Execution Count:2415 | 2415 |
3599 | } | - |
3600 | } executed: } Execution Count:2798 | 2798 |
3601 | } executed: } Execution Count:119807 | 119807 |
3602 | | - |
3603 | op.dest_store = destStoreProc[data->rasterBuffer->format]; | - |
3604 | | - |
3605 | op.funcSolid = functionForModeSolid[op.mode]; | - |
3606 | op.func = functionForMode[op.mode]; | - |
3607 | | - |
3608 | return op; executed: return op; Execution Count:238101 | 238101 |
3609 | } | - |
3610 | | - |
3611 | | - |
3612 | | - |
3613 | | - |
3614 | | - |
3615 | | - |
3616 | static | - |
3617 | | - |
3618 | void blend_color_generic(int count, const QSpan *spans, void *userData) | - |
3619 | { | - |
3620 | QSpanData *data = reinterpret_cast<QSpanData *>(userData); | - |
3621 | uint buffer[buffer_size]; | - |
3622 | Operator op = getOperator(data, spans, count); | - |
3623 | | - |
3624 | while (count--) { evaluated: count-- yes Evaluation Count:224120 | yes Evaluation Count:2336 |
| 2336-224120 |
3625 | int x = spans->x; | - |
3626 | int length = spans->len; | - |
3627 | while (length) { evaluated: length yes Evaluation Count:224120 | yes Evaluation Count:224120 |
| 224120 |
3628 | int l = qMin(buffer_size, length); | - |
3629 | uint *dest = op.dest_fetch ? op.dest_fetch(buffer, data->rasterBuffer, x, spans->y, l) : buffer; evaluated: op.dest_fetch yes Evaluation Count:98089 | yes Evaluation Count:126031 |
| 98089-126031 |
3630 | op.funcSolid(dest, l, data->solid.color, spans->coverage); | - |
3631 | if (op.dest_store) partially evaluated: op.dest_store yes Evaluation Count:224120 | no Evaluation Count:0 |
| 0-224120 |
3632 | op.dest_store(data->rasterBuffer, x, spans->y, dest, l); executed: op.dest_store(data->rasterBuffer, x, spans->y, dest, l); Execution Count:224120 | 224120 |
3633 | length -= l; | - |
3634 | x += l; | - |
3635 | } executed: } Execution Count:224120 | 224120 |
3636 | ++spans; | - |
3637 | } executed: } Execution Count:224120 | 224120 |
3638 | } executed: } Execution Count:2336 | 2336 |
3639 | | - |
3640 | static void blend_color_argb(int count, const QSpan *spans, void *userData) | - |
3641 | { | - |
3642 | QSpanData *data = reinterpret_cast<QSpanData *>(userData); | - |
3643 | | - |
3644 | Operator op = getOperator(data, spans, count); | - |
3645 | | - |
3646 | if (op.mode == QPainter::CompositionMode_Source) { evaluated: op.mode == QPainter::CompositionMode_Source yes Evaluation Count:100900 | yes Evaluation Count:105808 |
| 100900-105808 |
3647 | | - |
3648 | while (count--) { evaluated: count-- yes Evaluation Count:620957 | yes Evaluation Count:100900 |
| 100900-620957 |
3649 | uint *target = ((uint *)data->rasterBuffer->scanLine(spans->y)) + spans->x; | - |
3650 | if (spans->coverage == 255) { evaluated: spans->coverage == 255 yes Evaluation Count:599558 | yes Evaluation Count:21399 |
| 21399-599558 |
3651 | qt_memfill<quint32>(target, data->solid.color, spans->len);; | - |
3652 | } else { executed: } Execution Count:599558 | 599558 |
3653 | uint c = BYTE_MUL(data->solid.color, spans->coverage); | - |
3654 | int ialpha = 255 - spans->coverage; | - |
3655 | for (int i = 0; i < spans->len; ++i) evaluated: i < spans->len yes Evaluation Count:22387 | yes Evaluation Count:21399 |
| 21399-22387 |
3656 | target[i] = c + BYTE_MUL(target[i], ialpha); executed: target[i] = c + BYTE_MUL(target[i], ialpha); Execution Count:22387 | 22387 |
3657 | } executed: } Execution Count:21399 | 21399 |
3658 | ++spans; | - |
3659 | } executed: } Execution Count:620957 | 620957 |
3660 | return; executed: return; Execution Count:100900 | 100900 |
3661 | } | - |
3662 | | - |
3663 | while (count--) { evaluated: count-- yes Evaluation Count:2601018 | yes Evaluation Count:105808 |
| 105808-2601018 |
3664 | uint *target = ((uint *)data->rasterBuffer->scanLine(spans->y)) + spans->x; | - |
3665 | op.funcSolid(target, spans->len, data->solid.color, spans->coverage); | - |
3666 | ++spans; | - |
3667 | } executed: } Execution Count:2601018 | 2601018 |
3668 | } executed: } Execution Count:105808 | 105808 |
3669 | | - |
3670 | static void blend_color_rgb16(int count, const QSpan *spans, void *userData) | - |
3671 | { | - |
3672 | QSpanData *data = reinterpret_cast<QSpanData *>(userData); | - |
3673 | | - |
3674 | | - |
3675 | | - |
3676 | | - |
3677 | | - |
3678 | | - |
3679 | QPainter::CompositionMode mode = data->rasterBuffer->compositionMode; | - |
3680 | if (mode == QPainter::CompositionMode_SourceOver && partially evaluated: mode == QPainter::CompositionMode_SourceOver yes Evaluation Count:70346 | no Evaluation Count:0 |
| 0-70346 |
3681 | qAlpha(data->solid.color) == 255) evaluated: qAlpha(data->solid.color) == 255 yes Evaluation Count:69371 | yes Evaluation Count:975 |
| 975-69371 |
3682 | mode = QPainter::CompositionMode_Source; executed: mode = QPainter::CompositionMode_Source; Execution Count:69371 | 69371 |
3683 | | - |
3684 | if (mode == QPainter::CompositionMode_Source) { evaluated: mode == QPainter::CompositionMode_Source yes Evaluation Count:69371 | yes Evaluation Count:975 |
| 975-69371 |
3685 | | - |
3686 | ushort c = qConvertRgb32To16(data->solid.color); | - |
3687 | while (count--) { evaluated: count-- yes Evaluation Count:3739945 | yes Evaluation Count:69371 |
| 69371-3739945 |
3688 | ushort *target = ((ushort *)data->rasterBuffer->scanLine(spans->y)) + spans->x; | - |
3689 | if (spans->coverage == 255) { evaluated: spans->coverage == 255 yes Evaluation Count:3674306 | yes Evaluation Count:65639 |
| 65639-3674306 |
3690 | qt_memfill<quint16>(target, c, spans->len);; | - |
3691 | } else { executed: } Execution Count:3674306 | 3674306 |
3692 | ushort color = BYTE_MUL_RGB16(c, spans->coverage); | - |
3693 | int ialpha = 255 - spans->coverage; | - |
3694 | const ushort *end = target + spans->len; | - |
3695 | while (target < end) { evaluated: target < end yes Evaluation Count:82262 | yes Evaluation Count:65639 |
| 65639-82262 |
3696 | *target = color + BYTE_MUL_RGB16(*target, ialpha); | - |
3697 | ++target; | - |
3698 | } executed: } Execution Count:82262 | 82262 |
3699 | } executed: } Execution Count:65639 | 65639 |
3700 | ++spans; | - |
3701 | } executed: } Execution Count:3739945 | 3739945 |
3702 | return; executed: return; Execution Count:69371 | 69371 |
3703 | } | - |
3704 | | - |
3705 | if (mode == QPainter::CompositionMode_SourceOver) { partially evaluated: mode == QPainter::CompositionMode_SourceOver yes Evaluation Count:975 | no Evaluation Count:0 |
| 0-975 |
3706 | while (count--) { evaluated: count-- yes Evaluation Count:7160 | yes Evaluation Count:975 |
| 975-7160 |
3707 | uint color = BYTE_MUL(data->solid.color, spans->coverage); | - |
3708 | int ialpha = qAlpha(~color); | - |
3709 | ushort c = qConvertRgb32To16(color); | - |
3710 | ushort *target = ((ushort *)data->rasterBuffer->scanLine(spans->y)) + spans->x; | - |
3711 | int len = spans->len; | - |
3712 | bool pre = (((quintptr)target) & 0x3) != 0; | - |
3713 | bool post = false; | - |
3714 | if (pre) { evaluated: pre yes Evaluation Count:3575 | yes Evaluation Count:3585 |
| 3575-3585 |
3715 | | - |
3716 | *target = c + BYTE_MUL_RGB16(*target, ialpha); | - |
3717 | ++target; | - |
3718 | --len; | - |
3719 | } executed: } Execution Count:3575 | 3575 |
3720 | if (len & 0x1) { evaluated: len & 0x1 yes Evaluation Count:3787 | yes Evaluation Count:3373 |
| 3373-3787 |
3721 | post = true; | - |
3722 | --len; | - |
3723 | } executed: } Execution Count:3787 | 3787 |
3724 | uint *target32 = (uint*)target; | - |
3725 | uint c32 = c | (c<<16); | - |
3726 | len >>= 1; | - |
3727 | uint salpha = (ialpha+1) >> 3; | - |
3728 | while (len--) { evaluated: len-- yes Evaluation Count:64594 | yes Evaluation Count:7160 |
| 7160-64594 |
3729 | | - |
3730 | *target32 = c32 + BYTE_MUL_RGB16_32(*target32, salpha); | - |
3731 | ++target32; | - |
3732 | target += 2; | - |
3733 | } executed: } Execution Count:64594 | 64594 |
3734 | if (post) { evaluated: post yes Evaluation Count:3787 | yes Evaluation Count:3373 |
| 3373-3787 |
3735 | | - |
3736 | *target = c + BYTE_MUL_RGB16(*target, ialpha); | - |
3737 | } executed: } Execution Count:3787 | 3787 |
3738 | ++spans; | - |
3739 | } executed: } Execution Count:7160 | 7160 |
3740 | return; executed: return; Execution Count:975 | 975 |
3741 | } | - |
3742 | | - |
3743 | blend_color_generic(count, spans, userData); | - |
3744 | } | 0 |
3745 | | - |
3746 | template <typename T> | - |
3747 | void handleSpans(int count, const QSpan *spans, const QSpanData *data, T &handler) | - |
3748 | { | - |
3749 | uint const_alpha = 256; | - |
3750 | if (data->type == QSpanData::Texture) evaluated: data->type == QSpanData::Texture yes Evaluation Count:30 | yes Evaluation Count:16012 |
| 30-16012 |
3751 | const_alpha = data->texture.const_alpha; executed: const_alpha = data->texture.const_alpha; Execution Count:30 | 30 |
3752 | | - |
3753 | int coverage = 0; | - |
3754 | while (count) { evaluated: count yes Evaluation Count:22579 | yes Evaluation Count:16067 |
| 16067-22579 |
3755 | int x = spans->x; | - |
3756 | const int y = spans->y; | - |
3757 | int right = x + spans->len; | - |
3758 | | - |
3759 | | - |
3760 | for (int i = 1; i < count && spans[i].y == y && spans[i].x == right; ++i) evaluated: i < count yes Evaluation Count:13549 | yes Evaluation Count:16079 |
evaluated: spans[i].y == y yes Evaluation Count:7037 | yes Evaluation Count:6512 |
partially evaluated: spans[i].x == right yes Evaluation Count:7037 | no Evaluation Count:0 |
| 0-16079 |
3761 | right += spans[i].len; executed: right += spans[i].len; Execution Count:7037 | 7037 |
3762 | int length = right - x; | - |
3763 | | - |
3764 | while (length) { evaluated: length yes Evaluation Count:22578 | yes Evaluation Count:22562 |
| 22562-22578 |
3765 | int l = qMin(buffer_size, length); | - |
3766 | length -= l; | - |
3767 | | - |
3768 | int process_length = l; | - |
3769 | int process_x = x; | - |
3770 | | - |
3771 | const uint *src = handler.fetch(process_x, y, process_length); | - |
3772 | int offset = 0; | - |
3773 | while (l > 0) { evaluated: l > 0 yes Evaluation Count:29584 | yes Evaluation Count:22547 |
| 22547-29584 |
3774 | if (x == spans->x) partially evaluated: x == spans->x yes Evaluation Count:29581 | no Evaluation Count:0 |
| 0-29581 |
3775 | coverage = (spans->coverage * const_alpha) >> 8; executed: coverage = (spans->coverage * const_alpha) >> 8; Execution Count:29582 | 29582 |
3776 | | - |
3777 | int right = spans->x + spans->len; | - |
3778 | int len = qMin(l, right - x); | - |
3779 | | - |
3780 | handler.process(x, y, len, coverage, src, offset); | - |
3781 | | - |
3782 | l -= len; | - |
3783 | x += len; | - |
3784 | offset += len; | - |
3785 | | - |
3786 | if (x == right) { partially evaluated: x == right yes Evaluation Count:29572 | no Evaluation Count:0 |
| 0-29572 |
3787 | ++spans; | - |
3788 | --count; | - |
3789 | } executed: } Execution Count:29572 | 29572 |
3790 | } executed: } Execution Count:29584 | 29584 |
3791 | handler.store(process_x, y, process_length); | - |
3792 | } executed: } Execution Count:22559 | 22559 |
3793 | } executed: } Execution Count:22578 | 22578 |
3794 | } executed: } Execution Count:16073 | 16073 |
3795 | | - |
3796 | struct QBlendBase | - |
3797 | { | - |
3798 | QBlendBase(QSpanData *d, Operator o) | - |
3799 | : data(d) | - |
3800 | , op(o) | - |
3801 | , dest(0) | - |
3802 | { | - |
3803 | } executed: } Execution Count:16011 | 16011 |
3804 | | - |
3805 | QSpanData *data; | - |
3806 | Operator op; | - |
3807 | | - |
3808 | uint *dest; | - |
3809 | | - |
3810 | uint buffer[buffer_size]; | - |
3811 | uint src_buffer[buffer_size]; | - |
3812 | }; | - |
3813 | | - |
3814 | class BlendSrcGeneric : public QBlendBase | - |
3815 | { | - |
3816 | public: | - |
3817 | BlendSrcGeneric(QSpanData *d, Operator o) | - |
3818 | : QBlendBase(d, o) | - |
3819 | { | - |
3820 | } executed: } Execution Count:16017 | 16017 |
3821 | | - |
3822 | const uint *fetch(int x, int y, int len) | - |
3823 | { | - |
3824 | dest = op.dest_fetch ? op.dest_fetch(buffer, data->rasterBuffer, x, y, len) : buffer; evaluated: op.dest_fetch yes Evaluation Count:21674 | yes Evaluation Count:913 |
| 913-21674 |
3825 | return op.src_fetch(src_buffer, &op, data, y, x, len); executed: return op.src_fetch(src_buffer, &op, data, y, x, len); Execution Count:22563 | 22563 |
3826 | } | - |
3827 | | - |
3828 | void process(int, int, int len, int coverage, const uint *src, int offset) | - |
3829 | { | - |
3830 | op.func(dest + offset, src + offset, len, coverage); | - |
3831 | } executed: } Execution Count:29574 | 29574 |
3832 | | - |
3833 | void store(int x, int y, int len) | - |
3834 | { | - |
3835 | if (op.dest_store) evaluated: op.dest_store yes Evaluation Count:913 | yes Evaluation Count:21639 |
| 913-21639 |
3836 | op.dest_store(data->rasterBuffer, x, y, dest, len); executed: op.dest_store(data->rasterBuffer, x, y, dest, len); Execution Count:913 | 913 |
3837 | } executed: } Execution Count:22554 | 22554 |
3838 | }; | - |
3839 | | - |
3840 | static void blend_src_generic(int count, const QSpan *spans, void *userData) | - |
3841 | { | - |
3842 | QSpanData *data = reinterpret_cast<QSpanData *>(userData); | - |
3843 | BlendSrcGeneric blend(data, getOperator(data, spans, count)); | - |
3844 | handleSpans(count, spans, data, blend); | - |
3845 | } executed: } Execution Count:16073 | 16073 |
3846 | | - |
3847 | static void blend_untransformed_generic(int count, const QSpan *spans, void *userData) | - |
3848 | { | - |
3849 | QSpanData *data = reinterpret_cast<QSpanData *>(userData); | - |
3850 | | - |
3851 | uint buffer[buffer_size]; | - |
3852 | uint src_buffer[buffer_size]; | - |
3853 | Operator op = getOperator(data, spans, count); | - |
3854 | | - |
3855 | const int image_width = data->texture.width; | - |
3856 | const int image_height = data->texture.height; | - |
3857 | int xoff = -qRound(-data->dx); | - |
3858 | int yoff = -qRound(-data->dy); | - |
3859 | | - |
3860 | while (count--) { evaluated: count-- yes Evaluation Count:39624 | yes Evaluation Count:1194 |
| 1194-39624 |
3861 | int x = spans->x; | - |
3862 | int length = spans->len; | - |
3863 | int sx = xoff + x; | - |
3864 | int sy = yoff + spans->y; | - |
3865 | if (sy >= 0 && sy < image_height && sx < image_width) { partially evaluated: sy >= 0 yes Evaluation Count:39624 | no Evaluation Count:0 |
partially evaluated: sy < image_height yes Evaluation Count:39624 | no Evaluation Count:0 |
partially evaluated: sx < image_width yes Evaluation Count:39624 | no Evaluation Count:0 |
| 0-39624 |
3866 | if (sx < 0) { partially evaluated: sx < 0 no Evaluation Count:0 | yes Evaluation Count:39624 |
| 0-39624 |
3867 | x -= sx; | - |
3868 | length += sx; | - |
3869 | sx = 0; | - |
3870 | } | 0 |
3871 | if (sx + length > image_width) partially evaluated: sx + length > image_width no Evaluation Count:0 | yes Evaluation Count:39624 |
| 0-39624 |
3872 | length = image_width - sx; never executed: length = image_width - sx; | 0 |
3873 | if (length > 0) { partially evaluated: length > 0 yes Evaluation Count:39624 | no Evaluation Count:0 |
| 0-39624 |
3874 | const int coverage = (spans->coverage * data->texture.const_alpha) >> 8; | - |
3875 | while (length) { evaluated: length yes Evaluation Count:39624 | yes Evaluation Count:39624 |
| 39624 |
3876 | int l = qMin(buffer_size, length); | - |
3877 | const uint *src = op.src_fetch(src_buffer, &op, data, sy, sx, l); | - |
3878 | uint *dest = op.dest_fetch ? op.dest_fetch(buffer, data->rasterBuffer, x, spans->y, l) : buffer; evaluated: op.dest_fetch yes Evaluation Count:29736 | yes Evaluation Count:9888 |
| 9888-29736 |
3879 | op.func(dest, src, l, coverage); | - |
3880 | if (op.dest_store) evaluated: op.dest_store yes Evaluation Count:30698 | yes Evaluation Count:8926 |
| 8926-30698 |
3881 | op.dest_store(data->rasterBuffer, x, spans->y, dest, l); executed: op.dest_store(data->rasterBuffer, x, spans->y, dest, l); Execution Count:30698 | 30698 |
3882 | x += l; | - |
3883 | sx += l; | - |
3884 | length -= l; | - |
3885 | } executed: } Execution Count:39624 | 39624 |
3886 | } executed: } Execution Count:39624 | 39624 |
3887 | } executed: } Execution Count:39624 | 39624 |
3888 | ++spans; | - |
3889 | } executed: } Execution Count:39624 | 39624 |
3890 | } executed: } Execution Count:1194 | 1194 |
3891 | | - |
3892 | static void blend_untransformed_argb(int count, const QSpan *spans, void *userData) | - |
3893 | { | - |
3894 | QSpanData *data = reinterpret_cast<QSpanData *>(userData); | - |
3895 | if (data->texture.format != QImage::Format_ARGB32_Premultiplied evaluated: data->texture.format != QImage::Format_ARGB32_Premultiplied yes Evaluation Count:64 | yes Evaluation Count:27 |
| 27-64 |
3896 | && data->texture.format != QImage::Format_RGB32) { partially evaluated: data->texture.format != QImage::Format_RGB32 yes Evaluation Count:64 | no Evaluation Count:0 |
| 0-64 |
3897 | blend_untransformed_generic(count, spans, userData); | - |
3898 | return; executed: return; Execution Count:64 | 64 |
3899 | } | - |
3900 | | - |
3901 | Operator op = getOperator(data, spans, count); | - |
3902 | | - |
3903 | const int image_width = data->texture.width; | - |
3904 | const int image_height = data->texture.height; | - |
3905 | int xoff = -qRound(-data->dx); | - |
3906 | int yoff = -qRound(-data->dy); | - |
3907 | | - |
3908 | while (count--) { evaluated: count-- yes Evaluation Count:5198 | yes Evaluation Count:27 |
| 27-5198 |
3909 | int x = spans->x; | - |
3910 | int length = spans->len; | - |
3911 | int sx = xoff + x; | - |
3912 | int sy = yoff + spans->y; | - |
3913 | if (sy >= 0 && sy < image_height && sx < image_width) { partially evaluated: sy >= 0 yes Evaluation Count:5198 | no Evaluation Count:0 |
partially evaluated: sy < image_height yes Evaluation Count:5198 | no Evaluation Count:0 |
partially evaluated: sx < image_width yes Evaluation Count:5198 | no Evaluation Count:0 |
| 0-5198 |
3914 | if (sx < 0) { partially evaluated: sx < 0 no Evaluation Count:0 | yes Evaluation Count:5198 |
| 0-5198 |
3915 | x -= sx; | - |
3916 | length += sx; | - |
3917 | sx = 0; | - |
3918 | } | 0 |
3919 | if (sx + length > image_width) partially evaluated: sx + length > image_width no Evaluation Count:0 | yes Evaluation Count:5198 |
| 0-5198 |
3920 | length = image_width - sx; never executed: length = image_width - sx; | 0 |
3921 | if (length > 0) { partially evaluated: length > 0 yes Evaluation Count:5198 | no Evaluation Count:0 |
| 0-5198 |
3922 | const int coverage = (spans->coverage * data->texture.const_alpha) >> 8; | - |
3923 | const uint *src = (uint *)data->texture.scanLine(sy) + sx; | - |
3924 | uint *dest = ((uint *)data->rasterBuffer->scanLine(spans->y)) + x; | - |
3925 | op.func(dest, src, length, coverage); | - |
3926 | } executed: } Execution Count:5198 | 5198 |
3927 | } executed: } Execution Count:5198 | 5198 |
3928 | ++spans; | - |
3929 | } executed: } Execution Count:5198 | 5198 |
3930 | } executed: } Execution Count:27 | 27 |
3931 | | - |
3932 | static inline quint16 interpolate_pixel_rgb16_255(quint16 x, quint8 a, | - |
3933 | quint16 y, quint8 b) | - |
3934 | { | - |
3935 | quint16 t = ((((x & 0x07e0) * a) + ((y & 0x07e0) * b)) >> 5) & 0x07e0; | - |
3936 | t |= ((((x & 0xf81f) * a) + ((y & 0xf81f) * b)) >> 5) & 0xf81f; | - |
3937 | | - |
3938 | return t; executed: return t; Execution Count:1280 | 1280 |
3939 | } | - |
3940 | | - |
3941 | static inline quint32 interpolate_pixel_rgb16x2_255(quint32 x, quint8 a, | - |
3942 | quint32 y, quint8 b) | - |
3943 | { | - |
3944 | uint t; | - |
3945 | t = ((((x & 0xf81f07e0) >> 5) * a) + (((y & 0xf81f07e0) >> 5) * b)) & 0xf81f07e0; | - |
3946 | t |= ((((x & 0x07e0f81f) * a) + ((y & 0x07e0f81f) * b)) >> 5) & 0x07e0f81f; | - |
3947 | return t; executed: return t; Execution Count:39680 | 39680 |
3948 | } | - |
3949 | | - |
3950 | static inline void blend_sourceOver_rgb16_rgb16(quint16 *__restrict__ dest, | - |
3951 | const quint16 *__restrict__ src, | - |
3952 | int length, | - |
3953 | const quint8 alpha, | - |
3954 | const quint8 ialpha) | - |
3955 | { | - |
3956 | const int dstAlign = ((quintptr)dest) & 0x3; | - |
3957 | if (dstAlign) { evaluated: dstAlign yes Evaluation Count:640 | yes Evaluation Count:640 |
| 640 |
3958 | *dest = interpolate_pixel_rgb16_255(*src, alpha, *dest, ialpha); | - |
3959 | ++dest; | - |
3960 | ++src; | - |
3961 | --length; | - |
3962 | } executed: } Execution Count:640 | 640 |
3963 | const int srcAlign = ((quintptr)src) & 0x3; | - |
3964 | int length32 = length >> 1; | - |
3965 | if (length32 && srcAlign == 0) { partially evaluated: length32 yes Evaluation Count:1280 | no Evaluation Count:0 |
partially evaluated: srcAlign == 0 yes Evaluation Count:1280 | no Evaluation Count:0 |
| 0-1280 |
3966 | while (length32--) { evaluated: length32-- yes Evaluation Count:39680 | yes Evaluation Count:1280 |
| 1280-39680 |
3967 | const quint32 *src32 = reinterpret_cast<const quint32*>(src); | - |
3968 | quint32 *dest32 = reinterpret_cast<quint32*>(dest); | - |
3969 | *dest32 = interpolate_pixel_rgb16x2_255(*src32, alpha, | - |
3970 | *dest32, ialpha); | - |
3971 | dest += 2; | - |
3972 | src += 2; | - |
3973 | } executed: } Execution Count:39680 | 39680 |
3974 | length &= 0x1; | - |
3975 | } executed: } Execution Count:1280 | 1280 |
3976 | while (length--) { evaluated: length-- yes Evaluation Count:640 | yes Evaluation Count:1280 |
| 640-1280 |
3977 | *dest = interpolate_pixel_rgb16_255(*src, alpha, *dest, ialpha); | - |
3978 | ++dest; | - |
3979 | ++src; | - |
3980 | } executed: } Execution Count:640 | 640 |
3981 | } executed: } Execution Count:1280 | 1280 |
3982 | | - |
3983 | static void blend_untransformed_rgb565(int count, const QSpan *spans, void *userData) | - |
3984 | { | - |
3985 | QSpanData *data = reinterpret_cast<QSpanData*>(userData); | - |
3986 | QPainter::CompositionMode mode = data->rasterBuffer->compositionMode; | - |
3987 | | - |
3988 | if (data->texture.format != QImage::Format_RGB16 partially evaluated: data->texture.format != QImage::Format_RGB16 yes Evaluation Count:155 | no Evaluation Count:0 |
| 0-155 |
3989 | || (mode != QPainter::CompositionMode_SourceOver never evaluated: mode != QPainter::CompositionMode_SourceOver | 0 |
3990 | && mode != QPainter::CompositionMode_Source)) never evaluated: mode != QPainter::CompositionMode_Source | 0 |
3991 | { | - |
3992 | blend_untransformed_generic(count, spans, userData); | - |
3993 | return; executed: return; Execution Count:155 | 155 |
3994 | } | - |
3995 | | - |
3996 | const int image_width = data->texture.width; | - |
3997 | const int image_height = data->texture.height; | - |
3998 | int xoff = -qRound(-data->dx); | - |
3999 | int yoff = -qRound(-data->dy); | - |
4000 | | - |
4001 | while (count--) { | 0 |
4002 | const quint8 coverage = (data->texture.const_alpha * spans->coverage) >> 8; | - |
4003 | if (coverage == 0) { never evaluated: coverage == 0 | 0 |
4004 | ++spans; | - |
4005 | continue; never executed: continue; | 0 |
4006 | } | - |
4007 | | - |
4008 | int x = spans->x; | - |
4009 | int length = spans->len; | - |
4010 | int sx = xoff + x; | - |
4011 | int sy = yoff + spans->y; | - |
4012 | if (sy >= 0 && sy < image_height && sx < image_width) { never evaluated: sy < image_height never evaluated: sx < image_width | 0 |
4013 | if (sx < 0) { | 0 |
4014 | x -= sx; | - |
4015 | length += sx; | - |
4016 | sx = 0; | - |
4017 | } | 0 |
4018 | if (sx + length > image_width) never evaluated: sx + length > image_width | 0 |
4019 | length = image_width - sx; never executed: length = image_width - sx; | 0 |
4020 | if (length > 0) { never evaluated: length > 0 | 0 |
4021 | quint16 *dest = (quint16 *)data->rasterBuffer->scanLine(spans->y) + x; | - |
4022 | const quint16 *src = (quint16 *)data->texture.scanLine(sy) + sx; | - |
4023 | if (coverage == 255) { never evaluated: coverage == 255 | 0 |
4024 | memcpy(dest, src, length * sizeof(quint16)); | - |
4025 | } else { | 0 |
4026 | const quint8 alpha = (coverage + 1) >> 3; | - |
4027 | const quint8 ialpha = 0x20 - alpha; | - |
4028 | if (alpha > 0) never evaluated: alpha > 0 | 0 |
4029 | blend_sourceOver_rgb16_rgb16(dest, src, length, alpha, ialpha); never executed: blend_sourceOver_rgb16_rgb16(dest, src, length, alpha, ialpha); | 0 |
4030 | } | 0 |
4031 | } | - |
4032 | } | 0 |
4033 | ++spans; | - |
4034 | } | 0 |
4035 | } | 0 |
4036 | | - |
4037 | static void blend_tiled_generic(int count, const QSpan *spans, void *userData) | - |
4038 | { | - |
4039 | QSpanData *data = reinterpret_cast<QSpanData *>(userData); | - |
4040 | | - |
4041 | uint buffer[buffer_size]; | - |
4042 | uint src_buffer[buffer_size]; | - |
4043 | Operator op = getOperator(data, spans, count); | - |
4044 | | - |
4045 | const int image_width = data->texture.width; | - |
4046 | const int image_height = data->texture.height; | - |
4047 | int xoff = -qRound(-data->dx) % image_width; | - |
4048 | int yoff = -qRound(-data->dy) % image_height; | - |
4049 | | - |
4050 | if (xoff < 0) evaluated: xoff < 0 yes Evaluation Count:9811 | yes Evaluation Count:518 |
| 518-9811 |
4051 | xoff += image_width; executed: xoff += image_width; Execution Count:9811 | 9811 |
4052 | if (yoff < 0) evaluated: yoff < 0 yes Evaluation Count:9930 | yes Evaluation Count:399 |
| 399-9930 |
4053 | yoff += image_height; executed: yoff += image_height; Execution Count:9930 | 9930 |
4054 | | - |
4055 | while (count--) { evaluated: count-- yes Evaluation Count:225458 | yes Evaluation Count:10329 |
| 10329-225458 |
4056 | int x = spans->x; | - |
4057 | int length = spans->len; | - |
4058 | int sx = (xoff + spans->x) % image_width; | - |
4059 | int sy = (spans->y + yoff) % image_height; | - |
4060 | if (sx < 0) partially evaluated: sx < 0 no Evaluation Count:0 | yes Evaluation Count:225458 |
| 0-225458 |
4061 | sx += image_width; never executed: sx += image_width; | 0 |
4062 | if (sy < 0) partially evaluated: sy < 0 no Evaluation Count:0 | yes Evaluation Count:225458 |
| 0-225458 |
4063 | sy += image_height; never executed: sy += image_height; | 0 |
4064 | | - |
4065 | const int coverage = (spans->coverage * data->texture.const_alpha) >> 8; | - |
4066 | while (length) { evaluated: length yes Evaluation Count:439182 | yes Evaluation Count:225458 |
| 225458-439182 |
4067 | int l = qMin(image_width - sx, length); | - |
4068 | if (buffer_size < l) partially evaluated: buffer_size < l no Evaluation Count:0 | yes Evaluation Count:439182 |
| 0-439182 |
4069 | l = buffer_size; never executed: l = buffer_size; | 0 |
4070 | const uint *src = op.src_fetch(src_buffer, &op, data, sy, sx, l); | - |
4071 | uint *dest = op.dest_fetch ? op.dest_fetch(buffer, data->rasterBuffer, x, spans->y, l) : buffer; evaluated: op.dest_fetch yes Evaluation Count:436110 | yes Evaluation Count:3072 |
| 3072-436110 |
4072 | op.func(dest, src, l, coverage); | - |
4073 | if (op.dest_store) evaluated: op.dest_store yes Evaluation Count:381643 | yes Evaluation Count:57539 |
| 57539-381643 |
4074 | op.dest_store(data->rasterBuffer, x, spans->y, dest, l); executed: op.dest_store(data->rasterBuffer, x, spans->y, dest, l); Execution Count:381643 | 381643 |
4075 | x += l; | - |
4076 | sx += l; | - |
4077 | length -= l; | - |
4078 | if (sx >= image_width) evaluated: sx >= image_width yes Evaluation Count:252811 | yes Evaluation Count:186371 |
| 186371-252811 |
4079 | sx = 0; executed: sx = 0; Execution Count:252811 | 252811 |
4080 | } executed: } Execution Count:439182 | 439182 |
4081 | ++spans; | - |
4082 | } executed: } Execution Count:225458 | 225458 |
4083 | } executed: } Execution Count:10329 | 10329 |
4084 | | - |
4085 | static void blend_tiled_argb(int count, const QSpan *spans, void *userData) | - |
4086 | { | - |
4087 | QSpanData *data = reinterpret_cast<QSpanData *>(userData); | - |
4088 | if (data->texture.format != QImage::Format_ARGB32_Premultiplied evaluated: data->texture.format != QImage::Format_ARGB32_Premultiplied yes Evaluation Count:1 | yes Evaluation Count:1454 |
| 1-1454 |
4089 | && data->texture.format != QImage::Format_RGB32) { partially evaluated: data->texture.format != QImage::Format_RGB32 no Evaluation Count:0 | yes Evaluation Count:1 |
| 0-1 |
4090 | blend_tiled_generic(count, spans, userData); | - |
4091 | return; | 0 |
4092 | } | - |
4093 | | - |
4094 | Operator op = getOperator(data, spans, count); | - |
4095 | | - |
4096 | int image_width = data->texture.width; | - |
4097 | int image_height = data->texture.height; | - |
4098 | int xoff = -qRound(-data->dx) % image_width; | - |
4099 | int yoff = -qRound(-data->dy) % image_height; | - |
4100 | | - |
4101 | if (xoff < 0) partially evaluated: xoff < 0 no Evaluation Count:0 | yes Evaluation Count:1455 |
| 0-1455 |
4102 | xoff += image_width; never executed: xoff += image_width; | 0 |
4103 | if (yoff < 0) partially evaluated: yoff < 0 no Evaluation Count:0 | yes Evaluation Count:1455 |
| 0-1455 |
4104 | yoff += image_height; never executed: yoff += image_height; | 0 |
4105 | | - |
4106 | while (count--) { evaluated: count-- yes Evaluation Count:9107 | yes Evaluation Count:1455 |
| 1455-9107 |
4107 | int x = spans->x; | - |
4108 | int length = spans->len; | - |
4109 | int sx = (xoff + spans->x) % image_width; | - |
4110 | int sy = (spans->y + yoff) % image_height; | - |
4111 | if (sx < 0) partially evaluated: sx < 0 no Evaluation Count:0 | yes Evaluation Count:9107 |
| 0-9107 |
4112 | sx += image_width; never executed: sx += image_width; | 0 |
4113 | if (sy < 0) partially evaluated: sy < 0 no Evaluation Count:0 | yes Evaluation Count:9107 |
| 0-9107 |
4114 | sy += image_height; never executed: sy += image_height; | 0 |
4115 | | - |
4116 | const int coverage = (spans->coverage * data->texture.const_alpha) >> 8; | - |
4117 | while (length) { evaluated: length yes Evaluation Count:10330 | yes Evaluation Count:9107 |
| 9107-10330 |
4118 | int l = qMin(image_width - sx, length); | - |
4119 | if (buffer_size < l) partially evaluated: buffer_size < l no Evaluation Count:0 | yes Evaluation Count:10330 |
| 0-10330 |
4120 | l = buffer_size; never executed: l = buffer_size; | 0 |
4121 | const uint *src = (uint *)data->texture.scanLine(sy) + sx; | - |
4122 | uint *dest = ((uint *)data->rasterBuffer->scanLine(spans->y)) + x; | - |
4123 | op.func(dest, src, l, coverage); | - |
4124 | x += l; | - |
4125 | length -= l; | - |
4126 | sx = 0; | - |
4127 | } executed: } Execution Count:10330 | 10330 |
4128 | ++spans; | - |
4129 | } executed: } Execution Count:9107 | 9107 |
4130 | } executed: } Execution Count:1455 | 1455 |
4131 | | - |
4132 | static void blend_tiled_rgb565(int count, const QSpan *spans, void *userData) | - |
4133 | { | - |
4134 | QSpanData *data = reinterpret_cast<QSpanData*>(userData); | - |
4135 | QPainter::CompositionMode mode = data->rasterBuffer->compositionMode; | - |
4136 | | - |
4137 | if (data->texture.format != QImage::Format_RGB16 evaluated: data->texture.format != QImage::Format_RGB16 yes Evaluation Count:10146 | yes Evaluation Count:8 |
| 8-10146 |
4138 | || (mode != QPainter::CompositionMode_SourceOver partially evaluated: mode != QPainter::CompositionMode_SourceOver no Evaluation Count:0 | yes Evaluation Count:8 |
| 0-8 |
4139 | && mode != QPainter::CompositionMode_Source)) never evaluated: mode != QPainter::CompositionMode_Source | 0 |
4140 | { | - |
4141 | blend_tiled_generic(count, spans, userData); | - |
4142 | return; executed: return; Execution Count:10146 | 10146 |
4143 | } | - |
4144 | | - |
4145 | const int image_width = data->texture.width; | - |
4146 | const int image_height = data->texture.height; | - |
4147 | int xoff = -qRound(-data->dx) % image_width; | - |
4148 | int yoff = -qRound(-data->dy) % image_height; | - |
4149 | | - |
4150 | if (xoff < 0) partially evaluated: xoff < 0 no Evaluation Count:0 | yes Evaluation Count:8 |
| 0-8 |
4151 | xoff += image_width; never executed: xoff += image_width; | 0 |
4152 | if (yoff < 0) partially evaluated: yoff < 0 no Evaluation Count:0 | yes Evaluation Count:8 |
| 0-8 |
4153 | yoff += image_height; never executed: yoff += image_height; | 0 |
4154 | | - |
4155 | while (count--) { evaluated: count-- yes Evaluation Count:1024 | yes Evaluation Count:8 |
| 8-1024 |
4156 | const quint8 coverage = (data->texture.const_alpha * spans->coverage) >> 8; | - |
4157 | if (coverage == 0) { evaluated: coverage == 0 yes Evaluation Count:128 | yes Evaluation Count:896 |
| 128-896 |
4158 | ++spans; | - |
4159 | continue; executed: continue; Execution Count:128 | 128 |
4160 | } | - |
4161 | | - |
4162 | int x = spans->x; | - |
4163 | int length = spans->len; | - |
4164 | int sx = (xoff + spans->x) % image_width; | - |
4165 | int sy = (spans->y + yoff) % image_height; | - |
4166 | if (sx < 0) partially evaluated: sx < 0 no Evaluation Count:0 | yes Evaluation Count:896 |
| 0-896 |
4167 | sx += image_width; never executed: sx += image_width; | 0 |
4168 | if (sy < 0) partially evaluated: sy < 0 no Evaluation Count:0 | yes Evaluation Count:896 |
| 0-896 |
4169 | sy += image_height; never executed: sy += image_height; | 0 |
4170 | | - |
4171 | if (coverage == 255) { evaluated: coverage == 255 yes Evaluation Count:128 | yes Evaluation Count:768 |
| 128-768 |
4172 | | - |
4173 | length = qMin(image_width,length); | - |
4174 | int tx = x; | - |
4175 | while (length) { evaluated: length yes Evaluation Count:256 | yes Evaluation Count:128 |
| 128-256 |
4176 | int l = qMin(image_width - sx, length); | - |
4177 | if (buffer_size < l) partially evaluated: buffer_size < l no Evaluation Count:0 | yes Evaluation Count:256 |
| 0-256 |
4178 | l = buffer_size; never executed: l = buffer_size; | 0 |
4179 | quint16 *dest = ((quint16 *)data->rasterBuffer->scanLine(spans->y)) + tx; | - |
4180 | const quint16 *src = (quint16 *)data->texture.scanLine(sy) + sx; | - |
4181 | memcpy(dest, src, l * sizeof(quint16)); | - |
4182 | length -= l; | - |
4183 | tx += l; | - |
4184 | sx = 0; | - |
4185 | } executed: } Execution Count:256 | 256 |
4186 | | - |
4187 | | - |
4188 | | - |
4189 | | - |
4190 | | - |
4191 | | - |
4192 | | - |
4193 | int copy_image_width = qMin(image_width, int(spans->len)); | - |
4194 | length = spans->len - copy_image_width; | - |
4195 | quint16 *src = ((quint16 *)data->rasterBuffer->scanLine(spans->y)) + x; | - |
4196 | quint16 *dest = src + copy_image_width; | - |
4197 | while (copy_image_width < length) { partially evaluated: copy_image_width < length no Evaluation Count:0 | yes Evaluation Count:128 |
| 0-128 |
4198 | memcpy(dest, src, copy_image_width * sizeof(quint16)); | - |
4199 | dest += copy_image_width; | - |
4200 | length -= copy_image_width; | - |
4201 | copy_image_width *= 2; | - |
4202 | } | 0 |
4203 | if (length > 0) partially evaluated: length > 0 yes Evaluation Count:128 | no Evaluation Count:0 |
| 0-128 |
4204 | memcpy(dest, src, length * sizeof(quint16)); executed: memcpy(dest, src, length * sizeof(quint16)); Execution Count:128 | 128 |
4205 | } else { executed: } Execution Count:128 | 128 |
4206 | const quint8 alpha = (coverage + 1) >> 3; | - |
4207 | const quint8 ialpha = 0x20 - alpha; | - |
4208 | if (alpha > 0) { evaluated: alpha > 0 yes Evaluation Count:640 | yes Evaluation Count:128 |
| 128-640 |
4209 | while (length) { evaluated: length yes Evaluation Count:1280 | yes Evaluation Count:640 |
| 640-1280 |
4210 | int l = qMin(image_width - sx, length); | - |
4211 | if (buffer_size < l) partially evaluated: buffer_size < l no Evaluation Count:0 | yes Evaluation Count:1280 |
| 0-1280 |
4212 | l = buffer_size; never executed: l = buffer_size; | 0 |
4213 | quint16 *dest = ((quint16 *)data->rasterBuffer->scanLine(spans->y)) + x; | - |
4214 | const quint16 *src = (quint16 *)data->texture.scanLine(sy) + sx; | - |
4215 | blend_sourceOver_rgb16_rgb16(dest, src, l, alpha, ialpha); | - |
4216 | x += l; | - |
4217 | length -= l; | - |
4218 | sx = 0; | - |
4219 | } executed: } Execution Count:1280 | 1280 |
4220 | } executed: } Execution Count:640 | 640 |
4221 | } executed: } Execution Count:768 | 768 |
4222 | ++spans; | - |
4223 | } executed: } Execution Count:896 | 896 |
4224 | } executed: } Execution Count:8 | 8 |
4225 | | - |
4226 | static void blend_transformed_bilinear_rgb565(int count, const QSpan *spans, void *userData) | - |
4227 | { | - |
4228 | QSpanData *data = reinterpret_cast<QSpanData*>(userData); | - |
4229 | QPainter::CompositionMode mode = data->rasterBuffer->compositionMode; | - |
4230 | | - |
4231 | if (data->texture.format != QImage::Format_RGB16 never evaluated: data->texture.format != QImage::Format_RGB16 | 0 |
4232 | || (mode != QPainter::CompositionMode_SourceOver never evaluated: mode != QPainter::CompositionMode_SourceOver | 0 |
4233 | && mode != QPainter::CompositionMode_Source)) never evaluated: mode != QPainter::CompositionMode_Source | 0 |
4234 | { | - |
4235 | blend_src_generic(count, spans, userData); | - |
4236 | return; | 0 |
4237 | } | - |
4238 | | - |
4239 | quint16 buffer[buffer_size]; | - |
4240 | | - |
4241 | const int src_minx = data->texture.x1; | - |
4242 | const int src_miny = data->texture.y1; | - |
4243 | const int src_maxx = data->texture.x2 - 1; | - |
4244 | const int src_maxy = data->texture.y2 - 1; | - |
4245 | | - |
4246 | if (data->fast_matrix) { never evaluated: data->fast_matrix | 0 |
4247 | | - |
4248 | const int fdx = (int)(data->m11 * fixed_scale); | - |
4249 | const int fdy = (int)(data->m12 * fixed_scale); | - |
4250 | | - |
4251 | while (count--) { | 0 |
4252 | const quint8 coverage = (data->texture.const_alpha * spans->coverage) >> 8; | - |
4253 | const quint8 alpha = (coverage + 1) >> 3; | - |
4254 | const quint8 ialpha = 0x20 - alpha; | - |
4255 | if (alpha == 0) { never evaluated: alpha == 0 | 0 |
4256 | ++spans; | - |
4257 | continue; never executed: continue; | 0 |
4258 | } | - |
4259 | | - |
4260 | quint16 *dest = (quint16 *)data->rasterBuffer->scanLine(spans->y) + spans->x; | - |
4261 | const qreal cx = spans->x + qreal(0.5); | - |
4262 | const qreal cy = spans->y + qreal(0.5); | - |
4263 | int x = int((data->m21 * cy | - |
4264 | + data->m11 * cx + data->dx) * fixed_scale) - half_point; | - |
4265 | int y = int((data->m22 * cy | - |
4266 | + data->m12 * cx + data->dy) * fixed_scale) - half_point; | - |
4267 | int length = spans->len; | - |
4268 | | - |
4269 | while (length) { | 0 |
4270 | int l; | - |
4271 | quint16 *b; | - |
4272 | if (ialpha == 0) { never evaluated: ialpha == 0 | 0 |
4273 | l = length; | - |
4274 | b = dest; | - |
4275 | } else { | 0 |
4276 | l = qMin(length, buffer_size); | - |
4277 | b = buffer; | - |
4278 | } | 0 |
4279 | const quint16 *end = b + l; | - |
4280 | | - |
4281 | while (b < end) { | 0 |
4282 | int x1 = (x >> 16); | - |
4283 | int x2; | - |
4284 | int y1 = (y >> 16); | - |
4285 | int y2; | - |
4286 | | - |
4287 | fetchTransformedBilinear_pixelBounds<BlendTransformedBilinear>(0, src_minx, src_maxx, x1, x2); | - |
4288 | fetchTransformedBilinear_pixelBounds<BlendTransformedBilinear>(0, src_miny, src_maxy, y1, y2); | - |
4289 | | - |
4290 | const quint16 *src1 = (quint16*)data->texture.scanLine(y1); | - |
4291 | const quint16 *src2 = (quint16*)data->texture.scanLine(y2); | - |
4292 | quint16 tl = src1[x1]; | - |
4293 | const quint16 tr = src1[x2]; | - |
4294 | quint16 bl = src2[x1]; | - |
4295 | const quint16 br = src2[x2]; | - |
4296 | | - |
4297 | const uint distxsl8 = x & 0xff00; | - |
4298 | const uint distysl8 = y & 0xff00; | - |
4299 | const uint distx = distxsl8 >> 8; | - |
4300 | const uint disty = distysl8 >> 8; | - |
4301 | const uint distxy = distx * disty; | - |
4302 | | - |
4303 | const uint tlw = 0x10000 - distxsl8 - distysl8 + distxy; | - |
4304 | const uint trw = distxsl8 - distxy; | - |
4305 | const uint blw = distysl8 - distxy; | - |
4306 | const uint brw = distxy; | - |
4307 | uint red = ((tl & 0xf800) * tlw + (tr & 0xf800) * trw | - |
4308 | + (bl & 0xf800) * blw + (br & 0xf800) * brw) & 0xf8000000; | - |
4309 | uint green = ((tl & 0x07e0) * tlw + (tr & 0x07e0) * trw | - |
4310 | + (bl & 0x07e0) * blw + (br & 0x07e0) * brw) & 0x07e00000; | - |
4311 | uint blue = ((tl & 0x001f) * tlw + (tr & 0x001f) * trw | - |
4312 | + (bl & 0x001f) * blw + (br & 0x001f) * brw); | - |
4313 | *b = quint16((red | green | blue) >> 16); | - |
4314 | | - |
4315 | ++b; | - |
4316 | x += fdx; | - |
4317 | y += fdy; | - |
4318 | } | 0 |
4319 | | - |
4320 | if (ialpha != 0) never evaluated: ialpha != 0 | 0 |
4321 | blend_sourceOver_rgb16_rgb16(dest, buffer, l, alpha, ialpha); never executed: blend_sourceOver_rgb16_rgb16(dest, buffer, l, alpha, ialpha); | 0 |
4322 | | - |
4323 | dest += l; | - |
4324 | length -= l; | - |
4325 | } | 0 |
4326 | ++spans; | - |
4327 | } | 0 |
4328 | } else { | 0 |
4329 | const qreal fdx = data->m11; | - |
4330 | const qreal fdy = data->m12; | - |
4331 | const qreal fdw = data->m13; | - |
4332 | | - |
4333 | while (count--) { | 0 |
4334 | const quint8 coverage = (data->texture.const_alpha * spans->coverage) >> 8; | - |
4335 | const quint8 alpha = (coverage + 1) >> 3; | - |
4336 | const quint8 ialpha = 0x20 - alpha; | - |
4337 | if (alpha == 0) { never evaluated: alpha == 0 | 0 |
4338 | ++spans; | - |
4339 | continue; never executed: continue; | 0 |
4340 | } | - |
4341 | | - |
4342 | quint16 *dest = (quint16 *)data->rasterBuffer->scanLine(spans->y) + spans->x; | - |
4343 | | - |
4344 | const qreal cx = spans->x + qreal(0.5); | - |
4345 | const qreal cy = spans->y + qreal(0.5); | - |
4346 | | - |
4347 | qreal x = data->m21 * cy + data->m11 * cx + data->dx; | - |
4348 | qreal y = data->m22 * cy + data->m12 * cx + data->dy; | - |
4349 | qreal w = data->m23 * cy + data->m13 * cx + data->m33; | - |
4350 | | - |
4351 | int length = spans->len; | - |
4352 | while (length) { | 0 |
4353 | int l; | - |
4354 | quint16 *b; | - |
4355 | if (ialpha == 0) { never evaluated: ialpha == 0 | 0 |
4356 | l = length; | - |
4357 | b = dest; | - |
4358 | } else { | 0 |
4359 | l = qMin(length, buffer_size); | - |
4360 | b = buffer; | - |
4361 | } | 0 |
4362 | const quint16 *end = b + l; | - |
4363 | | - |
4364 | while (b < end) { | 0 |
4365 | const qreal iw = w == 0 ? 1 : 1 / w; | 0 |
4366 | const qreal px = x * iw - qreal(0.5); | - |
4367 | const qreal py = y * iw - qreal(0.5); | - |
4368 | | - |
4369 | int x1 = int(px) - (px < 0); | - |
4370 | int x2; | - |
4371 | int y1 = int(py) - (py < 0); | - |
4372 | int y2; | - |
4373 | | - |
4374 | fetchTransformedBilinear_pixelBounds<BlendTransformedBilinear>(0, src_minx, src_maxx, x1, x2); | - |
4375 | fetchTransformedBilinear_pixelBounds<BlendTransformedBilinear>(0, src_miny, src_maxy, y1, y2); | - |
4376 | | - |
4377 | const quint16 *src1 = (quint16 *)data->texture.scanLine(y1); | - |
4378 | const quint16 *src2 = (quint16 *)data->texture.scanLine(y2); | - |
4379 | quint16 tl = src1[x1]; | - |
4380 | const quint16 tr = src1[x2]; | - |
4381 | quint16 bl = src2[x1]; | - |
4382 | const quint16 br = src2[x2]; | - |
4383 | | - |
4384 | const uint distx = uint((px - x1) * 256); | - |
4385 | const uint disty = uint((py - y1) * 256); | - |
4386 | const uint distxsl8 = distx << 8; | - |
4387 | const uint distysl8 = disty << 8; | - |
4388 | const uint distxy = distx * disty; | - |
4389 | | - |
4390 | const uint tlw = 0x10000 - distxsl8 - distysl8 + distxy; | - |
4391 | const uint trw = distxsl8 - distxy; | - |
4392 | const uint blw = distysl8 - distxy; | - |
4393 | const uint brw = distxy; | - |
4394 | uint red = ((tl & 0xf800) * tlw + (tr & 0xf800) * trw | - |
4395 | + (bl & 0xf800) * blw + (br & 0xf800) * brw) & 0xf8000000; | - |
4396 | uint green = ((tl & 0x07e0) * tlw + (tr & 0x07e0) * trw | - |
4397 | + (bl & 0x07e0) * blw + (br & 0x07e0) * brw) & 0x07e00000; | - |
4398 | uint blue = ((tl & 0x001f) * tlw + (tr & 0x001f) * trw | - |
4399 | + (bl & 0x001f) * blw + (br & 0x001f) * brw); | - |
4400 | *b = quint16((red | green | blue) >> 16); | - |
4401 | | - |
4402 | ++b; | - |
4403 | x += fdx; | - |
4404 | y += fdy; | - |
4405 | w += fdw; | - |
4406 | } | 0 |
4407 | | - |
4408 | if (ialpha != 0) never evaluated: ialpha != 0 | 0 |
4409 | blend_sourceOver_rgb16_rgb16(dest, buffer, l, alpha, ialpha); never executed: blend_sourceOver_rgb16_rgb16(dest, buffer, l, alpha, ialpha); | 0 |
4410 | | - |
4411 | dest += l; | - |
4412 | length -= l; | - |
4413 | } | 0 |
4414 | ++spans; | - |
4415 | } | 0 |
4416 | } | 0 |
4417 | } | - |
4418 | | - |
4419 | static void blend_transformed_argb(int count, const QSpan *spans, void *userData) | - |
4420 | { | - |
4421 | QSpanData *data = reinterpret_cast<QSpanData *>(userData); | - |
4422 | if (data->texture.format != QImage::Format_ARGB32_Premultiplied partially evaluated: data->texture.format != QImage::Format_ARGB32_Premultiplied yes Evaluation Count:1 | no Evaluation Count:0 |
| 0-1 |
4423 | && data->texture.format != QImage::Format_RGB32) { partially evaluated: data->texture.format != QImage::Format_RGB32 yes Evaluation Count:1 | no Evaluation Count:0 |
| 0-1 |
4424 | blend_src_generic(count, spans, userData); | - |
4425 | return; executed: return; Execution Count:1 | 1 |
4426 | } | - |
4427 | | - |
4428 | CompositionFunction func = functionForMode[data->rasterBuffer->compositionMode]; | - |
4429 | uint buffer[buffer_size]; | - |
4430 | | - |
4431 | int image_width = data->texture.width; | - |
4432 | int image_height = data->texture.height; | - |
4433 | | - |
4434 | if (data->fast_matrix) { never evaluated: data->fast_matrix | 0 |
4435 | | - |
4436 | int fdx = (int)(data->m11 * fixed_scale); | - |
4437 | int fdy = (int)(data->m12 * fixed_scale); | - |
4438 | | - |
4439 | while (count--) { | 0 |
4440 | void *t = data->rasterBuffer->scanLine(spans->y); | - |
4441 | | - |
4442 | uint *target = ((uint *)t) + spans->x; | - |
4443 | | - |
4444 | const qreal cx = spans->x + qreal(0.5); | - |
4445 | const qreal cy = spans->y + qreal(0.5); | - |
4446 | | - |
4447 | int x = int((data->m21 * cy | - |
4448 | + data->m11 * cx + data->dx) * fixed_scale); | - |
4449 | int y = int((data->m22 * cy | - |
4450 | + data->m12 * cx + data->dy) * fixed_scale); | - |
4451 | | - |
4452 | int length = spans->len; | - |
4453 | const int coverage = (spans->coverage * data->texture.const_alpha) >> 8; | - |
4454 | while (length) { | 0 |
4455 | int l = qMin(length, buffer_size); | - |
4456 | const uint *end = buffer + l; | - |
4457 | uint *b = buffer; | - |
4458 | while (b < end) { | 0 |
4459 | int px = qBound(0, x >> 16, image_width - 1); | - |
4460 | int py = qBound(0, y >> 16, image_height - 1); | - |
4461 | *b = reinterpret_cast<const uint *>(data->texture.scanLine(py))[px]; | - |
4462 | | - |
4463 | x += fdx; | - |
4464 | y += fdy; | - |
4465 | ++b; | - |
4466 | } | 0 |
4467 | func(target, buffer, l, coverage); | - |
4468 | target += l; | - |
4469 | length -= l; | - |
4470 | } | 0 |
4471 | ++spans; | - |
4472 | } | 0 |
4473 | } else { | 0 |
4474 | const qreal fdx = data->m11; | - |
4475 | const qreal fdy = data->m12; | - |
4476 | const qreal fdw = data->m13; | - |
4477 | while (count--) { | 0 |
4478 | void *t = data->rasterBuffer->scanLine(spans->y); | - |
4479 | | - |
4480 | uint *target = ((uint *)t) + spans->x; | - |
4481 | | - |
4482 | const qreal cx = spans->x + qreal(0.5); | - |
4483 | const qreal cy = spans->y + qreal(0.5); | - |
4484 | | - |
4485 | qreal x = data->m21 * cy + data->m11 * cx + data->dx; | - |
4486 | qreal y = data->m22 * cy + data->m12 * cx + data->dy; | - |
4487 | qreal w = data->m23 * cy + data->m13 * cx + data->m33; | - |
4488 | | - |
4489 | int length = spans->len; | - |
4490 | const int coverage = (spans->coverage * data->texture.const_alpha) >> 8; | - |
4491 | while (length) { | 0 |
4492 | int l = qMin(length, buffer_size); | - |
4493 | const uint *end = buffer + l; | - |
4494 | uint *b = buffer; | - |
4495 | while (b < end) { | 0 |
4496 | const qreal iw = w == 0 ? 1 : 1 / w; | 0 |
4497 | const qreal tx = x * iw; | - |
4498 | const qreal ty = y * iw; | - |
4499 | const int px = qBound(0, int(tx) - (tx < 0), image_width - 1); | - |
4500 | const int py = qBound(0, int(ty) - (ty < 0), image_height - 1); | - |
4501 | | - |
4502 | *b = reinterpret_cast<const uint *>(data->texture.scanLine(py))[px]; | - |
4503 | x += fdx; | - |
4504 | y += fdy; | - |
4505 | w += fdw; | - |
4506 | | - |
4507 | ++b; | - |
4508 | } | 0 |
4509 | func(target, buffer, l, coverage); | - |
4510 | target += l; | - |
4511 | length -= l; | - |
4512 | } | 0 |
4513 | ++spans; | - |
4514 | } | 0 |
4515 | } | 0 |
4516 | } | - |
4517 | | - |
4518 | static void blend_transformed_rgb565(int count, const QSpan *spans, void *userData) | - |
4519 | { | - |
4520 | QSpanData *data = reinterpret_cast<QSpanData*>(userData); | - |
4521 | QPainter::CompositionMode mode = data->rasterBuffer->compositionMode; | - |
4522 | | - |
4523 | if (data->texture.format != QImage::Format_RGB16 never evaluated: data->texture.format != QImage::Format_RGB16 | 0 |
4524 | || (mode != QPainter::CompositionMode_SourceOver never evaluated: mode != QPainter::CompositionMode_SourceOver | 0 |
4525 | && mode != QPainter::CompositionMode_Source)) never evaluated: mode != QPainter::CompositionMode_Source | 0 |
4526 | { | - |
4527 | blend_src_generic(count, spans, userData); | - |
4528 | return; | 0 |
4529 | } | - |
4530 | | - |
4531 | quint16 buffer[buffer_size]; | - |
4532 | const int image_width = data->texture.width; | - |
4533 | const int image_height = data->texture.height; | - |
4534 | | - |
4535 | if (data->fast_matrix) { never evaluated: data->fast_matrix | 0 |
4536 | | - |
4537 | const int fdx = (int)(data->m11 * fixed_scale); | - |
4538 | const int fdy = (int)(data->m12 * fixed_scale); | - |
4539 | | - |
4540 | while (count--) { | 0 |
4541 | const quint8 coverage = (data->texture.const_alpha * spans->coverage) >> 8; | - |
4542 | const quint8 alpha = (coverage + 1) >> 3; | - |
4543 | const quint8 ialpha = 0x20 - alpha; | - |
4544 | if (alpha == 0) { never evaluated: alpha == 0 | 0 |
4545 | ++spans; | - |
4546 | continue; never executed: continue; | 0 |
4547 | } | - |
4548 | | - |
4549 | quint16 *dest = (quint16 *)data->rasterBuffer->scanLine(spans->y) + spans->x; | - |
4550 | const qreal cx = spans->x + qreal(0.5); | - |
4551 | const qreal cy = spans->y + qreal(0.5); | - |
4552 | int x = int((data->m21 * cy | - |
4553 | + data->m11 * cx + data->dx) * fixed_scale); | - |
4554 | int y = int((data->m22 * cy | - |
4555 | + data->m12 * cx + data->dy) * fixed_scale); | - |
4556 | int length = spans->len; | - |
4557 | | - |
4558 | while (length) { | 0 |
4559 | int l; | - |
4560 | quint16 *b; | - |
4561 | if (ialpha == 0) { never evaluated: ialpha == 0 | 0 |
4562 | l = length; | - |
4563 | b = dest; | - |
4564 | } else { | 0 |
4565 | l = qMin(length, buffer_size); | - |
4566 | b = buffer; | - |
4567 | } | 0 |
4568 | const quint16 *end = b + l; | - |
4569 | | - |
4570 | while (b < end) { | 0 |
4571 | const int px = qBound(0, x >> 16, image_width - 1); | - |
4572 | const int py = qBound(0, y >> 16, image_height - 1); | - |
4573 | | - |
4574 | *b = ((quint16 *)data->texture.scanLine(py))[px]; | - |
4575 | ++b; | - |
4576 | | - |
4577 | x += fdx; | - |
4578 | y += fdy; | - |
4579 | } | 0 |
4580 | | - |
4581 | if (ialpha != 0) never evaluated: ialpha != 0 | 0 |
4582 | blend_sourceOver_rgb16_rgb16(dest, buffer, l, alpha, ialpha); never executed: blend_sourceOver_rgb16_rgb16(dest, buffer, l, alpha, ialpha); | 0 |
4583 | | - |
4584 | dest += l; | - |
4585 | length -= l; | - |
4586 | } | 0 |
4587 | ++spans; | - |
4588 | } | 0 |
4589 | } else { | 0 |
4590 | const qreal fdx = data->m11; | - |
4591 | const qreal fdy = data->m12; | - |
4592 | const qreal fdw = data->m13; | - |
4593 | | - |
4594 | while (count--) { | 0 |
4595 | const quint8 coverage = (data->texture.const_alpha * spans->coverage) >> 8; | - |
4596 | const quint8 alpha = (coverage + 1) >> 3; | - |
4597 | const quint8 ialpha = 0x20 - alpha; | - |
4598 | if (alpha == 0) { never evaluated: alpha == 0 | 0 |
4599 | ++spans; | - |
4600 | continue; never executed: continue; | 0 |
4601 | } | - |
4602 | | - |
4603 | quint16 *dest = (quint16 *)data->rasterBuffer->scanLine(spans->y) + spans->x; | - |
4604 | | - |
4605 | const qreal cx = spans->x + qreal(0.5); | - |
4606 | const qreal cy = spans->y + qreal(0.5); | - |
4607 | | - |
4608 | qreal x = data->m21 * cy + data->m11 * cx + data->dx; | - |
4609 | qreal y = data->m22 * cy + data->m12 * cx + data->dy; | - |
4610 | qreal w = data->m23 * cy + data->m13 * cx + data->m33; | - |
4611 | | - |
4612 | int length = spans->len; | - |
4613 | while (length) { | 0 |
4614 | int l; | - |
4615 | quint16 *b; | - |
4616 | if (ialpha == 0) { never evaluated: ialpha == 0 | 0 |
4617 | l = length; | - |
4618 | b = dest; | - |
4619 | } else { | 0 |
4620 | l = qMin(length, buffer_size); | - |
4621 | b = buffer; | - |
4622 | } | 0 |
4623 | const quint16 *end = b + l; | - |
4624 | | - |
4625 | while (b < end) { | 0 |
4626 | const qreal iw = w == 0 ? 1 : 1 / w; | 0 |
4627 | const qreal tx = x * iw; | - |
4628 | const qreal ty = y * iw; | - |
4629 | | - |
4630 | const int px = qBound(0, int(tx) - (tx < 0), image_width - 1); | - |
4631 | const int py = qBound(0, int(ty) - (ty < 0), image_height - 1); | - |
4632 | | - |
4633 | *b = ((quint16 *)data->texture.scanLine(py))[px]; | - |
4634 | ++b; | - |
4635 | | - |
4636 | x += fdx; | - |
4637 | y += fdy; | - |
4638 | w += fdw; | - |
4639 | } | 0 |
4640 | | - |
4641 | if (ialpha != 0) never evaluated: ialpha != 0 | 0 |
4642 | blend_sourceOver_rgb16_rgb16(dest, buffer, l, alpha, ialpha); never executed: blend_sourceOver_rgb16_rgb16(dest, buffer, l, alpha, ialpha); | 0 |
4643 | | - |
4644 | dest += l; | - |
4645 | length -= l; | - |
4646 | } | 0 |
4647 | ++spans; | - |
4648 | } | 0 |
4649 | } | 0 |
4650 | } | - |
4651 | | - |
4652 | static void blend_transformed_tiled_argb(int count, const QSpan *spans, void *userData) | - |
4653 | { | - |
4654 | QSpanData *data = reinterpret_cast<QSpanData *>(userData); | - |
4655 | if (data->texture.format != QImage::Format_ARGB32_Premultiplied partially evaluated: data->texture.format != QImage::Format_ARGB32_Premultiplied no Evaluation Count:0 | yes Evaluation Count:2 |
| 0-2 |
4656 | && data->texture.format != QImage::Format_RGB32) { never evaluated: data->texture.format != QImage::Format_RGB32 | 0 |
4657 | blend_src_generic(count, spans, userData); | - |
4658 | return; | 0 |
4659 | } | - |
4660 | | - |
4661 | CompositionFunction func = functionForMode[data->rasterBuffer->compositionMode]; | - |
4662 | uint buffer[buffer_size]; | - |
4663 | | - |
4664 | int image_width = data->texture.width; | - |
4665 | int image_height = data->texture.height; | - |
4666 | const int scanline_offset = data->texture.bytesPerLine / 4; | - |
4667 | | - |
4668 | if (data->fast_matrix) { partially evaluated: data->fast_matrix no Evaluation Count:0 | yes Evaluation Count:2 |
| 0-2 |
4669 | | - |
4670 | int fdx = (int)(data->m11 * fixed_scale); | - |
4671 | int fdy = (int)(data->m12 * fixed_scale); | - |
4672 | | - |
4673 | while (count--) { | 0 |
4674 | void *t = data->rasterBuffer->scanLine(spans->y); | - |
4675 | | - |
4676 | uint *target = ((uint *)t) + spans->x; | - |
4677 | uint *image_bits = (uint *)data->texture.imageData; | - |
4678 | | - |
4679 | const qreal cx = spans->x + qreal(0.5); | - |
4680 | const qreal cy = spans->y + qreal(0.5); | - |
4681 | | - |
4682 | int x = int((data->m21 * cy | - |
4683 | + data->m11 * cx + data->dx) * fixed_scale); | - |
4684 | int y = int((data->m22 * cy | - |
4685 | + data->m12 * cx + data->dy) * fixed_scale); | - |
4686 | | - |
4687 | const int coverage = (spans->coverage * data->texture.const_alpha) >> 8; | - |
4688 | int length = spans->len; | - |
4689 | while (length) { | 0 |
4690 | int l = qMin(length, buffer_size); | - |
4691 | const uint *end = buffer + l; | - |
4692 | uint *b = buffer; | - |
4693 | while (b < end) { | 0 |
4694 | int px = x >> 16; | - |
4695 | int py = y >> 16; | - |
4696 | px %= image_width; | - |
4697 | py %= image_height; | - |
4698 | if (px < 0) px += image_width; never executed: px += image_width; | 0 |
4699 | if (py < 0) py += image_height; never executed: py += image_height; | 0 |
4700 | int y_offset = py * scanline_offset; | - |
4701 | | - |
4702 | qt_noop(); | - |
4703 | qt_noop(); | - |
4704 | | - |
4705 | *b = image_bits[y_offset + px]; | - |
4706 | x += fdx; | - |
4707 | y += fdy; | - |
4708 | ++b; | - |
4709 | } | 0 |
4710 | func(target, buffer, l, coverage); | - |
4711 | target += l; | - |
4712 | length -= l; | - |
4713 | } | 0 |
4714 | ++spans; | - |
4715 | } | 0 |
4716 | } else { | 0 |
4717 | const qreal fdx = data->m11; | - |
4718 | const qreal fdy = data->m12; | - |
4719 | const qreal fdw = data->m13; | - |
4720 | while (count--) { evaluated: count-- yes Evaluation Count:111 | yes Evaluation Count:2 |
| 2-111 |
4721 | void *t = data->rasterBuffer->scanLine(spans->y); | - |
4722 | | - |
4723 | uint *target = ((uint *)t) + spans->x; | - |
4724 | uint *image_bits = (uint *)data->texture.imageData; | - |
4725 | | - |
4726 | const qreal cx = spans->x + qreal(0.5); | - |
4727 | const qreal cy = spans->y + qreal(0.5); | - |
4728 | | - |
4729 | qreal x = data->m21 * cy + data->m11 * cx + data->dx; | - |
4730 | qreal y = data->m22 * cy + data->m12 * cx + data->dy; | - |
4731 | qreal w = data->m23 * cy + data->m13 * cx + data->m33; | - |
4732 | | - |
4733 | const int coverage = (spans->coverage * data->texture.const_alpha) >> 8; | - |
4734 | int length = spans->len; | - |
4735 | while (length) { evaluated: length yes Evaluation Count:111 | yes Evaluation Count:111 |
| 111 |
4736 | int l = qMin(length, buffer_size); | - |
4737 | const uint *end = buffer + l; | - |
4738 | uint *b = buffer; | - |
4739 | while (b < end) { evaluated: b < end yes Evaluation Count:12101 | yes Evaluation Count:111 |
| 111-12101 |
4740 | const qreal iw = w == 0 ? 1 : 1 / w; partially evaluated: w == 0 no Evaluation Count:0 | yes Evaluation Count:12101 |
| 0-12101 |
4741 | const qreal tx = x * iw; | - |
4742 | const qreal ty = y * iw; | - |
4743 | int px = int(tx) - (tx < 0); | - |
4744 | int py = int(ty) - (ty < 0); | - |
4745 | | - |
4746 | px %= image_width; | - |
4747 | py %= image_height; | - |
4748 | if (px < 0) px += image_width; executed: px += image_width; Execution Count:10450 evaluated: px < 0 yes Evaluation Count:10450 | yes Evaluation Count:1651 |
| 1651-10450 |
4749 | if (py < 0) py += image_height; never executed: py += image_height; partially evaluated: py < 0 no Evaluation Count:0 | yes Evaluation Count:12101 |
| 0-12101 |
4750 | int y_offset = py * scanline_offset; | - |
4751 | | - |
4752 | qt_noop(); | - |
4753 | qt_noop(); | - |
4754 | | - |
4755 | *b = image_bits[y_offset + px]; | - |
4756 | x += fdx; | - |
4757 | y += fdy; | - |
4758 | w += fdw; | - |
4759 | | - |
4760 | if (!w) { partially evaluated: !w no Evaluation Count:0 | yes Evaluation Count:12101 |
| 0-12101 |
4761 | w += fdw; | - |
4762 | } | 0 |
4763 | ++b; | - |
4764 | } executed: } Execution Count:12101 | 12101 |
4765 | func(target, buffer, l, coverage); | - |
4766 | target += l; | - |
4767 | length -= l; | - |
4768 | } executed: } Execution Count:111 | 111 |
4769 | ++spans; | - |
4770 | } executed: } Execution Count:111 | 111 |
4771 | } executed: } Execution Count:2 | 2 |
4772 | } | - |
4773 | | - |
4774 | static void blend_transformed_tiled_rgb565(int count, const QSpan *spans, void *userData) | - |
4775 | { | - |
4776 | QSpanData *data = reinterpret_cast<QSpanData*>(userData); | - |
4777 | QPainter::CompositionMode mode = data->rasterBuffer->compositionMode; | - |
4778 | | - |
4779 | if (data->texture.format != QImage::Format_RGB16 never evaluated: data->texture.format != QImage::Format_RGB16 | 0 |
4780 | || (mode != QPainter::CompositionMode_SourceOver never evaluated: mode != QPainter::CompositionMode_SourceOver | 0 |
4781 | && mode != QPainter::CompositionMode_Source)) never evaluated: mode != QPainter::CompositionMode_Source | 0 |
4782 | { | - |
4783 | blend_src_generic(count, spans, userData); | - |
4784 | return; | 0 |
4785 | } | - |
4786 | | - |
4787 | quint16 buffer[buffer_size]; | - |
4788 | const int image_width = data->texture.width; | - |
4789 | const int image_height = data->texture.height; | - |
4790 | | - |
4791 | if (data->fast_matrix) { never evaluated: data->fast_matrix | 0 |
4792 | | - |
4793 | const int fdx = (int)(data->m11 * fixed_scale); | - |
4794 | const int fdy = (int)(data->m12 * fixed_scale); | - |
4795 | | - |
4796 | while (count--) { | 0 |
4797 | const quint8 coverage = (data->texture.const_alpha * spans->coverage) >> 8; | - |
4798 | const quint8 alpha = (coverage + 1) >> 3; | - |
4799 | const quint8 ialpha = 0x20 - alpha; | - |
4800 | if (alpha == 0) { never evaluated: alpha == 0 | 0 |
4801 | ++spans; | - |
4802 | continue; never executed: continue; | 0 |
4803 | } | - |
4804 | | - |
4805 | quint16 *dest = (quint16 *)data->rasterBuffer->scanLine(spans->y) + spans->x; | - |
4806 | const qreal cx = spans->x + qreal(0.5); | - |
4807 | const qreal cy = spans->y + qreal(0.5); | - |
4808 | int x = int((data->m21 * cy | - |
4809 | + data->m11 * cx + data->dx) * fixed_scale); | - |
4810 | int y = int((data->m22 * cy | - |
4811 | + data->m12 * cx + data->dy) * fixed_scale); | - |
4812 | int length = spans->len; | - |
4813 | | - |
4814 | while (length) { | 0 |
4815 | int l; | - |
4816 | quint16 *b; | - |
4817 | if (ialpha == 0) { never evaluated: ialpha == 0 | 0 |
4818 | l = length; | - |
4819 | b = dest; | - |
4820 | } else { | 0 |
4821 | l = qMin(length, buffer_size); | - |
4822 | b = buffer; | - |
4823 | } | 0 |
4824 | const quint16 *end = b + l; | - |
4825 | | - |
4826 | while (b < end) { | 0 |
4827 | int px = (x >> 16) % image_width; | - |
4828 | int py = (y >> 16) % image_height; | - |
4829 | | - |
4830 | if (px < 0) | 0 |
4831 | px += image_width; never executed: px += image_width; | 0 |
4832 | if (py < 0) | 0 |
4833 | py += image_height; never executed: py += image_height; | 0 |
4834 | | - |
4835 | *b = ((quint16 *)data->texture.scanLine(py))[px]; | - |
4836 | ++b; | - |
4837 | | - |
4838 | x += fdx; | - |
4839 | y += fdy; | - |
4840 | } | 0 |
4841 | | - |
4842 | if (ialpha != 0) never evaluated: ialpha != 0 | 0 |
4843 | blend_sourceOver_rgb16_rgb16(dest, buffer, l, alpha, ialpha); never executed: blend_sourceOver_rgb16_rgb16(dest, buffer, l, alpha, ialpha); | 0 |
4844 | | - |
4845 | dest += l; | - |
4846 | length -= l; | - |
4847 | } | 0 |
4848 | ++spans; | - |
4849 | } | 0 |
4850 | } else { | 0 |
4851 | const qreal fdx = data->m11; | - |
4852 | const qreal fdy = data->m12; | - |
4853 | const qreal fdw = data->m13; | - |
4854 | | - |
4855 | while (count--) { | 0 |
4856 | const quint8 coverage = (data->texture.const_alpha * spans->coverage) >> 8; | - |
4857 | const quint8 alpha = (coverage + 1) >> 3; | - |
4858 | const quint8 ialpha = 0x20 - alpha; | - |
4859 | if (alpha == 0) { never evaluated: alpha == 0 | 0 |
4860 | ++spans; | - |
4861 | continue; never executed: continue; | 0 |
4862 | } | - |
4863 | | - |
4864 | quint16 *dest = (quint16 *)data->rasterBuffer->scanLine(spans->y) + spans->x; | - |
4865 | | - |
4866 | const qreal cx = spans->x + qreal(0.5); | - |
4867 | const qreal cy = spans->y + qreal(0.5); | - |
4868 | | - |
4869 | qreal x = data->m21 * cy + data->m11 * cx + data->dx; | - |
4870 | qreal y = data->m22 * cy + data->m12 * cx + data->dy; | - |
4871 | qreal w = data->m23 * cy + data->m13 * cx + data->m33; | - |
4872 | | - |
4873 | int length = spans->len; | - |
4874 | while (length) { | 0 |
4875 | int l; | - |
4876 | quint16 *b; | - |
4877 | if (ialpha == 0) { never evaluated: ialpha == 0 | 0 |
4878 | l = length; | - |
4879 | b = dest; | - |
4880 | } else { | 0 |
4881 | l = qMin(length, buffer_size); | - |
4882 | b = buffer; | - |
4883 | } | 0 |
4884 | const quint16 *end = b + l; | - |
4885 | | - |
4886 | while (b < end) { | 0 |
4887 | const qreal iw = w == 0 ? 1 : 1 / w; | 0 |
4888 | const qreal tx = x * iw; | - |
4889 | const qreal ty = y * iw; | - |
4890 | | - |
4891 | int px = int(tx) - (tx < 0); | - |
4892 | int py = int(ty) - (ty < 0); | - |
4893 | | - |
4894 | px %= image_width; | - |
4895 | py %= image_height; | - |
4896 | if (px < 0) | 0 |
4897 | px += image_width; never executed: px += image_width; | 0 |
4898 | if (py < 0) | 0 |
4899 | py += image_height; never executed: py += image_height; | 0 |
4900 | | - |
4901 | *b = ((quint16 *)data->texture.scanLine(py))[px]; | - |
4902 | ++b; | - |
4903 | | - |
4904 | x += fdx; | - |
4905 | y += fdy; | - |
4906 | w += fdw; | - |
4907 | | - |
4908 | if (!w) | 0 |
4909 | w += fdw; never executed: w += fdw; | 0 |
4910 | } | 0 |
4911 | | - |
4912 | if (ialpha != 0) never evaluated: ialpha != 0 | 0 |
4913 | blend_sourceOver_rgb16_rgb16(dest, buffer, l, alpha, ialpha); never executed: blend_sourceOver_rgb16_rgb16(dest, buffer, l, alpha, ialpha); | 0 |
4914 | | - |
4915 | dest += l; | - |
4916 | length -= l; | - |
4917 | } | 0 |
4918 | ++spans; | - |
4919 | } | 0 |
4920 | } | 0 |
4921 | } | - |
4922 | | - |
4923 | | - |
4924 | | - |
4925 | static const ProcessSpans processTextureSpans[NBlendTypes][QImage::NImageFormats] = { | - |
4926 | | - |
4927 | { | - |
4928 | 0, | - |
4929 | blend_untransformed_generic, | - |
4930 | blend_untransformed_generic, | - |
4931 | blend_untransformed_generic, | - |
4932 | blend_untransformed_generic, | - |
4933 | blend_untransformed_generic, | - |
4934 | blend_untransformed_argb, | - |
4935 | blend_untransformed_rgb565, | - |
4936 | blend_untransformed_generic, | - |
4937 | blend_untransformed_generic, | - |
4938 | blend_untransformed_generic, | - |
4939 | blend_untransformed_generic, | - |
4940 | blend_untransformed_generic, | - |
4941 | blend_untransformed_generic, | - |
4942 | blend_untransformed_generic, | - |
4943 | blend_untransformed_generic, | - |
4944 | }, | - |
4945 | | - |
4946 | { | - |
4947 | 0, | - |
4948 | blend_tiled_generic, | - |
4949 | blend_tiled_generic, | - |
4950 | blend_tiled_generic, | - |
4951 | blend_tiled_generic, | - |
4952 | blend_tiled_generic, | - |
4953 | blend_tiled_argb, | - |
4954 | blend_tiled_rgb565, | - |
4955 | blend_tiled_generic, | - |
4956 | blend_tiled_generic, | - |
4957 | blend_tiled_generic, | - |
4958 | blend_tiled_generic, | - |
4959 | blend_tiled_generic, | - |
4960 | blend_tiled_generic, | - |
4961 | blend_tiled_generic, | - |
4962 | blend_tiled_generic, | - |
4963 | }, | - |
4964 | | - |
4965 | { | - |
4966 | 0, | - |
4967 | blend_src_generic, | - |
4968 | blend_src_generic, | - |
4969 | blend_src_generic, | - |
4970 | blend_src_generic, | - |
4971 | blend_src_generic, | - |
4972 | blend_transformed_argb, | - |
4973 | blend_transformed_rgb565, | - |
4974 | blend_src_generic, | - |
4975 | blend_src_generic, | - |
4976 | blend_src_generic, | - |
4977 | blend_src_generic, | - |
4978 | blend_src_generic, | - |
4979 | blend_src_generic, | - |
4980 | blend_src_generic, | - |
4981 | blend_src_generic, | - |
4982 | }, | - |
4983 | | - |
4984 | { | - |
4985 | 0, | - |
4986 | blend_src_generic, | - |
4987 | blend_src_generic, | - |
4988 | blend_src_generic, | - |
4989 | blend_src_generic, | - |
4990 | blend_src_generic, | - |
4991 | blend_transformed_tiled_argb, | - |
4992 | blend_transformed_tiled_rgb565, | - |
4993 | blend_src_generic, | - |
4994 | blend_src_generic, | - |
4995 | blend_src_generic, | - |
4996 | blend_src_generic, | - |
4997 | blend_src_generic, | - |
4998 | blend_src_generic, | - |
4999 | blend_src_generic, | - |
5000 | blend_src_generic | - |
5001 | }, | - |
5002 | | - |
5003 | { | - |
5004 | 0, | - |
5005 | blend_src_generic, | - |
5006 | blend_src_generic, | - |
5007 | blend_src_generic, | - |
5008 | blend_src_generic, | - |
5009 | blend_src_generic, | - |
5010 | blend_src_generic, | - |
5011 | blend_transformed_bilinear_rgb565, | - |
5012 | blend_src_generic, | - |
5013 | blend_src_generic, | - |
5014 | blend_src_generic, | - |
5015 | blend_src_generic, | - |
5016 | blend_src_generic, | - |
5017 | blend_src_generic, | - |
5018 | blend_src_generic, | - |
5019 | blend_src_generic, | - |
5020 | }, | - |
5021 | | - |
5022 | { | - |
5023 | 0, | - |
5024 | blend_src_generic, | - |
5025 | blend_src_generic, | - |
5026 | blend_src_generic, | - |
5027 | blend_src_generic, | - |
5028 | blend_src_generic, | - |
5029 | blend_src_generic, | - |
5030 | blend_src_generic, | - |
5031 | blend_src_generic, | - |
5032 | blend_src_generic, | - |
5033 | blend_src_generic, | - |
5034 | blend_src_generic, | - |
5035 | blend_src_generic, | - |
5036 | blend_src_generic, | - |
5037 | blend_src_generic, | - |
5038 | blend_src_generic, | - |
5039 | } | - |
5040 | }; | - |
5041 | | - |
5042 | void qBlendTexture(int count, const QSpan *spans, void *userData) | - |
5043 | { | - |
5044 | QSpanData *data = reinterpret_cast<QSpanData *>(userData); | - |
5045 | ProcessSpans proc = processTextureSpans[getBlendType(data)][data->rasterBuffer->format]; | - |
5046 | proc(count, spans, userData); | - |
5047 | } executed: } Execution Count:13045 | 13045 |
5048 | | - |
5049 | template <class DST> | - |
5050 | inline void qt_bitmapblit_template(QRasterBuffer *rasterBuffer, | - |
5051 | int x, int y, DST color, | - |
5052 | const uchar *map, | - |
5053 | int mapWidth, int mapHeight, int mapStride) | - |
5054 | { | - |
5055 | DST *dest = reinterpret_cast<DST *>(rasterBuffer->scanLine(y)) + x; | - |
5056 | const int destStride = rasterBuffer->bytesPerLine() / sizeof(DST); | - |
5057 | | - |
5058 | if (mapWidth > 8) { never evaluated: mapWidth > 8 | 0 |
5059 | while (mapHeight--) { never evaluated: mapHeight-- | 0 |
5060 | int x0 = 0; | - |
5061 | int n = 0; | - |
5062 | for (int x = 0; x < mapWidth; x += 8) { never evaluated: x < mapWidth | 0 |
5063 | uchar s = map[x >> 3]; | - |
5064 | for (int i = 0; i < 8; ++i) { | 0 |
5065 | if (s & 0x80) { never evaluated: s & 0x80 | 0 |
5066 | ++n; | - |
5067 | } else { | 0 |
5068 | if (n) { | 0 |
5069 | qt_memfill(dest + x0, color, n); | - |
5070 | x0 += n + 1; | - |
5071 | n = 0; | - |
5072 | } else { | 0 |
5073 | ++x0; | - |
5074 | } | 0 |
5075 | if (!s) { | 0 |
5076 | x0 += 8 - 1 - i; | - |
5077 | break; | 0 |
5078 | } | - |
5079 | } | 0 |
5080 | s <<= 1; | - |
5081 | } | 0 |
5082 | } | 0 |
5083 | if (n) | 0 |
5084 | qt_memfill(dest + x0, color, n); never executed: qt_memfill(dest + x0, color, n); | 0 |
5085 | dest += destStride; | - |
5086 | map += mapStride; | - |
5087 | } | 0 |
5088 | } else { | 0 |
5089 | while (mapHeight--) { never evaluated: mapHeight-- | 0 |
5090 | int x0 = 0; | - |
5091 | int n = 0; | - |
5092 | for (uchar s = *map; s; s <<= 1) { | 0 |
5093 | if (s & 0x80) { never evaluated: s & 0x80 | 0 |
5094 | ++n; | - |
5095 | } else if (n) { | 0 |
5096 | qt_memfill(dest + x0, color, n); | - |
5097 | x0 += n + 1; | - |
5098 | n = 0; | - |
5099 | } else { | 0 |
5100 | ++x0; | - |
5101 | } | 0 |
5102 | } | - |
5103 | if (n) | 0 |
5104 | qt_memfill(dest + x0, color, n); never executed: qt_memfill(dest + x0, color, n); | 0 |
5105 | dest += destStride; | - |
5106 | map += mapStride; | - |
5107 | } | 0 |
5108 | } | 0 |
5109 | } | - |
5110 | | - |
5111 | static void qt_gradient_quint32(int count, const QSpan *spans, void *userData) | - |
5112 | { | - |
5113 | QSpanData *data = reinterpret_cast<QSpanData *>(userData); | - |
5114 | | - |
5115 | bool isVerticalGradient = | - |
5116 | data->txop <= QTransform::TxScale && partially evaluated: data->txop <= QTransform::TxScale yes Evaluation Count:16061 | no Evaluation Count:0 |
| 0-16061 |
5117 | data->type == QSpanData::LinearGradient && evaluated: data->type == QSpanData::LinearGradient yes Evaluation Count:16054 | yes Evaluation Count:17 |
| 17-16054 |
5118 | data->gradient.linear.end.x == data->gradient.linear.origin.x; evaluated: data->gradient.linear.end.x == data->gradient.linear.origin.x yes Evaluation Count:32 | yes Evaluation Count:16001 |
| 32-16001 |
5119 | | - |
5120 | if (isVerticalGradient) { evaluated: isVerticalGradient yes Evaluation Count:32 | yes Evaluation Count:16013 |
| 32-16013 |
5121 | LinearGradientValues linear; | - |
5122 | getLinearGradientValues(&linear, data); | - |
5123 | | - |
5124 | CompositionFunctionSolid funcSolid = | - |
5125 | functionForModeSolid[data->rasterBuffer->compositionMode]; | - |
5126 | const int gss = 1024 - 1; | - |
5127 | int yinc = int((linear.dy * data->m22 * gss) * (1<<8)); | - |
5128 | int off = int((((linear.dy * (data->m22 * qreal(0.5) + data->dy) + linear.off) * gss) * (1<<8))); | - |
5129 | | - |
5130 | while (count--) { evaluated: count-- yes Evaluation Count:4109 | yes Evaluation Count:32 |
| 32-4109 |
5131 | int y = spans->y; | - |
5132 | int x = spans->x; | - |
5133 | | - |
5134 | quint32 *dst = (quint32 *)(data->rasterBuffer->scanLine(y)) + x; | - |
5135 | quint32 color = | - |
5136 | qt_gradient_pixel_fixed(&data->gradient, yinc * y + off); | - |
5137 | | - |
5138 | funcSolid(dst, spans->len, color, spans->coverage); | - |
5139 | ++spans; | - |
5140 | } executed: } Execution Count:4109 | 4109 |
5141 | | - |
5142 | } else { executed: } Execution Count:32 | 32 |
5143 | blend_src_generic(count, spans, userData); | - |
5144 | } executed: } Execution Count:15981 | 15981 |
5145 | } | - |
5146 | | - |
5147 | static void qt_gradient_quint16(int count, const QSpan *spans, void *userData) | - |
5148 | { | - |
5149 | QSpanData *data = reinterpret_cast<QSpanData *>(userData); | - |
5150 | | - |
5151 | bool isVerticalGradient = | - |
5152 | data->txop <= QTransform::TxScale && partially evaluated: data->txop <= QTransform::TxScale yes Evaluation Count:242 | no Evaluation Count:0 |
| 0-242 |
5153 | data->type == QSpanData::LinearGradient && partially evaluated: data->type == QSpanData::LinearGradient yes Evaluation Count:242 | no Evaluation Count:0 |
| 0-242 |
5154 | data->gradient.linear.end.x == data->gradient.linear.origin.x; evaluated: data->gradient.linear.end.x == data->gradient.linear.origin.x yes Evaluation Count:228 | yes Evaluation Count:14 |
| 14-228 |
5155 | | - |
5156 | if (isVerticalGradient) { evaluated: isVerticalGradient yes Evaluation Count:228 | yes Evaluation Count:14 |
| 14-228 |
5157 | | - |
5158 | LinearGradientValues linear; | - |
5159 | getLinearGradientValues(&linear, data); | - |
5160 | const int gss = 1024 - 1; | - |
5161 | int yinc = int((linear.dy * data->m22 * gss) * (1<<8)); | - |
5162 | int off = int((((linear.dy * (data->m22 * qreal(0.5) + data->dy) + linear.off) * gss) * (1<<8))); | - |
5163 | | - |
5164 | uint oldColor = data->solid.color; | - |
5165 | while (count--) { evaluated: count-- yes Evaluation Count:2058 | yes Evaluation Count:228 |
| 228-2058 |
5166 | int y = spans->y; | - |
5167 | | - |
5168 | quint32 color = qt_gradient_pixel_fixed(&data->gradient, yinc * y + off); | - |
5169 | | - |
5170 | data->solid.color = color; | - |
5171 | blend_color_rgb16(1, spans, userData); | - |
5172 | ++spans; | - |
5173 | } executed: } Execution Count:2058 | 2058 |
5174 | data->solid.color = oldColor; | - |
5175 | | - |
5176 | } else { executed: } Execution Count:228 | 228 |
5177 | blend_src_generic(count, spans, userData); | - |
5178 | } executed: } Execution Count:14 | 14 |
5179 | } | - |
5180 | | - |
5181 | inline static void qt_bitmapblit_quint32(QRasterBuffer *rasterBuffer, | - |
5182 | int x, int y, quint32 color, | - |
5183 | const uchar *map, | - |
5184 | int mapWidth, int mapHeight, int mapStride) | - |
5185 | { | - |
5186 | qt_bitmapblit_template<quint32>(rasterBuffer, x, y, color, | - |
5187 | map, mapWidth, mapHeight, mapStride); | - |
5188 | } | 0 |
5189 | | - |
5190 | inline static void qt_bitmapblit_quint16(QRasterBuffer *rasterBuffer, | - |
5191 | int x, int y, quint32 color, | - |
5192 | const uchar *map, | - |
5193 | int mapWidth, int mapHeight, int mapStride) | - |
5194 | { | - |
5195 | qt_bitmapblit_template<quint16>(rasterBuffer, x, y, qConvertRgb32To16(color), | - |
5196 | map, mapWidth, mapHeight, mapStride); | - |
5197 | } | 0 |
5198 | | - |
5199 | static void qt_alphamapblit_quint16(QRasterBuffer *rasterBuffer, | - |
5200 | int x, int y, quint32 color, | - |
5201 | const uchar *map, | - |
5202 | int mapWidth, int mapHeight, int mapStride, | - |
5203 | const QClipData *) | - |
5204 | { | - |
5205 | const quint16 c = qConvertRgb32To16(color); | - |
5206 | quint16 *dest = reinterpret_cast<quint16*>(rasterBuffer->scanLine(y)) + x; | - |
5207 | const int destStride = rasterBuffer->bytesPerLine() / sizeof(quint16); | - |
5208 | | - |
5209 | while (mapHeight--) { evaluated: mapHeight-- yes Evaluation Count:749393 | yes Evaluation Count:78570 |
| 78570-749393 |
5210 | for (int i = 0; i < mapWidth; ++i) { evaluated: i < mapWidth yes Evaluation Count:4515169 | yes Evaluation Count:749393 |
| 749393-4515169 |
5211 | const int coverage = map[i]; | - |
5212 | | - |
5213 | if (coverage == 0) { evaluated: coverage == 0 yes Evaluation Count:1564851 | yes Evaluation Count:2950318 |
| 1564851-2950318 |
5214 | | - |
5215 | } else if (coverage == 255) { executed: } Execution Count:1564851 evaluated: coverage == 255 yes Evaluation Count:90746 | yes Evaluation Count:2859572 |
| 90746-2859572 |
5216 | dest[i] = c; | - |
5217 | } else { executed: } Execution Count:90746 | 90746 |
5218 | int ialpha = 255 - coverage; | - |
5219 | dest[i] = BYTE_MUL_RGB16(c, coverage) | - |
5220 | + BYTE_MUL_RGB16(dest[i], ialpha); | - |
5221 | } executed: } Execution Count:2859572 | 2859572 |
5222 | } | - |
5223 | dest += destStride; | - |
5224 | map += mapStride; | - |
5225 | } executed: } Execution Count:749393 | 749393 |
5226 | } executed: } Execution Count:78570 | 78570 |
5227 | | - |
5228 | static inline void rgbBlendPixel(quint32 *dst, int coverage, int sr, int sg, int sb, const uchar *gamma, const uchar *invgamma) | - |
5229 | { | - |
5230 | | - |
5231 | int da = qAlpha(*dst); | - |
5232 | int dr = qRed(*dst); | - |
5233 | int dg = qGreen(*dst); | - |
5234 | int db = qBlue(*dst); | - |
5235 | | - |
5236 | if (da != 255 never evaluated: da != 255 | 0 |
5237 | ) { | - |
5238 | | - |
5239 | int a = qGray(coverage); | - |
5240 | sr = qt_div_255(invgamma[sr] * a); | - |
5241 | sg = qt_div_255(invgamma[sg] * a); | - |
5242 | sb = qt_div_255(invgamma[sb] * a); | - |
5243 | | - |
5244 | int ia = 255 - a; | - |
5245 | dr = qt_div_255(dr * ia); | - |
5246 | dg = qt_div_255(dg * ia); | - |
5247 | db = qt_div_255(db * ia); | - |
5248 | | - |
5249 | *dst = ((a + qt_div_255((255 - a) * da)) << 24) | - |
5250 | | ((sr + dr) << 16) | - |
5251 | | ((sg + dg) << 8) | - |
5252 | | ((sb + db)); | - |
5253 | return; | 0 |
5254 | } | - |
5255 | | - |
5256 | int mr = qRed(coverage); | - |
5257 | int mg = qGreen(coverage); | - |
5258 | int mb = qBlue(coverage); | - |
5259 | | - |
5260 | dr = gamma[dr]; | - |
5261 | dg = gamma[dg]; | - |
5262 | db = gamma[db]; | - |
5263 | | - |
5264 | int nr = qt_div_255((sr - dr) * mr) + dr; | - |
5265 | int ng = qt_div_255((sg - dg) * mg) + dg; | - |
5266 | int nb = qt_div_255((sb - db) * mb) + db; | - |
5267 | | - |
5268 | nr = invgamma[nr]; | - |
5269 | ng = invgamma[ng]; | - |
5270 | nb = invgamma[nb]; | - |
5271 | | - |
5272 | *dst = qRgb(nr, ng, nb); | - |
5273 | } | 0 |
5274 | static void qt_alphamapblit_quint32(QRasterBuffer *rasterBuffer, | - |
5275 | int x, int y, quint32 color, | - |
5276 | const uchar *map, | - |
5277 | int mapWidth, int mapHeight, int mapStride, | - |
5278 | const QClipData *clip) | - |
5279 | { | - |
5280 | const quint32 c = color; | - |
5281 | const int destStride = rasterBuffer->bytesPerLine() / sizeof(quint32); | - |
5282 | if (!clip) { evaluated: !clip yes Evaluation Count:6843 | yes Evaluation Count:513 |
| 513-6843 |
5283 | quint32 *dest = reinterpret_cast<quint32*>(rasterBuffer->scanLine(y)) + x; | - |
5284 | while (mapHeight--) { evaluated: mapHeight-- yes Evaluation Count:56452 | yes Evaluation Count:6843 |
| 6843-56452 |
5285 | for (int i = 0; i < mapWidth; ++i) { evaluated: i < mapWidth yes Evaluation Count:277335 | yes Evaluation Count:56452 |
| 56452-277335 |
5286 | const int coverage = map[i]; | - |
5287 | | - |
5288 | if (coverage == 0) { evaluated: coverage == 0 yes Evaluation Count:91959 | yes Evaluation Count:185376 |
| 91959-185376 |
5289 | | - |
5290 | } else if (coverage == 255) { executed: } Execution Count:91959 evaluated: coverage == 255 yes Evaluation Count:17448 | yes Evaluation Count:167928 |
| 17448-167928 |
5291 | dest[i] = c; | - |
5292 | } else { executed: } Execution Count:17448 | 17448 |
5293 | | - |
5294 | | - |
5295 | | - |
5296 | | - |
5297 | | - |
5298 | | - |
5299 | { | - |
5300 | int ialpha = 255 - coverage; | - |
5301 | dest[i] = INTERPOLATE_PIXEL_255(c, coverage, dest[i], ialpha); | - |
5302 | } | - |
5303 | } executed: } Execution Count:167928 | 167928 |
5304 | } | - |
5305 | dest += destStride; | - |
5306 | map += mapStride; | - |
5307 | } executed: } Execution Count:56452 | 56452 |
5308 | } else { executed: } Execution Count:6843 | 6843 |
5309 | int bottom = qMin(y + mapHeight, rasterBuffer->height()); | - |
5310 | | - |
5311 | int top = qMax(y, 0); | - |
5312 | map += (top - y) * mapStride; | - |
5313 | | - |
5314 | const_cast<QClipData *>(clip)->initialize(); | - |
5315 | for (int yp = top; yp<bottom; ++yp) { evaluated: yp<bottom yes Evaluation Count:4872 | yes Evaluation Count:513 |
| 513-4872 |
5316 | const QClipData::ClipLine &line = clip->m_clipLines[yp]; | - |
5317 | | - |
5318 | quint32 *dest = reinterpret_cast<quint32 *>(rasterBuffer->scanLine(yp)); | - |
5319 | | - |
5320 | for (int i=0; i<line.count; ++i) { evaluated: i<line.count yes Evaluation Count:4872 | yes Evaluation Count:4872 |
| 4872 |
5321 | const QSpan &clip = line.spans[i]; | - |
5322 | | - |
5323 | int start = qMax<int>(x, clip.x); | - |
5324 | int end = qMin<int>(x + mapWidth, clip.x + clip.len); | - |
5325 | | - |
5326 | for (int xp=start; xp<end; ++xp) { evaluated: xp<end yes Evaluation Count:18364 | yes Evaluation Count:4872 |
| 4872-18364 |
5327 | const int coverage = map[xp - x]; | - |
5328 | | - |
5329 | if (coverage == 0) { evaluated: coverage == 0 yes Evaluation Count:7288 | yes Evaluation Count:11076 |
| 7288-11076 |
5330 | | - |
5331 | } else if (coverage == 255) { executed: } Execution Count:7288 evaluated: coverage == 255 yes Evaluation Count:1190 | yes Evaluation Count:9886 |
| 1190-9886 |
5332 | dest[xp] = c; | - |
5333 | } else { executed: } Execution Count:1190 | 1190 |
5334 | | - |
5335 | | - |
5336 | | - |
5337 | | - |
5338 | | - |
5339 | | - |
5340 | { | - |
5341 | int ialpha = 255 - coverage; | - |
5342 | dest[xp] = INTERPOLATE_PIXEL_255(c, coverage, dest[xp], ialpha); | - |
5343 | } | - |
5344 | } executed: } Execution Count:9886 | 9886 |
5345 | | - |
5346 | } | - |
5347 | } executed: } Execution Count:4872 | 4872 |
5348 | map += mapStride; | - |
5349 | } executed: } Execution Count:4872 | 4872 |
5350 | } executed: } Execution Count:513 | 513 |
5351 | } | - |
5352 | | - |
5353 | static void qt_alphargbblit_quint32(QRasterBuffer *rasterBuffer, | - |
5354 | int x, int y, quint32 color, | - |
5355 | const uint *src, int mapWidth, int mapHeight, int srcStride, | - |
5356 | const QClipData *clip) | - |
5357 | { | - |
5358 | const quint32 c = color; | - |
5359 | | - |
5360 | int sr = qRed(color); | - |
5361 | int sg = qGreen(color); | - |
5362 | int sb = qBlue(color); | - |
5363 | int sa = qAlpha(color); | - |
5364 | | - |
5365 | const QDrawHelperGammaTables *tables = QGuiApplicationPrivate::instance()->gammaTables(); | - |
5366 | if (!tables) | 0 |
5367 | return; | 0 |
5368 | | - |
5369 | const uchar *gamma = tables->qt_pow_rgb_gamma; | - |
5370 | const uchar *invgamma = tables->qt_pow_rgb_invgamma; | - |
5371 | | - |
5372 | sr = gamma[sr]; | - |
5373 | sg = gamma[sg]; | - |
5374 | sb = gamma[sb]; | - |
5375 | | - |
5376 | if (sa == 0) | 0 |
5377 | return; | 0 |
5378 | | - |
5379 | if (!clip) { | 0 |
5380 | quint32 *dst = reinterpret_cast<quint32*>(rasterBuffer->scanLine(y)) + x; | - |
5381 | const int destStride = rasterBuffer->bytesPerLine() / sizeof(quint32); | - |
5382 | while (mapHeight--) { never evaluated: mapHeight-- | 0 |
5383 | for (int i = 0; i < mapWidth; ++i) { never evaluated: i < mapWidth | 0 |
5384 | const uint coverage = src[i]; | - |
5385 | if (coverage == 0xffffffff) { never evaluated: coverage == 0xffffffff | 0 |
5386 | dst[i] = c; | - |
5387 | } else if (coverage != 0xff000000) { never evaluated: coverage != 0xff000000 | 0 |
5388 | rgbBlendPixel(dst+i, coverage, sr, sg, sb, gamma, invgamma); | - |
5389 | } | 0 |
5390 | } | - |
5391 | | - |
5392 | dst += destStride; | - |
5393 | src += srcStride; | - |
5394 | } | 0 |
5395 | } else { | 0 |
5396 | int bottom = qMin(y + mapHeight, rasterBuffer->height()); | - |
5397 | | - |
5398 | int top = qMax(y, 0); | - |
5399 | src += (top - y) * srcStride; | - |
5400 | | - |
5401 | const_cast<QClipData *>(clip)->initialize(); | - |
5402 | for (int yp = top; yp<bottom; ++yp) { never evaluated: yp<bottom | 0 |
5403 | const QClipData::ClipLine &line = clip->m_clipLines[yp]; | - |
5404 | | - |
5405 | quint32 *dst = reinterpret_cast<quint32 *>(rasterBuffer->scanLine(yp)); | - |
5406 | | - |
5407 | for (int i=0; i<line.count; ++i) { never evaluated: i<line.count | 0 |
5408 | const QSpan &clip = line.spans[i]; | - |
5409 | | - |
5410 | int start = qMax<int>(x, clip.x); | - |
5411 | int end = qMin<int>(x + mapWidth, clip.x + clip.len); | - |
5412 | | - |
5413 | for (int xp=start; xp<end; ++xp) { | 0 |
5414 | const uint coverage = src[xp - x]; | - |
5415 | if (coverage == 0xffffffff) { never evaluated: coverage == 0xffffffff | 0 |
5416 | dst[xp] = c; | - |
5417 | } else if (coverage != 0xff000000) { never evaluated: coverage != 0xff000000 | 0 |
5418 | rgbBlendPixel(dst+xp, coverage, sr, sg, sb, gamma, invgamma); | - |
5419 | } | 0 |
5420 | } | - |
5421 | } | 0 |
5422 | src += srcStride; | - |
5423 | } | 0 |
5424 | | - |
5425 | } | 0 |
5426 | } | - |
5427 | | - |
5428 | static void qt_rectfill_quint32(QRasterBuffer *rasterBuffer, | - |
5429 | int x, int y, int width, int height, | - |
5430 | quint32 color) | - |
5431 | { | - |
5432 | qt_rectfill<quint32>(reinterpret_cast<quint32 *>(rasterBuffer->buffer()), | - |
5433 | color, x, y, width, height, rasterBuffer->bytesPerLine()); | - |
5434 | } executed: } Execution Count:981 | 981 |
5435 | | - |
5436 | static void qt_rectfill_quint16(QRasterBuffer *rasterBuffer, | - |
5437 | int x, int y, int width, int height, | - |
5438 | quint32 color) | - |
5439 | { | - |
5440 | qt_rectfill<quint16>(reinterpret_cast<quint16 *>(rasterBuffer->buffer()), | - |
5441 | qConvertRgb32To16(color), x, y, width, height, rasterBuffer->bytesPerLine()); | - |
5442 | } executed: } Execution Count:18329 | 18329 |
5443 | | - |
5444 | static void qt_rectfill_nonpremul_quint32(QRasterBuffer *rasterBuffer, | - |
5445 | int x, int y, int width, int height, | - |
5446 | quint32 color) | - |
5447 | { | - |
5448 | qt_rectfill<quint32>(reinterpret_cast<quint32 *>(rasterBuffer->buffer()), | - |
5449 | (qAlpha(color) == 0 ? 0 : ((qAlpha(color) << 24) | (((255*qRed(color))/ qAlpha(color)) << 16) | (((255*qGreen(color)) / qAlpha(color)) << 8) | ((255*qBlue(color)) / qAlpha(color)))), x, y, width, height, rasterBuffer->bytesPerLine()); | - |
5450 | } executed: } Execution Count:189 | 189 |
5451 | | - |
5452 | | - |
5453 | | - |
5454 | | - |
5455 | | - |
5456 | DrawHelper qDrawHelper[QImage::NImageFormats] = | - |
5457 | { | - |
5458 | | - |
5459 | { 0, 0, 0, 0, 0, 0 }, | - |
5460 | | - |
5461 | { | - |
5462 | blend_color_generic, | - |
5463 | blend_src_generic, | - |
5464 | 0, 0, 0, 0 | - |
5465 | }, | - |
5466 | | - |
5467 | { | - |
5468 | blend_color_generic, | - |
5469 | blend_src_generic, | - |
5470 | 0, 0, 0, 0 | - |
5471 | }, | - |
5472 | | - |
5473 | { | - |
5474 | blend_color_generic, | - |
5475 | blend_src_generic, | - |
5476 | 0, 0, 0, 0 | - |
5477 | }, | - |
5478 | | - |
5479 | { | - |
5480 | blend_color_argb, | - |
5481 | qt_gradient_quint32, | - |
5482 | qt_bitmapblit_quint32, | - |
5483 | qt_alphamapblit_quint32, | - |
5484 | qt_alphargbblit_quint32, | - |
5485 | qt_rectfill_quint32 | - |
5486 | }, | - |
5487 | | - |
5488 | { | - |
5489 | blend_color_generic, | - |
5490 | qt_gradient_quint32, | - |
5491 | qt_bitmapblit_quint32, | - |
5492 | qt_alphamapblit_quint32, | - |
5493 | qt_alphargbblit_quint32, | - |
5494 | qt_rectfill_nonpremul_quint32 | - |
5495 | }, | - |
5496 | | - |
5497 | { | - |
5498 | blend_color_argb, | - |
5499 | qt_gradient_quint32, | - |
5500 | qt_bitmapblit_quint32, | - |
5501 | qt_alphamapblit_quint32, | - |
5502 | qt_alphargbblit_quint32, | - |
5503 | qt_rectfill_quint32 | - |
5504 | }, | - |
5505 | | - |
5506 | { | - |
5507 | blend_color_rgb16, | - |
5508 | qt_gradient_quint16, | - |
5509 | qt_bitmapblit_quint16, | - |
5510 | qt_alphamapblit_quint16, | - |
5511 | 0, | - |
5512 | qt_rectfill_quint16 | - |
5513 | }, | - |
5514 | | - |
5515 | { | - |
5516 | blend_color_generic, | - |
5517 | blend_src_generic, | - |
5518 | 0, 0, 0, 0 | - |
5519 | }, | - |
5520 | | - |
5521 | { | - |
5522 | blend_color_generic, | - |
5523 | blend_src_generic, | - |
5524 | 0, 0, 0, 0 | - |
5525 | }, | - |
5526 | | - |
5527 | { | - |
5528 | blend_color_generic, | - |
5529 | blend_src_generic, | - |
5530 | 0, 0, 0, 0 | - |
5531 | }, | - |
5532 | | - |
5533 | { | - |
5534 | blend_color_generic, | - |
5535 | blend_src_generic, | - |
5536 | 0, 0, 0, 0 | - |
5537 | }, | - |
5538 | | - |
5539 | { | - |
5540 | blend_color_generic, | - |
5541 | blend_src_generic, | - |
5542 | 0, 0, 0, 0 | - |
5543 | }, | - |
5544 | | - |
5545 | { | - |
5546 | blend_color_generic, | - |
5547 | blend_src_generic, | - |
5548 | 0, 0, 0, 0 | - |
5549 | }, | - |
5550 | | - |
5551 | { | - |
5552 | blend_color_generic, | - |
5553 | blend_src_generic, | - |
5554 | 0, 0, 0, 0 | - |
5555 | }, | - |
5556 | | - |
5557 | { | - |
5558 | blend_color_generic, | - |
5559 | blend_src_generic, | - |
5560 | 0, 0, 0, 0 | - |
5561 | } | - |
5562 | }; | - |
5563 | template <class T> | - |
5564 | inline void qt_memfill_template(T *dest, T color, int count) | - |
5565 | { | - |
5566 | int n = (count + 7) / 8; | - |
5567 | switch (count & 0x07) | - |
5568 | { | - |
5569 | case 0: do { *dest++ = color; | - |
5570 | case 7: *dest++ = color; code before this statement never executed: case 7: | 0 |
5571 | case 6: *dest++ = color; code before this statement never executed: case 6: | 0 |
5572 | case 5: *dest++ = color; code before this statement never executed: case 5: | 0 |
5573 | case 4: *dest++ = color; code before this statement never executed: case 4: | 0 |
5574 | case 3: *dest++ = color; code before this statement never executed: case 3: | 0 |
5575 | case 2: *dest++ = color; code before this statement never executed: case 2: | 0 |
5576 | case 1: *dest++ = color; code before this statement never executed: case 1: | 0 |
5577 | } while (--n > 0); | 0 |
5578 | } | 0 |
5579 | } | 0 |
5580 | | - |
5581 | template <> | - |
5582 | inline void qt_memfill_template(quint16 *dest, quint16 value, int count) | - |
5583 | { | - |
5584 | if (count < 3) { never evaluated: count < 3 | 0 |
5585 | switch (count) { | - |
5586 | case 2: *dest++ = value; | - |
5587 | case 1: *dest = value; code before this statement never executed: case 1: | 0 |
5588 | } | 0 |
5589 | return; | 0 |
5590 | } | - |
5591 | | - |
5592 | const int align = (quintptr)(dest) & 0x3; | - |
5593 | switch (align) { | - |
5594 | case 2: *dest++ = value; --count; | - |
5595 | } | 0 |
5596 | | - |
5597 | const quint32 value32 = (value << 16) | value; | - |
5598 | qt_memfill(reinterpret_cast<quint32*>(dest), value32, count / 2); | - |
5599 | if (count & 0x1) never evaluated: count & 0x1 | 0 |
5600 | dest[count - 1] = value; never executed: dest[count - 1] = value; | 0 |
5601 | } | 0 |
5602 | | - |
5603 | | - |
5604 | static void qt_memfill_quint16(quint16 *dest, quint16 color, int count) | - |
5605 | { | - |
5606 | qt_memfill_template<quint16>(dest, color, count); | - |
5607 | } | 0 |
5608 | | - |
5609 | typedef void (*qt_memfill32_func)(quint32 *dest, quint32 value, int count); | - |
5610 | typedef void (*qt_memfill16_func)(quint16 *dest, quint16 value, int count); | - |
5611 | static void qt_memfill32_setup(quint32 *dest, quint32 value, int count); | - |
5612 | static void qt_memfill16_setup(quint16 *dest, quint16 value, int count); | - |
5613 | | - |
5614 | qt_memfill32_func qt_memfill32 = qt_memfill32_setup; | - |
5615 | qt_memfill16_func qt_memfill16 = qt_memfill16_setup; | - |
5616 | | - |
5617 | void qInitDrawhelperAsm() | - |
5618 | { | - |
5619 | | - |
5620 | qt_memfill32 = qt_memfill_template<quint32>; | - |
5621 | qt_memfill16 = qt_memfill_quint16; | - |
5622 | | - |
5623 | CompositionFunction *functionForModeAsm = 0; | - |
5624 | CompositionFunctionSolid *functionForModeSolidAsm = 0; | - |
5625 | | - |
5626 | const uint features = qCpuFeatures(); | - |
5627 | if (false) { partially evaluated: false no Evaluation Count:0 | yes Evaluation Count:276 |
| 0-276 |
5628 | | - |
5629 | } else if (features & AVX) { partially evaluated: features & AVX no Evaluation Count:0 | yes Evaluation Count:276 |
| 0-276 |
5630 | qt_memfill32 = qt_memfill32_avx; | - |
5631 | qt_memfill16 = qt_memfill16_avx; | - |
5632 | qDrawHelper[QImage::Format_RGB32].bitmapBlit = qt_bitmapblit32_avx; | - |
5633 | qDrawHelper[QImage::Format_ARGB32].bitmapBlit = qt_bitmapblit32_avx; | - |
5634 | qDrawHelper[QImage::Format_ARGB32_Premultiplied].bitmapBlit = qt_bitmapblit32_avx; | - |
5635 | qDrawHelper[QImage::Format_RGB16].bitmapBlit = qt_bitmapblit16_avx; | - |
5636 | | - |
5637 | extern void qt_scale_image_argb32_on_argb32_avx(uchar *destPixels, int dbpl, | - |
5638 | const uchar *srcPixels, int sbpl, | - |
5639 | const QRectF &targetRect, | - |
5640 | const QRectF &sourceRect, | - |
5641 | const QRect &clip, | - |
5642 | int const_alpha); | - |
5643 | qScaleFunctions[QImage::Format_ARGB32_Premultiplied][QImage::Format_ARGB32_Premultiplied] = qt_scale_image_argb32_on_argb32_avx; | - |
5644 | qScaleFunctions[QImage::Format_RGB32][QImage::Format_ARGB32_Premultiplied] = qt_scale_image_argb32_on_argb32_avx; | - |
5645 | | - |
5646 | | - |
5647 | } else if (features & SSE2) { partially evaluated: features & SSE2 yes Evaluation Count:276 | no Evaluation Count:0 |
| 0-276 |
5648 | qt_memfill32 = qt_memfill32_sse2; | - |
5649 | qt_memfill16 = qt_memfill16_sse2; | - |
5650 | qDrawHelper[QImage::Format_RGB32].bitmapBlit = qt_bitmapblit32_sse2; | - |
5651 | qDrawHelper[QImage::Format_ARGB32].bitmapBlit = qt_bitmapblit32_sse2; | - |
5652 | qDrawHelper[QImage::Format_ARGB32_Premultiplied].bitmapBlit = qt_bitmapblit32_sse2; | - |
5653 | qDrawHelper[QImage::Format_RGB16].bitmapBlit = qt_bitmapblit16_sse2; | - |
5654 | | - |
5655 | extern void qt_scale_image_argb32_on_argb32_sse2(uchar *destPixels, int dbpl, | - |
5656 | const uchar *srcPixels, int sbpl, | - |
5657 | const QRectF &targetRect, | - |
5658 | const QRectF &sourceRect, | - |
5659 | const QRect &clip, | - |
5660 | int const_alpha); | - |
5661 | qScaleFunctions[QImage::Format_ARGB32_Premultiplied][QImage::Format_ARGB32_Premultiplied] = qt_scale_image_argb32_on_argb32_sse2; | - |
5662 | qScaleFunctions[QImage::Format_RGB32][QImage::Format_ARGB32_Premultiplied] = qt_scale_image_argb32_on_argb32_sse2; | - |
5663 | | - |
5664 | } executed: } Execution Count:276 | 276 |
5665 | | - |
5666 | | - |
5667 | if (features & SSE2) { partially evaluated: features & SSE2 yes Evaluation Count:276 | no Evaluation Count:0 |
| 0-276 |
5668 | extern void qt_blend_rgb32_on_rgb32_sse2(uchar *destPixels, int dbpl, | - |
5669 | const uchar *srcPixels, int sbpl, | - |
5670 | int w, int h, | - |
5671 | int const_alpha); | - |
5672 | extern void qt_blend_argb32_on_argb32_sse2(uchar *destPixels, int dbpl, | - |
5673 | const uchar *srcPixels, int sbpl, | - |
5674 | int w, int h, | - |
5675 | int const_alpha); | - |
5676 | | - |
5677 | qBlendFunctions[QImage::Format_RGB32][QImage::Format_RGB32] = qt_blend_rgb32_on_rgb32_sse2; | - |
5678 | qBlendFunctions[QImage::Format_ARGB32_Premultiplied][QImage::Format_RGB32] = qt_blend_rgb32_on_rgb32_sse2; | - |
5679 | qBlendFunctions[QImage::Format_RGB32][QImage::Format_ARGB32_Premultiplied] = qt_blend_argb32_on_argb32_sse2; | - |
5680 | qBlendFunctions[QImage::Format_ARGB32_Premultiplied][QImage::Format_ARGB32_Premultiplied] = qt_blend_argb32_on_argb32_sse2; | - |
5681 | | - |
5682 | extern const uint * qt_fetch_radial_gradient_sse2(uint *buffer, const Operator *op, const QSpanData *data, | - |
5683 | int y, int x, int length); | - |
5684 | | - |
5685 | qt_fetch_radial_gradient = qt_fetch_radial_gradient_sse2; | - |
5686 | } executed: } Execution Count:276 | 276 |
5687 | | - |
5688 | | - |
5689 | if (features & SSSE3) { partially evaluated: features & SSSE3 yes Evaluation Count:276 | no Evaluation Count:0 |
| 0-276 |
5690 | extern void qt_blend_argb32_on_argb32_ssse3(uchar *destPixels, int dbpl, | - |
5691 | const uchar *srcPixels, int sbpl, | - |
5692 | int w, int h, | - |
5693 | int const_alpha); | - |
5694 | | - |
5695 | qBlendFunctions[QImage::Format_RGB32][QImage::Format_ARGB32_Premultiplied] = qt_blend_argb32_on_argb32_ssse3; | - |
5696 | qBlendFunctions[QImage::Format_ARGB32_Premultiplied][QImage::Format_ARGB32_Premultiplied] = qt_blend_argb32_on_argb32_ssse3; | - |
5697 | } executed: } Execution Count:276 | 276 |
5698 | | - |
5699 | | - |
5700 | | - |
5701 | if (features & AVX) { partially evaluated: features & AVX no Evaluation Count:0 | yes Evaluation Count:276 |
| 0-276 |
5702 | extern void qt_blend_rgb32_on_rgb32_avx(uchar *destPixels, int dbpl, | - |
5703 | const uchar *srcPixels, int sbpl, | - |
5704 | int w, int h, | - |
5705 | int const_alpha); | - |
5706 | extern void qt_blend_argb32_on_argb32_avx(uchar *destPixels, int dbpl, | - |
5707 | const uchar *srcPixels, int sbpl, | - |
5708 | int w, int h, | - |
5709 | int const_alpha); | - |
5710 | | - |
5711 | qBlendFunctions[QImage::Format_RGB32][QImage::Format_RGB32] = qt_blend_rgb32_on_rgb32_avx; | - |
5712 | qBlendFunctions[QImage::Format_ARGB32_Premultiplied][QImage::Format_RGB32] = qt_blend_rgb32_on_rgb32_avx; | - |
5713 | qBlendFunctions[QImage::Format_RGB32][QImage::Format_ARGB32_Premultiplied] = qt_blend_argb32_on_argb32_avx; | - |
5714 | qBlendFunctions[QImage::Format_ARGB32_Premultiplied][QImage::Format_ARGB32_Premultiplied] = qt_blend_argb32_on_argb32_avx; | - |
5715 | | - |
5716 | extern const uint * qt_fetch_radial_gradient_avx(uint *buffer, const Operator *op, const QSpanData *data, | - |
5717 | int y, int x, int length); | - |
5718 | | - |
5719 | qt_fetch_radial_gradient = qt_fetch_radial_gradient_avx; | - |
5720 | } | 0 |
5721 | | - |
5722 | | - |
5723 | | - |
5724 | | - |
5725 | | - |
5726 | if (features & SSE2) { partially evaluated: features & SSE2 yes Evaluation Count:276 | no Evaluation Count:0 |
| 0-276 |
5727 | functionForModeAsm = qt_functionForMode_SSE2; | - |
5728 | functionForModeSolidAsm = qt_functionForModeSolid_SSE2; | - |
5729 | } executed: } Execution Count:276 | 276 |
5730 | | - |
5731 | | - |
5732 | if (features & AVX) { partially evaluated: features & AVX no Evaluation Count:0 | yes Evaluation Count:276 |
| 0-276 |
5733 | extern void comp_func_SourceOver_avx(uint *destPixels, | - |
5734 | const uint *srcPixels, | - |
5735 | int length, | - |
5736 | uint const_alpha); | - |
5737 | extern void comp_func_solid_SourceOver_avx(uint *destPixels, int length, uint color, uint const_alpha); | - |
5738 | extern void comp_func_Plus_avx(uint *dst, const uint *src, int length, uint const_alpha); | - |
5739 | extern void comp_func_Source_avx(uint *dst, const uint *src, int length, uint const_alpha); | - |
5740 | | - |
5741 | functionForModeAsm[0] = comp_func_SourceOver_avx; | - |
5742 | functionForModeAsm[QPainter::CompositionMode_Source] = comp_func_Source_avx; | - |
5743 | functionForModeAsm[QPainter::CompositionMode_Plus] = comp_func_Plus_avx; | - |
5744 | functionForModeSolidAsm[0] = comp_func_solid_SourceOver_avx; | - |
5745 | } | 0 |
5746 | if (functionForModeSolidAsm) { partially evaluated: functionForModeSolidAsm yes Evaluation Count:276 | no Evaluation Count:0 |
| 0-276 |
5747 | const int destinationMode = QPainter::CompositionMode_Destination; | - |
5748 | functionForModeSolidAsm[destinationMode] = functionForModeSolid_C[destinationMode]; | - |
5749 | | - |
5750 | | - |
5751 | | - |
5752 | for (int mode = 12; mode < 24; ++mode) evaluated: mode < 24 yes Evaluation Count:3312 | yes Evaluation Count:276 |
| 276-3312 |
5753 | functionForModeSolidAsm[mode] = functionForModeSolid_C[mode]; executed: functionForModeSolidAsm[mode] = functionForModeSolid_C[mode]; Execution Count:3312 | 3312 |
5754 | | - |
5755 | functionForModeSolid = functionForModeSolidAsm; | - |
5756 | } executed: } Execution Count:276 | 276 |
5757 | if (functionForModeAsm) partially evaluated: functionForModeAsm yes Evaluation Count:276 | no Evaluation Count:0 |
| 0-276 |
5758 | functionForMode = functionForModeAsm; executed: functionForMode = functionForModeAsm; Execution Count:276 | 276 |
5759 | } executed: } Execution Count:276 | 276 |
5760 | | - |
5761 | static void qt_memfill32_setup(quint32 *dest, quint32 value, int count) | - |
5762 | { | - |
5763 | qInitDrawhelperAsm(); | - |
5764 | qt_memfill32(dest, value, count); | - |
5765 | } | 0 |
5766 | | - |
5767 | static void qt_memfill16_setup(quint16 *dest, quint16 value, int count) | - |
5768 | { | - |
5769 | qInitDrawhelperAsm(); | - |
5770 | qt_memfill16(dest, value, count); | - |
5771 | } | 0 |
5772 | | - |
5773 | | - |
5774 | | - |
| | |