Subversion Repositories Kolibri OS

Rev

Rev 1891 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1891 Rev 3931
Line 28... Line 28...
28
#endif
28
#endif
29
#include 
29
#include 
30
#include 
30
#include 
31
#include "pixman-private.h"
31
#include "pixman-private.h"
32
#include "pixman-combine32.h"
32
#include "pixman-combine32.h"
33
#include "pixman-fast-path.h"
33
#include "pixman-inlines.h"
Line 34... Line 34...
34
 
34
 
35
static force_inline uint32_t
35
static force_inline uint32_t
36
fetch_24 (uint8_t *a)
36
fetch_24 (uint8_t *a)
37
{
37
{
38
    if (((unsigned long)a) & 1)
38
    if (((uintptr_t)a) & 1)
39
    {
39
    {
40
#ifdef WORDS_BIGENDIAN
40
#ifdef WORDS_BIGENDIAN
41
	return (*a << 16) | (*(uint16_t *)(a + 1));
41
	return (*a << 16) | (*(uint16_t *)(a + 1));
42
#else
42
#else
Line 55... Line 55...
55
 
55
 
56
static force_inline void
56
static force_inline void
57
store_24 (uint8_t *a,
57
store_24 (uint8_t *a,
58
          uint32_t v)
58
          uint32_t v)
59
{
59
{
60
    if (((unsigned long)a) & 1)
60
    if (((uintptr_t)a) & 1)
61
    {
61
    {
62
#ifdef WORDS_BIGENDIAN
62
#ifdef WORDS_BIGENDIAN
63
	*a = (uint8_t) (v >> 16);
63
	*a = (uint8_t) (v >> 16);
64
	*(uint16_t *)(a + 1) = (uint16_t) (v);
64
	*(uint16_t *)(a + 1) = (uint16_t) (v);
Line 88... Line 88...
88
    UN8x4_MUL_UN8_ADD_UN8x4 (dest, a, src);
88
    UN8x4_MUL_UN8_ADD_UN8x4 (dest, a, src);
Line 89... Line 89...
89
 
89
 
90
    return dest;
90
    return dest;
Line 91... Line 91...
91
}
91
}
92
 
92
 
93
static uint32_t
93
static force_inline uint32_t
94
in (uint32_t x,
94
in (uint32_t x,
95
    uint8_t  y)
95
    uint8_t  y)
Line 106... Line 106...
106
 *
106
 *
107
 *  op_src_mask_dest
107
 *  op_src_mask_dest
108
 */
108
 */
109
static void
109
static void
110
fast_composite_over_x888_8_8888 (pixman_implementation_t *imp,
110
fast_composite_over_x888_8_8888 (pixman_implementation_t *imp,
111
                                 pixman_op_t              op,
111
                                 pixman_composite_info_t *info)
112
                                 pixman_image_t *         src_image,
-
 
113
                                 pixman_image_t *         mask_image,
-
 
114
                                 pixman_image_t *         dst_image,
-
 
115
                                 int32_t                  src_x,
-
 
116
                                 int32_t                  src_y,
-
 
117
                                 int32_t                  mask_x,
-
 
118
                                 int32_t                  mask_y,
-
 
119
                                 int32_t                  dest_x,
-
 
120
                                 int32_t                  dest_y,
-
 
121
                                 int32_t                  width,
-
 
122
                                 int32_t                  height)
-
 
123
{
112
{
-
 
113
    PIXMAN_COMPOSITE_ARGS (info);
124
    uint32_t    *src, *src_line;
114
    uint32_t    *src, *src_line;
125
    uint32_t    *dst, *dst_line;
115
    uint32_t    *dst, *dst_line;
126
    uint8_t     *mask, *mask_line;
116
    uint8_t     *mask, *mask_line;
127
    int src_stride, mask_stride, dst_stride;
117
    int src_stride, mask_stride, dst_stride;
128
    uint8_t m;
118
    uint8_t m;
129
    uint32_t s, d;
119
    uint32_t s, d;
130
    int32_t w;
120
    int32_t w;
Line 131... Line 121...
131
 
121
 
132
    PIXMAN_IMAGE_GET_LINE (dst_image, dest_x, dest_y, uint32_t, dst_stride, dst_line, 1);
122
    PIXMAN_IMAGE_GET_LINE (dest_image, dest_x, dest_y, uint32_t, dst_stride, dst_line, 1);
133
    PIXMAN_IMAGE_GET_LINE (mask_image, mask_x, mask_y, uint8_t, mask_stride, mask_line, 1);
123
    PIXMAN_IMAGE_GET_LINE (mask_image, mask_x, mask_y, uint8_t, mask_stride, mask_line, 1);
Line 134... Line 124...
134
    PIXMAN_IMAGE_GET_LINE (src_image, src_x, src_y, uint32_t, src_stride, src_line, 1);
124
    PIXMAN_IMAGE_GET_LINE (src_image, src_x, src_y, uint32_t, src_stride, src_line, 1);
135
 
125
 
Line 166... Line 156...
166
    }
156
    }
167
}
157
}
Line 168... Line 158...
168
 
158
 
169
static void
159
static void
170
fast_composite_in_n_8_8 (pixman_implementation_t *imp,
160
fast_composite_in_n_8_8 (pixman_implementation_t *imp,
171
                         pixman_op_t              op,
-
 
172
                         pixman_image_t *         src_image,
-
 
173
                         pixman_image_t *         mask_image,
-
 
174
                         pixman_image_t *         dest_image,
-
 
175
                         int32_t                  src_x,
-
 
176
                         int32_t                  src_y,
-
 
177
                         int32_t                  mask_x,
-
 
178
                         int32_t                  mask_y,
-
 
179
                         int32_t                  dest_x,
-
 
180
                         int32_t                  dest_y,
-
 
181
                         int32_t                  width,
-
 
182
                         int32_t                  height)
161
                         pixman_composite_info_t *info)
-
 
162
{
183
{
163
    PIXMAN_COMPOSITE_ARGS (info);
184
    uint32_t src, srca;
164
    uint32_t src, srca;
185
    uint8_t     *dst_line, *dst;
165
    uint8_t     *dst_line, *dst;
186
    uint8_t     *mask_line, *mask, m;
166
    uint8_t     *mask_line, *mask, m;
187
    int dst_stride, mask_stride;
167
    int dst_stride, mask_stride;
188
    int32_t w;
168
    int32_t w;
Line 189... Line 169...
189
    uint16_t t;
169
    uint16_t t;
Line 190... Line 170...
190
 
170
 
Line 191... Line 171...
191
    src = _pixman_image_get_solid (src_image, dest_image->bits.format);
171
    src = _pixman_image_get_solid (imp, src_image, dest_image->bits.format);
192
 
172
 
Line 244... Line 224...
244
    }
224
    }
245
}
225
}
Line 246... Line 226...
246
 
226
 
247
static void
227
static void
248
fast_composite_in_8_8 (pixman_implementation_t *imp,
228
fast_composite_in_8_8 (pixman_implementation_t *imp,
249
                       pixman_op_t              op,
-
 
250
                       pixman_image_t *         src_image,
-
 
251
                       pixman_image_t *         mask_image,
-
 
252
                       pixman_image_t *         dest_image,
-
 
253
                       int32_t                  src_x,
-
 
254
                       int32_t                  src_y,
-
 
255
                       int32_t                  mask_x,
-
 
256
                       int32_t                  mask_y,
-
 
257
                       int32_t                  dest_x,
-
 
258
                       int32_t                  dest_y,
-
 
259
                       int32_t                  width,
-
 
260
                       int32_t                  height)
229
                       pixman_composite_info_t *info)
-
 
230
{
261
{
231
    PIXMAN_COMPOSITE_ARGS (info);
262
    uint8_t     *dst_line, *dst;
232
    uint8_t     *dst_line, *dst;
263
    uint8_t     *src_line, *src;
233
    uint8_t     *src_line, *src;
264
    int dst_stride, src_stride;
234
    int dst_stride, src_stride;
265
    int32_t w;
235
    int32_t w;
Line 291... Line 261...
291
    }
261
    }
292
}
262
}
Line 293... Line 263...
293
 
263
 
294
static void
264
static void
295
fast_composite_over_n_8_8888 (pixman_implementation_t *imp,
265
fast_composite_over_n_8_8888 (pixman_implementation_t *imp,
296
                              pixman_op_t              op,
-
 
297
                              pixman_image_t *         src_image,
-
 
298
                              pixman_image_t *         mask_image,
-
 
299
                              pixman_image_t *         dst_image,
-
 
300
                              int32_t                  src_x,
-
 
301
                              int32_t                  src_y,
-
 
302
                              int32_t                  mask_x,
-
 
303
                              int32_t                  mask_y,
-
 
304
                              int32_t                  dest_x,
-
 
305
                              int32_t                  dest_y,
-
 
306
                              int32_t                  width,
-
 
307
                              int32_t                  height)
266
                              pixman_composite_info_t *info)
-
 
267
{
308
{
268
    PIXMAN_COMPOSITE_ARGS (info);
309
    uint32_t src, srca;
269
    uint32_t src, srca;
310
    uint32_t    *dst_line, *dst, d;
270
    uint32_t    *dst_line, *dst, d;
311
    uint8_t     *mask_line, *mask, m;
271
    uint8_t     *mask_line, *mask, m;
312
    int dst_stride, mask_stride;
272
    int dst_stride, mask_stride;
Line 313... Line 273...
313
    int32_t w;
273
    int32_t w;
Line 314... Line 274...
314
 
274
 
315
    src = _pixman_image_get_solid (src_image, dst_image->bits.format);
275
    src = _pixman_image_get_solid (imp, src_image, dest_image->bits.format);
316
 
276
 
Line 317... Line 277...
317
    srca = src >> 24;
277
    srca = src >> 24;
318
    if (src == 0)
278
    if (src == 0)
Line 319... Line 279...
319
	return;
279
	return;
320
 
280
 
321
    PIXMAN_IMAGE_GET_LINE (dst_image, dest_x, dest_y, uint32_t, dst_stride, dst_line, 1);
281
    PIXMAN_IMAGE_GET_LINE (dest_image, dest_x, dest_y, uint32_t, dst_stride, dst_line, 1);
Line 349... Line 309...
349
    }
309
    }
350
}
310
}
Line 351... Line 311...
351
 
311
 
352
static void
312
static void
353
fast_composite_add_n_8888_8888_ca (pixman_implementation_t *imp,
313
fast_composite_add_n_8888_8888_ca (pixman_implementation_t *imp,
354
				   pixman_op_t              op,
-
 
355
				   pixman_image_t *         src_image,
-
 
356
				   pixman_image_t *         mask_image,
-
 
357
				   pixman_image_t *         dst_image,
-
 
358
				   int32_t                  src_x,
-
 
359
				   int32_t                  src_y,
-
 
360
				   int32_t                  mask_x,
-
 
361
				   int32_t                  mask_y,
-
 
362
				   int32_t                  dest_x,
-
 
363
				   int32_t                  dest_y,
-
 
364
				   int32_t                  width,
-
 
365
				   int32_t                  height)
314
				   pixman_composite_info_t *info)
-
 
315
{
366
{
316
    PIXMAN_COMPOSITE_ARGS (info);
367
    uint32_t src, srca, s;
317
    uint32_t src, s;
368
    uint32_t    *dst_line, *dst, d;
318
    uint32_t    *dst_line, *dst, d;
369
    uint32_t    *mask_line, *mask, ma;
319
    uint32_t    *mask_line, *mask, ma;
370
    int dst_stride, mask_stride;
320
    int dst_stride, mask_stride;
Line 371... Line 321...
371
    int32_t w;
321
    int32_t w;
Line 372... Line -...
372
 
-
 
373
    src = _pixman_image_get_solid (src_image, dst_image->bits.format);
322
 
374
 
323
    src = _pixman_image_get_solid (imp, src_image, dest_image->bits.format);
Line 375... Line 324...
375
    srca = src >> 24;
324
 
376
    if (src == 0)
325
    if (src == 0)
Line 377... Line 326...
377
	return;
326
	return;
378
 
327
 
379
    PIXMAN_IMAGE_GET_LINE (dst_image, dest_x, dest_y, uint32_t, dst_stride, dst_line, 1);
328
    PIXMAN_IMAGE_GET_LINE (dest_image, dest_x, dest_y, uint32_t, dst_stride, dst_line, 1);
Line 406... Line 355...
406
    }
355
    }
407
}
356
}
Line 408... Line 357...
408
 
357
 
409
static void
358
static void
410
fast_composite_over_n_8888_8888_ca (pixman_implementation_t *imp,
359
fast_composite_over_n_8888_8888_ca (pixman_implementation_t *imp,
411
                                    pixman_op_t              op,
-
 
412
                                    pixman_image_t *         src_image,
-
 
413
                                    pixman_image_t *         mask_image,
-
 
414
                                    pixman_image_t *         dst_image,
-
 
415
                                    int32_t                  src_x,
-
 
416
                                    int32_t                  src_y,
-
 
417
                                    int32_t                  mask_x,
-
 
418
                                    int32_t                  mask_y,
-
 
419
                                    int32_t                  dest_x,
-
 
420
                                    int32_t                  dest_y,
-
 
421
                                    int32_t                  width,
-
 
422
                                    int32_t                  height)
360
                                    pixman_composite_info_t *info)
-
 
361
{
423
{
362
    PIXMAN_COMPOSITE_ARGS (info);
424
    uint32_t src, srca, s;
363
    uint32_t src, srca, s;
425
    uint32_t    *dst_line, *dst, d;
364
    uint32_t    *dst_line, *dst, d;
426
    uint32_t    *mask_line, *mask, ma;
365
    uint32_t    *mask_line, *mask, ma;
427
    int dst_stride, mask_stride;
366
    int dst_stride, mask_stride;
Line 428... Line 367...
428
    int32_t w;
367
    int32_t w;
Line 429... Line 368...
429
 
368
 
430
    src = _pixman_image_get_solid (src_image, dst_image->bits.format);
369
    src = _pixman_image_get_solid (imp, src_image, dest_image->bits.format);
431
 
370
 
Line 432... Line 371...
432
    srca = src >> 24;
371
    srca = src >> 24;
433
    if (src == 0)
372
    if (src == 0)
Line 434... Line 373...
434
	return;
373
	return;
435
 
374
 
436
    PIXMAN_IMAGE_GET_LINE (dst_image, dest_x, dest_y, uint32_t, dst_stride, dst_line, 1);
375
    PIXMAN_IMAGE_GET_LINE (dest_image, dest_x, dest_y, uint32_t, dst_stride, dst_line, 1);
Line 472... Line 411...
472
    }
411
    }
473
}
412
}
Line 474... Line 413...
474
 
413
 
475
static void
414
static void
476
fast_composite_over_n_8_0888 (pixman_implementation_t *imp,
415
fast_composite_over_n_8_0888 (pixman_implementation_t *imp,
477
                              pixman_op_t              op,
-
 
478
                              pixman_image_t *         src_image,
-
 
479
                              pixman_image_t *         mask_image,
-
 
480
                              pixman_image_t *         dst_image,
-
 
481
                              int32_t                  src_x,
-
 
482
                              int32_t                  src_y,
-
 
483
                              int32_t                  mask_x,
-
 
484
                              int32_t                  mask_y,
-
 
485
                              int32_t                  dest_x,
-
 
486
                              int32_t                  dest_y,
-
 
487
                              int32_t                  width,
-
 
488
                              int32_t                  height)
416
                              pixman_composite_info_t *info)
-
 
