1 #include "evas_common_soft16.h"
2 #include "evas_soft16_scanline_blend.c"
5 _soft16_image_draw_scaled_solid_solid(Soft16_Image *src,
8 int dst_offset, int w, int h,
9 int *offset_x, int *offset_y)
16 dst_itr = dst->pixels + dst_offset;
17 for (y = 0; y < h; y++, dst_itr += dst->stride)
22 s = src->pixels + offset_y[y];
31 pld(offset_x + x, 32);
34 _soft16_pt_blend_solid_solid(d, s[offset_x[x]]);
40 for (; x < w; x++, d++)
41 _soft16_pt_blend_solid_solid(d, s[offset_x[x]]);
45 _soft16_image_draw_scaled_transp_solid(Soft16_Image *src,
47 RGBA_Draw_Context *dc,
48 int dst_offset, int w, int h,
49 int *offset_x, int *offset_y)
56 dst_itr = dst->pixels + dst_offset;
57 for (y = 0; y < h; y++, dst_itr += dst->stride)
63 s = src->pixels + offset_y[y];
64 a = src->alpha + offset_y[y];
75 pld(offset_x + x, 32);
78 int off_x = offset_x[x];
79 _soft16_pt_blend_transp_solid(d, s[off_x], a[off_x]);
85 for (; x < w; x++, d++)
86 _soft16_pt_blend_transp_solid(d, s[offset_x[x]], a[offset_x[x]]);
91 _soft16_image_draw_scaled_no_mul(Soft16_Image *src, Soft16_Image *dst,
92 RGBA_Draw_Context *dc,
93 int dst_offset, int w, int h,
94 int *offset_x, int *offset_y)
96 if ((src->cache_entry.flags.alpha && src->alpha) &&
97 (!dst->cache_entry.flags.alpha))
98 _soft16_image_draw_scaled_transp_solid
99 (src, dst, dc, dst_offset, w, h, offset_x, offset_y);
100 else if (!dst->cache_entry.flags.alpha)
101 _soft16_image_draw_scaled_solid_solid
102 (src, dst, dc, dst_offset, w, h, offset_x, offset_y);
105 "Unsupported draw of scaled images src->cache_entry.flags.alpha=%d, "
106 "dst->cache_entry.flags.alpha=%d, WITHOUT COLOR MUL\n",
107 src->cache_entry.flags.alpha, dst->cache_entry.flags.alpha);
111 _soft16_image_draw_scaled_solid_solid_mul_alpha(Soft16_Image *src,
113 RGBA_Draw_Context *dc,
114 int dst_offset, int w, int h,
115 int *offset_x, int *offset_y,
123 dst_itr = dst->pixels + dst_offset;
124 for (y = 0; y < h; y++, dst_itr += dst->stride)
129 s = src->pixels + offset_y[y];
138 pld(offset_x + x, 32);
141 _soft16_pt_blend_solid_solid_mul_alpha
142 (d, s[offset_x[x]], alpha);
148 for (; x < w; x++, d++)
149 _soft16_pt_blend_solid_solid_mul_alpha
150 (d, s[offset_x[x]], alpha);
155 _soft16_image_draw_scaled_transp_solid_mul_alpha(Soft16_Image *src,
157 RGBA_Draw_Context *dc,
158 int dst_offset, int w, int h,
159 int *offset_x, int *offset_y,
167 dst_itr = dst->pixels + dst_offset;
168 for (y = 0; y < h; y++, dst_itr += dst->stride)
174 s = src->pixels + offset_y[y];
175 a = src->alpha + offset_y[y];
186 pld(offset_x + x, 32);
189 int off_x = offset_x[x];
190 _soft16_pt_blend_transp_solid_mul_alpha
191 (d, s[off_x], a[off_x], alpha);
197 for (; x < w; x++, d++)
198 _soft16_pt_blend_transp_solid_mul_alpha
199 (d, s[offset_x[x]], a[offset_x[x]], alpha);
204 _soft16_image_draw_scaled_mul_alpha(Soft16_Image *src, Soft16_Image *dst,
205 RGBA_Draw_Context *dc,
206 int dst_offset, int w, int h,
207 int *offset_x, int *offset_y, DATA8 a)
209 if ((src->cache_entry.flags.alpha && src->alpha) &&
210 (!dst->cache_entry.flags.alpha))
211 _soft16_image_draw_scaled_transp_solid_mul_alpha
212 (src, dst, dc, dst_offset, w, h, offset_x, offset_y, a);
213 else if (!dst->cache_entry.flags.alpha)
214 _soft16_image_draw_scaled_solid_solid_mul_alpha
215 (src, dst, dc, dst_offset, w, h, offset_x, offset_y, a);
218 "Unsupported draw of scaled images src->cache_entry.flags.alpha=%d, "
219 "dst->cache_entry.flags.alpha=%d, WITH ALPHA MUL %d\n",
220 src->cache_entry.flags.alpha, dst->cache_entry.flags.alpha, A_VAL(&dc->mul.col));
224 _soft16_image_draw_scaled_solid_solid_mul_color(Soft16_Image *src,
226 RGBA_Draw_Context *dc,
227 int dst_offset, int w, int h,
228 int *offset_x, int *offset_y,
229 DATA8 r, DATA8 g, DATA8 b,
237 dst_itr = dst->pixels + dst_offset;
240 for (y = 0; y < h; y++, dst_itr += dst->stride)
245 s = src->pixels + offset_y[y];
254 pld(offset_x + x, 32);
257 _soft16_pt_blend_solid_solid_mul_color_solid
258 (d, s[offset_x[x]], r, g, b);
264 for (; x < w; x++, d++)
265 _soft16_pt_blend_solid_solid_mul_color_solid
266 (d, s[offset_x[x]], r, g, b);
269 for (y = 0; y < h; y++, dst_itr += dst->stride)
274 s = src->pixels + offset_y[y];
283 pld(offset_x + x, 32);
286 _soft16_pt_blend_solid_solid_mul_color_transp
287 (d, s[offset_x[x]], alpha, r, g, b);
293 for (; x < w; x++, d++)
294 _soft16_pt_blend_solid_solid_mul_color_transp
295 (d, s[offset_x[x]], alpha, r, g, b);
300 _soft16_image_draw_scaled_transp_solid_mul_color(Soft16_Image *src,
302 RGBA_Draw_Context *dc,
303 int dst_offset, int w, int h,
304 int *offset_x, int *offset_y,
305 DATA8 r, DATA8 g, DATA8 b,
313 dst_itr = dst->pixels + dst_offset;
316 for (y = 0; y < h; y++, dst_itr += dst->stride)
322 s = src->pixels + offset_y[y];
323 a = src->alpha + offset_y[y];
334 pld(offset_x + x, 32);
337 int off_x = offset_x[x];
338 _soft16_pt_blend_transp_solid_mul_color_solid
339 (d, s[off_x], a[off_x], r, g, b);
345 for (; x < w; x++, d++)
346 _soft16_pt_blend_transp_solid_mul_color_solid
347 (d, s[offset_x[x]], a[offset_x[x]], r, g, b);
350 for (y = 0; y < h; y++, dst_itr += dst->stride)
356 s = src->pixels + offset_y[y];
357 a = src->alpha + offset_y[y];
368 pld(offset_x + x, 32);
371 int off_x = offset_x[x];
372 _soft16_pt_blend_transp_solid_mul_color_transp
373 (d, s[off_x], a[off_x], alpha, r, g, b);
379 for (; x < w; x++, d++)
380 _soft16_pt_blend_transp_solid_mul_color_transp
381 (d, s[offset_x[x]], a[offset_x[x]], alpha, r, g, b);
386 _soft16_image_draw_scaled_mul_color(Soft16_Image *src, Soft16_Image *dst,
387 RGBA_Draw_Context *dc,
388 int dst_offset, int w, int h,
389 int *offset_x, int *offset_y,
390 DATA8 r, DATA8 g, DATA8 b, DATA8 a)
392 if ((src->cache_entry.flags.alpha && src->alpha) &&
393 (!dst->cache_entry.flags.alpha))
394 _soft16_image_draw_scaled_transp_solid_mul_color
395 (src, dst, dc, dst_offset, w, h, offset_x, offset_y, r, g, b, a);
396 else if (!dst->cache_entry.flags.alpha)
397 _soft16_image_draw_scaled_solid_solid_mul_color
398 (src, dst, dc, dst_offset, w, h, offset_x, offset_y, r, g, b, a);
401 "Unsupported draw of scaled images src->cache_entry.flags.alpha=%d, "
402 "dst->cache_entry.flags.alpha=%d, WITH COLOR MUL 0x%08x\n",
403 src->cache_entry.flags.alpha, dst->cache_entry.flags.alpha, dc->mul.col);
407 _soft16_image_draw_scaled_mul(Soft16_Image *src, Soft16_Image *dst,
408 RGBA_Draw_Context *dc,
409 int dst_offset, int w, int h,
410 int *offset_x, int *offset_y, DATA8 r, DATA8 g,
413 if ((a == r) && (a == (g >> 1)) && (a == b))
414 _soft16_image_draw_scaled_mul_alpha
415 (src, dst, dc, dst_offset, w, h, offset_x, offset_y, a);
417 _soft16_image_draw_scaled_mul_color
418 (src, dst, dc, dst_offset, w, h, offset_x, offset_y, r, g, b, a);
422 soft16_image_draw_scaled_sampled(Soft16_Image *src, Soft16_Image *dst,
423 RGBA_Draw_Context *dc,
424 const Evas_Rectangle sr,
425 const Evas_Rectangle dr,
426 const Evas_Rectangle cr)
428 int x, y, dst_offset, *offset_x, *offset_y;
440 a = A_VAL(&dc->mul.col) >> 3;
444 r = R_VAL(&dc->mul.col) >> 3;
445 g = G_VAL(&dc->mul.col) >> 2;
446 b = B_VAL(&dc->mul.col) >> 3;
449 if (g > (a << 1)) g = (a << 1);
452 mul_rgb565 = (r << 11) || (g << 5) | b;
455 /* pre-calculated scale tables */
456 offset_x = alloca(cr.w * sizeof(*offset_x));
457 for (x = 0; x < cr.w; x++)
458 offset_x[x] = (((x + cr.x - dr.x) * sr.w) / dr.w) + sr.x;
460 offset_y = alloca(cr.h * sizeof(*offset_y));
461 for (y = 0; y < cr.h; y++)
462 offset_y[y] = (((((y + cr.y - dr.y) * sr.h) / dr.h) + sr.y)
465 dst_offset = cr.x + (cr.y * dst->stride);
468 if (mul_rgb565 == 0xffff)
469 _soft16_image_draw_scaled_no_mul
470 (src, dst, dc, dst_offset, cr.w, cr.h, offset_x, offset_y);
472 _soft16_image_draw_scaled_mul
473 (src, dst, dc, dst_offset, cr.w, cr.h, offset_x, offset_y, r, g, b, a);