1 #include "evas_common_soft16.h"
2 #include "evas_soft16_scanline_blend.c"
5 _soft16_image_draw_unscaled_solid_solid(Soft16_Image *src, Soft16_Image *dst,
7 int src_offset, int dst_offset,
10 DATA16 *src_itr, *dst_itr;
13 src_itr = src->pixels + src_offset;
14 dst_itr = dst->pixels + dst_offset;
16 for (y = 0; y < h; y++)
18 _soft16_scanline_blend_solid_solid(src_itr, dst_itr, w);
19 src_itr += src->stride;
20 dst_itr += dst->stride;
25 _soft16_image_draw_unscaled_transp_solid(Soft16_Image *src, Soft16_Image *dst,
26 RGBA_Draw_Context *dc,
27 int src_offset, int dst_offset,
31 DATA16 *src_itr, *dst_itr;
35 src_itr = src->pixels + src_offset;
36 alpha_itr = src->alpha + src_offset;
37 dst_itr = dst->pixels + dst_offset;
39 for (y = 0; y < h; y++)
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;
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)
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,
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,
64 "Unsupported draw of unscaled images src->cache_entry.flags.alpha=%d, "
65 "dst->cache_entry.flags.alpha=%d, WITHOUT COLOR MUL\n",
66 src->cache_entry.flags.alpha, dst->cache_entry.flags.alpha);
70 _soft16_image_draw_unscaled_solid_solid_mul_alpha(Soft16_Image *src,
72 RGBA_Draw_Context *dc,
75 int w, int h, DATA8 a)
77 DATA16 *src_itr, *dst_itr;
80 src_itr = src->pixels + src_offset;
81 dst_itr = dst->pixels + dst_offset;
83 for (y = 0; y < h; y++)
85 _soft16_scanline_blend_solid_solid_mul_alpha(src_itr, dst_itr, w, a);
86 src_itr += src->stride;
87 dst_itr += dst->stride;
92 _soft16_image_draw_unscaled_transp_solid_mul_alpha(Soft16_Image *src,
94 RGBA_Draw_Context *dc,
97 int w, int h, DATA8 a)
100 DATA16 *src_itr, *dst_itr;
104 src_itr = src->pixels + src_offset;
105 alpha_itr = src->alpha + src_offset;
106 dst_itr = dst->pixels + dst_offset;
108 for (y = 0; y < h; y++)
110 _soft16_scanline_blend_transp_solid_mul_alpha(src_itr, alpha_itr,
112 src_itr += src->stride;
113 alpha_itr += src->stride;
114 dst_itr += dst->stride;
119 _soft16_image_draw_unscaled_mul_alpha(Soft16_Image *src, Soft16_Image *dst,
120 RGBA_Draw_Context *dc,
121 int src_offset, int dst_offset,
122 int width, int height, DATA8 a)
124 if (src->cache_entry.flags.alpha && (!dst->cache_entry.flags.alpha))
125 _soft16_image_draw_unscaled_transp_solid_mul_alpha
126 (src, dst, dc, src_offset, dst_offset, width, height, a);
127 else if ((!src->cache_entry.flags.alpha) && (!dst->cache_entry.flags.alpha))
128 _soft16_image_draw_unscaled_solid_solid_mul_alpha
129 (src, dst, dc, src_offset, dst_offset, width, height, a);
132 "Unsupported draw of unscaled images src->cache_entry.flags.alpha=%d, "
133 "dst->cache_entry.flags.alpha=%d, WITH ALPHA MUL %d\n",
134 src->cache_entry.flags.alpha, dst->cache_entry.flags.alpha, A_VAL(&dc->mul.col));
138 _soft16_image_draw_unscaled_solid_solid_mul_color(Soft16_Image *src,
140 RGBA_Draw_Context *dc,
143 int w, int h, DATA8 r,
144 DATA8 g, DATA8 b, DATA8 a)
146 DATA16 *src_itr, *dst_itr;
149 src_itr = src->pixels + src_offset;
150 dst_itr = dst->pixels + dst_offset;
153 for (y = 0; y < h; y++)
155 _soft16_scanline_blend_solid_solid_mul_color_solid
156 (src_itr, dst_itr, w, r, g, b);
157 src_itr += src->stride;
158 dst_itr += dst->stride;
161 for (y = 0; y < h; y++)
163 _soft16_scanline_blend_solid_solid_mul_color_transp
164 (src_itr, dst_itr, w, a, r, g, b);
165 src_itr += src->stride;
166 dst_itr += dst->stride;
171 _soft16_image_draw_unscaled_transp_solid_mul_color(Soft16_Image *src,
173 RGBA_Draw_Context *dc,
176 int w, int h, DATA8 r,
177 DATA8 g, DATA8 b, DATA8 a)
180 DATA16 *src_itr, *dst_itr;
184 src_itr = src->pixels + src_offset;
185 alpha_itr = src->alpha + src_offset;
186 dst_itr = dst->pixels + dst_offset;
189 for (y = 0; y < h; y++)
191 _soft16_scanline_blend_transp_solid_mul_color_solid
192 (src_itr, alpha_itr, dst_itr, w, r, g, b);
193 src_itr += src->stride;
194 alpha_itr += src->stride;
195 dst_itr += dst->stride;
198 for (y = 0; y < h; y++)
200 _soft16_scanline_blend_transp_solid_mul_color_transp
201 (src_itr, alpha_itr, dst_itr, w, a, r, g, b);
202 src_itr += src->stride;
203 alpha_itr += src->stride;
204 dst_itr += dst->stride;
209 _soft16_image_draw_unscaled_mul_color(Soft16_Image *src, Soft16_Image *dst,
210 RGBA_Draw_Context *dc,
211 int src_offset, int dst_offset,
212 int width, int height,
213 DATA8 r, DATA8 g, DATA8 b, DATA8 a)
215 if (src->cache_entry.flags.alpha && (!dst->cache_entry.flags.alpha))
216 _soft16_image_draw_unscaled_transp_solid_mul_color
217 (src, dst, dc, src_offset, dst_offset, width, height, r, g, b, a);
218 else if ((!src->cache_entry.flags.alpha) && (!dst->cache_entry.flags.alpha))
219 _soft16_image_draw_unscaled_solid_solid_mul_color
220 (src, dst, dc, src_offset, dst_offset, width, height, r, g, b, a);
223 "Unsupported draw of unscaled images src->cache_entry.flags.alpha=%d, "
224 "dst->cache_entry.flags.alpha=%d, WITH COLOR MUL 0x%08x\n",
225 src->cache_entry.flags.alpha, dst->cache_entry.flags.alpha, dc->mul.col);
229 _soft16_image_draw_unscaled_mul(Soft16_Image *src, Soft16_Image *dst,
230 RGBA_Draw_Context *dc,
231 int src_offset, int dst_offset,
232 int width, int height, DATA8 r, DATA8 g,
235 if ((a == r) && (a == (g >> 1)) && (a == b))
236 _soft16_image_draw_unscaled_mul_alpha(src, dst, dc, src_offset,
237 dst_offset, width, height, a);
239 _soft16_image_draw_unscaled_mul_color(src, dst, dc, src_offset,
240 dst_offset, width, height,
245 soft16_image_draw_unscaled(Soft16_Image *src, Soft16_Image *dst,
246 RGBA_Draw_Context *dc,
247 const Evas_Rectangle sr,
248 const Evas_Rectangle dr,
249 const Evas_Rectangle cr)
251 int src_offset_rows, src_offset, dst_offset;
263 a = A_VAL(&dc->mul.col) >> 3;
267 r = R_VAL(&dc->mul.col) >> 3;
268 g = G_VAL(&dc->mul.col) >> 2;
269 b = B_VAL(&dc->mul.col) >> 3;
272 if (g > (a << 1)) g = (a << 1);
275 mul_rgb565 = (r << 11) || (g << 5) | b;
279 src_offset_rows = (cr.y - dr.y) + sr.y;
280 src_offset = (src_offset_rows * src->stride) + (cr.x - dr.x) + sr.x;
282 dst_offset = cr.x + (cr.y * dst->stride);
284 if (mul_rgb565 == 0xffff)
285 _soft16_image_draw_unscaled_no_mul(src, dst, dc, src_offset, dst_offset,
288 _soft16_image_draw_unscaled_mul(src, dst, dc, src_offset, dst_offset,
289 cr.w, cr.h, r, g, b, a);