417
{
489
{
418
    PIXMAN_COMPOSITE_ARGS (info);
490
    uint32_t src, srca;
419
    uint32_t src, srca;
491
    uint8_t     *dst_line, *dst;
420
    uint8_t     *dst_line, *dst;
492
    uint32_t d;
421
    uint32_t d;
493
    uint8_t     *mask_line, *mask, m;
422
    uint8_t     *mask_line, *mask, m;
494
    int dst_stride, mask_stride;
423
    int dst_stride, mask_stride;
Line 495... Line 424...
495
    int32_t w;
424
    int32_t w;
Line 496... Line 425...
496
 
425
 
497
    src = _pixman_image_get_solid (src_image, dst_image->bits.format);
426
    src = _pixman_image_get_solid (imp, src_image, dest_image->bits.format);
498
 
427
 
Line 499... Line 428...
499
    srca = src >> 24;
428
    srca = src >> 24;
500
    if (src == 0)
429
    if (src == 0)
Line 501... Line 430...
501
	return;
430
	return;
502
 
431
 
503
    PIXMAN_IMAGE_GET_LINE (dst_image, dest_x, dest_y, uint8_t, dst_stride, dst_line, 3);
432
    PIXMAN_IMAGE_GET_LINE (dest_image, dest_x, dest_y, uint8_t, dst_stride, dst_line, 3);
Line 537... Line 466...
537
    }
466
    }
538
}
467
}
Line 539... Line 468...
539
 
468
 
540
static void
469
static void
541
fast_composite_over_n_8_0565 (pixman_implementation_t *imp,
470
fast_composite_over_n_8_0565 (pixman_implementation_t *imp,
542
                              pixman_op_t              op,
-
 
543
                              pixman_image_t *         src_image,
-
 
544
                              pixman_image_t *         mask_image,
-
 
545
                              pixman_image_t *         dst_image,
-
 
546
                              int32_t                  src_x,
-
 
547
                              int32_t                  src_y,
-
 
548
                              int32_t                  mask_x,
-
 
549
                              int32_t                  mask_y,
-
 
550
                              int32_t                  dest_x,
-
 
551
                              int32_t                  dest_y,
-
 
552
                              int32_t                  width,
-
 
553
                              int32_t                  height)
471
                              pixman_composite_info_t *info)
-
 
472
{
554
{
473
    PIXMAN_COMPOSITE_ARGS (info);
555
    uint32_t src, srca;
474
    uint32_t src, srca;
556
    uint16_t    *dst_line, *dst;
475
    uint16_t    *dst_line, *dst;
557
    uint32_t d;
476
    uint32_t d;
558
    uint8_t     *mask_line, *mask, m;
477
    uint8_t     *mask_line, *mask, m;
559
    int dst_stride, mask_stride;
478
    int dst_stride, mask_stride;
Line 560... Line 479...
560
    int32_t w;
479
    int32_t w;
Line 561... Line 480...
561
 
480
 
562
    src = _pixman_image_get_solid (src_image, dst_image->bits.format);
481
    src = _pixman_image_get_solid (imp, src_image, dest_image->bits.format);
563
 
482
 
Line 564... Line 483...
564
    srca = src >> 24;
483
    srca = src >> 24;
565
    if (src == 0)
484
    if (src == 0)
Line 566... Line 485...
566
	return;
485
	return;
567
 
486
 
568
    PIXMAN_IMAGE_GET_LINE (dst_image, dest_x, dest_y, uint16_t, dst_stride, dst_line, 1);
487
    PIXMAN_IMAGE_GET_LINE (dest_image, dest_x, dest_y, uint16_t, dst_stride, dst_line, 1);
Line 586... Line 505...
586
		    d = src;
505
		    d = src;
587
		}
506
		}
588
		else
507
		else
589
		{
508
		{
590
		    d = *dst;
509
		    d = *dst;
591
		    d = over (src, CONVERT_0565_TO_0888 (d));
510
		    d = over (src, convert_0565_to_0888 (d));
592
		}
511
		}
593
		*dst = CONVERT_8888_TO_0565 (d);
512
		*dst = convert_8888_to_0565 (d);
594
	    }
513
	    }
595
	    else if (m)
514
	    else if (m)
596
	    {
515
	    {
597
		d = *dst;
516
		d = *dst;
598
		d = over (in (src, m), CONVERT_0565_TO_0888 (d));
517
		d = over (in (src, m), convert_0565_to_0888 (d));
599
		*dst = CONVERT_8888_TO_0565 (d);
518
		*dst = convert_8888_to_0565 (d);
600
	    }
519
	    }
601
	    dst++;
520
	    dst++;
602
	}
521
	}
603
    }
522
    }
604
}
523
}
Line 605... Line 524...
605
 
524
 
606
static void
525
static void
607
fast_composite_over_n_8888_0565_ca (pixman_implementation_t *imp,
526
fast_composite_over_n_8888_0565_ca (pixman_implementation_t *imp,
608
                                    pixman_op_t              op,
-
 
609
                                    pixman_image_t *         src_image,
-
 
610
                                    pixman_image_t *         mask_image,
-
 
611
                                    pixman_image_t *         dst_image,
-
 
612
                                    int32_t                  src_x,
-
 
613
                                    int32_t                  src_y,
-
 
614
                                    int32_t                  mask_x,
-
 
615
                                    int32_t                  mask_y,
-
 
616
                                    int32_t                  dest_x,
-
 
617
                                    int32_t                  dest_y,
-
 
618
                                    int32_t                  width,
-
 
619
                                    int32_t                  height)
527
                                    pixman_composite_info_t *info)
-
 
528
{
620
{
529
    PIXMAN_COMPOSITE_ARGS (info);
621
    uint32_t  src, srca, s;
530
    uint32_t  src, srca, s;
622
    uint16_t  src16;
531
    uint16_t  src16;
623
    uint16_t *dst_line, *dst;
532
    uint16_t *dst_line, *dst;
624
    uint32_t  d;
533
    uint32_t  d;
625
    uint32_t *mask_line, *mask, ma;
534
    uint32_t *mask_line, *mask, ma;
626
    int dst_stride, mask_stride;
535
    int dst_stride, mask_stride;
Line 627... Line 536...
627
    int32_t w;
536
    int32_t w;
Line 628... Line 537...
628
 
537
 
629
    src = _pixman_image_get_solid (src_image, dst_image->bits.format);
538
    src = _pixman_image_get_solid (imp, src_image, dest_image->bits.format);
630
 
539
 
Line 631... Line 540...
631
    srca = src >> 24;
540
    srca = src >> 24;
Line 632... Line 541...
632
    if (src == 0)
541
    if (src == 0)
633
	return;
542
	return;
Line 634... Line 543...
634
 
543
 
635
    src16 = CONVERT_8888_TO_0565 (src);
544
    src16 = convert_8888_to_0565 (src);
636
 
545
 
Line 655... Line 564...
655
		    *dst = src16;
564
		    *dst = src16;
656
		}
565
		}
657
		else
566
		else
658
		{
567
		{
659
		    d = *dst;
568
		    d = *dst;
660
		    d = over (src, CONVERT_0565_TO_0888 (d));
569
		    d = over (src, convert_0565_to_0888 (d));
661
		    *dst = CONVERT_8888_TO_0565 (d);
570
		    *dst = convert_8888_to_0565 (d);
662
		}
571
		}
663
	    }
572
	    }
664
	    else if (ma)
573
	    else if (ma)
665
	    {
574
	    {
666
		d = *dst;
575
		d = *dst;
667
		d = CONVERT_0565_TO_0888 (d);
576
		d = convert_0565_to_0888 (d);
Line 668... Line 577...
668
 
577
 
Line 669... Line 578...
669
		s = src;
578
		s = src;
670
 
579
 
671
		UN8x4_MUL_UN8x4 (s, ma);
580
		UN8x4_MUL_UN8x4 (s, ma);
672
		UN8x4_MUL_UN8 (ma, srca);
581
		UN8x4_MUL_UN8 (ma, srca);
Line 673... Line 582...
673
		ma = ~ma;
582
		ma = ~ma;
674
		UN8x4_MUL_UN8x4_ADD_UN8x4 (d, ma, s);
583
		UN8x4_MUL_UN8x4_ADD_UN8x4 (d, ma, s);
675
 
584
 
676
		*dst = CONVERT_8888_TO_0565 (d);
585
		*dst = convert_8888_to_0565 (d);
677
	    }
586
	    }
678
	    dst++;
587
	    dst++;
Line 679... Line 588...
679
	}
588
	}
680
    }
589
    }
681
}
590
}
682
 
-
 
683
static void
-
 
684
fast_composite_over_8888_8888 (pixman_implementation_t *imp,
-
 
685
                               pixman_op_t              op,
-
 
686
                               pixman_image_t *         src_image,
-
 
687
                               pixman_image_t *         mask_image,
-
 
688
                               pixman_image_t *         dst_image,
-
 
689
                               int32_t                  src_x,
-
 
690
                               int32_t                  src_y,
-
 
691
                               int32_t                  mask_x,
-
 
692
                               int32_t                  mask_y,
-
 
693
                               int32_t                  dest_x,
591
 
-
 
592
static void
694
                               int32_t                  dest_y,
593
fast_composite_over_8888_8888 (pixman_implementation_t *imp,
695
                               int32_t                  width,
594
                               pixman_composite_info_t *info)
696
                               int32_t                  height)
595
{
697
{
596
    PIXMAN_COMPOSITE_ARGS (info);
698
    uint32_t    *dst_line, *dst;
597
    uint32_t    *dst_line, *dst;
Line 699... Line 598...
699
    uint32_t    *src_line, *src, s;
598
    uint32_t    *src_line, *src, s;
700
    int dst_stride, src_stride;
599
    int dst_stride, src_stride;
Line 701... Line 600...
701
    uint8_t a;
600
    uint8_t a;
702
    int32_t w;
601
    int32_t w;
703
 
602
 
Line 725... Line 624...
725
    }
624
    }
726
}
625
}
Line 727... Line 626...
727
 
626
 
728
static void
627
static void
729
fast_composite_src_x888_8888 (pixman_implementation_t *imp,
628
fast_composite_src_x888_8888 (pixman_implementation_t *imp,
730
			      pixman_op_t              op,
-
 
731
			      pixman_image_t *         src_image,
-
 
732
			      pixman_image_t *         mask_image,
-
 
733
			      pixman_image_t *         dst_image,
-
 
734
			      int32_t                  src_x,
-
 
735
			      int32_t                  src_y,
-
 
736
			      int32_t                  mask_x,
-
 
737
			      int32_t                  mask_y,
-
 
738
			      int32_t                  dest_x,
-
 
739
			      int32_t                  dest_y,
-
 
740
			      int32_t                  width,
-
 
741
			      int32_t                  height)
629
			      pixman_composite_info_t *info)
-
 
630
{
742
{
631
    PIXMAN_COMPOSITE_ARGS (info);
743
    uint32_t    *dst_line, *dst;
632
    uint32_t    *dst_line, *dst;
744
    uint32_t    *src_line, *src;
633
    uint32_t    *src_line, *src;
745
    int dst_stride, src_stride;
634
    int dst_stride, src_stride;
Line 746... Line 635...
746
    int32_t w;
635
    int32_t w;
747
 
636
 
Line 748... Line 637...
748
    PIXMAN_IMAGE_GET_LINE (dst_image, dest_x, dest_y, uint32_t, dst_stride, dst_line, 1);
637
    PIXMAN_IMAGE_GET_LINE (dest_image, dest_x, dest_y, uint32_t, dst_stride, dst_line, 1);
749
    PIXMAN_IMAGE_GET_LINE (src_image, src_x, src_y, uint32_t, src_stride, src_line, 1);
638
    PIXMAN_IMAGE_GET_LINE (src_image, src_x, src_y, uint32_t, src_stride, src_line, 1);
750
 
639
 
Line 762... Line 651...
762
}
651
}
Line 763... Line 652...
763
 
652
 
764
#if 0
653
#if 0
765
static void
654
static void
766
fast_composite_over_8888_0888 (pixman_implementation_t *imp,
655
fast_composite_over_8888_0888 (pixman_implementation_t *imp,
767
			       pixman_op_t              op,
-
 
768
			       pixman_image_t *         src_image,
-
 
769
			       pixman_image_t *         mask_image,
-
 
770
			       pixman_image_t *         dst_image,
-
 
771
			       int32_t                  src_x,
-
 
772
			       int32_t                  src_y,
-
 
773
			       int32_t                  mask_x,
-
 
774
			       int32_t                  mask_y,
-
 
775
			       int32_t                  dest_x,
-
 
776
			       int32_t                  dest_y,
-
 
777
			       int32_t                  width,
-
 
778
			       int32_t                  height)
656
			       pixman_composite_info_t *info)
-
 
657
{
779
{
658
    PIXMAN_COMPOSITE_ARGS (info);
780
    uint8_t     *dst_line, *dst;
659
    uint8_t     *dst_line, *dst;
781
    uint32_t d;
660
    uint32_t d;
782
    uint32_t    *src_line, *src, s;
661
    uint32_t    *src_line, *src, s;
783
    uint8_t a;
662
    uint8_t a;
784
    int dst_stride, src_stride;
663
    int dst_stride, src_stride;
Line 785... Line 664...
785
    int32_t w;
664
    int32_t w;
786
 
665
 
Line 787... Line 666...
787
    PIXMAN_IMAGE_GET_LINE (dst_image, dest_x, dest_y, uint8_t, dst_stride, dst_line, 3);
666
    PIXMAN_IMAGE_GET_LINE (dest_image, dest_x, dest_y, uint8_t, dst_stride, dst_line, 3);
788
    PIXMAN_IMAGE_GET_LINE (src_image, src_x, src_y, uint32_t, src_stride, src_line, 1);
667
    PIXMAN_IMAGE_GET_LINE (src_image, src_x, src_y, uint32_t, src_stride, src_line, 1);
789
 
668
 
Line 814... Line 693...
814
}
693
}
815
#endif
694
#endif
Line 816... Line 695...
816
 
695
 
817
static void
696
static void
818
fast_composite_over_8888_0565 (pixman_implementation_t *imp,
697
fast_composite_over_8888_0565 (pixman_implementation_t *imp,
819
                               pixman_op_t              op,
-
 
820
                               pixman_image_t *         src_image,
-
 
821
                               pixman_image_t *         mask_image,
-
 
822
                               pixman_image_t *         dst_image,
-
 
823
                               int32_t                  src_x,
-
 
824
                               int32_t                  src_y,
-
 
825
                               int32_t                  mask_x,
-
 
826
                               int32_t                  mask_y,
-
 
827
                               int32_t                  dest_x,
-
 
828
                               int32_t                  dest_y,
-
 
829
                               int32_t                  width,
-
 
830
                               int32_t                  height)
698
                               pixman_composite_info_t *info)
-
 
699
{
831
{
700
    PIXMAN_COMPOSITE_ARGS (info);
832
    uint16_t    *dst_line, *dst;
701
    uint16_t    *dst_line, *dst;
833
    uint32_t d;
702
    uint32_t d;
834
    uint32_t    *src_line, *src, s;
703
    uint32_t    *src_line, *src, s;
835
    uint8_t a;
704
    uint8_t a;
836
    int dst_stride, src_stride;
705
    int dst_stride, src_stride;
Line 837... Line 706...
837
    int32_t w;
706
    int32_t w;
838
 
707
 
Line 839... Line 708...
839
    PIXMAN_IMAGE_GET_LINE (src_image, src_x, src_y, uint32_t, src_stride, src_line, 1);
708
    PIXMAN_IMAGE_GET_LINE (src_image, src_x, src_y, uint32_t, src_stride, src_line, 1);
840
    PIXMAN_IMAGE_GET_LINE (dst_image, dest_x, dest_y, uint16_t, dst_stride, dst_line, 1);
709
    PIXMAN_IMAGE_GET_LINE (dest_image, dest_x, dest_y, uint16_t, dst_stride, dst_line, 1);
841
 
710
 
842
    while (height--)
711
    while (height--)
Line 858... Line 727...
858
		    d = s;
727
		    d = s;
859
		}
728
		}
