diff options
author | David Walter Seikel | 2012-01-04 18:41:13 +1000 |
---|---|---|
committer | David Walter Seikel | 2012-01-04 18:41:13 +1000 |
commit | dd7595a3475407a7fa96a97393bae8c5220e8762 (patch) | |
tree | e341e911d7eb911a51684a7412ef7f7c7605d28e /libraries/evas/src/lib/engines/common_16/evas_soft16_point_blend.c | |
parent | Add the skeleton. (diff) | |
download | SledjHamr-dd7595a3475407a7fa96a97393bae8c5220e8762.zip SledjHamr-dd7595a3475407a7fa96a97393bae8c5220e8762.tar.gz SledjHamr-dd7595a3475407a7fa96a97393bae8c5220e8762.tar.bz2 SledjHamr-dd7595a3475407a7fa96a97393bae8c5220e8762.tar.xz |
Add the base Enlightenment Foundation Libraries - eina, eet, evas, ecore, embryo, and edje.
Note that embryo wont be used, but I'm not sure yet if you can build edje without it.
Diffstat (limited to 'libraries/evas/src/lib/engines/common_16/evas_soft16_point_blend.c')
-rw-r--r-- | libraries/evas/src/lib/engines/common_16/evas_soft16_point_blend.c | 149 |
1 files changed, 149 insertions, 0 deletions
diff --git a/libraries/evas/src/lib/engines/common_16/evas_soft16_point_blend.c b/libraries/evas/src/lib/engines/common_16/evas_soft16_point_blend.c new file mode 100644 index 0000000..8cd02d5 --- /dev/null +++ b/libraries/evas/src/lib/engines/common_16/evas_soft16_point_blend.c | |||
@@ -0,0 +1,149 @@ | |||
1 | /** NOTE: This file is meant to be included by users **/ | ||
2 | |||
3 | /** NOTE2: r, g, b parameters are 16bits, so you can pass 0 to 256 inclusive. | ||
4 | ** this is due our division by 256 when multiplying the color. | ||
5 | **/ | ||
6 | |||
7 | /***************************************************************************** | ||
8 | * Scanline processing | ||
9 | * | ||
10 | * _soft16_pt_<description>_<src>_<dst>[_<modifier>]() | ||
11 | * | ||
12 | ****************************************************************************/ | ||
13 | |||
14 | /*********************************************************************** | ||
15 | * Regular blend operations | ||
16 | */ | ||
17 | |||
18 | EFL_ALWAYS_INLINE void | ||
19 | _soft16_pt_blend_transp_solid(DATA16 *p_dst, DATA16 src, DATA8 alpha) | ||
20 | { | ||
21 | if (alpha == 31) *p_dst = src; | ||
22 | else if (alpha != 0) | ||
23 | { | ||
24 | DATA32 a, b; | ||
25 | |||
26 | a = RGB_565_UNPACK(src); | ||
27 | b = RGB_565_UNPACK(*p_dst); | ||
28 | b = RGB_565_UNPACKED_BLEND(a, b, alpha); | ||
29 | *p_dst = RGB_565_PACK(b); | ||
30 | } | ||
31 | } | ||
32 | |||
33 | EFL_ALWAYS_INLINE void | ||
34 | _soft16_pt_blend_solid_solid(DATA16 *p_dst, DATA16 src) | ||
35 | { | ||
36 | *p_dst = src; | ||
37 | } | ||
38 | |||
39 | /*********************************************************************** | ||
40 | * Blend operations taking an extra alpha (fade in, out) | ||
41 | */ | ||
42 | |||
43 | EFL_ALWAYS_INLINE void | ||
44 | _soft16_pt_blend_transp_solid_mul_alpha(DATA16 *p_dst, DATA16 src, DATA8 alpha, DATA8 rel_alpha) | ||
45 | { | ||
46 | DATA32 a, b; | ||
47 | |||
48 | alpha = (alpha * rel_alpha) >> 5; | ||
49 | if (alpha == 0) | ||
50 | return; | ||
51 | |||
52 | alpha++; | ||
53 | |||
54 | a = ((RGB_565_UNPACK(src) * rel_alpha) >> 5) & RGB_565_UNPACKED_MASK; | ||
55 | b = RGB_565_UNPACK(*p_dst); | ||
56 | b = RGB_565_UNPACKED_BLEND(a, b, alpha); | ||
57 | *p_dst = RGB_565_PACK(b); | ||
58 | } | ||
59 | |||
60 | EFL_ALWAYS_INLINE void | ||
61 | _soft16_pt_blend_solid_solid_mul_alpha(DATA16 *p_dst, DATA16 src, DATA8 rel_alpha) | ||
62 | { | ||
63 | DATA32 a, b; | ||
64 | a = RGB_565_UNPACK(src); | ||
65 | b = RGB_565_UNPACK(*p_dst); | ||
66 | b = RGB_565_UNPACKED_BLEND_UNMUL(a, b, rel_alpha); | ||
67 | *p_dst = RGB_565_PACK(b); | ||
68 | } | ||
69 | |||
70 | /*********************************************************************** | ||
71 | * Blend operations with extra alpha and multiply color | ||
72 | */ | ||
73 | |||
74 | EFL_ALWAYS_INLINE void | ||
75 | _soft16_pt_blend_transp_solid_mul_color_transp(DATA16 *p_dst, DATA16 src, DATA8 alpha, DATA8 rel_alpha, DATA16 r, DATA16 g, DATA16 b) | ||
76 | { | ||
77 | DATA32 rgb, d; | ||
78 | int r1, g1, b1; | ||
79 | |||
80 | alpha = (alpha * rel_alpha) >> 5; | ||
81 | if (alpha == 0) | ||
82 | return; | ||
83 | |||
84 | alpha++; | ||
85 | |||
86 | r1 = ((((src) >> 11) & 0x1f) * r) >> 5; | ||
87 | g1 = ((((src) >> 5) & 0x3f) * g) >> 6; | ||
88 | b1 = (((src) & 0x1f) * b) >> 5; | ||
89 | rgb = ((r1 << 11) | (g1 << 21) | b1) & RGB_565_UNPACKED_MASK; | ||
90 | d = RGB_565_UNPACK(*p_dst); | ||
91 | d = RGB_565_UNPACKED_BLEND(rgb, d, alpha); | ||
92 | |||
93 | *p_dst = RGB_565_PACK(d); | ||
94 | } | ||
95 | |||
96 | EFL_ALWAYS_INLINE void | ||
97 | _soft16_pt_blend_solid_solid_mul_color_transp(DATA16 *p_dst, DATA16 src, DATA8 rel_alpha, DATA16 r, DATA16 g, DATA16 b) | ||
98 | { | ||
99 | int r1, g1, b1; | ||
100 | DATA32 rgb, d; | ||
101 | |||
102 | r1 = ((((src) >> 11) & 0x1f) * r) >> 5; | ||
103 | g1 = ((((src) >> 5) & 0x3f) * g) >> 6; | ||
104 | b1 = (((src) & 0x1f) * b) >> 5; | ||
105 | |||
106 | rgb = ((r1 << 11) | (g1 << 21) | b1) & RGB_565_UNPACKED_MASK; | ||
107 | d = RGB_565_UNPACK(*p_dst); | ||
108 | d = RGB_565_UNPACKED_BLEND(rgb, d, rel_alpha); | ||
109 | *p_dst = RGB_565_PACK(d); | ||
110 | } | ||
111 | |||
112 | /*********************************************************************** | ||
113 | * Blend operations with extra multiply color | ||
114 | */ | ||
115 | |||
116 | EFL_ALWAYS_INLINE void | ||
117 | _soft16_pt_blend_transp_solid_mul_color_solid(DATA16 *p_dst, DATA16 src, DATA8 alpha, DATA8 r, DATA8 g, DATA8 b) | ||
118 | { | ||
119 | int r1, g1, b1; | ||
120 | |||
121 | if (alpha == 0) return; | ||
122 | |||
123 | r1 = ((((src >> 11) & 0x1f) * r) >> 5) & 0x1f; | ||
124 | g1 = ((((src >> 5) & 0x3f) * g) >> 6) & 0x3f; | ||
125 | b1 = (((src & 0x1f) * b) >> 5) & 0x1f; | ||
126 | |||
127 | if (alpha == 31) *p_dst = (r1 << 11) | (g1 << 5) | b1; | ||
128 | else | ||
129 | { | ||
130 | DATA32 rgb_unpack, d; | ||
131 | |||
132 | rgb_unpack = ((r1 << 11) | (g1 << 21) | b1) & RGB_565_UNPACKED_MASK; | ||
133 | d = RGB_565_UNPACK(*p_dst); | ||
134 | d = RGB_565_UNPACKED_BLEND(rgb_unpack, d, alpha); | ||
135 | *p_dst = RGB_565_PACK(d); | ||
136 | } | ||
137 | } | ||
138 | |||
139 | EFL_ALWAYS_INLINE void | ||
140 | _soft16_pt_blend_solid_solid_mul_color_solid(DATA16 *p_dst, DATA16 src, DATA16 r, DATA16 g, DATA16 b) | ||
141 | { | ||
142 | int r1, g1, b1; | ||
143 | |||
144 | r1 = ((((src >> 11) & 0x1f) * r) >> 5) & 0x1f; | ||
145 | g1 = ((((src >> 5) & 0x3f) * g) >> 6) & 0x3f; | ||
146 | b1 = (((src & 0x1f) * b) >> 5) & 0x1f; | ||
147 | |||
148 | *p_dst = (r1 << 11) | (g1 << 5) | b1; | ||
149 | } | ||