5#include <private/qdrawhelper_p.h>
6#include <private/qdrawhelper_mips_dsp_p.h>
7#include <private/qpaintengine_raster_p.h>
13 qt_memfill32_asm_mips_dsp(dest, color, count);
17 const uchar *srcPixels,
int sbpl,
24 "qt_blend_argb32_on_argb32: dst=(%p, %d), src=(%p, %d), dim=(%d, %d) alpha=%d\n",
25 destPixels, dbpl, srcPixels, sbpl, w, h, const_alpha);
29 const uint *src = (
const uint *) srcPixels;
30 uint *dst = (uint *) destPixels;
31 if (const_alpha == 256) {
32 for (
int y=0; y<h; ++y) {
33 qt_blend_argb32_on_argb32_const_alpha_256_mips_dsp_asm(dst, src, w);
34 dst = (quint32 *)(((uchar *) dst) + dbpl);
35 src = (
const quint32 *)(((
const uchar *) src) + sbpl);
37 }
else if (const_alpha != 0) {
38 const_alpha = (const_alpha * 255) >> 8;
39 for (
int y=0; y<h; ++y) {
41 uint s = BYTE_MUL(src[0], const_alpha);
42 dst[0] = s + BYTE_MUL(dst[0], qAlpha(~s));
47 qt_blend_argb32_on_argb32_mips_dsp_asm_x2(dst, src, h, const_alpha);
48 dst = (quint32 *)(((uchar *) dst) + dbpl);
49 src = (
const quint32 *)(((
const uchar *) src) + sbpl);
55 const uchar *srcPixels,
int sbpl,
61 "qt_blend_rgb32_on_rgb32: dst=(%p, %d), src=(%p, %d), dim=(%d, %d) alpha=%d\n",
62 destPixels, dbpl, srcPixels, sbpl, w, h, const_alpha);
66 if (const_alpha != 256) {
67 qt_blend_argb32_on_argb32_mips_dsp(destPixels, dbpl, srcPixels, sbpl, w, h, const_alpha);
71 const uint *src = (
const uint *) srcPixels;
72 uint *dst = (uint *) destPixels;
74 for (
int y=0; y<h; ++y) {
75 memcpy(dst, src, len);
76 dst = (quint32 *)(((uchar *) dst) + dbpl);
77 src = (
const quint32 *)(((
const uchar *) src) + sbpl);
81#if defined(__MIPS_DSPR2__)
82void qt_blend_rgb16_on_rgb16_mips_dspr2(uchar *destPixels,
int dbpl,
83 const uchar *srcPixels,
int sbpl,
87 if (const_alpha == 256) {
89 const quint16 *src = (
const quint16*) srcPixels;
90 quint16 *dst = (quint16*) destPixels;
91 for (
int y = 0; y < h; ++y) {
92 qt_blend_rgb16_on_rgb16_const_alpha_256_mips_dsp_asm(dst, src, w);
93 dst = (quint16*) (((uchar*) dst) + dbpl);
94 src = (quint16*) (((uchar*) src) + sbpl);
100 memcpy(destPixels, srcPixels, length);
106 else if (const_alpha != 0) {
107 const quint16 *src = (
const quint16*) srcPixels;
108 quint16 *dst = (quint16*) destPixels;
109 for (
int y = 0; y < h; ++y) {
110 qt_blend_rgb16_on_rgb16_mips_dspr2_asm(dst, src, w, const_alpha);
111 dst = (quint16*) (((uchar*) dst) + dbpl);
112 src = (quint16*) (((uchar*) src) + sbpl);
118 const uchar *srcPixels,
int sbpl,
122 if (const_alpha == 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);
135 memcpy(destPixels, srcPixels, length);
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_dsp_asm(dst, src, w, const_alpha);
146 dst = (quint16*) (((uchar*) dst) + dbpl);
147 src = (quint16*) (((uchar*) src) + sbpl);
155 if (const_alpha == 255) {
156 ::memcpy(dest, src, length *
sizeof(uint));
158 int ialpha = 255 - const_alpha;
160 dest[0] = INTERPOLATE_PIXEL_255(src[0], const_alpha, dest[0], ialpha);
165 comp_func_Source_dsp_asm_x2(dest, src, length, const_alpha);
170 QRasterBuffer *rasterBuffer,
171 int x,
int y,
int length)
173 const uint *data = (
const uint *)rasterBuffer->scanLine(y) + x;
174 buffer = destfetchARGB32_asm_mips_dsp(buffer, data, length);
178void QT_FASTCALL qt_destStoreARGB32_mips_dsp(QRasterBuffer *rasterBuffer,
int x,
int y,
179 const uint *buffer,
int length)
181 uint *data = (uint *)rasterBuffer->scanLine(y) + x;
182 qt_destStoreARGB32_asm_mips_dsp(data, buffer, length);
185void QT_FASTCALL comp_func_solid_SourceOver_mips_dsp(uint *dest,
int length, uint color, uint const_alpha)
187 if (const_alpha != 255)
188 color = BYTE_MUL(color, const_alpha);
190 dest[0] = color + BYTE_MUL(dest[0], qAlpha(~color));
194 comp_func_solid_Source_dsp_asm_x2(dest, length, color, qAlpha(~color));
197void QT_FASTCALL comp_func_solid_DestinationOver_mips_dsp(uint *dest,
int length, uint color, uint const_alpha)
199 if (const_alpha != 255)
200 color = BYTE_MUL(color, const_alpha);
203 dest[0] = d + BYTE_MUL(color, qAlpha(~d));
207 comp_func_solid_DestinationOver_dsp_asm_x2(dest, length, color);
210void QT_FASTCALL comp_func_DestinationOver_mips_dsp(uint *dest,
const uint *src,
int length, uint const_alpha)
213 if (const_alpha == 255) {
215 dest[0] = d + BYTE_MUL(src[0], qAlpha(~d));
218 uint s = BYTE_MUL(src[0], const_alpha);
219 dest[0] = d + BYTE_MUL(s, qAlpha(~d));
225 comp_func_DestinationOver_dsp_asm_x2(dest, src, length, const_alpha);
228void QT_FASTCALL comp_func_solid_SourceIn_mips_dsp(uint *dest,
int length, uint color, uint const_alpha)
231 if (const_alpha == 255) {
232 dest[0] = BYTE_MUL(color, qAlpha(dest[0]));
234 uint tmp_color = BYTE_MUL(color, const_alpha);
235 uint cia = 255 - const_alpha;
237 dest[0] = INTERPOLATE_PIXEL_255(tmp_color, qAlpha(d), d, cia);
242 comp_func_solid_SourceIn_dsp_asm_x2(dest, length, color, const_alpha);
245void QT_FASTCALL comp_func_SourceIn_mips_dsp(uint *dest,
const uint *src,
int length, uint const_alpha)
248 if (const_alpha == 255) {
249 dest[0] = BYTE_MUL(src[0], qAlpha(dest[0]));
251 uint cia = 255 - const_alpha;
253 uint s = BYTE_MUL(src[0], const_alpha);
254 dest[0] = INTERPOLATE_PIXEL_255(s, qAlpha(d), d, cia);
260 comp_func_SourceIn_dsp_asm_x2(dest, src, length, const_alpha);
263void QT_FASTCALL comp_func_solid_DestinationIn_mips_dsp(uint *dest,
int length, uint color, uint const_alpha)
265 uint a = qAlpha(color);
266 if (const_alpha != 255) {
267 a = BYTE_MUL(a, const_alpha) + 255 - const_alpha;
270 dest[0] = BYTE_MUL(dest[0], a);
274 comp_func_solid_DestinationIn_dsp_asm_x2(dest, length, a);
277void QT_FASTCALL comp_func_DestinationIn_mips_dsp(uint *dest,
const uint *src,
int length, uint const_alpha)
280 if (const_alpha == 255) {
281 dest[0] = BYTE_MUL(dest[0], qAlpha(src[0]));
283 int cia = 255 - const_alpha;
284 uint a = BYTE_MUL(qAlpha(src[0]), const_alpha) + cia;
285 dest[0] = BYTE_MUL(dest[0], a);
291 comp_func_DestinationIn_dsp_asm_x2(dest, src, length, const_alpha);
294void QT_FASTCALL comp_func_solid_DestinationOut_mips_dsp(uint *dest,
int length, uint color, uint const_alpha)
296 uint a = qAlpha(~color);
297 if (const_alpha != 255) {
298 a = BYTE_MUL(a, const_alpha) + 255 - const_alpha;
301 dest[0] = BYTE_MUL(dest[0], a);
305 comp_func_solid_DestinationIn_dsp_asm_x2(dest, length, a);
308void QT_FASTCALL comp_func_DestinationOut_mips_dsp(uint *dest,
const uint *src,
int length, uint const_alpha)
311 if (const_alpha == 255) {
312 dest[0] = BYTE_MUL(dest[0], qAlpha(~src[0]));
314 int cia = 255 - const_alpha;
315 uint sia = BYTE_MUL(qAlpha(~src[0]), const_alpha) + cia;
316 dest[0] = BYTE_MUL(dest[0], sia);
322 comp_func_DestinationOut_dsp_asm_x2(dest, src, length, const_alpha);
325void QT_FASTCALL comp_func_solid_SourceAtop_mips_dsp(uint *dest,
int length, uint color, uint const_alpha)
327 if (const_alpha != 255) {
328 color = BYTE_MUL(color, const_alpha);
330 uint sia = qAlpha(~color);
332 dest[0] = INTERPOLATE_PIXEL_255(color, qAlpha(dest[0]), dest[0], sia);
336 comp_func_solid_SourceAtop_dsp_asm_x2(dest, length, color, sia);
339void QT_FASTCALL comp_func_SourceAtop_mips_dsp(uint *dest,
const uint *src,
int length, uint const_alpha)
342 if (const_alpha == 255) {
345 dest[0] = INTERPOLATE_PIXEL_255(s, qAlpha(d), d, qAlpha(~s));
347 uint s = BYTE_MUL(src[0], const_alpha);
349 dest[0] = INTERPOLATE_PIXEL_255(s, qAlpha(d), d, qAlpha(~s));
355 comp_func_SourceAtop_dsp_asm_x2(dest, src, length, const_alpha);
359void QT_FASTCALL comp_func_solid_DestinationAtop_mips_dsp(uint *dest,
int length, uint color, uint const_alpha)
361 uint a = qAlpha(color);
362 if (const_alpha != 255) {
363 color = BYTE_MUL(color, const_alpha);
364 a = qAlpha(color) + 255 - const_alpha;
368 dest[0] = INTERPOLATE_PIXEL_255(d, a, color, qAlpha(~d));
372 comp_func_solid_DestinationAtop_dsp_asm_x2(dest, length, color, a);
375void QT_FASTCALL comp_func_DestinationAtop_mips_dsp(uint *dest,
const uint *src,
int length, uint const_alpha)
378 if (const_alpha == 255) {
381 dest[0] = INTERPOLATE_PIXEL_255(d, qAlpha(s), s, qAlpha(~d));
383 int cia = 255 - const_alpha;
384 uint s = BYTE_MUL(src[0], const_alpha);
386 uint a = qAlpha(s) + cia;
387 dest[0] = INTERPOLATE_PIXEL_255(d, a, s, qAlpha(~d));
393 comp_func_DestinationAtop_dsp_asm_x2(dest, src, length, const_alpha);
396void QT_FASTCALL comp_func_solid_XOR_mips_dsp(uint *dest,
int length, uint color, uint const_alpha)
398 if (const_alpha != 255)
399 color = BYTE_MUL(color, const_alpha);
400 uint sia = qAlpha(~color);
404 dest[0] = INTERPOLATE_PIXEL_255(color, qAlpha(~d), d, sia);
408 comp_func_solid_XOR_dsp_asm_x2(dest, length, color, sia);
411void QT_FASTCALL comp_func_XOR_mips_dsp(uint *dest,
const uint *src,
int length, uint const_alpha)
414 if (const_alpha == 255) {
417 dest[0] = INTERPOLATE_PIXEL_255(s, qAlpha(~d), d, qAlpha(~s));
420 uint s = BYTE_MUL(src[0], const_alpha);
421 dest[0] = INTERPOLATE_PIXEL_255(s, qAlpha(~d), d, qAlpha(~s));
427 comp_func_XOR_dsp_asm_x2(dest, src, length, const_alpha);
430void QT_FASTCALL comp_func_solid_SourceOut_mips_dsp(uint *dest,
int length, uint color, uint const_alpha)
433 if (const_alpha == 255) {
434 dest[0] = BYTE_MUL(color, qAlpha(~dest[0]));
436 uint tmp_color = BYTE_MUL(color, const_alpha);
437 int cia = 255 - const_alpha;
439 dest[0] = INTERPOLATE_PIXEL_255(tmp_color, qAlpha(~d), d, cia);
444 comp_func_solid_SourceOut_dsp_asm_x2(dest, length, color, const_alpha);
447void QT_FASTCALL comp_func_SourceOut_mips_dsp(uint *dest,
const uint *src,
int length, uint const_alpha)
450 if (const_alpha == 255) {
451 dest[0] = BYTE_MUL(src[0], qAlpha(~dest[0]));
453 int cia = 255 - const_alpha;
454 uint s = BYTE_MUL(src[0], const_alpha);
456 dest[0] = INTERPOLATE_PIXEL_255(s, qAlpha(~d), d, cia);
462 comp_func_SourceOut_dsp_asm_x2(dest, src, length, const_alpha);
465const uint *
QT_FASTCALL qt_fetchUntransformed_888_mips_dsp (uint *buffer,
const Operator *,
const QSpanData *data,
466 int y,
int x,
int length)
468 const uchar *line = data->texture.scanLine(y) + x * 3;
469 fetchUntransformed_888_asm_mips_dsp(buffer, line, length);
473const uint *
QT_FASTCALL qt_fetchUntransformed_444_mips_dsp (uint *buffer,
const Operator *,
const QSpanData *data,
474 int y,
int x,
int length)
476 const uchar *line = data->texture.scanLine(y) + x * 2;
477 fetchUntransformed_444_asm_mips_dsp(buffer, line, length);
481const uint *
QT_FASTCALL qt_fetchUntransformed_argb8565_premultiplied_mips_dsp (uint *buffer,
const Operator *,
const QSpanData *data,
482 int y,
int x,
int length)
484 const uchar *line = data->texture.scanLine(y) + x * 3;
485 fetchUntransformed_argb8565_premultiplied_asm_mips_dsp(buffer, line, length);
489#if defined(__MIPS_DSPR2__)
490extern "C" void qConvertRgb16To32_asm_mips_dspr2(quint32 *dest,
const quint16 *src,
int length);
492const uint *QT_FASTCALL qt_fetchUntransformedRGB16_mips_dspr2(uint *buffer,
const Operator *,
493 const QSpanData *data,
int y,
int x,
496 const quint16 *scanLine = (
const quint16 *)data->texture.scanLine(y) + x;
497 qConvertRgb16To32_asm_mips_dspr2(buffer, scanLine, length);
uint QT_FASTCALL fetch1Pixel< QPixelLayout::BPP1LSB >(const uchar *src, int index)
void qt_blend_argb32_on_argb32_mips_dsp(uchar *destPixels, int dbpl, const uchar *srcPixels, int sbpl, int w, int h, int const_alpha)
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 comp_func_Source_mips_dsp(uint *dest, const uint *src, int length, uint const_alpha)
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_memfill32(quint32 *dest, quint32 value, qsizetype count)