860
		else
729
		else
861
		{
730
		{
862
		    d = *dst;
731
		    d = *dst;
863
		    d = over (s, CONVERT_0565_TO_0888 (d));
732
		    d = over (s, convert_0565_to_0888 (d));
864
		}
733
		}
865
		*dst = CONVERT_8888_TO_0565 (d);
734
		*dst = convert_8888_to_0565 (d);
866
	    }
735
	    }
867
	    dst++;
736
	    dst++;
868
	}
737
	}
869
    }
738
    }
870
}
739
}
Line 871... Line 740...
871
 
740
 
872
static void
741
static void
873
fast_composite_src_x888_0565 (pixman_implementation_t *imp,
742
fast_composite_add_8_8 (pixman_implementation_t *imp,
874
                              pixman_op_t              op,
-
 
875
                              pixman_image_t *         src_image,
-
 
876
                              pixman_image_t *         mask_image,
-
 
877
                              pixman_image_t *         dst_image,
-
 
878
                              int32_t                  src_x,
-
 
879
                              int32_t                  src_y,
-
 
880
                              int32_t                  mask_x,
-
 
881
                              int32_t                  mask_y,
-
 
882
                              int32_t                  dest_x,
-
 
883
                              int32_t                  dest_y,
-
 
884
                              int32_t                  width,
-
 
885
                              int32_t                  height)
743
			pixman_composite_info_t *info)
-
 
744
{
886
{
745
    PIXMAN_COMPOSITE_ARGS (info);
887
    uint16_t    *dst_line, *dst;
746
    uint8_t     *dst_line, *dst;
888
    uint32_t    *src_line, *src, s;
747
    uint8_t     *src_line, *src;
889
    int dst_stride, src_stride;
748
    int dst_stride, src_stride;
-
 
749
    int32_t w;
-
 
750
    uint8_t s, d;
Line 890... Line 751...
890
    int32_t w;
751
    uint16_t t;
891
 
752
 
Line 892... Line 753...
892
    PIXMAN_IMAGE_GET_LINE (src_image, src_x, src_y, uint32_t, src_stride, src_line, 1);
753
    PIXMAN_IMAGE_GET_LINE (src_image, src_x, src_y, uint8_t, src_stride, src_line, 1);
893
    PIXMAN_IMAGE_GET_LINE (dst_image, dest_x, dest_y, uint16_t, dst_stride, dst_line, 1);
754
    PIXMAN_IMAGE_GET_LINE (dest_image, dest_x, dest_y, uint8_t, dst_stride, dst_line, 1);
894
 
755
 
895
    while (height--)
756
    while (height--)
Line 901... Line 762...
901
	w = width;
762
	w = width;
Line 902... Line 763...
902
 
763
 
903
	while (w--)
764
	while (w--)
904
	{
765
	{
-
 
766
	    s = *src++;
-
 
767
	    if (s)
-
 
768
	    {
-
 
769
		if (s != 0xff)
-
 
770
		{
-
 
771
		    d = *dst;
905
	    s = *src++;
772
		    t = d + s;
-
 
773
		    s = t | (0 - (t >> 8));
-
 
774
		}
-
 
775
		*dst = s;
906
	    *dst = CONVERT_8888_TO_0565 (s);
776
	    }
907
	    dst++;
777
	    dst++;
908
	}
778
	}
909
    }
779
    }
Line 910... Line 780...
910
}
780
}
911
 
781
 
912
static void
-
 
913
fast_composite_add_8_8 (pixman_implementation_t *imp,
-
 
914
			pixman_op_t              op,
-
 
915
			pixman_image_t *         src_image,
-
 
916
			pixman_image_t *         mask_image,
-
 
917
			pixman_image_t *         dst_image,
-
 
918
			int32_t                  src_x,
782
static void
919
			int32_t                  src_y,
-
 
920
			int32_t                  mask_x,
-
 
921
			int32_t                  mask_y,
-
 
922
			int32_t                  dest_x,
-
 
923
			int32_t                  dest_y,
-
 
924
			int32_t                  width,
783
fast_composite_add_0565_0565 (pixman_implementation_t *imp,
-
 
784
                              pixman_composite_info_t *info)
925
			int32_t                  height)
785
{
-
 
786
    PIXMAN_COMPOSITE_ARGS (info);
926
{
787
    uint16_t    *dst_line, *dst;
-
 
788
    uint32_t	d;
927
    uint8_t     *dst_line, *dst;
789
    uint16_t    *src_line, *src;
928
    uint8_t     *src_line, *src;
790
    uint32_t	s;
929
    int dst_stride, src_stride;
-
 
930
    int32_t w;
-
 
Line 931... Line 791...
931
    uint8_t s, d;
791
    int dst_stride, src_stride;
932
    uint16_t t;
792
    int32_t w;
Line 933... Line 793...
933
 
793
 
934
    PIXMAN_IMAGE_GET_LINE (src_image, src_x, src_y, uint8_t, src_stride, src_line, 1);
794
    PIXMAN_IMAGE_GET_LINE (src_image, src_x, src_y, uint16_t, src_stride, src_line, 1);
935
    PIXMAN_IMAGE_GET_LINE (dst_image, dest_x, dest_y, uint8_t, dst_stride, dst_line, 1);
795
    PIXMAN_IMAGE_GET_LINE (dest_image, dest_x, dest_y, uint16_t, dst_stride, dst_line, 1);
936
 
796
 
Line 945... Line 805...
945
	while (w--)
805
	while (w--)
946
	{
806
	{
947
	    s = *src++;
807
	    s = *src++;
948
	    if (s)
808
	    if (s)
949
	    {
809
	    {
950
		if (s != 0xff)
-
 
951
		{
-
 
952
		    d = *dst;
810
		d = *dst;
-
 
811
		s = convert_0565_to_8888 (s);
953
		    t = d + s;
812
		if (d)
-
 
813
		{
954
		    s = t | (0 - (t >> 8));
814
		    d = convert_0565_to_8888 (d);
-
 
815
		    UN8x4_ADD_UN8x4 (s, d);
955
		}
816
		}
956
		*dst = s;
817
		*dst = convert_8888_to_0565 (s);
957
	    }
818
	    }
958
	    dst++;
819
	    dst++;
959
	}
820
	}
960
    }
821
    }
961
}
822
}
Line 962... Line 823...
962
 
823
 
963
static void
824
static void
964
fast_composite_add_8888_8888 (pixman_implementation_t *imp,
825
fast_composite_add_8888_8888 (pixman_implementation_t *imp,
965
                              pixman_op_t              op,
-
 
966
                              pixman_image_t *         src_image,
-
 
967
                              pixman_image_t *         mask_image,
-
 
968
                              pixman_image_t *         dst_image,
-
 
969
                              int32_t                  src_x,
-
 
970
                              int32_t                  src_y,
-
 
971
                              int32_t                  mask_x,
-
 
972
                              int32_t                  mask_y,
-
 
973
                              int32_t                  dest_x,
-
 
974
                              int32_t                  dest_y,
-
 
975
                              int32_t                  width,
-
 
976
                              int32_t                  height)
826
                              pixman_composite_info_t *info)
-
 
827
{
977
{
828
    PIXMAN_COMPOSITE_ARGS (info);
978
    uint32_t    *dst_line, *dst;
829
    uint32_t    *dst_line, *dst;
979
    uint32_t    *src_line, *src;
830
    uint32_t    *src_line, *src;
980
    int dst_stride, src_stride;
831
    int dst_stride, src_stride;
981
    int32_t w;
832
    int32_t w;
Line 982... Line 833...
982
    uint32_t s, d;
833
    uint32_t s, d;
983
 
834
 
Line 984... Line 835...
984
    PIXMAN_IMAGE_GET_LINE (src_image, src_x, src_y, uint32_t, src_stride, src_line, 1);
835
    PIXMAN_IMAGE_GET_LINE (src_image, src_x, src_y, uint32_t, src_stride, src_line, 1);
985
    PIXMAN_IMAGE_GET_LINE (dst_image, dest_x, dest_y, uint32_t, dst_stride, dst_line, 1);
836
    PIXMAN_IMAGE_GET_LINE (dest_image, dest_x, dest_y, uint32_t, dst_stride, dst_line, 1);
986
 
837
 
987
    while (height--)
838
    while (height--)
Line 1010... Line 861...
1010
    }
861
    }
1011
}
862
}
Line 1012... Line 863...
1012
 
863
 
1013
static void
864
static void
1014
fast_composite_add_n_8_8 (pixman_implementation_t *imp,
865
fast_composite_add_n_8_8 (pixman_implementation_t *imp,
1015
			  pixman_op_t              op,
-
 
1016
			  pixman_image_t *         src_image,
-
 
1017
			  pixman_image_t *         mask_image,
-
 
1018
			  pixman_image_t *         dst_image,
-
 
1019
			  int32_t                  src_x,
-
 
1020
			  int32_t                  src_y,
-
 
1021
			  int32_t                  mask_x,
-
 
1022
			  int32_t                  mask_y,
-
 
1023
			  int32_t                  dest_x,
-
 
1024
			  int32_t                  dest_y,
-
 
1025
			  int32_t                  width,
-
 
1026
			  int32_t                  height)
866
			  pixman_composite_info_t *info)
-
 
867
{
1027
{
868
    PIXMAN_COMPOSITE_ARGS (info);
1028
    uint8_t     *dst_line, *dst;
869
    uint8_t     *dst_line, *dst;
1029
    uint8_t     *mask_line, *mask;
870
    uint8_t     *mask_line, *mask;
1030
    int dst_stride, mask_stride;
871
    int dst_stride, mask_stride;
1031
    int32_t w;
872
    int32_t w;
1032
    uint32_t src;
873
    uint32_t src;
Line 1033... Line 874...
1033
    uint8_t sa;
874
    uint8_t sa;
1034
 
875
 
1035
    PIXMAN_IMAGE_GET_LINE (dst_image, dest_x, dest_y, uint8_t, dst_stride, dst_line, 1);
876
    PIXMAN_IMAGE_GET_LINE (dest_image, dest_x, dest_y, uint8_t, dst_stride, dst_line, 1);
1036
    PIXMAN_IMAGE_GET_LINE (mask_image, mask_x, mask_y, uint8_t, mask_stride, mask_line, 1);
877
    PIXMAN_IMAGE_GET_LINE (mask_image, mask_x, mask_y, uint8_t, mask_stride, mask_line, 1);
Line 1037... Line 878...
1037
    src = _pixman_image_get_solid (src_image, dst_image->bits.format);
878
    src = _pixman_image_get_solid (imp, src_image, dest_image->bits.format);
1038
    sa = (src >> 24);
879
    sa = (src >> 24);
1039
 
880
 
Line 1075... Line 916...
1075
    (*((p) + ((n) >> 5)) & CREATE_BITMASK ((n) & 31))
916
    (*((p) + ((n) >> 5)) & CREATE_BITMASK ((n) & 31))
1076
#define SET_BIT(p, n)							\
917
#define SET_BIT(p, n)							\
1077
    do { *((p) + ((n) >> 5)) |= CREATE_BITMASK ((n) & 31); } while (0);
918
    do { *((p) + ((n) >> 5)) |= CREATE_BITMASK ((n) & 31); } while (0);
Line 1078... Line 919...
1078
 
919
 
1079
static void
920
static void
1080
fast_composite_add_1000_1000 (pixman_implementation_t *imp,
921
fast_composite_add_1_1 (pixman_implementation_t *imp,
1081
                              pixman_op_t              op,
-
 
1082
                              pixman_image_t *         src_image,
-
 
1083
                              pixman_image_t *         mask_image,
-
 
1084
                              pixman_image_t *         dst_image,
-
 
1085
                              int32_t                  src_x,
-
 
1086
                              int32_t                  src_y,
-
 
1087
                              int32_t                  mask_x,
-
 
1088
                              int32_t                  mask_y,
-
 
1089
                              int32_t                  dest_x,
-
 
1090
                              int32_t                  dest_y,
-
 
1091
                              int32_t                  width,
-
 
1092
                              int32_t                  height)
922
			pixman_composite_info_t *info)
-
 
923
{
1093
{
924
    PIXMAN_COMPOSITE_ARGS (info);
1094
    uint32_t     *dst_line, *dst;
925
    uint32_t     *dst_line, *dst;
1095
    uint32_t     *src_line, *src;
926
    uint32_t     *src_line, *src;
1096
    int           dst_stride, src_stride;
927
    int           dst_stride, src_stride;
Line 1097... Line 928...
1097
    int32_t       w;
928
    int32_t       w;
1098
 
929
 
1099
    PIXMAN_IMAGE_GET_LINE (src_image, 0, src_y, uint32_t,
930
    PIXMAN_IMAGE_GET_LINE (src_image, 0, src_y, uint32_t,
1100
                           src_stride, src_line, 1);
931
                           src_stride, src_line, 1);
Line 1101... Line 932...
1101
    PIXMAN_IMAGE_GET_LINE (dst_image, 0, dest_y, uint32_t,
932
    PIXMAN_IMAGE_GET_LINE (dest_image, 0, dest_y, uint32_t,
1102
                           dst_stride, dst_line, 1);
933
                           dst_stride, dst_line, 1);
1103
 
934
 
Line 1121... Line 952...
1121
    }
952
    }
1122
}
953
}
Line 1123... Line 954...
1123
 
954
 
1124
static void
955
static void
1125
fast_composite_over_n_1_8888 (pixman_implementation_t *imp,
956
fast_composite_over_n_1_8888 (pixman_implementation_t *imp,
1126
                              pixman_op_t              op,
-
 
1127
                              pixman_image_t *         src_image,
-
 
1128
                              pixman_image_t *         mask_image,
-
 
1129
                              pixman_image_t *         dst_image,
-
 
1130
                              int32_t                  src_x,
-
 
1131
                              int32_t                  src_y,
-
 
1132
                              int32_t                  mask_x,
-
 
1133
                              int32_t                  mask_y,
-
 
1134
                              int32_t                  dest_x,
-
 
1135
                              int32_t                  dest_y,
-
 
1136
                              int32_t                  width,
-
 
1137
                              int32_t                  height)
957
                              pixman_composite_info_t *info)
-
 
958
{
1138
{
959
    PIXMAN_COMPOSITE_ARGS (info);
1139
    uint32_t     src, srca;
960
    uint32_t     src, srca;
1140
    uint32_t    *dst, *dst_line;
961
    uint32_t    *dst, *dst_line;
1141
    uint32_t    *mask, *mask_line;
962
    uint32_t    *mask, *mask_line;
1142
    int          mask_stride, dst_stride;
963
    int          mask_stride, dst_stride;
1143
    uint32_t     bitcache, bitmask;
964
    uint32_t     bitcache, bitmask;
Line 1144... Line 965...
1144
    int32_t      w;
965
    int32_t      w;
1145
 
966
 
Line 1146... Line 967...
1146
    if (width <= 0)
967
    if (width <= 0)
1147
	return;
968
	return;
1148
 
969
 
1149
    src = _pixman_image_get_solid (src_image, dst_image->bits.format);
970
    src = _pixman_image_get_solid (imp, src_image, dest_image->bits.format);
Line 1150... Line 971...
1150
    srca = src >> 24;
971
    srca = src >> 24;
1151
    if (src == 0)
972
    if (src == 0)
1152
	return;
973
	return;
1153
 
974
 
1154
    PIXMAN_IMAGE_GET_LINE (dst_image, dest_x, dest_y, uint32_t,
975
    PIXMAN_IMAGE_GET_LINE (dest_image, dest_x, dest_y, uint32_t,
Line 1213... Line 1034...
1213
    }
1034
    }
1214
}
1035
}
Line 1215... Line 1036...
1215
 
