aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/libraries/evas/src/lib/engines/common_16/evas_soft16_scanline_fill.c
blob: d31bef86402336a350ef1d9a0aeff75ac66563e3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
/** NOTE: This file is meant to be included by users **/

/*****************************************************************************
 * Point processing
 *
 *    _soft16_pt_<description>_<src>_<dst>[_<modifier>]()
 *
 * Scanline processing
 *
 *    _soft16_scanline_<description>_<src>_<dst>[_<modifier>]()
 *
 ****************************************************************************/
EFL_ALWAYS_INLINE void
_soft16_pt_fill_solid_solid(DATA16 *dst, DATA16 rgb565)
{
   *dst = rgb565;
}

static void
_soft16_scanline_fill_solid_solid(DATA16 *dst, int size, DATA16 rgb565)
{
   DATA16 *start, *end;
   DATA32 rgb565_double;

   start = dst;

   if ((long)start & 0x2)
     {
	*start = rgb565;
	start++;
	size--;
     }

   end = start + (size & ~7);

   rgb565_double = (rgb565 << 16) | rgb565;

   while (start < end)
     {
        DATA32 *p = (DATA32 *)start;

        p[0] = rgb565_double;
        p[1] = rgb565_double;
        p[2] = rgb565_double;
        p[3] = rgb565_double;

        start += 8;
     }

   end = start + (size & 7);
   for (; start < end; start++)
      *start = rgb565;
}

EFL_ALWAYS_INLINE void
_soft16_pt_fill_transp_solid(DATA16 *dst, DATA32 rgb565_unpack, DATA8 alpha)
{
   DATA32 d;

   d = RGB_565_UNPACK(*dst);
   d = RGB_565_UNPACKED_BLEND(rgb565_unpack, d, alpha);
   *dst = RGB_565_PACK(d);
}

static void
_soft16_scanline_fill_transp_solid(DATA16 *dst, int size, DATA32 rgb565_unpack, DATA8 alpha)
{
   DATA16 *start, *end;

   start = dst;
   pld(start, 0);
   end = start + (size & ~7);

   while (start < end)
     {
        pld(start, 32);
        UNROLL8({
           _soft16_pt_fill_transp_solid(start, rgb565_unpack, alpha);
           start++;
        });
     }

   end = start + (size & 7);
   for (; start < end; start++)
     _soft16_pt_fill_transp_solid(start, rgb565_unpack, alpha);
}