Warning: That file was not part of the compilation database. It may have many parsing errors.

1/****************************************************************************
2**
3** Copyright (C) 2013 Imagination Technologies Limited, www.imgtec.com
4** Contact: https://www.qt.io/licensing/
5**
6** This file is part of the QtGui module of the Qt Toolkit.
7**
8** $QT_BEGIN_LICENSE:LGPL$
9** Commercial License Usage
10** Licensees holding valid commercial Qt licenses may use this file in
11** accordance with the commercial license agreement provided with the
12** Software or, alternatively, in accordance with the terms contained in
13** a written agreement between you and The Qt Company. For licensing terms
14** and conditions see https://www.qt.io/terms-conditions. For further
15** information use the contact form at https://www.qt.io/contact-us.
16**
17** GNU Lesser General Public License Usage
18** Alternatively, this file may be used under the terms of the GNU Lesser
19** General Public License version 3 as published by the Free Software
20** Foundation and appearing in the file LICENSE.LGPL3 included in the
21** packaging of this file. Please review the following information to
22** ensure the GNU Lesser General Public License version 3 requirements
23** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
24**
25** GNU General Public License Usage
26** Alternatively, this file may be used under the terms of the GNU
27** General Public License version 2.0 or (at your option) the GNU General
28** Public license version 3 or any later version approved by the KDE Free
29** Qt Foundation. The licenses are as published by the Free Software
30** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
31** included in the packaging of this file. Please review the following
32** information to ensure the GNU General Public License requirements will
33** be met: https://www.gnu.org/licenses/gpl-2.0.html and
34** https://www.gnu.org/licenses/gpl-3.0.html.
35**
36** $QT_END_LICENSE$
37**
38****************************************************************************/
39
40#include <private/qdrawhelper_p.h>
41#include <private/qdrawhelper_mips_dsp_p.h>
42#include <private/qpaintengine_raster_p.h>
43
44QT_BEGIN_NAMESPACE
45
46void qt_memfill32(quint32 *dest, quint32 color, qsizetype count)
47{
48 qt_memfill32_asm_mips_dsp(dest, color, count);
49}
50
51void qt_blend_argb32_on_argb32_mips_dsp(uchar *destPixels, int dbpl,
52 const uchar *srcPixels, int sbpl,
53 int w, int h,
54 int const_alpha)
55
56{
57#ifdef QT_DEBUG_DRAW
58 fprintf(stdout,
59 "qt_blend_argb32_on_argb32: dst=(%p, %d), src=(%p, %d), dim=(%d, %d) alpha=%d\n",
60 destPixels, dbpl, srcPixels, sbpl, w, h, const_alpha);
61 fflush(stdout);
62#endif
63
64 const uint *src = (const uint *) srcPixels;
65 uint *dst = (uint *) destPixels;
66 if (const_alpha == 256) {
67 for (int y=0; y<h; ++y) {
68 qt_blend_argb32_on_argb32_const_alpha_256_mips_dsp_asm(dst, src, w);
69 dst = (quint32 *)(((uchar *) dst) + dbpl);
70 src = (const quint32 *)(((const uchar *) src) + sbpl);
71 }
72 } else if (const_alpha != 0) {
73 const_alpha = (const_alpha * 255) >> 8;
74 for (int y=0; y<h; ++y) {
75 if (h%2 > 0) {
76 uint s = BYTE_MUL(src[0], const_alpha);
77 dst[0] = s + BYTE_MUL(dst[0], qAlpha(~s));
78 h--;
79 dst++;
80 src++;
81 }
82 qt_blend_argb32_on_argb32_mips_dsp_asm_x2(dst, src, h, const_alpha);
83 dst = (quint32 *)(((uchar *) dst) + dbpl);
84 src = (const quint32 *)(((const uchar *) src) + sbpl);
85 }
86 }
87}
88
89void qt_blend_rgb32_on_rgb32_mips_dsp(uchar *destPixels, int dbpl,
90 const uchar *srcPixels, int sbpl,
91 int w, int h,
92 int const_alpha)
93{
94#ifdef QT_DEBUG_DRAW
95 fprintf(stdout,
96 "qt_blend_rgb32_on_rgb32: dst=(%p, %d), src=(%p, %d), dim=(%d, %d) alpha=%d\n",
97 destPixels, dbpl, srcPixels, sbpl, w, h, const_alpha);
98 fflush(stdout);
99#endif
100
101 if (const_alpha != 256) {
102 qt_blend_argb32_on_argb32_mips_dsp(destPixels, dbpl, srcPixels, sbpl, w, h, const_alpha);
103 return;
104 }
105
106 const uint *src = (const uint *) srcPixels;
107 uint *dst = (uint *) destPixels;
108 int len = w * 4;
109 for (int y=0; y<h; ++y) {
110 memcpy(dst, src, len);
111 dst = (quint32 *)(((uchar *) dst) + dbpl);
112 src = (const quint32 *)(((const uchar *) src) + sbpl);
113 }
114}
115
116#if defined(__MIPS_DSPR2__)
117void qt_blend_rgb16_on_rgb16_mips_dspr2(uchar *destPixels, int dbpl,
118 const uchar *srcPixels, int sbpl,
119 int w, int h,
120 int const_alpha)
121{
122 if (const_alpha == 256) {
123 if (w < 256) {
124 const quint16 *src = (const quint16*) srcPixels;
125 quint16 *dst = (quint16*) destPixels;
126 for (int y = 0; y < h; ++y) {
127 qt_blend_rgb16_on_rgb16_const_alpha_256_mips_dsp_asm(dst, src, w);
128 dst = (quint16*) (((uchar*) dst) + dbpl);
129 src = (quint16*) (((uchar*) src) + sbpl);
130 }
131 }
132 else {
133 int length = w << 1;
134 while (h--) {
135 memcpy(destPixels, srcPixels, length);
136 destPixels += dbpl;
137 srcPixels += sbpl;
138 }
139 }
140 }
141 else if (const_alpha != 0) {
142 const quint16 *src = (const quint16*) srcPixels;
143 quint16 *dst = (quint16*) destPixels;
144 for (int y = 0; y < h; ++y) {
145 qt_blend_rgb16_on_rgb16_mips_dspr2_asm(dst, src, w, const_alpha);
146 dst = (quint16*) (((uchar*) dst) + dbpl);
147 src = (quint16*) (((uchar*) src) + sbpl);
148 }
149 }
150}
151#else
152void qt_blend_rgb16_on_rgb16_mips_dsp(uchar *destPixels, int dbpl,
153 const uchar *srcPixels, int sbpl,
154 int w, int h,
155 int const_alpha)
156{
157 if (const_alpha == 256) {
158 if (w < 256) {
159 const quint16 *src = (const quint16*) srcPixels;
160 quint16 *dst = (quint16*) destPixels;
161 for (int y = 0; y < h; ++y) {
162 qt_blend_rgb16_on_rgb16_const_alpha_256_mips_dsp_asm(dst, src, w);
163 dst = (quint16*) (((uchar*) dst) + dbpl);
164 src = (quint16*) (((uchar*) src) + sbpl);
165 }
166 }
167 else {
168 int length = w << 1;
169 while (h--) {
170 memcpy(destPixels, srcPixels, length);
171 destPixels += dbpl;
172 srcPixels += sbpl;
173 }
174 }
175 }
176 else if (const_alpha != 0) {
177 const quint16 *src = (const quint16*) srcPixels;
178 quint16 *dst = (quint16*) destPixels;
179 for (int y = 0; y < h; ++y) {
180 qt_blend_rgb16_on_rgb16_mips_dsp_asm(dst, src, w, const_alpha);
181 dst = (quint16*) (((uchar*) dst) + dbpl);
182 src = (quint16*) (((uchar*) src) + sbpl);
183 }
184 }
185}
186#endif
187
188void comp_func_Source_mips_dsp(uint *dest, const uint *src, int length, uint const_alpha)
189{
190 if (const_alpha == 255) {
191 ::memcpy(dest, src, length * sizeof(uint));
192 } else {
193 int ialpha = 255 - const_alpha;
194 if (length%2 > 0) {
195 dest[0] = INTERPOLATE_PIXEL_255(src[0], const_alpha, dest[0], ialpha);
196 length--;
197 dest++;
198 src++;
199 }
200 comp_func_Source_dsp_asm_x2(dest, src, length, const_alpha);
201 }
202}
203
204uint * QT_FASTCALL qt_destFetchARGB32_mips_dsp(uint *buffer,
205 QRasterBuffer *rasterBuffer,
206 int x, int y, int length)
207{
208 const uint *data = (const uint *)rasterBuffer->scanLine(y) + x;
209 buffer = destfetchARGB32_asm_mips_dsp(buffer, data, length);
210 return buffer;
211}
212
213void QT_FASTCALL qt_destStoreARGB32_mips_dsp(QRasterBuffer *rasterBuffer, int x, int y,
214 const uint *buffer, int length)
215{
216 uint *data = (uint *)rasterBuffer->scanLine(y) + x;
217 qt_destStoreARGB32_asm_mips_dsp(data, buffer, length);
218}
219
220void QT_FASTCALL comp_func_solid_SourceOver_mips_dsp(uint *dest, int length, uint color, uint const_alpha)
221{
222 if (const_alpha != 255)
223 color = BYTE_MUL(color, const_alpha);
224 if (length%2 > 0) {
225 dest[0] = color + BYTE_MUL(dest[0], qAlpha(~color));
226 length--;
227 dest++;
228 }
229 comp_func_solid_Source_dsp_asm_x2(dest, length, color, qAlpha(~color));
230}
231
232void QT_FASTCALL comp_func_solid_DestinationOver_mips_dsp(uint *dest, int length, uint color, uint const_alpha)
233{
234 if (const_alpha != 255)
235 color = BYTE_MUL(color, const_alpha);
236 if (length%2 > 0) {
237 uint d = dest[0];
238 dest[0] = d + BYTE_MUL(color, qAlpha(~d));
239 length--;
240 dest++;
241 }
242 comp_func_solid_DestinationOver_dsp_asm_x2(dest, length, color);
243}
244
245void QT_FASTCALL comp_func_DestinationOver_mips_dsp(uint *dest, const uint *src, int length, uint const_alpha)
246{
247 if (length%2 > 0) {
248 if (const_alpha == 255) {
249 uint d = dest[0];
250 dest[0] = d + BYTE_MUL(src[0], qAlpha(~d));
251 } else {
252 uint d = dest[0];
253 uint s = BYTE_MUL(src[0], const_alpha);
254 dest[0] = d + BYTE_MUL(s, qAlpha(~d));
255 }
256 length--;
257 dest++;
258 src++;
259 }
260 comp_func_DestinationOver_dsp_asm_x2(dest, src, length, const_alpha);
261}
262
263void QT_FASTCALL comp_func_solid_SourceIn_mips_dsp(uint *dest, int length, uint color, uint const_alpha)
264{
265 if (length%2 > 0) {
266 if (const_alpha == 255) {
267 dest[0] = BYTE_MUL(color, qAlpha(dest[0]));
268 } else {
269 uint tmp_color = BYTE_MUL(color, const_alpha);
270 uint cia = 255 - const_alpha;
271 uint d = dest[0];
272 dest[0] = INTERPOLATE_PIXEL_255(tmp_color, qAlpha(d), d, cia);
273 }
274 length--;
275 dest++;
276 }
277 comp_func_solid_SourceIn_dsp_asm_x2(dest, length, color, const_alpha);
278}
279
280void QT_FASTCALL comp_func_SourceIn_mips_dsp(uint *dest, const uint *src, int length, uint const_alpha)
281{
282 if (length%2 > 0) {
283 if (const_alpha == 255) {
284 dest[0] = BYTE_MUL(src[0], qAlpha(dest[0]));
285 } else {
286 uint cia = 255 - const_alpha;
287 uint d = dest[0];
288 uint s = BYTE_MUL(src[0], const_alpha);
289 dest[0] = INTERPOLATE_PIXEL_255(s, qAlpha(d), d, cia);
290 }
291 length--;
292 dest++;
293 src++;
294 }
295 comp_func_SourceIn_dsp_asm_x2(dest, src, length, const_alpha);
296}
297
298void QT_FASTCALL comp_func_solid_DestinationIn_mips_dsp(uint *dest, int length, uint color, uint const_alpha)
299{
300 uint a = qAlpha(color);
301 if (const_alpha != 255) {
302 a = BYTE_MUL(a, const_alpha) + 255 - const_alpha;
303 }
304 if (length%2 > 0) {
305 dest[0] = BYTE_MUL(dest[0], a);
306 length--;
307 dest++;
308 }
309 comp_func_solid_DestinationIn_dsp_asm_x2(dest, length, a);
310}
311
312void QT_FASTCALL comp_func_DestinationIn_mips_dsp(uint *dest, const uint *src, int length, uint const_alpha)
313{
314 if (length%2 > 0) {
315 if (const_alpha == 255) {
316 dest[0] = BYTE_MUL(dest[0], qAlpha(src[0]));
317 } else {
318 int cia = 255 - const_alpha;
319 uint a = BYTE_MUL(qAlpha(src[0]), const_alpha) + cia;
320 dest[0] = BYTE_MUL(dest[0], a);
321 }
322 length--;
323 src++;
324 dest++;
325 }
326 comp_func_DestinationIn_dsp_asm_x2(dest, src, length, const_alpha);
327}
328
329void QT_FASTCALL comp_func_solid_DestinationOut_mips_dsp(uint *dest, int length, uint color, uint const_alpha)
330{
331 uint a = qAlpha(~color);
332 if (const_alpha != 255) {
333 a = BYTE_MUL(a, const_alpha) + 255 - const_alpha;
334 }
335 if (length%2 > 0) {
336 dest[0] = BYTE_MUL(dest[0], a);
337 length--;
338 dest++;
339 }
340 comp_func_solid_DestinationIn_dsp_asm_x2(dest, length, a);
341}
342
343void QT_FASTCALL comp_func_DestinationOut_mips_dsp(uint *dest, const uint *src, int length, uint const_alpha)
344{
345 if (length%2 > 0) {
346 if (const_alpha == 255) {
347 dest[0] = BYTE_MUL(dest[0], qAlpha(~src[0]));
348 } else {
349 int cia = 255 - const_alpha;
350 uint sia = BYTE_MUL(qAlpha(~src[0]), const_alpha) + cia;
351 dest[0] = BYTE_MUL(dest[0], sia);
352 }
353 length--;
354 dest++;
355 src++;
356 }
357 comp_func_DestinationOut_dsp_asm_x2(dest, src, length, const_alpha);
358}
359
360void QT_FASTCALL comp_func_solid_SourceAtop_mips_dsp(uint *dest, int length, uint color, uint const_alpha)
361{
362 if (const_alpha != 255) {
363 color = BYTE_MUL(color, const_alpha);
364 }
365 uint sia = qAlpha(~color);
366 if (length%2 > 0) {
367 dest[0] = INTERPOLATE_PIXEL_255(color, qAlpha(dest[0]), dest[0], sia);
368 length--;
369 dest++;
370 }
371 comp_func_solid_SourceAtop_dsp_asm_x2(dest, length, color, sia);
372}
373
374void QT_FASTCALL comp_func_SourceAtop_mips_dsp(uint *dest, const uint *src, int length, uint const_alpha)
375{
376 if (length%2 > 0) {
377 if (const_alpha == 255) {
378 uint s = src[0];
379 uint d = dest[0];
380 dest[0] = INTERPOLATE_PIXEL_255(s, qAlpha(d), d, qAlpha(~s));
381 } else {
382 uint s = BYTE_MUL(src[0], const_alpha);
383 uint d = dest[0];
384 dest[0] = INTERPOLATE_PIXEL_255(s, qAlpha(d), d, qAlpha(~s));
385 }
386 length--;
387 dest++;
388 src++;
389 }
390 comp_func_SourceAtop_dsp_asm_x2(dest, src, length, const_alpha);
391}
392
393
394void QT_FASTCALL comp_func_solid_DestinationAtop_mips_dsp(uint *dest, int length, uint color, uint const_alpha)
395{
396 uint a = qAlpha(color);
397 if (const_alpha != 255) {
398 color = BYTE_MUL(color, const_alpha);
399 a = qAlpha(color) + 255 - const_alpha;
400 }
401 if (length%2 > 0) {
402 uint d = dest[0];
403 dest[0] = INTERPOLATE_PIXEL_255(d, a, color, qAlpha(~d));
404 length--;
405 dest++;
406 }
407 comp_func_solid_DestinationAtop_dsp_asm_x2(dest, length, color, a);
408}
409
410void QT_FASTCALL comp_func_DestinationAtop_mips_dsp(uint *dest, const uint *src, int length, uint const_alpha)
411{
412 if (length%2 > 0) {
413 if (const_alpha == 255) {
414 uint s = src[0];
415 uint d = dest[0];
416 dest[0] = INTERPOLATE_PIXEL_255(d, qAlpha(s), s, qAlpha(~d));
417 } else {
418 int cia = 255 - const_alpha;
419 uint s = BYTE_MUL(src[0], const_alpha);
420 uint d = dest[0];
421 uint a = qAlpha(s) + cia;
422 dest[0] = INTERPOLATE_PIXEL_255(d, a, s, qAlpha(~d));
423 }
424 length--;
425 dest++;
426 src++;
427 }
428 comp_func_DestinationAtop_dsp_asm_x2(dest, src, length, const_alpha);
429}
430
431void QT_FASTCALL comp_func_solid_XOR_mips_dsp(uint *dest, int length, uint color, uint const_alpha)
432{
433 if (const_alpha != 255)
434 color = BYTE_MUL(color, const_alpha);
435 uint sia = qAlpha(~color);
436
437 if (length%2 > 0) {
438 uint d = dest[0];
439 dest[0] = INTERPOLATE_PIXEL_255(color, qAlpha(~d), d, sia);
440 length--;
441 dest++;
442 }
443 comp_func_solid_XOR_dsp_asm_x2(dest, length, color, sia);
444}
445
446void QT_FASTCALL comp_func_XOR_mips_dsp(uint *dest, const uint *src, int length, uint const_alpha)
447{
448 if (length%2 > 0) {
449 if (const_alpha == 255) {
450 uint d = dest[0];
451 uint s = src[0];
452 dest[0] = INTERPOLATE_PIXEL_255(s, qAlpha(~d), d, qAlpha(~s));
453 } else {
454 uint d = dest[0];
455 uint s = BYTE_MUL(src[0], const_alpha);
456 dest[0] = INTERPOLATE_PIXEL_255(s, qAlpha(~d), d, qAlpha(~s));
457 }
458 length--;
459 dest++;
460 src++;
461 }
462 comp_func_XOR_dsp_asm_x2(dest, src, length, const_alpha);
463}
464
465void QT_FASTCALL comp_func_solid_SourceOut_mips_dsp(uint *dest, int length, uint color, uint const_alpha)
466{
467 if (length%2 > 0) {
468 if (const_alpha == 255) {
469 dest[0] = BYTE_MUL(color, qAlpha(~dest[0]));
470 } else {
471 uint tmp_color = BYTE_MUL(color, const_alpha);
472 int cia = 255 - const_alpha;
473 uint d = dest[0];
474 dest[0] = INTERPOLATE_PIXEL_255(tmp_color, qAlpha(~d), d, cia);
475 }
476 length--;
477 dest++;
478 }
479 comp_func_solid_SourceOut_dsp_asm_x2(dest, length, color, const_alpha);
480}
481
482void QT_FASTCALL comp_func_SourceOut_mips_dsp(uint *dest, const uint *src, int length, uint const_alpha)
483{
484 if (length%2 > 0) {
485 if (const_alpha == 255) {
486 dest[0] = BYTE_MUL(src[0], qAlpha(~dest[0]));
487 } else {
488 int cia = 255 - const_alpha;
489 uint s = BYTE_MUL(src[0], const_alpha);
490 uint d = dest[0];
491 dest[0] = INTERPOLATE_PIXEL_255(s, qAlpha(~d), d, cia);
492 }
493 length--;
494 dest++;
495 src++;
496 }
497 comp_func_SourceOut_dsp_asm_x2(dest, src, length, const_alpha);
498}
499
500const uint * QT_FASTCALL qt_fetchUntransformed_888_mips_dsp (uint *buffer, const Operator *, const QSpanData *data,
501 int y, int x, int length)
502{
503 const uchar *line = data->texture.scanLine(y) + x * 3;
504 fetchUntransformed_888_asm_mips_dsp(buffer, line, length);
505 return buffer;
506}
507
508const uint * QT_FASTCALL qt_fetchUntransformed_444_mips_dsp (uint *buffer, const Operator *, const QSpanData *data,
509 int y, int x, int length)
510{
511 const uchar *line = data->texture.scanLine(y) + x * 2;
512 fetchUntransformed_444_asm_mips_dsp(buffer, line, length);
513 return buffer;
514}
515
516const uint * QT_FASTCALL qt_fetchUntransformed_argb8565_premultiplied_mips_dsp (uint *buffer, const Operator *, const QSpanData *data,
517 int y, int x, int length)
518{
519 const uchar *line = data->texture.scanLine(y) + x * 3;
520 fetchUntransformed_argb8565_premultiplied_asm_mips_dsp(buffer, line, length);
521 return buffer;
522}
523
524#if defined(__MIPS_DSPR2__)
525extern "C" void qConvertRgb16To32_asm_mips_dspr2(quint32 *dest, const quint16 *src, int length);
526
527const uint *QT_FASTCALL qt_fetchUntransformedRGB16_mips_dspr2(uint *buffer, const Operator *,
528 const QSpanData *data, int y, int x,
529 int length)
530{
531 const quint16 *scanLine = (const quint16 *)data->texture.scanLine(y) + x;
532 qConvertRgb16To32_asm_mips_dspr2(buffer, scanLine, length);
533 return buffer;
534}
535#endif
536
537QT_END_NAMESPACE
538

Warning: That file was not part of the compilation database. It may have many parsing errors.