1036
 
1216
static void
1037
static void
1217
fast_composite_over_n_1_0565 (pixman_implementation_t *imp,
1038
fast_composite_over_n_1_0565 (pixman_implementation_t *imp,
1218
                              pixman_op_t              op,
-
 
1219
                              pixman_image_t *         src_image,
-
 
1220
                              pixman_image_t *         mask_image,
-
 
1221
                              pixman_image_t *         dst_image,
-
 
1222
                              int32_t                  src_x,
-
 
1223
                              int32_t                  src_y,
-
 
1224
                              int32_t                  mask_x,
-
 
1225
                              int32_t                  mask_y,
-
 
1226
                              int32_t                  dest_x,
-
 
1227
                              int32_t                  dest_y,
-
 
1228
                              int32_t                  width,
-
 
1229
                              int32_t                  height)
1039
                              pixman_composite_info_t *info)
-
 
1040
{
1230
{
1041
    PIXMAN_COMPOSITE_ARGS (info);
1231
    uint32_t     src, srca;
1042
    uint32_t     src, srca;
1232
    uint16_t    *dst, *dst_line;
1043
    uint16_t    *dst, *dst_line;
1233
    uint32_t    *mask, *mask_line;
1044
    uint32_t    *mask, *mask_line;
1234
    int          mask_stride, dst_stride;
1045
    int          mask_stride, dst_stride;
Line 1238... Line 1049...
1238
    uint16_t     src565;
1049
    uint16_t     src565;
Line 1239... Line 1050...
1239
 
1050
 
1240
    if (width <= 0)
1051
    if (width <= 0)
Line 1241... Line 1052...
1241
	return;
1052
	return;
1242
 
1053
 
1243
    src = _pixman_image_get_solid (src_image, dst_image->bits.format);
1054
    src = _pixman_image_get_solid (imp, src_image, dest_image->bits.format);
1244
    srca = src >> 24;
1055
    srca = src >> 24;
Line 1245... Line 1056...
1245
    if (src == 0)
1056
    if (src == 0)
1246
	return;
1057
	return;
1247
 
1058
 
1248
    PIXMAN_IMAGE_GET_LINE (dst_image, dest_x, dest_y, uint16_t,
1059
    PIXMAN_IMAGE_GET_LINE (dest_image, dest_x, dest_y, uint16_t,
1249
                           dst_stride, dst_line, 1);
1060
                           dst_stride, dst_line, 1);
Line 1250... Line 1061...
1250
    PIXMAN_IMAGE_GET_LINE (mask_image, 0, mask_y, uint32_t,
1061
    PIXMAN_IMAGE_GET_LINE (mask_image, 0, mask_y, uint32_t,
1251
                           mask_stride, mask_line, 1);
1062
                           mask_stride, mask_line, 1);
1252
    mask_line += mask_x >> 5;
1063
    mask_line += mask_x >> 5;
1253
 
1064
 
1254
    if (srca == 0xff)
1065
    if (srca == 0xff)
1255
    {
1066
    {
1256
	src565 = CONVERT_8888_TO_0565 (src);
1067
	src565 = convert_8888_to_0565 (src);
1257
	while (height--)
1068
	while (height--)
Line 1299... Line 1110...
1299
		    bitcache = *mask++;
1110
		    bitcache = *mask++;
1300
		    bitmask = CREATE_BITMASK (0);
1111
		    bitmask = CREATE_BITMASK (0);
1301
		}
1112
		}
1302
		if (bitcache & bitmask)
1113
		if (bitcache & bitmask)
1303
		{
1114
		{
1304
		    d = over (src, CONVERT_0565_TO_0888 (*dst));
1115
		    d = over (src, convert_0565_to_0888 (*dst));
1305
		    *dst = CONVERT_8888_TO_0565 (d);
1116
		    *dst = convert_8888_to_0565 (d);
1306
		}
1117
		}
1307
		bitmask = UPDATE_BITMASK (bitmask);
1118
		bitmask = UPDATE_BITMASK (bitmask);
1308
		dst++;
1119
		dst++;
1309
	    }
1120
	    }
1310
	}
1121
	}
Line 1315... Line 1126...
1315
 * Simple bitblt
1126
 * Simple bitblt
1316
 */
1127
 */
Line 1317... Line 1128...
1317
 
1128
 
1318
static void
1129
static void
1319
fast_composite_solid_fill (pixman_implementation_t *imp,
1130
fast_composite_solid_fill (pixman_implementation_t *imp,
1320
                           pixman_op_t              op,
-
 
1321
                           pixman_image_t *         src_image,
-
 
1322
                           pixman_image_t *         mask_image,
-
 
1323
                           pixman_image_t *         dst_image,
-
 
1324
                           int32_t                  src_x,
-
 
1325
                           int32_t                  src_y,
-
 
1326
                           int32_t                  mask_x,
-
 
1327
                           int32_t                  mask_y,
-
 
1328
                           int32_t                  dest_x,
-
 
1329
                           int32_t                  dest_y,
-
 
1330
                           int32_t                  width,
-
 
1331
                           int32_t                  height)
1131
                           pixman_composite_info_t *info)
-
 
1132
{
1332
{
1133
    PIXMAN_COMPOSITE_ARGS (info);
Line 1333... Line 1134...
1333
    uint32_t src;
1134
    uint32_t src;
Line 1334... Line 1135...
1334
 
1135
 
-
 
1136
    src = _pixman_image_get_solid (imp, src_image, dest_image->bits.format);
-
 
1137
 
-
 
1138
    if (dest_image->bits.format == PIXMAN_a1)
-
 
1139
    {
1335
    src = _pixman_image_get_solid (src_image, dst_image->bits.format);
1140
	src = src >> 31;
1336
 
1141
    }
1337
    if (dst_image->bits.format == PIXMAN_a8)
1142
    else if (dest_image->bits.format == PIXMAN_a8)
1338
    {
1143
    {
1339
	src = src >> 24;
1144
	src = src >> 24;
1340
    }
1145
    }
1341
    else if (dst_image->bits.format == PIXMAN_r5g6b5 ||
1146
    else if (dest_image->bits.format == PIXMAN_r5g6b5 ||
1342
             dst_image->bits.format == PIXMAN_b5g6r5)
1147
             dest_image->bits.format == PIXMAN_b5g6r5)
Line 1343... Line 1148...
1343
    {
1148
    {
1344
	src = CONVERT_8888_TO_0565 (src);
1149
	src = convert_8888_to_0565 (src);
1345
    }
1150
    }
1346
 
1151
 
1347
    pixman_fill (dst_image->bits.bits, dst_image->bits.rowstride,
1152
    pixman_fill (dest_image->bits.bits, dest_image->bits.rowstride,
1348
                 PIXMAN_FORMAT_BPP (dst_image->bits.format),
1153
                 PIXMAN_FORMAT_BPP (dest_image->bits.format),
Line 1349... Line 1154...
1349
                 dest_x, dest_y,
1154
                 dest_x, dest_y,
1350
                 width, height,
1155
                 width, height,
1351
                 src);
1156
                 src);
1352
}
-
 
1353
 
-
 
1354
static void
-
 
1355
fast_composite_src_memcpy (pixman_implementation_t *imp,
-
 
1356
			   pixman_op_t              op,
-
 
1357
			   pixman_image_t *         src_image,
-
 
1358
			   pixman_image_t *         mask_image,
-
 
1359
			   pixman_image_t *         dst_image,
-
 
1360
			   int32_t                  src_x,
-
 
1361
			   int32_t                  src_y,
-
 
1362
			   int32_t                  mask_x,
-
 
1363
			   int32_t                  mask_y,
1157
}
-
 
1158
 
1364
			   int32_t                  dest_x,
1159
static void
1365
			   int32_t                  dest_y,
1160
fast_composite_src_memcpy (pixman_implementation_t *imp,
1366
			   int32_t                  width,
1161
			   pixman_composite_info_t *info)
1367
			   int32_t                  height)
1162
{
1368
{
1163
    PIXMAN_COMPOSITE_ARGS (info);
Line 1369... Line 1164...
1369
    int bpp = PIXMAN_FORMAT_BPP (dst_image->bits.format) / 8;
1164
    int bpp = PIXMAN_FORMAT_BPP (dest_image->bits.format) / 8;
1370
    uint32_t n_bytes = width * bpp;
1165
    uint32_t n_bytes = width * bpp;
Line 1371... Line 1166...
1371
    int dst_stride, src_stride;
1166
    int dst_stride, src_stride;
1372
    uint8_t    *dst;
1167
    uint8_t    *dst;
Line 1373... Line 1168...
1373
    uint8_t    *src;
1168
    uint8_t    *src;
1374
 
1169
 
1375
    src_stride = src_image->bits.rowstride * 4;
1170
    src_stride = src_image->bits.rowstride * 4;
Line 1376... Line 1171...
1376
    dst_stride = dst_image->bits.rowstride * 4;
1171
    dst_stride = dest_image->bits.rowstride * 4;
1377
 
1172
 
1378
    src = (uint8_t *)src_image->bits.bits + src_y * src_stride + src_x * bpp;
1173
    src = (uint8_t *)src_image->bits.bits + src_y * src_stride + src_x * bpp;
1379
    dst = (uint8_t *)dst_image->bits.bits + dest_y * dst_stride + dest_x * bpp;
1174
    dst = (uint8_t *)dest_image->bits.bits + dest_y * dst_stride + dest_x * bpp;
Line 1380... Line 1175...
1380
 
1175
 
1381
    while (height--)
1176
    while (height--)
1382
    {
1177
    {
1383
	memcpy (dst, src, n_bytes);
1178
	memcpy (dst, src, n_bytes);
-
 
1179
 
-
 
1180
	dst += dst_stride;
-
 
1181
	src += src_stride;
1384
 
1182
    }
1385
	dst += dst_stride;
1183
}
1386
	src += src_stride;
1184
 
1387
    }
1185
FAST_NEAREST (8888_8888_cover, 8888, 8888, uint32_t, uint32_t, SRC, COVER)
1388
}
1186
FAST_NEAREST (8888_8888_none, 8888, 8888, uint32_t, uint32_t, SRC, NONE)
1389
 
1187
FAST_NEAREST (8888_8888_pad, 8888, 8888, uint32_t, uint32_t, SRC, PAD)
1390
FAST_NEAREST (8888_8888_cover, 8888, 8888, uint32_t, uint32_t, SRC, COVER);
1188
FAST_NEAREST (8888_8888_normal, 8888, 8888, uint32_t, uint32_t, SRC, NORMAL)
1391
FAST_NEAREST (8888_8888_none, 8888, 8888, uint32_t, uint32_t, SRC, NONE);
1189
FAST_NEAREST (x888_8888_cover, x888, 8888, uint32_t, uint32_t, SRC, COVER)
1392
FAST_NEAREST (8888_8888_pad, 8888, 8888, uint32_t, uint32_t, SRC, PAD);
1190
FAST_NEAREST (x888_8888_pad, x888, 8888, uint32_t, uint32_t, SRC, PAD)
1393
FAST_NEAREST (8888_8888_normal, 8888, 8888, uint32_t, uint32_t, SRC, NORMAL);
1191
FAST_NEAREST (x888_8888_normal, x888, 8888, uint32_t, uint32_t, SRC, NORMAL)
1394
FAST_NEAREST (8888_8888_cover, 8888, 8888, uint32_t, uint32_t, OVER, COVER);
1192
FAST_NEAREST (8888_8888_cover, 8888, 8888, uint32_t, uint32_t, OVER, COVER)
1395
FAST_NEAREST (8888_8888_none, 8888, 8888, uint32_t, uint32_t, OVER, NONE);
1193
FAST_NEAREST (8888_8888_none, 8888, 8888, uint32_t, uint32_t, OVER, NONE)
1396
FAST_NEAREST (8888_8888_pad, 8888, 8888, uint32_t, uint32_t, OVER, PAD);
1194
FAST_NEAREST (8888_8888_pad, 8888, 8888, uint32_t, uint32_t, OVER, PAD)
-
 
1195
FAST_NEAREST (8888_8888_normal, 8888, 8888, uint32_t, uint32_t, OVER, NORMAL)
-
 
1196
FAST_NEAREST (8888_565_cover, 8888, 0565, uint32_t, uint16_t, SRC, COVER)
-
 
1197
FAST_NEAREST (8888_565_none, 8888, 0565, uint32_t, uint16_t, SRC, NONE)
-
 
1198
FAST_NEAREST (8888_565_pad, 8888, 0565, uint32_t, uint16_t, SRC, PAD)
-
 
1199
FAST_NEAREST (8888_565_normal, 8888, 0565, uint32_t, uint16_t, SRC, NORMAL)
-
 
1200
FAST_NEAREST (565_565_normal, 0565, 0565, uint16_t, uint16_t, SRC, NORMAL)
-
 
1201
FAST_NEAREST (8888_565_cover, 8888, 0565, uint32_t, uint16_t, OVER, COVER)
-
 
1202
FAST_NEAREST (8888_565_none, 8888, 0565, uint32_t, uint16_t, OVER, NONE)
-
 
1203
FAST_NEAREST (8888_565_pad, 8888, 0565, uint32_t, uint16_t, OVER, PAD)
-
 
1204
FAST_NEAREST (8888_565_normal, 8888, 0565, uint32_t, uint16_t, OVER, NORMAL)
-
 
1205
 
-
 
1206
#define REPEAT_MIN_WIDTH    32
-
 
1207
 
-
 
1208
static void
-
 
1209
fast_composite_tiled_repeat (pixman_implementation_t *imp,
-
 
1210
			     pixman_composite_info_t *info)
-
 
