4#include <private/qdrawhelper_p.h>
5#include <private/qdrawhelper_mips_dsp_p.h>
6#include <private/qpaintengine_raster_p.h>
12 qt_memfill32_asm_mips_dsp(dest, color, count);
16 const uchar *srcPixels,
int sbpl,
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);
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);
36 }
else if (const_alpha != 0) {
37 const_alpha = (const_alpha * 255) >> 8;
38 for (
int y=0; y<h; ++y) {
40 uint s = BYTE_MUL(src[0], const_alpha);
41 dst[0] = s + BYTE_MUL(dst[0], qAlpha(~s));
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);
54 const uchar *srcPixels,
int sbpl,
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);
65 if (const_alpha != 256) {
66 qt_blend_argb32_on_argb32_mips_dsp(destPixels, dbpl, srcPixels, sbpl, w, h, const_alpha);
70 const uint *src = (
const uint *) srcPixels;
71 uint *dst = (uint *) destPixels;
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);
80#if defined(__MIPS_DSPR2__)
81void qt_blend_rgb16_on_rgb16_mips_dspr2(uchar *destPixels,
int dbpl,
82 const uchar *srcPixels,
int sbpl,
86 if (const_alpha == 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);
99 memcpy(destPixels, srcPixels, length);
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);
117 const uchar *srcPixels,
int sbpl,
121 if (const_alpha == 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);
134 memcpy(destPixels, srcPixels, length);
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);
154 if (const_alpha == 255) {
155 ::memcpy(dest, src, length *
sizeof(uint));
157 int ialpha = 255 - const_alpha;
159 dest[0] = INTERPOLATE_PIXEL_255(src[0], const_alpha, dest[0], ialpha);
164 comp_func_Source_dsp_asm_x2(dest, src, length, const_alpha);
169 QRasterBuffer *rasterBuffer,
170 int x,
int y,
int length)
172 const uint *data = (
const uint *)rasterBuffer->scanLine(y) + x;
173 buffer = destfetchARGB32_asm_mips_dsp(buffer, data, length);
177void QT_FASTCALL qt_destStoreARGB32_mips_dsp(QRasterBuffer *rasterBuffer,
int x,
int y,
178 const uint *buffer,
int length)
180 uint *data = (uint *)rasterBuffer->scanLine(y) + x;
181 qt_destStoreARGB32_asm_mips_dsp(data, buffer, length);
184void QT_FASTCALL comp_func_solid_SourceOver_mips_dsp(uint *dest,
int length, uint color, uint const_alpha)
186 if (const_alpha != 255)
187 color = BYTE_MUL(color, const_alpha);
189 dest[0] = color + BYTE_MUL(dest[0], qAlpha(~color));
193 comp_func_solid_Source_dsp_asm_x2(dest, length, color, qAlpha(~color));
196void QT_FASTCALL comp_func_solid_DestinationOver_mips_dsp(uint *dest,
int length, uint color, uint const_alpha)
198 if (const_alpha != 255)
199 color = BYTE_MUL(color, const_alpha);
202 dest[0] = d + BYTE_MUL(color, qAlpha(~d));
206 comp_func_solid_DestinationOver_dsp_asm_x2(dest, length, color);
209void QT_FASTCALL comp_func_DestinationOver_mips_dsp(uint *dest,
const uint *src,
int length, uint const_alpha)
212 if (const_alpha == 255) {
214 dest[0] = d + BYTE_MUL(src[0], qAlpha(~d));
217 uint s = BYTE_MUL(src[0], const_alpha);
218 dest[0] = d + BYTE_MUL(s, qAlpha(~d));
224 comp_func_DestinationOver_dsp_asm_x2(dest, src, length, const_alpha);
227void QT_FASTCALL comp_func_solid_SourceIn_mips_dsp(uint *dest,
int length, uint color, uint const_alpha)
230 if (const_alpha == 255) {
231 dest[0] = BYTE_MUL(color, qAlpha(dest[0]));
233 uint tmp_color = BYTE_MUL(color, const_alpha);
234 uint cia = 255 - const_alpha;
236 dest[0] = INTERPOLATE_PIXEL_255(tmp_color, qAlpha(d), d, cia);
241 comp_func_solid_SourceIn_dsp_asm_x2(dest, length, color, const_alpha);
244void QT_FASTCALL comp_func_SourceIn_mips_dsp(uint *dest,
const uint *src,
int length, uint const_alpha)
247 if (const_alpha == 255) {
248 dest[0] = BYTE_MUL(src[0], qAlpha(dest[0]));
250 uint cia = 255 - const_alpha;
252 uint s = BYTE_MUL(src[0], const_alpha);
253 dest[0] = INTERPOLATE_PIXEL_255(s, qAlpha(d), d, cia);
259 comp_func_SourceIn_dsp_asm_x2(dest, src, length, const_alpha);
262void QT_FASTCALL comp_func_solid_DestinationIn_mips_dsp(uint *dest,
int length, uint color, uint const_alpha)
264 uint a = qAlpha(color);
265 if (const_alpha != 255) {
266 a = BYTE_MUL(a, const_alpha) + 255 - const_alpha;
269 dest[0] = BYTE_MUL(dest[0], a);
273 comp_func_solid_DestinationIn_dsp_asm_x2(dest, length, a);
276void QT_FASTCALL comp_func_DestinationIn_mips_dsp(uint *dest,
const uint *src,
int length, uint const_alpha)
279 if (const_alpha == 255) {
280 dest[0] = BYTE_MUL(dest[0], qAlpha(src[0]));
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);
290 comp_func_DestinationIn_dsp_asm_x2(dest, src, length, const_alpha);
293void QT_FASTCALL comp_func_solid_DestinationOut_mips_dsp(uint *dest,
int length, uint color, uint const_alpha)
295 uint a = qAlpha(~color);
296 if (const_alpha != 255) {
297 a = BYTE_MUL(a, const_alpha) + 255 - const_alpha;
300 dest[0] = BYTE_MUL(dest[0], a);
304 comp_func_solid_DestinationIn_dsp_asm_x2(dest, length, a);
307void QT_FASTCALL comp_func_DestinationOut_mips_dsp(uint *dest,
const uint *src,
int length, uint const_alpha)
310 if (const_alpha == 255) {
311 dest[0] = BYTE_MUL(dest[0], qAlpha(~src[0]));
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);
321 comp_func_DestinationOut_dsp_asm_x2(dest, src, length, const_alpha);
324void QT_FASTCALL comp_func_solid_SourceAtop_mips_dsp(uint *dest,
int length, uint color, uint const_alpha)
326 if (const_alpha != 255) {
327 color = BYTE_MUL(color, const_alpha);
329 uint sia = qAlpha(~color);
331 dest[0] = INTERPOLATE_PIXEL_255(color, qAlpha(dest[0]), dest[0], sia);
335 comp_func_solid_SourceAtop_dsp_asm_x2(dest, length, color, sia);
338void QT_FASTCALL comp_func_SourceAtop_mips_dsp(uint *dest,
const uint *src,
int length, uint const_alpha)
341 if (const_alpha == 255) {
344 dest[0] = INTERPOLATE_PIXEL_255(s, qAlpha(d), d, qAlpha(~s));
346 uint s = BYTE_MUL(src[0], const_alpha);
348 dest[0] = INTERPOLATE_PIXEL_255(s, qAlpha(d), d, qAlpha(~s));
354 comp_func_SourceAtop_dsp_asm_x2(dest, src, length, const_alpha);
358void QT_FASTCALL comp_func_solid_DestinationAtop_mips_dsp(uint *dest,
int length, uint color, uint const_alpha)
360 uint a = qAlpha(color);
361 if (const_alpha != 255) {
362 color = BYTE_MUL(color, const_alpha);
363 a = qAlpha(color) + 255 - const_alpha;
367 dest[0] = INTERPOLATE_PIXEL_255(d, a, color, qAlpha(~d));
371 comp_func_solid_DestinationAtop_dsp_asm_x2(dest, length, color, a);
374void QT_FASTCALL comp_func_DestinationAtop_mips_dsp(uint *dest,
const uint *src,
int length, uint const_alpha)
377 if (const_alpha == 255) {
380 dest[0] = INTERPOLATE_PIXEL_255(d, qAlpha(s), s, qAlpha(~d));
382 int cia = 255 - const_alpha;
383 uint s = BYTE_MUL(src[0], const_alpha);
385 uint a = qAlpha(s) + cia;
386 dest[0] = INTERPOLATE_PIXEL_255(d, a, s, qAlpha(~d));
392 comp_func_DestinationAtop_dsp_asm_x2(dest, src, length, const_alpha);
395void QT_FASTCALL comp_func_solid_XOR_mips_dsp(uint *dest,
int length, uint color, uint const_alpha)
397 if (const_alpha != 255)
398 color = BYTE_MUL(color, const_alpha);
399 uint sia = qAlpha(~color);
403 dest[0] = INTERPOLATE_PIXEL_255(color, qAlpha(~d), d, sia);
407 comp_func_solid_XOR_dsp_asm_x2(dest, length, color, sia);
410void QT_FASTCALL comp_func_XOR_mips_dsp(uint *dest,
const uint *src,
int length, uint const_alpha)
413 if (const_alpha == 255) {
416 dest[0] = INTERPOLATE_PIXEL_255(s, qAlpha(~d), d, qAlpha(~s));
419 uint s = BYTE_MUL(src[0], const_alpha);
420 dest[0] = INTERPOLATE_PIXEL_255(s, qAlpha(~d), d, qAlpha(~s));
426 comp_func_XOR_dsp_asm_x2(dest, src, length, const_alpha);
429void QT_FASTCALL comp_func_solid_SourceOut_mips_dsp(uint *dest,
int length, uint color, uint const_alpha)
432 if (const_alpha == 255) {
433 dest[0] = BYTE_MUL(color, qAlpha(~dest[0]));
435 uint tmp_color = BYTE_MUL(color, const_alpha);
436 int cia = 255 - const_alpha;
438 dest[0] = INTERPOLATE_PIXEL_255(tmp_color, qAlpha(~d), d, cia);
443 comp_func_solid_SourceOut_dsp_asm_x2(dest, length, color, const_alpha);
446void QT_FASTCALL comp_func_SourceOut_mips_dsp(uint *dest,
const uint *src,
int length, uint const_alpha)
449 if (const_alpha == 255) {
450 dest[0] = BYTE_MUL(src[0], qAlpha(~dest[0]));
452 int cia = 255 - const_alpha;
453 uint s = BYTE_MUL(src[0], const_alpha);
455 dest[0] = INTERPOLATE_PIXEL_255(s, qAlpha(~d), d, cia);
461 comp_func_SourceOut_dsp_asm_x2(dest, src, length, const_alpha);
464const uint *
QT_FASTCALL qt_fetchUntransformed_888_mips_dsp (uint *buffer,
const Operator *,
const QSpanData *data,
465 int y,
int x,
int length)
467 const uchar *line = data->texture.scanLine(y) + x * 3;
468 fetchUntransformed_888_asm_mips_dsp(buffer, line, length);
472const uint *
QT_FASTCALL qt_fetchUntransformed_444_mips_dsp (uint *buffer,
const Operator *,
const QSpanData *data,
473 int y,
int x,
int length)
475 const uchar *line = data->texture.scanLine(y) + x * 2;
476 fetchUntransformed_444_asm_mips_dsp(buffer, line, length);
480const uint *
QT_FASTCALL qt_fetchUntransformed_argb8565_premultiplied_mips_dsp (uint *buffer,
const Operator *,
const QSpanData *data,
481 int y,
int x,
int length)
483 const uchar *line = data->texture.scanLine(y) + x * 3;
484 fetchUntransformed_argb8565_premultiplied_asm_mips_dsp(buffer, line, length);
488#if defined(__MIPS_DSPR2__)
489extern "C" void qConvertRgb16To32_asm_mips_dspr2(quint32 *dest,
const quint16 *src,
int length);
491const uint *QT_FASTCALL qt_fetchUntransformedRGB16_mips_dspr2(uint *buffer,
const Operator *,
492 const QSpanData *data,
int y,
int x,
495 const quint16 *scanLine = (
const quint16 *)data->texture.scanLine(y) + x;
496 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)