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_image_unscaled.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 '')
-rw-r--r-- | libraries/evas/src/lib/engines/common_16/evas_soft16_image_unscaled.c | 287 |
1 files changed, 287 insertions, 0 deletions
diff --git a/libraries/evas/src/lib/engines/common_16/evas_soft16_image_unscaled.c b/libraries/evas/src/lib/engines/common_16/evas_soft16_image_unscaled.c new file mode 100644 index 0000000..f53fdf0 --- /dev/null +++ b/libraries/evas/src/lib/engines/common_16/evas_soft16_image_unscaled.c | |||
@@ -0,0 +1,287 @@ | |||
1 | #include "evas_common_soft16.h" | ||
2 | #include "evas_soft16_scanline_blend.c" | ||
3 | |||
4 | static void | ||
5 | _soft16_image_draw_unscaled_solid_solid(Soft16_Image *src, Soft16_Image *dst, | ||
6 | RGBA_Draw_Context *dc __UNUSED__, | ||
7 | int src_offset, int dst_offset, | ||
8 | int w, int h) | ||
9 | { | ||
10 | DATA16 *src_itr, *dst_itr; | ||
11 | int y; | ||
12 | |||
13 | src_itr = src->pixels + src_offset; | ||
14 | dst_itr = dst->pixels + dst_offset; | ||
15 | |||
16 | for (y = 0; y < h; y++) | ||
17 | { | ||
18 | _soft16_scanline_blend_solid_solid(src_itr, dst_itr, w); | ||
19 | src_itr += src->stride; | ||
20 | dst_itr += dst->stride; | ||
21 | } | ||
22 | } | ||
23 | |||
24 | static void | ||
25 | _soft16_image_draw_unscaled_transp_solid(Soft16_Image *src, Soft16_Image *dst, | ||
26 | RGBA_Draw_Context *dc __UNUSED__, | ||
27 | int src_offset, int dst_offset, | ||
28 | int w, int h) | ||
29 | |||
30 | { | ||
31 | DATA16 *src_itr, *dst_itr; | ||
32 | DATA8 *alpha_itr; | ||
33 | int y; | ||
34 | |||
35 | src_itr = src->pixels + src_offset; | ||
36 | alpha_itr = src->alpha + src_offset; | ||
37 | dst_itr = dst->pixels + dst_offset; | ||
38 | |||
39 | for (y = 0; y < h; y++) | ||
40 | { | ||
41 | _soft16_scanline_blend_transp_solid(src_itr, alpha_itr, dst_itr, w); | ||
42 | src_itr += src->stride; | ||
43 | alpha_itr += src->stride; | ||
44 | dst_itr += dst->stride; | ||
45 | } | ||
46 | } | ||
47 | |||
48 | static inline void | ||
49 | _soft16_image_draw_unscaled_no_mul(Soft16_Image *src, Soft16_Image *dst, | ||
50 | RGBA_Draw_Context *dc, | ||
51 | int src_offset, int dst_offset, | ||
52 | int width, int height) | ||
53 | { | ||
54 | if (src->cache_entry.flags.alpha && (!dst->cache_entry.flags.alpha)) | ||
55 | _soft16_image_draw_unscaled_transp_solid(src, dst, dc, | ||
56 | src_offset, dst_offset, | ||
57 | width, height); | ||
58 | else if ((!src->cache_entry.flags.alpha) && (!dst->cache_entry.flags.alpha)) | ||
59 | _soft16_image_draw_unscaled_solid_solid(src, dst, dc, | ||
60 | src_offset, dst_offset, | ||
61 | width, height); | ||
62 | else | ||
63 | ERR("Unsupported draw of unscaled images src->cache_entry.flags.alpha=%d, " | ||
64 | "dst->cache_entry.flags.alpha=%d, WITHOUT COLOR MUL", | ||
65 | src->cache_entry.flags.alpha, dst->cache_entry.flags.alpha); | ||
66 | } | ||
67 | |||
68 | static void | ||
69 | _soft16_image_draw_unscaled_solid_solid_mul_alpha(Soft16_Image *src, | ||
70 | Soft16_Image *dst, | ||
71 | RGBA_Draw_Context *dc __UNUSED__, | ||
72 | int src_offset, | ||
73 | int dst_offset, | ||
74 | int w, int h, DATA8 a) | ||
75 | { | ||
76 | DATA16 *src_itr, *dst_itr; | ||
77 | int y; | ||
78 | |||
79 | src_itr = src->pixels + src_offset; | ||
80 | dst_itr = dst->pixels + dst_offset; | ||
81 | |||
82 | for (y = 0; y < h; y++) | ||
83 | { | ||
84 | _soft16_scanline_blend_solid_solid_mul_alpha(src_itr, dst_itr, w, a); | ||
85 | src_itr += src->stride; | ||
86 | dst_itr += dst->stride; | ||
87 | } | ||
88 | } | ||
89 | |||
90 | static void | ||
91 | _soft16_image_draw_unscaled_transp_solid_mul_alpha(Soft16_Image *src, | ||
92 | Soft16_Image *dst, | ||
93 | RGBA_Draw_Context *dc __UNUSED__, | ||
94 | int src_offset, | ||
95 | int dst_offset, | ||
96 | int w, int h, DATA8 a) | ||
97 | |||
98 | { | ||
99 | DATA16 *src_itr, *dst_itr; | ||
100 | DATA8 *alpha_itr; | ||
101 | int y; | ||
102 | |||
103 | src_itr = src->pixels + src_offset; | ||
104 | alpha_itr = src->alpha + src_offset; | ||
105 | dst_itr = dst->pixels + dst_offset; | ||
106 | |||
107 | for (y = 0; y < h; y++) | ||
108 | { | ||
109 | _soft16_scanline_blend_transp_solid_mul_alpha(src_itr, alpha_itr, | ||
110 | dst_itr, w, a); | ||
111 | src_itr += src->stride; | ||
112 | alpha_itr += src->stride; | ||
113 | dst_itr += dst->stride; | ||
114 | } | ||
115 | } | ||
116 | |||
117 | static inline void | ||
118 | _soft16_image_draw_unscaled_mul_alpha(Soft16_Image *src, Soft16_Image *dst, | ||
119 | RGBA_Draw_Context *dc, | ||
120 | int src_offset, int dst_offset, | ||
121 | int width, int height, DATA8 a) | ||
122 | { | ||
123 | if (src->cache_entry.flags.alpha && (!dst->cache_entry.flags.alpha)) | ||
124 | _soft16_image_draw_unscaled_transp_solid_mul_alpha | ||
125 | (src, dst, dc, src_offset, dst_offset, width, height, a); | ||
126 | else if ((!src->cache_entry.flags.alpha) && (!dst->cache_entry.flags.alpha)) | ||
127 | _soft16_image_draw_unscaled_solid_solid_mul_alpha | ||
128 | (src, dst, dc, src_offset, dst_offset, width, height, a); | ||
129 | else | ||
130 | ERR("Unsupported draw of unscaled images src->cache_entry.flags.alpha=%d, " | ||
131 | "dst->cache_entry.flags.alpha=%d, WITH ALPHA MUL %d", | ||
132 | src->cache_entry.flags.alpha, dst->cache_entry.flags.alpha, A_VAL(&dc->mul.col)); | ||
133 | } | ||
134 | |||
135 | static void | ||
136 | _soft16_image_draw_unscaled_solid_solid_mul_color(Soft16_Image *src, | ||
137 | Soft16_Image *dst, | ||
138 | RGBA_Draw_Context *dc __UNUSED__, | ||
139 | int src_offset, | ||
140 | int dst_offset, | ||
141 | int w, int h, DATA8 r, | ||
142 | DATA8 g, DATA8 b, DATA8 a) | ||
143 | { | ||
144 | DATA16 *src_itr, *dst_itr; | ||
145 | int y; | ||
146 | |||
147 | src_itr = src->pixels + src_offset; | ||
148 | dst_itr = dst->pixels + dst_offset; | ||
149 | |||
150 | if (a == 31) | ||
151 | for (y = 0; y < h; y++) | ||
152 | { | ||
153 | _soft16_scanline_blend_solid_solid_mul_color_solid | ||
154 | (src_itr, dst_itr, w, r, g, b); | ||
155 | src_itr += src->stride; | ||
156 | dst_itr += dst->stride; | ||
157 | } | ||
158 | else | ||
159 | for (y = 0; y < h; y++) | ||
160 | { | ||
161 | _soft16_scanline_blend_solid_solid_mul_color_transp | ||
162 | (src_itr, dst_itr, w, a, r, g, b); | ||
163 | src_itr += src->stride; | ||
164 | dst_itr += dst->stride; | ||
165 | } | ||
166 | } | ||
167 | |||
168 | static void | ||
169 | _soft16_image_draw_unscaled_transp_solid_mul_color(Soft16_Image *src, | ||
170 | Soft16_Image *dst, | ||
171 | RGBA_Draw_Context *dc __UNUSED__, | ||
172 | int src_offset, | ||
173 | int dst_offset, | ||
174 | int w, int h, DATA8 r, | ||
175 | DATA8 g, DATA8 b, DATA8 a) | ||
176 | |||
177 | { | ||
178 | DATA16 *src_itr, *dst_itr; | ||
179 | DATA8 *alpha_itr; | ||
180 | int y; | ||
181 | |||
182 | src_itr = src->pixels + src_offset; | ||
183 | alpha_itr = src->alpha + src_offset; | ||
184 | dst_itr = dst->pixels + dst_offset; | ||
185 | |||
186 | if (a == 31) | ||
187 | for (y = 0; y < h; y++) | ||
188 | { | ||
189 | _soft16_scanline_blend_transp_solid_mul_color_solid | ||
190 | (src_itr, alpha_itr, dst_itr, w, r, g, b); | ||
191 | src_itr += src->stride; | ||
192 | alpha_itr += src->stride; | ||
193 | dst_itr += dst->stride; | ||
194 | } | ||
195 | else | ||
196 | for (y = 0; y < h; y++) | ||
197 | { | ||
198 | _soft16_scanline_blend_transp_solid_mul_color_transp | ||
199 | (src_itr, alpha_itr, dst_itr, w, a, r, g, b); | ||
200 | src_itr += src->stride; | ||
201 | alpha_itr += src->stride; | ||
202 | dst_itr += dst->stride; | ||
203 | } | ||
204 | } | ||
205 | |||
206 | static inline void | ||
207 | _soft16_image_draw_unscaled_mul_color(Soft16_Image *src, Soft16_Image *dst, | ||
208 | RGBA_Draw_Context *dc, | ||
209 | int src_offset, int dst_offset, | ||
210 | int width, int height, | ||
211 | DATA8 r, DATA8 g, DATA8 b, DATA8 a) | ||
212 | { | ||
213 | if (src->cache_entry.flags.alpha && (!dst->cache_entry.flags.alpha)) | ||
214 | _soft16_image_draw_unscaled_transp_solid_mul_color | ||
215 | (src, dst, dc, src_offset, dst_offset, width, height, r, g, b, a); | ||
216 | else if ((!src->cache_entry.flags.alpha) && (!dst->cache_entry.flags.alpha)) | ||
217 | _soft16_image_draw_unscaled_solid_solid_mul_color | ||
218 | (src, dst, dc, src_offset, dst_offset, width, height, r, g, b, a); | ||
219 | else | ||
220 | ERR("Unsupported draw of unscaled images src->cache_entry.flags.alpha=%d, " | ||
221 | "dst->cache_entry.flags.alpha=%d, WITH COLOR MUL 0x%08x", | ||
222 | src->cache_entry.flags.alpha, dst->cache_entry.flags.alpha, dc->mul.col); | ||
223 | } | ||
224 | |||
225 | static inline void | ||
226 | _soft16_image_draw_unscaled_mul(Soft16_Image *src, Soft16_Image *dst, | ||
227 | RGBA_Draw_Context *dc, | ||
228 | int src_offset, int dst_offset, | ||
229 | int width, int height, DATA8 r, DATA8 g, | ||
230 | DATA8 b, DATA8 a) | ||
231 | { | ||
232 | if ((a == r) && (a == (g >> 1)) && (a == b)) | ||
233 | _soft16_image_draw_unscaled_mul_alpha(src, dst, dc, src_offset, | ||
234 | dst_offset, width, height, a); | ||
235 | else | ||
236 | _soft16_image_draw_unscaled_mul_color(src, dst, dc, src_offset, | ||
237 | dst_offset, width, height, | ||
238 | r, g, b, a); | ||
239 | } | ||
240 | |||
241 | void | ||
242 | evas_common_soft16_image_draw_unscaled(Soft16_Image *src, Soft16_Image *dst, | ||
243 | RGBA_Draw_Context *dc, | ||
244 | const Eina_Rectangle sr, | ||
245 | const Eina_Rectangle dr, | ||
246 | const Eina_Rectangle cr) | ||
247 | { | ||
248 | int src_offset_rows, src_offset, dst_offset; | ||
249 | DATA16 mul_rgb565; | ||
250 | DATA8 r, g, b, a; | ||
251 | |||
252 | if (!dc->mul.use) | ||
253 | { | ||
254 | r = b = a = 31; | ||
255 | g = 63; | ||
256 | mul_rgb565 = 0xffff; | ||
257 | } | ||
258 | else | ||
259 | { | ||
260 | a = A_VAL(&dc->mul.col) >> 3; | ||
261 | if (a == 0) | ||
262 | return; | ||
263 | |||
264 | r = R_VAL(&dc->mul.col) >> 3; | ||
265 | g = G_VAL(&dc->mul.col) >> 2; | ||
266 | b = B_VAL(&dc->mul.col) >> 3; | ||
267 | |||
268 | if (r > a) r = a; | ||
269 | if (g > (a << 1)) g = (a << 1); | ||
270 | if (b > a) b = a; | ||
271 | |||
272 | mul_rgb565 = (r << 11) || (g << 5) | b; | ||
273 | } | ||
274 | |||
275 | |||
276 | src_offset_rows = (cr.y - dr.y) + sr.y; | ||
277 | src_offset = (src_offset_rows * src->stride) + (cr.x - dr.x) + sr.x; | ||
278 | |||
279 | dst_offset = cr.x + (cr.y * dst->stride); | ||
280 | |||
281 | if (mul_rgb565 == 0xffff) | ||
282 | _soft16_image_draw_unscaled_no_mul(src, dst, dc, src_offset, dst_offset, | ||
283 | cr.w, cr.h); | ||
284 | else | ||
285 | _soft16_image_draw_unscaled_mul(src, dst, dc, src_offset, dst_offset, | ||
286 | cr.w, cr.h, r, g, b, a); | ||
287 | } | ||