1211
{
-
 
1212
    PIXMAN_COMPOSITE_ARGS (info);
-
 
1213
    pixman_composite_func_t func;
-
 
1214
    pixman_format_code_t mask_format;
-
 
1215
    uint32_t src_flags, mask_flags;
-
 
1216
    int32_t sx, sy;
-
 
1217
    int32_t width_remain;
-
 
1218
    int32_t num_pixels;
-
 
1219
    int32_t src_width;
-
 
1220
    int32_t i, j;
-
 
1221
    pixman_image_t extended_src_image;
-
 
1222
    uint32_t extended_src[REPEAT_MIN_WIDTH * 2];
-
 
1223
    pixman_bool_t need_src_extension;
-
 
1224
    uint32_t *src_line;
-
 
1225
    int32_t src_stride;
-
 
1226
    int32_t src_bpp;
-
 
1227
    pixman_composite_info_t info2 = *info;
-
 
1228
 
-
 
1229
    src_flags = (info->src_flags & ~FAST_PATH_NORMAL_REPEAT) |
-
 
1230
		    FAST_PATH_SAMPLES_COVER_CLIP_NEAREST;
-
 
1231
 
-
 
1232
    if (mask_image)
-
 
1233
    {
-
 
1234
	mask_format = mask_image->common.extended_format_code;
-
 
1235
	mask_flags = info->mask_flags;
-
 
1236
    }
-
 
1237
    else
-
 
1238
    {
-
 
1239
	mask_format = PIXMAN_null;
-
 
1240
	mask_flags = FAST_PATH_IS_OPAQUE;
-
 
1241
    }
-
 
1242
 
-
 
1243
    _pixman_implementation_lookup_composite (
-
 
1244
	imp->toplevel, info->op,
-
 
1245
	src_image->common.extended_format_code, src_flags,
-
 
1246
	mask_format, mask_flags,
-
 
1247
	dest_image->common.extended_format_code, info->dest_flags,
-
 
1248
	&imp, &func);
-
 
1249
 
-
 
1250
    src_bpp = PIXMAN_FORMAT_BPP (src_image->bits.format);
-
 
1251
 
-
 
1252
    if (src_image->bits.width < REPEAT_MIN_WIDTH		&&
-
 
1253
	(src_bpp == 32 || src_bpp == 16 || src_bpp == 8)	&&
-
 
1254
	!src_image->bits.indexed)
-
 
1255
    {
-
 
1256
	sx = src_x;
-
 
1257
	sx = MOD (sx, src_image->bits.width);
-
 
1258
	sx += width;
-
 
1259
	src_width = 0;
-
 
1260
 
-
 
1261
	while (src_width < REPEAT_MIN_WIDTH && src_width <= sx)
-
 
1262
	    src_width += src_image->bits.width;
-
 
1263
 
-
 
1264
	src_stride = (src_width * (src_bpp >> 3) + 3) / (int) sizeof (uint32_t);
-
 
1265
 
-
 
1266
	/* Initialize/validate stack-allocated temporary image */
-
 
1267
	_pixman_bits_image_init (&extended_src_image, src_image->bits.format,
-
 
1268
				 src_width, 1, &extended_src[0], src_stride,
-
 
1269
				 FALSE);
-
 
1270
	_pixman_image_validate (&extended_src_image);
-
 
1271
 
-
 
1272
	info2.src_image = &extended_src_image;
-
 
1273
	need_src_extension = TRUE;
-
 
1274
    }
-
 
1275
    else
-
 
1276
    {
-
 
1277
	src_width = src_image->bits.width;
-
 
1278
	need_src_extension = FALSE;
-
 
1279
    }
-
 
1280
 
-
 
1281
    sx = src_x;
-
 
1282
    sy = src_y;
-
 
1283
 
-
 
1284
    while (--height >= 0)
-
 
1285
    {
-
 
1286
	sx = MOD (sx, src_width);
-
 
1287
	sy = MOD (sy, src_image->bits.height);
-
 
1288
 
-
 
1289
	if (need_src_extension)
-
 
1290
	{
-
 
1291
	    if (src_bpp == 32)
-
 
1292
	    {
-
 
1293
		PIXMAN_IMAGE_GET_LINE (src_image, 0, sy, uint32_t, src_stride, src_line, 1);
-
 
1294
 
-
 
1295
		for (i = 0; i < src_width; )
-
 
1296
		{
-
 
1297
		    for (j = 0; j < src_image->bits.width; j++, i++)
-
 
1298
			extended_src[i] = src_line[j];
-
 
1299
		}
-
 
1300
	    }
-
 
1301
	    else if (src_bpp == 16)
-
 
1302
	    {
-
 
1303
		uint16_t *src_line_16;
-
 
1304
 
-
 
1305
		PIXMAN_IMAGE_GET_LINE (src_image, 0, sy, uint16_t, src_stride,
-
 
1306
				       src_line_16, 1);
-
 
1307
		src_line = (uint32_t*)src_line_16;
-
 
1308
 
-
 
1309
		for (i = 0; i < src_width; )
-
 
1310
		{
-
 
1311
		    for (j = 0; j < src_image->bits.width; j++, i++)
-
 
1312
			((uint16_t*)extended_src)[i] = ((uint16_t*)src_line)[j];
-
 
1313
		}
-
 
1314
	    }
-
 
1315
	    else if (src_bpp == 8)
-
 
1316
	    {
-
 
1317
		uint8_t *src_line_8;
-
 
1318
 
-
 
1319
		PIXMAN_IMAGE_GET_LINE (src_image, 0, sy, uint8_t, src_stride,
-
 
1320
				       src_line_8, 1);
-
 
1321
		src_line = (uint32_t*)src_line_8;
-
 
1322
 
-
 
1323
		for (i = 0; i < src_width; )
-
 
1324
		{
-
 
1325
		    for (j = 0; j < src_image->bits.width; j++, i++)
-
 
1326
			((uint8_t*)extended_src)[i] = ((uint8_t*)src_line)[j];
-
 
1327
		}
-
 
1328
	    }
-
 
1329
 
-
 
1330
	    info2.src_y = 0;
-
 
1331
	}
-
 
1332
	else
-
 
1333
	{
-
 
1334
	    info2.src_y = sy;
-
 
1335
	}
-
 
1336
 
-
 
1337
	width_remain = width;
-
 
1338
 
-
 
1339
	while (width_remain > 0)
-
 
1340
	{
-
 
1341
	    num_pixels = src_width - sx;
-
 
1342
 
-
 
1343
	    if (num_pixels > width_remain)
-
 
1344
		num_pixels = width_remain;
-
 
1345
 
-
 
1346
	    info2.src_x = sx;
-
 
1347
	    info2.width = num_pixels;
-
 
1348
	    info2.height = 1;
-
 
1349
 
-
 
1350
	    func (imp, &info2);
-
 
1351
 
-
 
1352
	    width_remain -= num_pixels;
-
 
1353
	    info2.mask_x += num_pixels;
-
 
1354
	    info2.dest_x += num_pixels;
-
 
1355
	    sx = 0;
-
 
1356
	}
-
 
1357
 
-
 
1358
	sx = src_x;
Line 1397... Line 1359...
1397
FAST_NEAREST (8888_8888_normal, 8888, 8888, uint32_t, uint32_t, OVER, NORMAL);
1359
	sy++;
1398
FAST_NEAREST (8888_565_cover, 8888, 0565, uint32_t, uint16_t, SRC, COVER);
1360
	info2.mask_x = info->mask_x;
1399
FAST_NEAREST (8888_565_none, 8888, 0565, uint32_t, uint16_t, SRC, NONE);
1361
	info2.mask_y++;
1400
FAST_NEAREST (8888_565_pad, 8888, 0565, uint32_t, uint16_t, SRC, PAD);
1362
	info2.dest_x = info->dest_x;
1401
FAST_NEAREST (8888_565_normal, 8888, 0565, uint32_t, uint16_t, SRC, NORMAL);
1363
	info2.dest_y++;
1402
FAST_NEAREST (565_565_normal, 0565, 0565, uint16_t, uint16_t, SRC, NORMAL);
1364
    }
1403
FAST_NEAREST (8888_565_cover, 8888, 0565, uint32_t, uint16_t, OVER, COVER);
1365
 
1404
FAST_NEAREST (8888_565_none, 8888, 0565, uint32_t, uint16_t, OVER, NONE);
1366
    if (need_src_extension)
-
 
1367
	_pixman_image_fini (&extended_src_image);
1405
FAST_NEAREST (8888_565_pad, 8888, 0565, uint32_t, uint16_t, OVER, PAD);
1368
}
1406
FAST_NEAREST (8888_565_normal, 8888, 0565, uint32_t, uint16_t, OVER, NORMAL);
1369
 
1407
 
1370
/* Use more unrolling for src_0565_0565 because it is typically CPU bound */
1408
/* Use more unrolling for src_0565_0565 because it is typically CPU bound */
1371
static force_inline void
1409
static force_inline void
1372
scaled_nearest_scanline_565_565_SRC (uint16_t *       dst,
1410
scaled_nearest_scanline_565_565_SRC (uint16_t *      dst,
1373
				     const uint16_t * src,
1411
				     uint16_t *      src,
1374
				     int32_t          w,
1412
				     int32_t         w,
1375
				     pixman_fixed_t   vx,
1413
				     pixman_fixed_t  vx,
1376
				     pixman_fixed_t   unit_x,
1414
				     pixman_fixed_t  unit_x,
1377
				     pixman_fixed_t   max_vx,
1415
				     pixman_fixed_t  max_vx)
1378
				     pixman_bool_t    fully_transparent_src)
1416
{
1379
{
1417
    uint16_t tmp1, tmp2, tmp3, tmp4;
1380
    uint16_t tmp1, tmp2, tmp3, tmp4;
1418
    while ((w -= 4) >= 0)
1381
    while ((w -= 4) >= 0)
1419
    {
1382
    {
1420
	tmp1 = src[pixman_fixed_to_int (vx)];
1383
	tmp1 = *(src + pixman_fixed_to_int (vx));
1421
	vx += unit_x;
1384
	vx += unit_x;
1422
	tmp2 = src[pixman_fixed_to_int (vx)];
1385
	tmp2 = *(src + pixman_fixed_to_int (vx));
1423
	vx += unit_x;
1386
	vx += unit_x;
1424
	tmp3 = src[pixman_fixed_to_int (vx)];
1387
	tmp3 = *(src + pixman_fixed_to_int (vx));
1425
	vx += unit_x;
1388
	vx += unit_x;
1426
	tmp4 = src[pixman_fixed_to_int (vx)];
1389
	tmp4 = *(src + pixman_fixed_to_int (vx));
1427
	vx += unit_x;
1390
	vx += unit_x;
1428
	*dst++ = tmp1;
1391
	*dst++ = tmp1;
1429
	*dst++ = tmp2;
1392
	*dst++ = tmp2;
1430
	*dst++ = tmp3;
1393
	*dst++ = tmp3;
1431
	*dst++ = tmp4;
1394
	*dst++ = tmp4;
1432
    }
1395
    }
1433
    if (w & 2)
1396
    if (w & 2)
Line 1434... Line 1397...
1434
    {
1397
    {
1435
	tmp1 = src[pixman_fixed_to_int (vx)];
1398
	tmp1 = *(src + pixman_fixed_to_int (vx));
1436
	vx += unit_x;
1399
	vx += unit_x;
1437
	tmp2 = src[pixman_fixed_to_int (vx)];
1400
	tmp2 = *(src + pixman_fixed_to_int (vx));
1438
	vx += unit_x;
1401
	vx += unit_x;
1439
	*dst++ = tmp1;
1402
	*dst++ = tmp1;
1440
	*dst++ = tmp2;
1403
	*dst++ = tmp2;
1441
    }
1404
    }
1442
    if (w & 1)
1405
    if (w & 1)
Line 1443... Line 1406...
1443
	*dst++ = src[pixman_fixed_to_int (vx)];
1406
	*dst = *(src + pixman_fixed_to_int (vx));
1444
}
1407
}
1445
 
1408
 
1446
FAST_NEAREST_MAINLOOP (565_565_cover_SRC,
1409
FAST_NEAREST_MAINLOOP (565_565_cover_SRC,
1447
		       scaled_nearest_scanline_565_565_SRC,
1410
		       scaled_nearest_scanline_565_565_SRC,
1448
		       uint16_t, uint16_t, COVER);
1411
		       uint16_t, uint16_t, COVER)
1449
FAST_NEAREST_MAINLOOP (565_565_none_SRC,
1412
FAST_NEAREST_MAINLOOP (565_565_none_SRC,
1450
		       scaled_nearest_scanline_565_565_SRC,
1413
		       scaled_nearest_scanline_565_565_SRC,
1451
		       uint16_t, uint16_t, NONE);
1414
		       uint16_t, uint16_t, NONE)
1452
FAST_NEAREST_MAINLOOP (565_565_pad_SRC,
1415
FAST_NEAREST_MAINLOOP (565_565_pad_SRC,
1453
		       scaled_nearest_scanline_565_565_SRC,
1416
		       scaled_nearest_scanline_565_565_SRC,
1454
		       uint16_t, uint16_t, PAD);
1417
		       uint16_t, uint16_t, PAD)
1455
 
1418
 
Line 1491... Line 1454...
1491
    *dst = s;
1454
    *dst = s;
1492
}
1455
}
Line 1493... Line 1456...
1493
 
1456
 
1494
static void
1457
static void
1495
fast_composite_scaled_nearest (pixman_implementation_t *imp,
1458
fast_composite_scaled_nearest (pixman_implementation_t *imp,
1496
			       pixman_op_t              op,
-
 
1497
			       pixman_image_t *         src_image,
-
 
1498
			       pixman_image_t *         mask_image,
-
 
1499
			       pixman_image_t *         dst_image,
-
 
1500
			       int32_t                  src_x,
-
 
1501
			       int32_t                  src_y,
-
 
1502
			       int32_t                  mask_x,
-
 
1503
			       int32_t                  mask_y,
-
 
1504
			       int32_t                  dest_x,
-
 
1505
			       int32_t                  dest_y,
-
 
1506
			       int32_t                  width,
-
 
1507
			       int32_t                  height)
1459
			       pixman_composite_info_t *info)
-
 
