Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
qdrawhelper_mips_dsp.cpp
Go to the documentation of this file.
1// Copyright (C) 2013 Imagination Technologies Limited, www.imgtec.com
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4#include <private/qdrawhelper_p.h>
5#include <private/qdrawhelper_mips_dsp_p.h>
6#include <private/qpaintengine_raster_p.h>
7
9
11{
12 qt_memfill32_asm_mips_dsp(dest, color, count);
13}
14
15void qt_blend_argb32_on_argb32_mips_dsp(uchar *destPixels, int dbpl,
16 const uchar *srcPixels, int sbpl,
17 int w, int h,
18 int const_alpha)
19
20{
21#ifdef QT_DEBUG_DRAW
22 fprintf(stdout,
23 "qt_blend_argb32_on_argb32: dst=(%p, %d), src=(%p, %d), dim=(%d, %d) alpha=%d\n",
24 destPixels, dbpl, srcPixels, sbpl, w, h, const_alpha);
25 fflush(stdout);
26#endif
27
28 const uint *src = (const uint *) srcPixels;
29 uint *dst = (uint *) destPixels;
30 if (const_alpha == 256) {
31 for (int y=0; y<h; ++y) {
32 qt_blend_argb32_on_argb32_const_alpha_256_mips_dsp_asm(dst, src, w);
33 dst = (quint32 *)(((uchar *) dst) + dbpl);
34 src = (const quint32 *)(((const uchar *) src) + sbpl);
35 }
36 } else if (const_alpha != 0) {
37 const_alpha = (const_alpha * 255) >> 8;
38 for (int y=0; y<h; ++y) {
39 if (h%2 > 0) {
40 uint s = BYTE_MUL(src[0], const_alpha);
41 dst[0] = s + BYTE_MUL(dst[0], qAlpha(~s));
42 h--;
43 dst++;
44 src++;
45 }
46 qt_blend_argb32_on_argb32_mips_dsp_asm_x2(dst, src, h, const_alpha);
47 dst = (quint32 *)(((uchar *) dst) + dbpl);
48 src = (const quint32 *)(((const uchar *) src) + sbpl);
49 }
50 }
51}
52
53void qt_blend_rgb32_on_rgb32_mips_dsp(uchar *destPixels, int dbpl,
54 const uchar *srcPixels, int sbpl,
55 int w, int h,
56 int const_alpha)
57{
58#ifdef QT_DEBUG_DRAW
59 fprintf(stdout,
60 "qt_blend_rgb32_on_rgb32: dst=(%p, %d), src=(%p, %d), dim=(%d, %d) alpha=%d\n",
61 destPixels, dbpl, srcPixels, sbpl, w, h, const_alpha);
62 fflush(stdout);
63#endif
64
65 if (const_alpha != 256) {
66 qt_blend_argb32_on_argb32_mips_dsp(destPixels, dbpl, srcPixels, sbpl, w, h, const_alpha);
67 return;
68 }
69
70 const uint *src = (const uint *) srcPixels;
71 uint *dst = (uint *) destPixels;
72 int len = w * 4;
73 for (int y=0; y<h; ++y) {
74 memcpy(dst, src, len);
75 dst = (quint32 *)(((uchar *) dst) + dbpl);
76 src = (const quint32 *)(((const uchar *) src) + sbpl);
77 }
78}
79
80#if defined(__MIPS_DSPR2__)
81void qt_blend_rgb16_on_rgb16_mips_dspr2(uchar *destPixels, int dbpl,
82 const uchar *srcPixels, int sbpl,
83 int w, int h,
84 int const_alpha)
85{
86 if (const_alpha == 256) {
87 if (w < 256) {
88 const quint16 *src = (const quint16*) srcPixels;
89 quint16 *dst = (quint16*) destPixels;
90 for (int y = 0; y < h; ++y) {
91 qt_blend_rgb16_on_rgb16_const_alpha_256_mips_dsp_asm(dst, src, w);
92 dst = (quint16*) (((uchar*) dst) + dbpl);
93 src = (quint16*) (((uchar*) src) + sbpl);
94 }
95 }
96 else {
97 int length = w << 1;
98 while (--h >= 0) {
99 memcpy(destPixels, srcPixels, length);
100 destPixels += dbpl;
101 srcPixels += sbpl;
102 }
103 }
104 }
105 else if (const_alpha != 0) {
106 const quint16 *src = (const quint16*) srcPixels;
107 quint16 *dst = (quint16*) destPixels;
108 for (int y = 0; y < h; ++y) {
109 qt_blend_rgb16_on_rgb16_mips_dspr2_asm(dst, src, w, const_alpha);
110 dst = (quint16*) (((uchar*) dst) + dbpl);
111 src = (quint16*) (((uchar*) src) + sbpl);
112 }
113 }
114}
115#else
116void qt_blend_rgb16_on_rgb16_mips_dsp(uchar *destPixels, int dbpl,
117 const uchar *srcPixels, int sbpl,
118 int w, int h,
119 int const_alpha)
120{
121 if (const_alpha == 256) {
122 if (w < 256) {
123 const quint16 *src = (const quint16*) srcPixels;
124 quint16 *dst = (quint16*) destPixels;
125 for (int y = 0; y < h; ++y) {
126 qt_blend_rgb16_on_rgb16_const_alpha_256_mips_dsp_asm(dst, src, w);
127 dst = (quint16*) (((uchar*) dst) + dbpl);
128 src = (quint16*) (((uchar*) src) + sbpl);
129 }
130 }
131 else {
132 int length = w << 1;
133 while (--h >= 0) {
134 memcpy(destPixels, srcPixels, length);
135 destPixels += dbpl;
136 srcPixels += sbpl;
137 }
138 }
139 }
140 else if (const_alpha != 0) {
141 const quint16 *src = (const quint16*) srcPixels;
142 quint16 *dst = (quint16*) destPixels;
143 for (int y = 0; y < h; ++y) {
144 qt_blend_rgb16_on_rgb16_mips_dsp_asm(dst, src, w, const_alpha);
145 dst = (quint16*) (((uchar*) dst) + dbpl);
146 src = (quint16*) (((uchar*) src) + sbpl);
147 }
148 }
149}
150#endif
151
152void comp_func_Source_mips_dsp(uint *dest, const uint *src, int length, uint const_alpha)
153{
154 if (const_alpha == 255) {
155 ::memcpy(dest, src, length * sizeof(uint));
156 } else {
157 int ialpha = 255 - const_alpha;
158 if (length%2 > 0) {
159 dest[0] = INTERPOLATE_PIXEL_255(src[0], const_alpha, dest[0], ialpha);
160 length--;
161 dest++;
162 src++;
163 }
164 comp_func_Source_dsp_asm_x2(dest, src, length, const_alpha);
165 }
166}
167
169 QRasterBuffer *rasterBuffer,
170 int x, int y, int length)
171{
172 const uint *data = (const uint *)rasterBuffer->scanLine(y) + x;
173 buffer = destfetchARGB32_asm_mips_dsp(buffer, data, length);
174 return buffer;
175}
176
178 const uint *buffer, int length)
179{
180 uint *data = (uint *)rasterBuffer->scanLine(y) + x;
181 qt_destStoreARGB32_asm_mips_dsp(data, buffer, length);
182}
183
185{
186 if (const_alpha != 255)
187 color = BYTE_MUL(color, const_alpha);
188 if (length%2 > 0) {
189 dest[0] = color + BYTE_MUL(dest[0], qAlpha(~color));
190 length--;
191 dest++;
192 }
193 comp_func_solid_Source_dsp_asm_x2(dest, length, color, qAlpha(~color));
194}
195
197{
198 if (const_alpha != 255)
199 color = BYTE_MUL(color, const_alpha);
200 if (length%2 > 0) {
201 uint d = dest[0];
202 dest[0] = d + BYTE_MUL(color, qAlpha(~d));
203 length--;
204 dest++;
205 }
206 comp_func_solid_DestinationOver_dsp_asm_x2(dest, length, color);
207}
208
210{
211 if (length%2 > 0) {
212 if (const_alpha == 255) {
213 uint d = dest[0];
214 dest[0] = d + BYTE_MUL(src[0], qAlpha(~d));
215 } else {
216 uint d = dest[0];
217 uint s = BYTE_MUL(src[0], const_alpha);
218 dest[0] = d + BYTE_MUL(s, qAlpha(~d));
219 }
220 length--;
221 dest++;
222 src++;
223 }
224 comp_func_DestinationOver_dsp_asm_x2(dest, src, length, const_alpha);
225}
226
228{
229 if (length%2 > 0) {
230 if (const_alpha == 255) {
231 dest[0] = BYTE_MUL(color, qAlpha(dest[0]));
232 } else {
233 uint tmp_color = BYTE_MUL(color, const_alpha);
234 uint cia = 255 - const_alpha;
235 uint d = dest[0];
236 dest[0] = INTERPOLATE_PIXEL_255(tmp_color, qAlpha(d), d, cia);
237 }
238 length--;
239 dest++;
240 }
241 comp_func_solid_SourceIn_dsp_asm_x2(dest, length, color, const_alpha);
242}
243
244void QT_FASTCALL comp_func_SourceIn_mips_dsp(uint *dest, const uint *src, int length, uint const_alpha)
245{
246 if (length%2 > 0) {
247 if (const_alpha == 255) {
248 dest[0] = BYTE_MUL(src[0], qAlpha(dest[0]));
249 } else {
250 uint cia = 255 - const_alpha;
251 uint d = dest[0];
252 uint s = BYTE_MUL(src[0], const_alpha);
253 dest[0] = INTERPOLATE_PIXEL_255(s, qAlpha(d), d, cia);
254 }
255 length--;
256 dest++;
257 src++;
258 }
259 comp_func_SourceIn_dsp_asm_x2(dest, src, length, const_alpha);
260}
261
263{
264 uint a = qAlpha(color);
265 if (const_alpha != 255) {
266 a = BYTE_MUL(a, const_alpha) + 255 - const_alpha;
267 }
268 if (length%2 > 0) {
269 dest[0] = BYTE_MUL(dest[0], a);
270 length--;
271 dest++;
272 }
273 comp_func_solid_DestinationIn_dsp_asm_x2(dest, length, a);
274}
275
277{
278 if (length%2 > 0) {
279 if (const_alpha == 255) {
280 dest[0] = BYTE_MUL(dest[0], qAlpha(src[0]));
281 } else {
282 int cia = 255 - const_alpha;
283 uint a = BYTE_MUL(qAlpha(src[0]), const_alpha) + cia;
284 dest[0] = BYTE_MUL(dest[0], a);
285 }
286 length--;
287 src++;
288 dest++;
289 }
290 comp_func_DestinationIn_dsp_asm_x2(dest, src, length, const_alpha);
291}
292
294{
295 uint a = qAlpha(~color);
296 if (const_alpha != 255) {
297 a = BYTE_MUL(a, const_alpha) + 255 - const_alpha;
298 }
299 if (length%2 > 0) {
300 dest[0] = BYTE_MUL(dest[0], a);
301 length--;
302 dest++;
303 }
304 comp_func_solid_DestinationIn_dsp_asm_x2(dest, length, a);
305}
306
308{
309 if (length%2 > 0) {
310 if (const_alpha == 255) {
311 dest[0] = BYTE_MUL(dest[0], qAlpha(~src[0]));
312 } else {
313 int cia = 255 - const_alpha;
314 uint sia = BYTE_MUL(qAlpha(~src[0]), const_alpha) + cia;
315 dest[0] = BYTE_MUL(dest[0], sia);
316 }
317 length--;
318 dest++;
319 src++;
320 }
321 comp_func_DestinationOut_dsp_asm_x2(dest, src, length, const_alpha);
322}
323
325{
326 if (const_alpha != 255) {
327 color = BYTE_MUL(color, const_alpha);
328 }
329 uint sia = qAlpha(~color);
330 if (length%2 > 0) {
331 dest[0] = INTERPOLATE_PIXEL_255(color, qAlpha(dest[0]), dest[0], sia);
332 length--;
333 dest++;
334 }
335 comp_func_solid_SourceAtop_dsp_asm_x2(dest, length, color, sia);
336}
337
338void QT_FASTCALL comp_func_SourceAtop_mips_dsp(uint *dest, const uint *src, int length, uint const_alpha)
339{
340 if (length%2 > 0) {
341 if (const_alpha == 255) {
342 uint s = src[0];
343 uint d = dest[0];
344 dest[0] = INTERPOLATE_PIXEL_255(s, qAlpha(d), d, qAlpha(~s));
345 } else {
346 uint s = BYTE_MUL(src[0], const_alpha);
347 uint d = dest[0];
348 dest[0] = INTERPOLATE_PIXEL_255(s, qAlpha(d), d, qAlpha(~s));
349 }
350 length--;
351 dest++;
352 src++;
353 }
354 comp_func_SourceAtop_dsp_asm_x2(dest, src, length, const_alpha);
355}
356
357
359{
360 uint a = qAlpha(color);
361 if (const_alpha != 255) {
362 color = BYTE_MUL(color, const_alpha);
363 a = qAlpha(color) + 255 - const_alpha;
364 }
365 if (length%2 > 0) {
366 uint d = dest[0];
367 dest[0] = INTERPOLATE_PIXEL_255(d, a, color, qAlpha(~d));
368 length--;
369 dest++;
370 }
371 comp_func_solid_DestinationAtop_dsp_asm_x2(dest, length, color, a);
372}
373
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(d, qAlpha(s), s, qAlpha(~d));
381 } else {
382 int cia = 255 - const_alpha;
383 uint s = BYTE_MUL(src[0], const_alpha);
384 uint d = dest[0];
385 uint a = qAlpha(s) + cia;
386 dest[0] = INTERPOLATE_PIXEL_255(d, a, s, qAlpha(~d));
387 }
388 length--;
389 dest++;
390 src++;
391 }
392 comp_func_DestinationAtop_dsp_asm_x2(dest, src, length, const_alpha);
393}
394
396{
397 if (const_alpha != 255)
398 color = BYTE_MUL(color, const_alpha);
399 uint sia = qAlpha(~color);
400
401 if (length%2 > 0) {
402 uint d = dest[0];
403 dest[0] = INTERPOLATE_PIXEL_255(color, qAlpha(~d), d, sia);
404 length--;
405 dest++;
406 }
407 comp_func_solid_XOR_dsp_asm_x2(dest, length, color, sia);
408}
409
410void QT_FASTCALL comp_func_XOR_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 d = dest[0];
415 uint s = src[0];
416 dest[0] = INTERPOLATE_PIXEL_255(s, qAlpha(~d), d, qAlpha(~s));
417 } else {
418 uint d = dest[0];
419 uint s = BYTE_MUL(src[0], const_alpha);
420 dest[0] = INTERPOLATE_PIXEL_255(s, qAlpha(~d), d, qAlpha(~s));
421 }
422 length--;
423 dest++;
424 src++;
425 }
426 comp_func_XOR_dsp_asm_x2(dest, src, length, const_alpha);
427}
428
430{
431 if (length%2 > 0) {
432 if (const_alpha == 255) {
433 dest[0] = BYTE_MUL(color, qAlpha(~dest[0]));
434 } else {
435 uint tmp_color = BYTE_MUL(color, const_alpha);
436 int cia = 255 - const_alpha;
437 uint d = dest[0];
438 dest[0] = INTERPOLATE_PIXEL_255(tmp_color, qAlpha(~d), d, cia);
439 }
440 length--;
441 dest++;
442 }
443 comp_func_solid_SourceOut_dsp_asm_x2(dest, length, color, const_alpha);
444}
445
446void QT_FASTCALL comp_func_SourceOut_mips_dsp(uint *dest, const uint *src, int length, uint const_alpha)
447{
448 if (length%2 > 0) {
449 if (const_alpha == 255) {
450 dest[0] = BYTE_MUL(src[0], qAlpha(~dest[0]));
451 } else {
452 int cia = 255 - const_alpha;
453 uint s = BYTE_MUL(src[0], const_alpha);
454 uint d = dest[0];
455 dest[0] = INTERPOLATE_PIXEL_255(s, qAlpha(~d), d, cia);
456 }
457 length--;
458 dest++;
459 src++;
460 }
461 comp_func_SourceOut_dsp_asm_x2(dest, src, length, const_alpha);
462}
463
465 int y, int x, int length)
466{
467 const uchar *line = data->texture.scanLine(y) + x * 3;
468 fetchUntransformed_888_asm_mips_dsp(buffer, line, length);
469 return buffer;
470}
471
473 int y, int x, int length)
474{
475 const uchar *line = data->texture.scanLine(y) + x * 2;
476 fetchUntransformed_444_asm_mips_dsp(buffer, line, length);
477 return buffer;
478}
479
481 int y, int x, int length)
482{
483 const uchar *line = data->texture.scanLine(y) + x * 3;
484 fetchUntransformed_argb8565_premultiplied_asm_mips_dsp(buffer, line, length);
485 return buffer;
486}
487
488#if defined(__MIPS_DSPR2__)
489extern "C" void qConvertRgb16To32_asm_mips_dspr2(quint32 *dest, const quint16 *src, int length);
490
491const uint *QT_FASTCALL qt_fetchUntransformedRGB16_mips_dspr2(uint *buffer, const Operator *,
492 const QSpanData *data, int y, int x,
493 int length)
494{
495 const quint16 *scanLine = (const quint16 *)data->texture.scanLine(y) + x;
496 qConvertRgb16To32_asm_mips_dspr2(buffer, scanLine, length);
497 return buffer;
498}
499#endif
500
uchar * scanLine(int y)
Combined button and popup list for selecting options.
#define QT_FASTCALL
void QT_FASTCALL comp_func_solid_DestinationOut_mips_dsp(uint *dest, int length, uint color, uint const_alpha)
void QT_FASTCALL comp_func_solid_SourceOver_mips_dsp(uint *dest, int length, uint color, uint const_alpha)
void QT_FASTCALL comp_func_solid_SourceOut_mips_dsp(uint *dest, int length, uint color, uint const_alpha)
const uint *QT_FASTCALL qt_fetchUntransformed_argb8565_premultiplied_mips_dsp(uint *buffer, const Operator *, const QSpanData *data, int y, int x, int length)
void QT_FASTCALL comp_func_solid_DestinationAtop_mips_dsp(uint *dest, int length, uint color, uint const_alpha)
void qt_blend_argb32_on_argb32_mips_dsp(uchar *destPixels, int dbpl, const uchar *srcPixels, int sbpl, int w, int h, int const_alpha)
uint *QT_FASTCALL qt_destFetchARGB32_mips_dsp(uint *buffer, QRasterBuffer *rasterBuffer, int x, int y, int length)
void QT_FASTCALL comp_func_solid_SourceAtop_mips_dsp(uint *dest, int length, uint color, uint const_alpha)
void QT_FASTCALL comp_func_SourceOut_mips_dsp(uint *dest, const uint *src, int length, uint const_alpha)
void QT_FASTCALL comp_func_DestinationOut_mips_dsp(uint *dest, const uint *src, int length, uint const_alpha)
void QT_FASTCALL comp_func_XOR_mips_dsp(uint *dest, const uint *src, int length, uint const_alpha)
const uint *QT_FASTCALL qt_fetchUntransformed_888_mips_dsp(uint *buffer, const Operator *, const QSpanData *data, int y, int x, int length)
void QT_FASTCALL qt_destStoreARGB32_mips_dsp(QRasterBuffer *rasterBuffer, int x, int y, const uint *buffer, int length)
void qt_blend_rgb16_on_rgb16_mips_dsp(uchar *destPixels, int dbpl, const uchar *srcPixels, int sbpl, int w, int h, int const_alpha)
void QT_FASTCALL comp_func_DestinationAtop_mips_dsp(uint *dest, const uint *src, int length, uint const_alpha)
QT_BEGIN_NAMESPACE void qt_memfill32(quint32 *dest, quint32 color, qsizetype count)
void QT_FASTCALL comp_func_DestinationIn_mips_dsp(uint *dest, const uint *src, int length, uint const_alpha)
void QT_FASTCALL comp_func_solid_DestinationOver_mips_dsp(uint *dest, int length, uint color, uint const_alpha)
void QT_FASTCALL comp_func_SourceAtop_mips_dsp(uint *dest, const uint *src, int length, uint const_alpha)
void QT_FASTCALL comp_func_solid_XOR_mips_dsp(uint *dest, int length, uint color, uint const_alpha)
void comp_func_Source_mips_dsp(uint *dest, const uint *src, int length, uint const_alpha)
const uint *QT_FASTCALL qt_fetchUntransformed_444_mips_dsp(uint *buffer, const Operator *, const QSpanData *data, int y, int x, int length)
void qt_blend_rgb32_on_rgb32_mips_dsp(uchar *destPixels, int dbpl, const uchar *srcPixels, int sbpl, int w, int h, int const_alpha)
void QT_FASTCALL comp_func_solid_DestinationIn_mips_dsp(uint *dest, int length, uint color, uint const_alpha)
void QT_FASTCALL comp_func_SourceIn_mips_dsp(uint *dest, const uint *src, int length, uint const_alpha)
void QT_FASTCALL comp_func_solid_SourceIn_mips_dsp(uint *dest, int length, uint color, uint const_alpha)
void QT_FASTCALL comp_func_DestinationOver_mips_dsp(uint *dest, const uint *src, int length, uint const_alpha)
static uint INTERPOLATE_PIXEL_255(uint x, uint a, uint y, uint b)
static uint BYTE_MUL(uint x, uint a)
GLint GLint GLint GLint GLint x
[0]
GLfloat GLfloat GLfloat w
[0]
GLboolean GLboolean GLboolean GLboolean a
[7]
GLenum GLuint GLenum GLsizei length
GLenum GLenum GLsizei count
GLint GLsizei GLsizei GLenum GLenum GLsizei void * data
GLenum src
GLenum GLuint buffer
GLuint color
[2]
GLenum GLenum dst
GLint y
GLfloat GLfloat GLfloat GLfloat h
GLdouble s
[6]
Definition qopenglext.h:235
GLenum GLsizei len
constexpr int qAlpha(QRgb rgb)
Definition qrgb.h:27
unsigned int quint32
Definition qtypes.h:50
unsigned char uchar
Definition qtypes.h:32
unsigned short quint16
Definition qtypes.h:48
ptrdiff_t qsizetype
Definition qtypes.h:165
unsigned int uint
Definition qtypes.h:34