diff options
Diffstat (limited to '')
-rw-r--r-- | libraries/evas/src/lib/engines/common_8/evas_soft8_image_scaled_sampled.c | 463 |
1 files changed, 0 insertions, 463 deletions
diff --git a/libraries/evas/src/lib/engines/common_8/evas_soft8_image_scaled_sampled.c b/libraries/evas/src/lib/engines/common_8/evas_soft8_image_scaled_sampled.c deleted file mode 100644 index 7344263..0000000 --- a/libraries/evas/src/lib/engines/common_8/evas_soft8_image_scaled_sampled.c +++ /dev/null | |||
@@ -1,463 +0,0 @@ | |||
1 | #include "evas_common_soft8.h" | ||
2 | #include "evas_soft8_scanline_blend.c" | ||
3 | |||
4 | static void | ||
5 | _soft8_image_draw_scaled_solid_solid(Soft8_Image * src, | ||
6 | Soft8_Image * dst, | ||
7 | RGBA_Draw_Context * dc __UNUSED__, | ||
8 | int dst_offset, int w, int h, | ||
9 | int *offset_x, int *offset_y) | ||
10 | { | ||
11 | DATA8 *dst_itr; | ||
12 | int y, w_align; | ||
13 | |||
14 | w_align = w & ~7; | ||
15 | |||
16 | dst_itr = dst->pixels + dst_offset; | ||
17 | for (y = 0; y < h; y++, dst_itr += dst->stride) | ||
18 | { | ||
19 | DATA8 *d, *s; | ||
20 | int x; | ||
21 | |||
22 | s = src->pixels + offset_y[y]; | ||
23 | pld(s, 0); | ||
24 | pld(offset_x, 0); | ||
25 | |||
26 | d = dst_itr; | ||
27 | x = 0; | ||
28 | while (x < w_align) | ||
29 | { | ||
30 | pld(s, 32); | ||
31 | pld(offset_x + x, 32); | ||
32 | |||
33 | UNROLL8( | ||
34 | { | ||
35 | _soft8_pt_blend_solid_solid(d, s[offset_x[x]]); x++; d++;} | ||
36 | ); | ||
37 | } | ||
38 | |||
39 | for (; x < w; x++, d++) | ||
40 | _soft8_pt_blend_solid_solid(d, s[offset_x[x]]); | ||
41 | } | ||
42 | } | ||
43 | static void | ||
44 | _soft8_image_draw_scaled_transp_solid(Soft8_Image * src, | ||
45 | Soft8_Image * dst, | ||
46 | RGBA_Draw_Context * dc __UNUSED__, | ||
47 | int dst_offset, int w, int h, | ||
48 | int *offset_x, int *offset_y) | ||
49 | { | ||
50 | DATA8 *dst_itr; | ||
51 | int y, w_align; | ||
52 | |||
53 | w_align = w & ~7; | ||
54 | |||
55 | dst_itr = dst->pixels + dst_offset; | ||
56 | for (y = 0; y < h; y++, dst_itr += dst->stride) | ||
57 | { | ||
58 | DATA8 *d, *s; | ||
59 | DATA8 *a; | ||
60 | int x; | ||
61 | |||
62 | s = src->pixels + offset_y[y]; | ||
63 | a = src->alpha + offset_y[y]; | ||
64 | pld(s, 0); | ||
65 | pld(a, 0); | ||
66 | pld(offset_x, 0); | ||
67 | |||
68 | d = dst_itr; | ||
69 | x = 0; | ||
70 | while (x < w_align) | ||
71 | { | ||
72 | pld(s, 32); | ||
73 | pld(a, 8); | ||
74 | pld(offset_x + x, 32); | ||
75 | |||
76 | UNROLL8( | ||
77 | { | ||
78 | int off_x = offset_x[x]; | ||
79 | _soft8_pt_blend_transp_solid(d, s[off_x], a[off_x]); | ||
80 | x++; d++;}); | ||
81 | } | ||
82 | |||
83 | for (; x < w; x++, d++) | ||
84 | _soft8_pt_blend_transp_solid(d, s[offset_x[x]], a[offset_x[x]]); | ||
85 | } | ||
86 | } | ||
87 | |||
88 | static inline void | ||
89 | _soft8_image_draw_scaled_no_mul(Soft8_Image * src, Soft8_Image * dst, | ||
90 | RGBA_Draw_Context * dc, | ||
91 | int dst_offset, int w, int h, | ||
92 | int *offset_x, int *offset_y) | ||
93 | { | ||
94 | if ((src->cache_entry.flags.alpha && src->alpha) && | ||
95 | (!dst->cache_entry.flags.alpha)) | ||
96 | _soft8_image_draw_scaled_transp_solid | ||
97 | (src, dst, dc, dst_offset, w, h, offset_x, offset_y); | ||
98 | else if (!dst->cache_entry.flags.alpha) | ||
99 | _soft8_image_draw_scaled_solid_solid | ||
100 | (src, dst, dc, dst_offset, w, h, offset_x, offset_y); | ||
101 | else | ||
102 | ERR("Unsupported draw of scaled images src->cache_entry.flags.alpha=%d, " | ||
103 | "dst->cache_entry.flags.alpha=%d, WITHOUT COLOR MUL", | ||
104 | src->cache_entry.flags.alpha, dst->cache_entry.flags.alpha); | ||
105 | } | ||
106 | |||
107 | static void | ||
108 | _soft8_image_draw_scaled_solid_solid_mul_alpha(Soft8_Image * src, | ||
109 | Soft8_Image * dst, | ||
110 | RGBA_Draw_Context * | ||
111 | dc __UNUSED__, int dst_offset, | ||
112 | int w, int h, int *offset_x, | ||
113 | int *offset_y, DATA8 alpha) | ||
114 | { | ||
115 | DATA8 *dst_itr; | ||
116 | int y, w_align; | ||
117 | |||
118 | w_align = w & ~7; | ||
119 | |||
120 | dst_itr = dst->pixels + dst_offset; | ||
121 | for (y = 0; y < h; y++, dst_itr += dst->stride) | ||
122 | { | ||
123 | DATA8 *d, *s; | ||
124 | int x; | ||
125 | |||
126 | s = src->pixels + offset_y[y]; | ||
127 | pld(s, 0); | ||
128 | pld(offset_x, 0); | ||
129 | |||
130 | d = dst_itr; | ||
131 | x = 0; | ||
132 | while (x < w_align) | ||
133 | { | ||
134 | pld(s, 32); | ||
135 | pld(offset_x + x, 32); | ||
136 | |||
137 | UNROLL8( | ||
138 | { | ||
139 | _soft8_pt_blend_solid_solid_mul_alpha | ||
140 | (d, s[offset_x[x]], alpha); x++; d++;} | ||
141 | ); | ||
142 | } | ||
143 | |||
144 | for (; x < w; x++, d++) | ||
145 | _soft8_pt_blend_solid_solid_mul_alpha(d, s[offset_x[x]], alpha); | ||
146 | } | ||
147 | } | ||
148 | |||
149 | static void | ||
150 | _soft8_image_draw_scaled_transp_solid_mul_alpha(Soft8_Image * src, | ||
151 | Soft8_Image * dst, | ||
152 | RGBA_Draw_Context * | ||
153 | dc __UNUSED__, int dst_offset, | ||
154 | int w, int h, int *offset_x, | ||
155 | int *offset_y, DATA8 alpha) | ||
156 | { | ||
157 | DATA8 *dst_itr; | ||
158 | int y, w_align; | ||
159 | |||
160 | w_align = w & ~7; | ||
161 | |||
162 | dst_itr = dst->pixels + dst_offset; | ||
163 | for (y = 0; y < h; y++, dst_itr += dst->stride) | ||
164 | { | ||
165 | DATA8 *d, *s; | ||
166 | DATA8 *a; | ||
167 | int x; | ||
168 | |||
169 | s = src->pixels + offset_y[y]; | ||
170 | a = src->alpha + offset_y[y]; | ||
171 | pld(s, 0); | ||
172 | pld(a, 0); | ||
173 | pld(offset_x, 0); | ||
174 | |||
175 | d = dst_itr; | ||
176 | x = 0; | ||
177 | while (x < w_align) | ||
178 | { | ||
179 | pld(s, 32); | ||
180 | pld(a, 8); | ||
181 | pld(offset_x + x, 32); | ||
182 | |||
183 | UNROLL8( | ||
184 | { | ||
185 | int off_x = offset_x[x]; | ||
186 | _soft8_pt_blend_transp_solid_mul_alpha | ||
187 | (d, s[off_x], a[off_x], alpha); x++; d++;}); | ||
188 | } | ||
189 | |||
190 | for (; x < w; x++, d++) | ||
191 | _soft8_pt_blend_transp_solid_mul_alpha | ||
192 | (d, s[offset_x[x]], a[offset_x[x]], alpha); | ||
193 | } | ||
194 | } | ||
195 | |||
196 | static inline void | ||
197 | _soft8_image_draw_scaled_mul_alpha(Soft8_Image * src, Soft8_Image * dst, | ||
198 | RGBA_Draw_Context * dc, | ||
199 | int dst_offset, int w, int h, | ||
200 | int *offset_x, int *offset_y, DATA8 a) | ||
201 | { | ||
202 | if ((src->cache_entry.flags.alpha && src->alpha) && | ||
203 | (!dst->cache_entry.flags.alpha)) | ||
204 | _soft8_image_draw_scaled_transp_solid_mul_alpha | ||
205 | (src, dst, dc, dst_offset, w, h, offset_x, offset_y, a); | ||
206 | else if (!dst->cache_entry.flags.alpha) | ||
207 | _soft8_image_draw_scaled_solid_solid_mul_alpha | ||
208 | (src, dst, dc, dst_offset, w, h, offset_x, offset_y, a); | ||
209 | else | ||
210 | ERR("Unsupported draw of scaled images src->cache_entry.flags.alpha=%d, " | ||
211 | "dst->cache_entry.flags.alpha=%d, WITH ALPHA MUL %d", | ||
212 | src->cache_entry.flags.alpha, dst->cache_entry.flags.alpha, | ||
213 | A_VAL(&dc->mul.col)); | ||
214 | } | ||
215 | |||
216 | static void | ||
217 | _soft8_image_draw_scaled_solid_solid_mul_color(Soft8_Image * src, | ||
218 | Soft8_Image * dst, | ||
219 | RGBA_Draw_Context * | ||
220 | dc __UNUSED__, int dst_offset, | ||
221 | int w, int h, int *offset_x, | ||
222 | int *offset_y, DATA8 r, DATA8 g, | ||
223 | DATA8 b, DATA8 alpha) | ||
224 | { | ||
225 | DATA8 *dst_itr; | ||
226 | int y, w_align; | ||
227 | |||
228 | w_align = w & ~7; | ||
229 | |||
230 | dst_itr = dst->pixels + dst_offset; | ||
231 | |||
232 | if (alpha == 0xff) | ||
233 | for (y = 0; y < h; y++, dst_itr += dst->stride) | ||
234 | { | ||
235 | DATA8 *d, *s; | ||
236 | int x; | ||
237 | |||
238 | s = src->pixels + offset_y[y]; | ||
239 | pld(s, 0); | ||
240 | pld(offset_x, 0); | ||
241 | |||
242 | d = dst_itr; | ||
243 | x = 0; | ||
244 | while (x < w_align) | ||
245 | { | ||
246 | pld(s, 32); | ||
247 | pld(offset_x + x, 32); | ||
248 | |||
249 | UNROLL8( | ||
250 | { | ||
251 | _soft8_pt_blend_solid_solid_mul_color_solid | ||
252 | (d, s[offset_x[x]], r, g, b); x++; d++;} | ||
253 | ); | ||
254 | } | ||
255 | |||
256 | for (; x < w; x++, d++) | ||
257 | _soft8_pt_blend_solid_solid_mul_color_solid | ||
258 | (d, s[offset_x[x]], r, g, b); | ||
259 | } | ||
260 | else | ||
261 | for (y = 0; y < h; y++, dst_itr += dst->stride) | ||
262 | { | ||
263 | DATA8 *d, *s; | ||
264 | int x; | ||
265 | |||
266 | s = src->pixels + offset_y[y]; | ||
267 | pld(s, 0); | ||
268 | pld(offset_x, 0); | ||
269 | |||
270 | d = dst_itr; | ||
271 | x = 0; | ||
272 | while (x < w_align) | ||
273 | { | ||
274 | pld(s, 32); | ||
275 | pld(offset_x + x, 32); | ||
276 | |||
277 | UNROLL8( | ||
278 | { | ||
279 | _soft8_pt_blend_solid_solid_mul_color_transp | ||
280 | (d, s[offset_x[x]], alpha, r, g, b); x++; d++;} | ||
281 | ); | ||
282 | } | ||
283 | |||
284 | for (; x < w; x++, d++) | ||
285 | _soft8_pt_blend_solid_solid_mul_color_transp | ||
286 | (d, s[offset_x[x]], alpha, r, g, b); | ||
287 | } | ||
288 | } | ||
289 | |||
290 | static void | ||
291 | _soft8_image_draw_scaled_transp_solid_mul_color(Soft8_Image * src, | ||
292 | Soft8_Image * dst, | ||
293 | RGBA_Draw_Context * | ||
294 | dc __UNUSED__, int dst_offset, | ||
295 | int w, int h, int *offset_x, | ||
296 | int *offset_y, DATA8 r, DATA8 g, | ||
297 | DATA8 b, DATA8 alpha) | ||
298 | { | ||
299 | DATA8 *dst_itr; | ||
300 | int y, w_align; | ||
301 | |||
302 | w_align = w & ~7; | ||
303 | |||
304 | dst_itr = dst->pixels + dst_offset; | ||
305 | |||
306 | if (alpha == 0xff) | ||
307 | for (y = 0; y < h; y++, dst_itr += dst->stride) | ||
308 | { | ||
309 | DATA8 *d, *s; | ||
310 | DATA8 *a; | ||
311 | int x; | ||
312 | |||
313 | s = src->pixels + offset_y[y]; | ||
314 | a = src->alpha + offset_y[y]; | ||
315 | pld(s, 0); | ||
316 | pld(a, 0); | ||
317 | pld(offset_x, 0); | ||
318 | |||
319 | d = dst_itr; | ||
320 | x = 0; | ||
321 | while (x < w_align) | ||
322 | { | ||
323 | pld(s, 32); | ||
324 | pld(a, 8); | ||
325 | pld(offset_x + x, 32); | ||
326 | |||
327 | UNROLL8( | ||
328 | { | ||
329 | int off_x = offset_x[x]; | ||
330 | _soft8_pt_blend_transp_solid_mul_color_solid | ||
331 | (d, s[off_x], a[off_x], r, g, b); x++; d++;}); | ||
332 | } | ||
333 | |||
334 | for (; x < w; x++, d++) | ||
335 | _soft8_pt_blend_transp_solid_mul_color_solid | ||
336 | (d, s[offset_x[x]], a[offset_x[x]], r, g, b); | ||
337 | } | ||
338 | else | ||
339 | for (y = 0; y < h; y++, dst_itr += dst->stride) | ||
340 | { | ||
341 | DATA8 *d, *s; | ||
342 | DATA8 *a; | ||
343 | int x; | ||
344 | |||
345 | s = src->pixels + offset_y[y]; | ||
346 | a = src->alpha + offset_y[y]; | ||
347 | pld(s, 0); | ||
348 | pld(a, 0); | ||
349 | pld(offset_x, 0); | ||
350 | |||
351 | d = dst_itr; | ||
352 | x = 0; | ||
353 | while (x < w_align) | ||
354 | { | ||
355 | pld(s, 32); | ||
356 | pld(a, 8); | ||
357 | pld(offset_x + x, 32); | ||
358 | |||
359 | UNROLL8( | ||
360 | { | ||
361 | int off_x = offset_x[x]; | ||
362 | _soft8_pt_blend_transp_solid_mul_color_transp | ||
363 | (d, s[off_x], a[off_x], alpha, r, g, b); x++; d++;}); | ||
364 | } | ||
365 | |||
366 | for (; x < w; x++, d++) | ||
367 | _soft8_pt_blend_transp_solid_mul_color_transp | ||
368 | (d, s[offset_x[x]], a[offset_x[x]], alpha, r, g, b); | ||
369 | } | ||
370 | } | ||
371 | |||
372 | static inline void | ||
373 | _soft8_image_draw_scaled_mul_color(Soft8_Image * src, Soft8_Image * dst, | ||
374 | RGBA_Draw_Context * dc, | ||
375 | int dst_offset, int w, int h, | ||
376 | int *offset_x, int *offset_y, | ||
377 | DATA8 r, DATA8 g, DATA8 b, DATA8 a) | ||
378 | { | ||
379 | if ((src->cache_entry.flags.alpha && src->alpha) && | ||
380 | (!dst->cache_entry.flags.alpha)) | ||
381 | _soft8_image_draw_scaled_transp_solid_mul_color | ||
382 | (src, dst, dc, dst_offset, w, h, offset_x, offset_y, r, g, b, a); | ||
383 | else if (!dst->cache_entry.flags.alpha) | ||
384 | _soft8_image_draw_scaled_solid_solid_mul_color | ||
385 | (src, dst, dc, dst_offset, w, h, offset_x, offset_y, r, g, b, a); | ||
386 | else | ||
387 | ERR("Unsupported draw of scaled images src->cache_entry.flags.alpha=%d, " | ||
388 | "dst->cache_entry.flags.alpha=%d, WITH COLOR MUL 0x%08x", | ||
389 | src->cache_entry.flags.alpha, dst->cache_entry.flags.alpha, | ||
390 | dc->mul.col); | ||
391 | } | ||
392 | |||
393 | static inline void | ||
394 | _soft8_image_draw_scaled_mul(Soft8_Image * src, Soft8_Image * dst, | ||
395 | RGBA_Draw_Context * dc, | ||
396 | int dst_offset, int w, int h, | ||
397 | int *offset_x, int *offset_y, DATA8 r, DATA8 g, | ||
398 | DATA8 b, DATA8 a) | ||
399 | { | ||
400 | if ((a == r) && (a == g) && (a == b)) | ||
401 | _soft8_image_draw_scaled_mul_alpha | ||
402 | (src, dst, dc, dst_offset, w, h, offset_x, offset_y, a); | ||
403 | else | ||
404 | _soft8_image_draw_scaled_mul_color | ||
405 | (src, dst, dc, dst_offset, w, h, offset_x, offset_y, r, g, b, a); | ||
406 | } | ||
407 | |||
408 | void | ||
409 | evas_common_soft8_image_draw_scaled_sampled(Soft8_Image * src, Soft8_Image * dst, | ||
410 | RGBA_Draw_Context * dc, | ||
411 | const Eina_Rectangle sr, | ||
412 | const Eina_Rectangle dr, | ||
413 | const Eina_Rectangle cr) | ||
414 | { | ||
415 | int x, y, dst_offset, *offset_x, *offset_y; | ||
416 | DATA8 mul_gry8; | ||
417 | DATA8 r, g, b, a; | ||
418 | |||
419 | if (!dc->mul.use) | ||
420 | { | ||
421 | r = g = b = a = 0xff; | ||
422 | mul_gry8 = 0xff; | ||
423 | } | ||
424 | else | ||
425 | { | ||
426 | a = A_VAL(&dc->mul.col); | ||
427 | if (a == 0) | ||
428 | return; | ||
429 | |||
430 | r = R_VAL(&dc->mul.col); | ||
431 | g = G_VAL(&dc->mul.col); | ||
432 | b = B_VAL(&dc->mul.col); | ||
433 | |||
434 | if (r > a) | ||
435 | r = a; | ||
436 | if (g > a) | ||
437 | g = a; | ||
438 | if (b > a) | ||
439 | b = a; | ||
440 | |||
441 | mul_gry8 = GRY_8_FROM_COMPONENTS(r, g, b); | ||
442 | } | ||
443 | |||
444 | /* pre-calculated scale tables */ | ||
445 | offset_x = alloca(cr.w * sizeof(*offset_x)); | ||
446 | for (x = 0; x < cr.w; x++) | ||
447 | offset_x[x] = (((x + cr.x - dr.x) * sr.w) / dr.w) + sr.x; | ||
448 | |||
449 | offset_y = alloca(cr.h * sizeof(*offset_y)); | ||
450 | for (y = 0; y < cr.h; y++) | ||
451 | offset_y[y] = (((((y + cr.y - dr.y) * sr.h) / dr.h) + sr.y) | ||
452 | * src->stride); | ||
453 | |||
454 | dst_offset = cr.x + (cr.y * dst->stride); | ||
455 | |||
456 | if (mul_gry8 == 0xff) | ||
457 | _soft8_image_draw_scaled_no_mul | ||
458 | (src, dst, dc, dst_offset, cr.w, cr.h, offset_x, offset_y); | ||
459 | else | ||
460 | _soft8_image_draw_scaled_mul | ||
461 | (src, dst, dc, dst_offset, cr.w, cr.h, offset_x, offset_y, r, g, b, | ||
462 | a); | ||
463 | } | ||