1460
{
1508
{
1461
    PIXMAN_COMPOSITE_ARGS (info);
1509
    uint32_t       *dst_line;
1462
    uint32_t       *dst_line;
1510
    uint32_t       *src_line;
1463
    uint32_t       *src_line;
1511
    int             dst_stride, src_stride;
1464
    int             dst_stride, src_stride;
1512
    int		    src_width, src_height;
1465
    int		    src_width, src_height;
1513
    pixman_repeat_t src_repeat;
1466
    pixman_repeat_t src_repeat;
1514
    pixman_fixed_t unit_x, unit_y;
1467
    pixman_fixed_t unit_x, unit_y;
1515
    pixman_format_code_t src_format;
1468
    pixman_format_code_t src_format;
1516
    pixman_vector_t v;
1469
    pixman_vector_t v;
Line 1517... Line 1470...
1517
    pixman_fixed_t vy;
1470
    pixman_fixed_t vy;
1518
 
1471
 
1519
    PIXMAN_IMAGE_GET_LINE (dst_image, dest_x, dest_y, uint32_t, dst_stride, dst_line, 1);
1472
    PIXMAN_IMAGE_GET_LINE (dest_image, dest_x, dest_y, uint32_t, dst_stride, dst_line, 1);
1520
    /* pass in 0 instead of src_x and src_y because src_x and src_y need to be
1473
    /* pass in 0 instead of src_x and src_y because src_x and src_y need to be
1521
     * transformed from destination space to source space
1474
     * transformed from destination space to source space
Line 1611... Line 1564...
1611
	    }
1564
	    }
1612
	}
1565
	}
1613
    }
1566
    }
1614
}
1567
}
Line -... Line 1568...
-
 
1568
 
-
 
1569
#define CACHE_LINE_SIZE 64
-
 
1570
 
-
 
1571
#define FAST_SIMPLE_ROTATE(suffix, pix_type)                                  \
-
 
1572
                                                                              \
-
 
1573
static void                                                                   \
-
 
1574
blt_rotated_90_trivial_##suffix (pix_type       *dst,                         \
-
 
1575
				 int             dst_stride,                  \
-
 
1576
				 const pix_type *src,                         \
-
 
1577
				 int             src_stride,                  \
-
 
1578
				 int             w,                           \
-
 
1579
				 int             h)                           \
-
 
1580
{                                                                             \
-
 
1581
    int x, y;                                                                 \
-
 
1582
    for (y = 0; y < h; y++)                                                   \
-
 
1583
    {                                                                         \
-
 
1584
	const pix_type *s = src + (h - y - 1);                                \
-
 
1585
	pix_type *d = dst + dst_stride * y;                                   \
-
 
1586
	for (x = 0; x < w; x++)                                               \
-
 
1587
	{                                                                     \
-
 
1588
	    *d++ = *s;                                                        \
-
 
1589
	    s += src_stride;                                                  \
-
 
1590
	}                                                                     \
-
 
1591
    }                                                                         \
-
 
1592
}                                                                             \
-
 
1593
                                                                              \
-
 
1594
static void                                                                   \
-
 
1595
blt_rotated_270_trivial_##suffix (pix_type       *dst,                        \
-
 
1596
				  int             dst_stride,                 \
-
 
1597
				  const pix_type *src,                        \
-
 
1598
				  int             src_stride,                 \
-
 
1599
				  int             w,                          \
-
 
1600
				  int             h)                          \
-
 
1601
{                                                                             \
-
 
1602
    int x, y;                                                                 \
-
 
1603
    for (y = 0; y < h; y++)                                                   \
-
 
1604
    {                                                                         \
-
 
1605
	const pix_type *s = src + src_stride * (w - 1) + y;                   \
-
 
1606
	pix_type *d = dst + dst_stride * y;                                   \
-
 
1607
	for (x = 0; x < w; x++)                                               \
-
 
1608
	{                                                                     \
-
 
1609
	    *d++ = *s;                                                        \
-
 
1610
	    s -= src_stride;                                                  \
-
 
1611
	}                                                                     \
-
 
1612
    }                                                                         \
-
 
1613
}                                                                             \
-
 
1614
                                                                              \
-
 
1615
static void                                                                   \
-
 
1616
blt_rotated_90_##suffix (pix_type       *dst,                                 \
-
 
1617
			 int             dst_stride,                          \
-
 
1618
			 const pix_type *src,                                 \
-
 
1619
			 int             src_stride,                          \
-
 
1620
			 int             W,                                   \
-
 
1621
			 int             H)                                   \
-
 
1622
{                                                                             \
-
 
1623
    int x;                                                                    \
-
 
1624
    int leading_pixels = 0, trailing_pixels = 0;                              \
-
 
1625
    const int TILE_SIZE = CACHE_LINE_SIZE / sizeof(pix_type);                 \
-
 
1626
                                                                              \
-
 
1627
    /*                                                                        \
-
 
1628
     * split processing into handling destination as TILE_SIZExH cache line   \
-
 
1629
     * aligned vertical stripes (optimistically assuming that destination     \
-
 
1630
     * stride is a multiple of cache line, if not - it will be just a bit     \
-
 
1631
     * slower)                                                                \
-
 
1632
     */                                                                       \
-
 
1633
                                                                              \
-
 
1634
    if ((uintptr_t)dst & (CACHE_LINE_SIZE - 1))                               \
-
 
1635
    {                                                                         \
-
 
1636
	leading_pixels = TILE_SIZE - (((uintptr_t)dst &                       \
-
 
1637
			    (CACHE_LINE_SIZE - 1)) / sizeof(pix_type));       \
-
 
1638
	if (leading_pixels > W)                                               \
-
 
1639
	    leading_pixels = W;                                               \
-
 
1640
                                                                              \
-
 
1641
	/* unaligned leading part NxH (where N < TILE_SIZE) */                \
-
 
1642
	blt_rotated_90_trivial_##suffix (                                     \
-
 
1643
	    dst,                                                              \
-
 
1644
	    dst_stride,                                                       \
-
 
1645
	    src,                                                              \
-
 
1646
	    src_stride,                                                       \
-
 
1647
	    leading_pixels,                                                   \
-
 
1648
	    H);                                                               \
-
 
1649
	                                                                      \
-
 
1650
	dst += leading_pixels;                                                \
-
 
1651
	src += leading_pixels * src_stride;                                   \
-
 
1652
	W -= leading_pixels;                                                  \
-
 
1653
    }                                                                         \
-
 
1654
                                                                              \
-
 
1655
    if ((uintptr_t)(dst + W) & (CACHE_LINE_SIZE - 1))                         \
-
 
1656
    {                                                                         \
-
 
1657
	trailing_pixels = (((uintptr_t)(dst + W) &                            \
-
 
1658
			    (CACHE_LINE_SIZE - 1)) / sizeof(pix_type));       \
-
 
1659
	if (trailing_pixels > W)                                              \
-
 
1660
	    trailing_pixels = W;                                              \
-
 
1661
	W -= trailing_pixels;                                                 \
-
 
1662
    }                                                                         \
-
 
1663
                                                                              \
-
 
1664
    for (x = 0; x < W; x += TILE_SIZE)                                        \
-
 
1665
    {                                                                         \
-
 
1666
	/* aligned middle part TILE_SIZExH */                                 \
-
 
1667
	blt_rotated_90_trivial_##suffix (                                     \
-
 
1668
	    dst + x,                                                          \
-
 
1669
	    dst_stride,                                                       \
-
 
1670
	    src + src_stride * x,                                             \
-
 
1671
	    src_stride,                                                       \
-
 
1672
	    TILE_SIZE,                                                        \
-
 
1673
	    H);                                                               \
-
 
1674
    }                                                                         \
-
 
1675
                                                                              \
-
 
1676
    if (trailing_pixels)                                                      \
-
 
1677
    {                                                                         \
-
 
1678
	/* unaligned trailing part NxH (where N < TILE_SIZE) */               \
-
 
1679
	blt_rotated_90_trivial_##suffix (                                     \
-
 
1680
	    dst + W,                                                          \
-
 
1681
	    dst_stride,                                                       \
-
 
1682
	    src + W * src_stride,                                             \
-
 
1683
	    src_stride,                                                       \
-
 
1684
	    trailing_pixels,                                                  \
-
 
1685
	    H);                                                               \
-
 
1686
    }                                                                         \
-
 
1687
}                                                                             \
-
 
1688
                                                                              \
-
 
1689
static void                                                                   \
-
 
1690
blt_rotated_270_##suffix (pix_type       *dst,                                \
-
 
1691
			  int             dst_stride,                         \
-
 
1692
			  const pix_type *src,                                \
-
 
1693
			  int             src_stride,                         \
-
 
1694
			  int             W,                                  \
-
 
1695
			  int             H)                                  \
-
 
1696
{                                                                             \
-
 
1697
    int x;                                                                    \
-
 
1698
    int leading_pixels = 0, trailing_pixels = 0;                              \
-
 
1699
    const int TILE_SIZE = CACHE_LINE_SIZE / sizeof(pix_type);                 \
-
 
1700
                                                                              \
-
 
1701
    /*                                                                        \
-
 
1702
     * split processing into handling destination as TILE_SIZExH cache line   \
-
 
1703
     * aligned vertical stripes (optimistically assuming that destination     \
-
 
1704
     * stride is a multiple of cache line, if not - it will be just a bit     \
-
 
1705
     * slower)                                                                \
-
 
1706
     */                                                                       \
-
 
1707
                                                                              \
-
 
1708
    if ((uintptr_t)dst & (CACHE_LINE_SIZE - 1))                               \
-
 
1709
    {                                                                         \
-
 
1710
	leading_pixels = TILE_SIZE - (((uintptr_t)dst &                       \
-
 
1711
			    (CACHE_LINE_SIZE - 1)) / sizeof(pix_type));       \
-
 
1712
	if (leading_pixels > W)                                               \
-
 
1713
	    leading_pixels = W;                                               \
-
 
1714
                                                                              \
-
 
1715
	/* unaligned leading part NxH (where N < TILE_SIZE) */                \
-
 
1716
	blt_rotated_270_trivial_##suffix (                                    \
-
 
1717
	    dst,                                                              \
-
 
1718
	    dst_stride,                                                       \
-
 
1719
	    src + src_stride * (W - leading_pixels),                          \
-
 
1720
	    src_stride,                                                       \
-
 
1721
	    leading_pixels,                                                   \
-
 
1722
	    H);                                                               \
-
 
1723
	                                                                      \
-
 
1724
	dst += leading_pixels;                                                \
-
 
1725
	W -= leading_pixels;                                                  \
-
 
1726
    }                                                                         \
-
 
1727
                                                                              \
-
 
1728
    if ((uintptr_t)(dst + W) & (CACHE_LINE_SIZE - 1))                         \
-
 
1729
    {                                                                         \
-
 
1730
	trailing_pixels = (((uintptr_t)(dst + W) &                            \
-
 
1731
			    (CACHE_LINE_SIZE - 1)) / sizeof(pix_type));       \
-
 
1732
	if (trailing_pixels > W)                                              \
-
 
1733
	    trailing_pixels = W;                                              \
-
 
1734
	W -= trailing_pixels;                                                 \
-
 
1735
	src += trailing_pixels * src_stride;                                  \
-
 
1736
    }                                                                         \
-
 
1737
                                                                              \
-
 
1738
    for (x = 0; x < W; x += TILE_SIZE)                                        \
-
 
1739
    {                                                                         \
-
 
1740
	/* aligned middle part TILE_SIZExH */                                 \
-
 
1741
	blt_rotated_270_trivial_##suffix (                                    \
-
 
1742
	    dst + x,                                                          \
-
 
1743
	    dst_stride,                                                       \
-
 
1744
	    src + src_stride * (W - x - TILE_SIZE),                           \
-
 
1745
	    src_stride,                                                       \
-
 
1746
	    TILE_SIZE,                                                        \
-
 
1747
	    H);                                                               \
-
 
1748
    }                                                                         \
-
 
1749
                                                                              \
-
 
1750
    if (trailing_pixels)                                                      \
-
 
1751
    {                                                                         \
-
 
1752
	/* unaligned trailing part NxH (where N < TILE_SIZE) */               \
-
 
1753
	blt_rotated_270_trivial_##suffix (                                    \
-
 
1754
	    dst + W,                                                          \
-
 
1755
	    dst_stride,                                                       \
-
 
1756
	    src - trailing_pixels * src_stride,                               \
-
 
1757
	    src_stride,                                                       \
-
 
1758
	    trailing_pixels,                                                  \
-
 
1759
	    H);                                                               \
-
 
1760
    }                                                                         \
-
 
1761
}                                                                             \
-
 
1762
                                                                              \
-
 
1763
static void                                                                   \
-
 
1764
fast_composite_rotate_90_##suffix (pixman_implementation_t *imp,              \
-
 
1765
				   pixman_composite_info_t *info)	      \
-
 
1766
{									      \
-
 
1767
    PIXMAN_COMPOSITE_ARGS (info);					      \
-
 
1768
    pix_type       *dst_line;						      \
-
 
1769
    pix_type       *src_line;                                                 \
-
 
1770
    int             dst_stride, src_stride;                                   \
-
 
1771
    int             src_x_t, src_y_t;                                         \
-
 
1772
                                                                              \
-
 
1773
    PIXMAN_IMAGE_GET_LINE (dest_image, dest_x, dest_y, pix_type,              \
-
 
1774
			   dst_stride, dst_line, 1);                          \
-
 
1775
    src_x_t = -src_y + pixman_fixed_to_int (                                  \
-
 
1776
				src_image->common.transform->matrix[0][2] +   \
-
 
1777
				pixman_fixed_1 / 2 - pixman_fixed_e) - height;\
-
 
1778
    src_y_t = src_x + pixman_fixed_to_int (                                   \
-
 
1779
				src_image->common.transform->matrix[1][2] +   \
-
 
1780
				pixman_fixed_1 / 2 - pixman_fixed_e);         \
-
 
1781
    PIXMAN_IMAGE_GET_LINE (src_image, src_x_t, src_y_t, pix_type,             \
-
 
1782
			   src_stride, src_line, 1);                          \
-
 
1783
    blt_rotated_90_##suffix (dst_line, dst_stride, src_line, src_stride,      \
-
 
1784
			     width, height);                                  \
-
 
1785
}                                                                             \
-
 
1786
                                                                              \
-
 
1787
static void                                                                   \
-
 
1788
fast_composite_rotate_270_##suffix (pixman_implementation_t *imp,             \
-
 
1789
				    pixman_composite_info_t *info)            \
-
 
1790
{                                                                             \
-
 
1791
    PIXMAN_COMPOSITE_ARGS (info);					      \
-
 
1792
    pix_type       *dst_line;						      \
-
 
1793
    pix_type       *src_line;                                                 \
-
 
1794
    int             dst_stride, src_stride;                                   \
-
 
1795
    int             src_x_t, src_y_t;                                         \
-
 
1796
                                                                              \
-
 
1797
    PIXMAN_IMAGE_GET_LINE (dest_image, dest_x, dest_y, pix_type,              \
-
 
1798
			   dst_stride, dst_line, 1);                          \
-
 
1799
    src_x_t = src_y + pixman_fixed_to_int (                                   \
-
 
1800
				src_image->common.transform->matrix[0][2] +   \
-
 
1801
				pixman_fixed_1 / 2 - pixman_fixed_e);         \
-
 
1802
    src_y_t = -src_x + pixman_fixed_to_int (                                  \
-
 
1803
				src_image->common.transform->matrix[1][2] +   \
-
 
1804
				pixman_fixed_1 / 2 - pixman_fixed_e) - width; \
-
 
1805
    PIXMAN_IMAGE_GET_LINE (src_image, src_x_t, src_y_t, pix_type,             \
-
 
1806
			   src_stride, src_line, 1);                          \
-
 
1807
    blt_rotated_270_##suffix (dst_line, dst_stride, src_line, src_stride,     \
-
 
1808
			      width, height);                                 \
-
 
1809
}
-
 
1810
 
-
 
1811
FAST_SIMPLE_ROTATE (8, uint8_t)
-
 
1812
FAST_SIMPLE_ROTATE (565, uint16_t)
-
 
1813
FAST_SIMPLE_ROTATE (8888, uint32_t)
1615
 
1814
 
