move around - flatter.
[profile/ivi/evas.git] / src / lib / engines / common_16 / evas_soft16_scanline_fill.c
1 /** NOTE: This file is meant to be included by users **/
2
3 /*****************************************************************************
4  * Point processing
5  *
6  *    _soft16_pt_<description>_<src>_<dst>[_<modifier>]()
7  *
8  * Scanline processing
9  *
10  *    _soft16_scanline_<description>_<src>_<dst>[_<modifier>]()
11  *
12  ****************************************************************************/
13 static always_inline void
14 _soft16_pt_fill_solid_solid(DATA16 *dst, DATA16 rgb565)
15 {
16    *dst = rgb565;
17 }
18
19 static void
20 _soft16_scanline_fill_solid_solid(DATA16 *dst, int size, DATA16 rgb565)
21 {
22    DATA16 *start, *end;
23    DATA32 rgb565_double;
24
25    start = dst;
26
27    if ((long)start & 0x2)
28      {
29         *start = rgb565;
30         start++;
31         size--;
32      }
33
34    end = start + (size & ~7);
35
36    rgb565_double = (rgb565 << 16) | rgb565;
37
38    while (start < end)
39      {
40         DATA32 *p = (DATA32 *)start;
41
42         p[0] = rgb565_double;
43         p[1] = rgb565_double;
44         p[2] = rgb565_double;
45         p[3] = rgb565_double;
46
47         start += 8;
48      }
49
50    end = start + (size & 7);
51    for (; start < end; start++)
52       *start = rgb565;
53 }
54
55 static always_inline void
56 _soft16_pt_fill_transp_solid(DATA16 *dst, DATA32 rgb565_unpack, DATA8 alpha)
57 {
58    DATA32 d;
59
60    d = RGB_565_UNPACK(*dst);
61    d = RGB_565_UNPACKED_BLEND(rgb565_unpack, d, alpha);
62    *dst = RGB_565_PACK(d);
63 }
64
65 static void
66 _soft16_scanline_fill_transp_solid(DATA16 *dst, int size, DATA32 rgb565_unpack, DATA8 alpha)
67 {
68    DATA16 *start, *end;
69
70    start = dst;
71    pld(start, 0);
72    end = start + (size & ~7);
73
74    while (start < end)
75      {
76         pld(start, 32);
77         UNROLL8({
78            _soft16_pt_fill_transp_solid(start, rgb565_unpack, alpha);
79            start++;
80         });
81      }
82
83    end = start + (size & 7);
84    for (; start < end; start++)
85      _soft16_pt_fill_transp_solid(start, rgb565_unpack, alpha);
86 }