1616
static const pixman_fast_path_t c_fast_paths[] =
1815
static const pixman_fast_path_t c_fast_paths[] =
1617
{
1816
{
1618
    PIXMAN_STD_FAST_PATH (OVER, solid, a8, r5g6b5, fast_composite_over_n_8_0565),
1817
    PIXMAN_STD_FAST_PATH (OVER, solid, a8, r5g6b5, fast_composite_over_n_8_0565),
1619
    PIXMAN_STD_FAST_PATH (OVER, solid, a8, b5g6r5, fast_composite_over_n_8_0565),
1818
    PIXMAN_STD_FAST_PATH (OVER, solid, a8, b5g6r5, fast_composite_over_n_8_0565),
Line 1643... Line 1842...
1643
    PIXMAN_STD_FAST_PATH (OVER, a8r8g8b8, null, x8r8g8b8, fast_composite_over_8888_8888),
1842
    PIXMAN_STD_FAST_PATH (OVER, a8r8g8b8, null, x8r8g8b8, fast_composite_over_8888_8888),
1644
    PIXMAN_STD_FAST_PATH (OVER, a8r8g8b8, null, r5g6b5, fast_composite_over_8888_0565),
1843
    PIXMAN_STD_FAST_PATH (OVER, a8r8g8b8, null, r5g6b5, fast_composite_over_8888_0565),
1645
    PIXMAN_STD_FAST_PATH (OVER, a8b8g8r8, null, a8b8g8r8, fast_composite_over_8888_8888),
1844
    PIXMAN_STD_FAST_PATH (OVER, a8b8g8r8, null, a8b8g8r8, fast_composite_over_8888_8888),
1646
    PIXMAN_STD_FAST_PATH (OVER, a8b8g8r8, null, x8b8g8r8, fast_composite_over_8888_8888),
1845
    PIXMAN_STD_FAST_PATH (OVER, a8b8g8r8, null, x8b8g8r8, fast_composite_over_8888_8888),
1647
    PIXMAN_STD_FAST_PATH (OVER, a8b8g8r8, null, b5g6r5, fast_composite_over_8888_0565),
1846
    PIXMAN_STD_FAST_PATH (OVER, a8b8g8r8, null, b5g6r5, fast_composite_over_8888_0565),
-
 
1847
    PIXMAN_STD_FAST_PATH (ADD, r5g6b5, null, r5g6b5, fast_composite_add_0565_0565),
-
 
1848
    PIXMAN_STD_FAST_PATH (ADD, b5g6r5, null, b5g6r5, fast_composite_add_0565_0565),
1648
    PIXMAN_STD_FAST_PATH (ADD, a8r8g8b8, null, a8r8g8b8, fast_composite_add_8888_8888),
1849
    PIXMAN_STD_FAST_PATH (ADD, a8r8g8b8, null, a8r8g8b8, fast_composite_add_8888_8888),
1649
    PIXMAN_STD_FAST_PATH (ADD, a8b8g8r8, null, a8b8g8r8, fast_composite_add_8888_8888),
1850
    PIXMAN_STD_FAST_PATH (ADD, a8b8g8r8, null, a8b8g8r8, fast_composite_add_8888_8888),
1650
    PIXMAN_STD_FAST_PATH (ADD, a8, null, a8, fast_composite_add_8_8),
1851
    PIXMAN_STD_FAST_PATH (ADD, a8, null, a8, fast_composite_add_8_8),
1651
    PIXMAN_STD_FAST_PATH (ADD, a1, null, a1, fast_composite_add_1000_1000),
1852
    PIXMAN_STD_FAST_PATH (ADD, a1, null, a1, fast_composite_add_1_1),
1652
    PIXMAN_STD_FAST_PATH_CA (ADD, solid, a8r8g8b8, a8r8g8b8, fast_composite_add_n_8888_8888_ca),
1853
    PIXMAN_STD_FAST_PATH_CA (ADD, solid, a8r8g8b8, a8r8g8b8, fast_composite_add_n_8888_8888_ca),
1653
    PIXMAN_STD_FAST_PATH (ADD, solid, a8, a8, fast_composite_add_n_8_8),
1854
    PIXMAN_STD_FAST_PATH (ADD, solid, a8, a8, fast_composite_add_n_8_8),
1654
    PIXMAN_STD_FAST_PATH (SRC, solid, null, a8r8g8b8, fast_composite_solid_fill),
1855
    PIXMAN_STD_FAST_PATH (SRC, solid, null, a8r8g8b8, fast_composite_solid_fill),
1655
    PIXMAN_STD_FAST_PATH (SRC, solid, null, x8r8g8b8, fast_composite_solid_fill),
1856
    PIXMAN_STD_FAST_PATH (SRC, solid, null, x8r8g8b8, fast_composite_solid_fill),
1656
    PIXMAN_STD_FAST_PATH (SRC, solid, null, a8b8g8r8, fast_composite_solid_fill),
1857
    PIXMAN_STD_FAST_PATH (SRC, solid, null, a8b8g8r8, fast_composite_solid_fill),
1657
    PIXMAN_STD_FAST_PATH (SRC, solid, null, x8b8g8r8, fast_composite_solid_fill),
1858
    PIXMAN_STD_FAST_PATH (SRC, solid, null, x8b8g8r8, fast_composite_solid_fill),
-
 
1859
    PIXMAN_STD_FAST_PATH (SRC, solid, null, a1, fast_composite_solid_fill),
1658
    PIXMAN_STD_FAST_PATH (SRC, solid, null, a8, fast_composite_solid_fill),
1860
    PIXMAN_STD_FAST_PATH (SRC, solid, null, a8, fast_composite_solid_fill),
1659
    PIXMAN_STD_FAST_PATH (SRC, solid, null, r5g6b5, fast_composite_solid_fill),
1861
    PIXMAN_STD_FAST_PATH (SRC, solid, null, r5g6b5, fast_composite_solid_fill),
1660
    PIXMAN_STD_FAST_PATH (SRC, x8r8g8b8, null, a8r8g8b8, fast_composite_src_x888_8888),
1862
    PIXMAN_STD_FAST_PATH (SRC, x8r8g8b8, null, a8r8g8b8, fast_composite_src_x888_8888),
1661
    PIXMAN_STD_FAST_PATH (SRC, x8b8g8r8, null, a8b8g8r8, fast_composite_src_x888_8888),
1863
    PIXMAN_STD_FAST_PATH (SRC, x8b8g8r8, null, a8b8g8r8, fast_composite_src_x888_8888),
1662
    PIXMAN_STD_FAST_PATH (SRC, a8r8g8b8, null, x8r8g8b8, fast_composite_src_memcpy),
1864
    PIXMAN_STD_FAST_PATH (SRC, a8r8g8b8, null, x8r8g8b8, fast_composite_src_memcpy),
Line 1673... Line 1875...
1673
    PIXMAN_STD_FAST_PATH (SRC, r8g8b8, null, r8g8b8, fast_composite_src_memcpy),
1875
    PIXMAN_STD_FAST_PATH (SRC, r8g8b8, null, r8g8b8, fast_composite_src_memcpy),
1674
    PIXMAN_STD_FAST_PATH (SRC, b8g8r8, null, b8g8r8, fast_composite_src_memcpy),
1876
    PIXMAN_STD_FAST_PATH (SRC, b8g8r8, null, b8g8r8, fast_composite_src_memcpy),
1675
    PIXMAN_STD_FAST_PATH (SRC, x1r5g5b5, null, x1r5g5b5, fast_composite_src_memcpy),
1877
    PIXMAN_STD_FAST_PATH (SRC, x1r5g5b5, null, x1r5g5b5, fast_composite_src_memcpy),
1676
    PIXMAN_STD_FAST_PATH (SRC, a1r5g5b5, null, x1r5g5b5, fast_composite_src_memcpy),
1878
    PIXMAN_STD_FAST_PATH (SRC, a1r5g5b5, null, x1r5g5b5, fast_composite_src_memcpy),
1677
    PIXMAN_STD_FAST_PATH (SRC, a8, null, a8, fast_composite_src_memcpy),
1879
    PIXMAN_STD_FAST_PATH (SRC, a8, null, a8, fast_composite_src_memcpy),
1678
    PIXMAN_STD_FAST_PATH (SRC, a8r8g8b8, null, r5g6b5, fast_composite_src_x888_0565),
-
 
1679
    PIXMAN_STD_FAST_PATH (SRC, x8r8g8b8, null, r5g6b5, fast_composite_src_x888_0565),
-
 
1680
    PIXMAN_STD_FAST_PATH (SRC, a8b8g8r8, null, b5g6r5, fast_composite_src_x888_0565),
-
 
1681
    PIXMAN_STD_FAST_PATH (SRC, x8b8g8r8, null, b5g6r5, fast_composite_src_x888_0565),
-
 
1682
    PIXMAN_STD_FAST_PATH (IN, a8, null, a8, fast_composite_in_8_8),
1880
    PIXMAN_STD_FAST_PATH (IN, a8, null, a8, fast_composite_in_8_8),
1683
    PIXMAN_STD_FAST_PATH (IN, solid, a8, a8, fast_composite_in_n_8_8),
1881
    PIXMAN_STD_FAST_PATH (IN, solid, a8, a8, fast_composite_in_n_8_8),
Line 1684... Line 1882...
1684
 
1882
 
1685
    SIMPLE_NEAREST_FAST_PATH (SRC, x8r8g8b8, x8r8g8b8, 8888_8888),
1883
    SIMPLE_NEAREST_FAST_PATH (SRC, x8r8g8b8, x8r8g8b8, 8888_8888),
Line 1693... Line 1891...
1693
    SIMPLE_NEAREST_FAST_PATH (SRC, x8r8g8b8, r5g6b5, 8888_565),
1891
    SIMPLE_NEAREST_FAST_PATH (SRC, x8r8g8b8, r5g6b5, 8888_565),
1694
    SIMPLE_NEAREST_FAST_PATH (SRC, a8r8g8b8, r5g6b5, 8888_565),
1892
    SIMPLE_NEAREST_FAST_PATH (SRC, a8r8g8b8, r5g6b5, 8888_565),
Line 1695... Line 1893...
1695
 
1893
 
Line -... Line 1894...
-
 
1894
    SIMPLE_NEAREST_FAST_PATH (SRC, r5g6b5, r5g6b5, 565_565),
-
 
1895
 
-
 
1896
    SIMPLE_NEAREST_FAST_PATH_COVER (SRC, x8r8g8b8, a8r8g8b8, x888_8888),
-
 
1897
    SIMPLE_NEAREST_FAST_PATH_COVER (SRC, x8b8g8r8, a8b8g8r8, x888_8888),
-
 
1898
    SIMPLE_NEAREST_FAST_PATH_PAD (SRC, x8r8g8b8, a8r8g8b8, x888_8888),
-
 
1899
    SIMPLE_NEAREST_FAST_PATH_PAD (SRC, x8b8g8r8, a8b8g8r8, x888_8888),
-
 
1900
    SIMPLE_NEAREST_FAST_PATH_NORMAL (SRC, x8r8g8b8, a8r8g8b8, x888_8888),
1696
    SIMPLE_NEAREST_FAST_PATH (SRC, r5g6b5, r5g6b5, 565_565),
1901
    SIMPLE_NEAREST_FAST_PATH_NORMAL (SRC, x8b8g8r8, a8b8g8r8, x888_8888),
1697
 
1902
 
1698
    SIMPLE_NEAREST_FAST_PATH (OVER, a8r8g8b8, x8r8g8b8, 8888_8888),
1903
    SIMPLE_NEAREST_FAST_PATH (OVER, a8r8g8b8, x8r8g8b8, 8888_8888),
1699
    SIMPLE_NEAREST_FAST_PATH (OVER, a8b8g8r8, x8b8g8r8, 8888_8888),
1904
    SIMPLE_NEAREST_FAST_PATH (OVER, a8b8g8r8, x8b8g8r8, 8888_8888),
Line 1728... Line 1933...
1728
    NEAREST_FAST_PATH (OVER, x8r8g8b8, a8r8g8b8),
1933
    NEAREST_FAST_PATH (OVER, x8r8g8b8, a8r8g8b8),
1729
    NEAREST_FAST_PATH (OVER, a8r8g8b8, a8r8g8b8),
1934
    NEAREST_FAST_PATH (OVER, a8r8g8b8, a8r8g8b8),
1730
    NEAREST_FAST_PATH (OVER, x8b8g8r8, a8b8g8r8),
1935
    NEAREST_FAST_PATH (OVER, x8b8g8r8, a8b8g8r8),
1731
    NEAREST_FAST_PATH (OVER, a8b8g8r8, a8b8g8r8),
1936
    NEAREST_FAST_PATH (OVER, a8b8g8r8, a8b8g8r8),
Line -... Line 1937...
-
 
1937
 
-
 
1938
#define SIMPLE_ROTATE_FLAGS(angle)					  \
-
 
1939
    (FAST_PATH_ROTATE_ ## angle ## _TRANSFORM	|			  \
-
 
1940
     FAST_PATH_NEAREST_FILTER			|			  \
-
 
1941
     FAST_PATH_SAMPLES_COVER_CLIP_NEAREST	|			  \
-
 
1942
     FAST_PATH_STANDARD_FLAGS)
-
 
1943
 
-
 
1944
#define SIMPLE_ROTATE_FAST_PATH(op,s,d,suffix)				  \
-
 
1945
    {   PIXMAN_OP_ ## op,						  \
-
 
1946
	PIXMAN_ ## s, SIMPLE_ROTATE_FLAGS (90),				  \
-
 
1947
	PIXMAN_null, 0,							  \
-
 
1948
	PIXMAN_ ## d, FAST_PATH_STD_DEST_FLAGS,				  \
-
 
1949
	fast_composite_rotate_90_##suffix,				  \
-
 
1950
    },									  \
-
 
1951
    {   PIXMAN_OP_ ## op,						  \
-
 
1952
	PIXMAN_ ## s, SIMPLE_ROTATE_FLAGS (270),			  \
-
 
1953
	PIXMAN_null, 0,							  \
-
 
1954
	PIXMAN_ ## d, FAST_PATH_STD_DEST_FLAGS,				  \
-
 
1955
	fast_composite_rotate_270_##suffix,				  \
-
 
1956
    }
-
 
1957
 
-
 
1958
    SIMPLE_ROTATE_FAST_PATH (SRC, a8r8g8b8, a8r8g8b8, 8888),
-
 
1959
    SIMPLE_ROTATE_FAST_PATH (SRC, a8r8g8b8, x8r8g8b8, 8888),
-
 
1960
    SIMPLE_ROTATE_FAST_PATH (SRC, x8r8g8b8, x8r8g8b8, 8888),
-
 
1961
    SIMPLE_ROTATE_FAST_PATH (SRC, r5g6b5, r5g6b5, 565),
-
 
1962
    SIMPLE_ROTATE_FAST_PATH (SRC, a8, a8, 8),
-
 
1963
 
-
 
1964
    /* Simple repeat fast path entry. */
-
 
1965
    {	PIXMAN_OP_any,
-
 
1966
	PIXMAN_any,
-
 
1967
	(FAST_PATH_STANDARD_FLAGS | FAST_PATH_ID_TRANSFORM | FAST_PATH_BITS_IMAGE |
-
 
1968
	 FAST_PATH_NORMAL_REPEAT),
-
 
1969
	PIXMAN_any, 0,
-
 
1970
	PIXMAN_any, FAST_PATH_STD_DEST_FLAGS,
-
 
1971
	fast_composite_tiled_repeat
-
 
1972
    },
1732
 
1973
 
1733
    {   PIXMAN_OP_NONE	},
1974
    {   PIXMAN_OP_NONE	},
Line -... Line 1975...
-
 
1975
};
-
 
1976
 
-
 
1977
#ifdef WORDS_BIGENDIAN
-
 
1978
#define A1_FILL_MASK(n, offs) (((1U << (n)) - 1) << (32 - (offs) - (n)))
-
 
1979
#else
-
 
1980
#define A1_FILL_MASK(n, offs) (((1U << (n)) - 1) << (offs))
-
 
1981
#endif
-
 
1982
 
-
 
1983
static force_inline void
-
 
1984
pixman_fill1_line (uint32_t *dst, int offs, int width, int v)
-
 
1985
{
-
 
1986
    if (offs)
-
 
1987
    {
-
 
1988
	int leading_pixels = 32 - offs;
-
 
1989
	if (leading_pixels >= width)
-
 
1990
	{
-
 
1991
	    if (v)
-
 
1992
		*dst |= A1_FILL_MASK (width, offs);
-
 
1993
	    else
-
 
1994
		*dst &= ~A1_FILL_MASK (width, offs);
-
 
1995
	    return;
-
 
1996
	}
-
 
1997
	else
-
 
1998
	{
-
 
1999
	    if (v)
-
 
2000
		*dst++ |= A1_FILL_MASK (leading_pixels, offs);
-
 
2001
	    else
-
 
2002
		*dst++ &= ~A1_FILL_MASK (leading_pixels, offs);
-
 
2003
	    width -= leading_pixels;
-
 
2004
	}
-
 
2005
    }
-
 
2006
    while (width >= 32)
-
 
2007
    {
-
 
2008
	if (v)
-
 
2009
	    *dst++ = 0xFFFFFFFF;
-
 
2010
	else
-
 
2011
	    *dst++ = 0;
-
 
2012
	width -= 32;
-
 
2013
    }
-
 
2014
    if (width > 0)
-
 
2015
    {
-
 
2016
	if (v)
-
 
2017
	    *dst |= A1_FILL_MASK (width, 0);
-
 
2018
	else
-
 
2019
	    *dst &= ~A1_FILL_MASK (width, 0);
-
 
2020
    }
-
 
2021
}
-
 
2022
 
-
 
2023
static void
-
 
2024
pixman_fill1 (uint32_t *bits,
-
 
2025
              int       stride,
-
 
2026
              int       x,
-
 
2027
              int       y,
-
 
2028
              int       width,
-
 
2029
              int       height,
-
 
2030
              uint32_t  filler)
-
 
2031
{
-
 
2032
    uint32_t *dst = bits + y * stride + (x >> 5);
-
 
2033
    int offs = x & 31;
-
 
2034
 
-
 
2035
    if (filler & 1)
-
 
2036
    {
-
 
2037
	while (height--)
-
 
2038
	{
-
 
2039
	    pixman_fill1_line (dst, offs, width, 1);
-
 
2040
	    dst += stride;
-
 
2041
	}
-
 
2042
    }
-
 
2043
    else
-
 
2044
    {
-
 
2045
	while (height--)
-
 
2046
	{
-
 
2047
	    pixman_fill1_line (dst, offs, width, 0);
-
 
2048
	    dst += stride;
-
 
2049
	}
-
 
2050
    }
1734
};
2051
}
1735
 
2052
 
1736
static void
2053
static void
1737
pixman_fill8 (uint32_t *bits,
2054
pixman_fill8 (uint32_t *bits,
1738
              int       stride,
2055
              int       stride,
1739
              int       x,
2056
              int       x,
1740
              int       y,
2057
              int       y,
1741
              int       width,
2058
              int       width,
1742
              int       height,
2059
              int       height,
1743
              uint32_t xor)
2060
              uint32_t  filler)
1744
{
2061
{
1745
    int byte_stride = stride * (int) sizeof (uint32_t);
2062
    int byte_stride = stride * (int) sizeof (uint32_t);
1746
    uint8_t *dst = (uint8_t *) bits;
2063
    uint8_t *dst = (uint8_t *) bits;
Line 1747... Line 2064...
1747
    uint8_t v = xor & 0xff;
2064
    uint8_t v = filler & 0xff;
Line 1748... Line 2065...
1748
    int i;
2065
    int i;
Line 1763... Line 2080...
1763
               int       stride,
2080
               int       stride,
1764
               int       x,
2081
               int       x,
1765
               int       y,
2082
               int       y,
1766
               int       width,
2083
               int       width,
1767
               int       height,
2084
               int       height,
1768
               uint32_t xor)
2085
               uint32_t  filler)
1769
{
2086
{
1770
    int short_stride =
2087
    int short_stride =
1771
	(stride * (int)sizeof (uint32_t)) / (int)sizeof (uint16_t);
2088
	(stride * (int)sizeof (uint32_t)) / (int)sizeof (uint16_t);
1772
    uint16_t *dst = (uint16_t *)bits;
2089
    uint16_t *dst = (uint16_t *)bits;
1773
    uint16_t v = xor & 0xffff;
2090
    uint16_t v = filler & 0xffff;
1774
    int i;
2091
    int i;
Line 1775... Line 2092...
1775
 
2092
 
Line 1776... Line 2093...
1776
    dst = dst + y * short_stride + x;
2093
    dst = dst + y * short_stride + x;
Line 1789... Line 2106...
1789
               int       stride,
2106
               int       stride,
1790
               int       x,
2107
               int       x,
1791
               int       y,
2108
               int       y,
1792
               int       width,
2109
               int       width,
1793
               int       height,
2110
               int       height,
1794
               uint32_t  xor)
2111
               uint32_t  filler)
1795
{
2112
{
1796
    int i;
2113
    int i;
Line 1797... Line 2114...
1797
 
2114
 
Line 1798... Line 2115...
1798
    bits = bits + y * stride + x;
2115
    bits = bits + y * stride + x;
1799
 
2116
 
1800
    while (height--)
2117
    while (height--)
1801
    {
2118
    {
Line 1802... Line 2119...
1802
	for (i = 0; i < width; ++i)
2119
	for (i = 0; i < width; ++i)
1803
	    bits[i] = xor;
2120
	    bits[i] = filler;
1804
 
2121
 
Line 1813... Line 2130...
1813
                int                      bpp,
2130
                int                      bpp,
1814
                int                      x,
2131
                int                      x,
1815
                int                      y,
2132
                int                      y,
1816
                int                      width,
2133
                int                      width,
1817
                int                      height,
2134
                int                      height,
1818
                uint32_t		 xor)
2135
                uint32_t		 filler)
1819
{
2136
{
1820
    switch (bpp)
2137
    switch (bpp)
1821
    {
2138
    {
-
 
2139
    case 1:
-
 
2140
	pixman_fill1 (bits, stride, x, y, width, height, filler);
-
 
2141
	break;
-
 
2142
 
1822
    case 8:
2143
    case 8:
1823
	pixman_fill8 (bits, stride, x, y, width, height, xor);
2144
	pixman_fill8 (bits, stride, x, y, width, height, filler);
1824
	break;
2145
	break;
Line 1825... Line 2146...
1825
 
2146
 
1826
    case 16:
2147
    case 16:
1827
	pixman_fill16 (bits, stride, x, y, width, height, xor);
2148
	pixman_fill16 (bits, stride, x, y, width, height, filler);
Line 1828... Line 2149...
1828
	break;
2149
	break;
1829
 
2150
 
1830
    case 32:
2151
    case 32:
Line 1831... Line 2152...
1831
	pixman_fill32 (bits, stride, x, y, width, height, xor);
2152
	pixman_fill32 (bits, stride, x, y, width, height, filler);
-
 
2153
	break;
-
 
2154
 
-
 
2155
    default:
-
 
2156
	return FALSE;
-
 
2157
    }
-
 
2158
 
-
 
2159
    return TRUE;
-
 
2160
}
-
 
2161
 
-
 
2162
/*****************************************************************************/
-
 
2163
 
-
 
2164
static uint32_t *
-
 
2165
fast_fetch_r5g6b5 (pixman_iter_t *iter, const uint32_t *mask)
-
 
2166
{
-
 
2167
    int32_t w = iter->width;
-
 
2168
    uint32_t *dst = iter->buffer;
-
 
2169
    const uint16_t *src = (const uint16_t *)iter->bits;
-
 
2170
 
-
 
2171
    iter->bits += iter->stride;
-
 
2172
 
-
 
2173
    /* Align the source buffer at 4 bytes boundary */
-
 
2174
    if (w > 0 && ((uintptr_t)src & 3))
-
 
2175
    {
-
 
2176
	*dst++ = convert_0565_to_8888 (*src++);
-
 
2177
	w--;
-
 
2178
    }
-
 
2179
    /* Process two pixels per iteration */
-
 
2180
    while ((w -= 2) >= 0)
-
 
2181
    {
-
 
2182
	uint32_t sr, sb, sg, t0, t1;
-
 
2183
	uint32_t s = *(const uint32_t *)src;
-
 
2184
	src += 2;
-
 
2185
	sr = (s >> 8) & 0x00F800F8;
-
 
2186
	sb = (s << 3) & 0x00F800F8;
-
 
2187
	sg = (s >> 3) & 0x00FC00FC;
-
 
2188
	sr |= sr >> 5;
-
 
2189
	sb |= sb >> 5;
-
 
2190
	sg |= sg >> 6;
-
 
2191
	t0 = ((sr << 16) & 0x00FF0000) | ((sg << 8) & 0x0000FF00) |
-
 
2192
	     (sb & 0xFF) | 0xFF000000;
-
 
2193
	t1 = (sr & 0x00FF0000) | ((sg >> 8) & 0x0000FF00) |
-
 
2194
	     (sb >> 16) | 0xFF000000;
-
 
2195
#ifdef WORDS_BIGENDIAN
-
 
2196
	*dst++ = t1;
-
 
2197
	*dst++ = t0;
-
 
2198
#else
-
 
2199
	*dst++ = t0;
-
 
2200
	*dst++ = t1;
-
 
2201
#endif
-
 
2202
    }
-
 
2203
    if (w & 1)
-
 
2204
    {
-
 
2205
	*dst = convert_0565_to_8888 (*src);
-
 
2206
    }
-
 
2207
 
-
 
2208
    return iter->buffer;
-
 
2209
}
-
 
2210
 
-
 
2211
static uint32_t *
-
 
2212
fast_dest_fetch_noop (pixman_iter_t *iter, const uint32_t *mask)
-
 
2213
{
-
 
2214
    iter->bits += iter->stride;
-
 
2215
    return iter->buffer;
-
 
2216
}
-
 
2217
 
-
 
2218
/* Helper function for a workaround, which tries to ensure that 0x1F001F
-
 
2219
 * constant is always allocated in a register on RISC architectures.
-
 
2220
 */
-
 
2221
static force_inline uint32_t
-
 
2222
convert_8888_to_0565_workaround (uint32_t s, uint32_t x1F001F)
-
 
2223
{
-
 
2224
    uint32_t a, b;
-
 
2225
    a = (s >> 3) & x1F001F;
-
 
2226
    b = s & 0xFC00;
-
 
2227
    a |= a >> 5;
-
 
2228
    a |= b >> 5;
-
 
2229
    return a;
-
 
2230
}
-
 
2231
 
-
 
2232
static void
-
 
2233
fast_write_back_r5g6b5 (pixman_iter_t *iter)
-
 
2234
{
-
 
2235
    int32_t w = iter->width;
-
 
2236
    uint16_t *dst = (uint16_t *)(iter->bits - iter->stride);
-
 
2237
    const uint32_t *src = iter->buffer;
-
 
2238
    /* Workaround to ensure that x1F001F variable is allocated in a register */
-
 
2239
    static volatile uint32_t volatile_x1F001F = 0x1F001F;
-
 
2240
    uint32_t x1F001F = volatile_x1F001F;
-
 
2241
 
-
 
2242
    while ((w -= 4) >= 0)
-
 
2243
    {
-
 
2244
	uint32_t s1 = *src++;
-
 
2245
	uint32_t s2 = *src++;
-
 
2246
	uint32_t s3 = *src++;
-
 
2247
	uint32_t s4 = *src++;
-
 
2248
	*dst++ = convert_8888_to_0565_workaround (s1, x1F001F);
-
 
2249
	*dst++ = convert_8888_to_0565_workaround (s2, x1F001F);
-
 
2250
	*dst++ = convert_8888_to_0565_workaround (s3, x1F001F);
-
 
2251
	*dst++ = convert_8888_to_0565_workaround (s4, x1F001F);
-
 
2252
    }
-
 
2253
    if (w & 2)
-
 
2254
    {
-
 
2255
	*dst++ = convert_8888_to_0565_workaround (*src++, x1F001F);
-
 
2256
	*dst++ = convert_8888_to_0565_workaround (*src++, x1F001F);
-
 
2257
    }
-
 
2258
    if (w & 1)
-
 
2259
    {
-
 
2260
	*dst = convert_8888_to_0565_workaround (*src, x1F001F);
-
 
2261
    }
-
 
2262
}
1832
	break;
2263
 
-
 
2264
typedef struct
-
 
2265
{
-
 
2266
    pixman_format_code_t	format;
-
 
2267
    pixman_iter_get_scanline_t	get_scanline;
-
 
2268
    pixman_iter_write_back_t	write_back;
-
 
2269
} fetcher_info_t;
1833
 
2270
 
-
 
2271
static const fetcher_info_t fetchers[] =
-
 
2272
{
-
 
2273
    { PIXMAN_r5g6b5, fast_fetch_r5g6b5, fast_write_back_r5g6b5 },
-
 
2274
    { PIXMAN_null }
-
 
2275
};
-
 
2276
 
-
 
2277
static pixman_bool_t
-
 
2278
fast_src_iter_init (pixman_implementation_t *imp, pixman_iter_t *iter)
-
 
2279
{
-
 
2280
    pixman_image_t *image = iter->image;
-
 
2281
 
-
 
2282
#define FLAGS								\
-
 
2283
    (FAST_PATH_STANDARD_FLAGS | FAST_PATH_ID_TRANSFORM |		\
-
 
2284
     FAST_PATH_BITS_IMAGE | FAST_PATH_SAMPLES_COVER_CLIP_NEAREST)
-
 
2285
 
-
 
2286
    if ((iter->iter_flags & ITER_NARROW)			&&
-
 
2287
	(iter->image_flags & FLAGS) == FLAGS)
-
 
2288
    {
-
 
2289
	const fetcher_info_t *f;
-
 
2290
 
1834
    default:
2291
	for (f = &fetchers[0]; f->format != PIXMAN_null; f++)
-
 
2292
	{
-
 
2293
	    if (image->common.extended_format_code == f->format)
-
 
2294
	    {
-
 
2295
		uint8_t *b = (uint8_t *)image->bits.bits;
-
 
2296
		int s = image->bits.rowstride * 4;
-
 
2297
 
-
 
2298
		iter->bits = b + s * iter->y + iter->x * PIXMAN_FORMAT_BPP (f->format) / 8;
-
 
2299
		iter->stride = s;
1835
	return _pixman_implementation_fill (
2300
 
-
 
2301
		iter->get_scanline = f->get_scanline;
-
 
2302
		return TRUE;
-
 
2303
	    }
-
 
2304
	}
-
 
2305
    }
-
 
2306
 
-
 
2307
    return FALSE;
-
 
2308
}
-
 
2309
 
-
 
2310
static pixman_bool_t
Line -... Line 2311...
-
 
2311
fast_dest_iter_init (pixman_implementation_t *imp, pixman_iter_t *iter)
-
 
2312
{
-
 
2313
    pixman_image_t *image = iter->image;
-
 
2314
 
-
 
2315
    if ((iter->iter_flags & ITER_NARROW)		&&
-
 
2316
	(iter->image_flags & FAST_PATH_STD_DEST_FLAGS) == FAST_PATH_STD_DEST_FLAGS)
-
 
2317
    {
-
 
2318
	const fetcher_info_t *f;
-
 
2319
 
-
 
2320
	for (f = &fetchers[0]; f->format != PIXMAN_null; f++)
-
 
2321
	{
-
 
2322
	    if (image->common.extended_format_code == f->format)
-
 
2323
	    {
-
 
2324
		uint8_t *b = (uint8_t *)image->bits.bits;
-
 
2325
		int s = image->bits.rowstride * 4;
-
 
2326
 
-
 
2327
		iter->bits = b + s * iter->y + iter->x * PIXMAN_FORMAT_BPP (f->format) / 8;
-
 
2328
		iter->stride = s;
-
 
2329
 
-
 
2330
		if ((iter->iter_flags & (ITER_IGNORE_RGB | ITER_IGNORE_ALPHA)) ==
-
 
2331
		    (ITER_IGNORE_RGB | ITER_IGNORE_ALPHA))
-
 
2332
		{
-
 
2333
		    iter->get_scanline = fast_dest_fetch_noop;
-
 
2334
		}
-
 
2335
		else
1836
	    imp->delegate, bits, stride, bpp, x, y, width, height, xor);
2336
		{
1837
	break;
2337
		    iter->get_scanline = f->get_scanline;
-
 
2338
		}
-
 
2339
		iter->write_back = f->write_back;
-
 
2340
		return TRUE;
-
 
2341
	    }
-
 
2342
	}
Line 1838... Line 2343...
1838
    }
2343
    }
1839
 
2344
    return FALSE;
1840
    return TRUE;
2345
}
1841
}
-
 
1842
 
2346
 
Line 1843... Line 2347...
1843
pixman_implementation_t *
2347
 
-
 
2348
pixman_implementation_t *
-
 
2349
_pixman_implementation_create_fast_path (pixman_implementation_t *fallback)
Line 1844... Line 2350...
1844
_pixman_implementation_create_fast_path (void)
2350
{
1845
{
2351
    pixman_implementation_t *imp = _pixman_implementation_create (fallback, c_fast_paths);