1 #include "evas_common_soft8.h"
2 #include "evas_soft8_scanline_blend.c"
5 _soft8_image_draw_unscaled_solid_solid(Soft8_Image * src, Soft8_Image * dst,
6 RGBA_Draw_Context * dc __UNUSED__,
7 int src_offset, int dst_offset,
10 DATA8 *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 _soft8_scanline_blend_solid_solid(src_itr, dst_itr, w);
19 src_itr += src->stride;
20 dst_itr += dst->stride;
25 _soft8_image_draw_unscaled_transp_solid(Soft8_Image * src, Soft8_Image * dst,
26 RGBA_Draw_Context * dc __UNUSED__,
27 int src_offset, int dst_offset,
30 DATA8 *src_itr, *dst_itr;
34 src_itr = src->pixels + src_offset;
35 alpha_itr = src->alpha + src_offset;
36 dst_itr = dst->pixels + dst_offset;
38 for (y = 0; y < h; y++)
40 _soft8_scanline_blend_transp_solid(src_itr, alpha_itr, dst_itr, w);
41 src_itr += src->stride;
42 alpha_itr += src->stride;
43 dst_itr += dst->stride;
48 _soft8_image_draw_unscaled_no_mul(Soft8_Image * src, Soft8_Image * dst,
49 RGBA_Draw_Context * dc,
50 int src_offset, int dst_offset,
51 int width, int height)
53 if (src->cache_entry.flags.alpha && (!dst->cache_entry.flags.alpha))
54 _soft8_image_draw_unscaled_transp_solid(src, dst, dc,
55 src_offset, dst_offset,
57 else if ((!src->cache_entry.flags.alpha) && (!dst->cache_entry.flags.alpha))
58 _soft8_image_draw_unscaled_solid_solid(src, dst, dc,
59 src_offset, dst_offset,
62 ERR("Unsupported draw of unscaled images src->cache_entry.flags.alpha=%d, "
63 "dst->cache_entry.flags.alpha=%d, WITHOUT COLOR MUL",
64 src->cache_entry.flags.alpha, dst->cache_entry.flags.alpha);
68 _soft8_image_draw_unscaled_solid_solid_mul_alpha(Soft8_Image * src,
71 dc __UNUSED__, int src_offset,
72 int dst_offset, int w, int h,
75 DATA8 *src_itr, *dst_itr;
78 src_itr = src->pixels + src_offset;
79 dst_itr = dst->pixels + dst_offset;
81 for (y = 0; y < h; y++)
83 _soft8_scanline_blend_solid_solid_mul_alpha(src_itr, dst_itr, w, a);
84 src_itr += src->stride;
85 dst_itr += dst->stride;
90 _soft8_image_draw_unscaled_transp_solid_mul_alpha(Soft8_Image * src,
93 dc __UNUSED__, int src_offset,
94 int dst_offset, int w, int h,
97 DATA8 *src_itr, *dst_itr;
101 src_itr = src->pixels + src_offset;
102 alpha_itr = src->alpha + src_offset;
103 dst_itr = dst->pixels + dst_offset;
105 for (y = 0; y < h; y++)
107 _soft8_scanline_blend_transp_solid_mul_alpha(src_itr, alpha_itr,
109 src_itr += src->stride;
110 alpha_itr += src->stride;
111 dst_itr += dst->stride;
116 _soft8_image_draw_unscaled_mul_alpha(Soft8_Image * src, Soft8_Image * dst,
117 RGBA_Draw_Context * dc,
118 int src_offset, int dst_offset,
119 int width, int height, DATA8 a)
121 if (src->cache_entry.flags.alpha && (!dst->cache_entry.flags.alpha))
122 _soft8_image_draw_unscaled_transp_solid_mul_alpha
123 (src, dst, dc, src_offset, dst_offset, width, height, a);
124 else if ((!src->cache_entry.flags.alpha) && (!dst->cache_entry.flags.alpha))
125 _soft8_image_draw_unscaled_solid_solid_mul_alpha
126 (src, dst, dc, src_offset, dst_offset, width, height, a);
128 ERR("Unsupported draw of unscaled images src->cache_entry.flags.alpha=%d, "
129 "dst->cache_entry.flags.alpha=%d, WITH ALPHA MUL %d",
130 src->cache_entry.flags.alpha, dst->cache_entry.flags.alpha, A_VAL(&dc->mul.col));
134 _soft8_image_draw_unscaled_solid_solid_mul_color(Soft8_Image * src,
137 dc __UNUSED__, int src_offset,
138 int dst_offset, int w, int h,
139 DATA8 r, DATA8 g, DATA8 b,
142 DATA8 *src_itr, *dst_itr;
145 src_itr = src->pixels + src_offset;
146 dst_itr = dst->pixels + dst_offset;
149 for (y = 0; y < h; y++)
151 _soft8_scanline_blend_solid_solid_mul_color_solid
152 (src_itr, dst_itr, w, r, g, b);
153 src_itr += src->stride;
154 dst_itr += dst->stride;
157 for (y = 0; y < h; y++)
159 _soft8_scanline_blend_solid_solid_mul_color_transp
160 (src_itr, dst_itr, w, a, r, g, b);
161 src_itr += src->stride;
162 dst_itr += dst->stride;
167 _soft8_image_draw_unscaled_transp_solid_mul_color(Soft8_Image * src,
170 dc __UNUSED__, int src_offset,
171 int dst_offset, int w, int h,
172 DATA8 r, DATA8 g, DATA8 b,
175 DATA8 *src_itr, *dst_itr;
179 src_itr = src->pixels + src_offset;
180 alpha_itr = src->alpha + src_offset;
181 dst_itr = dst->pixels + dst_offset;
184 for (y = 0; y < h; y++)
186 _soft8_scanline_blend_transp_solid_mul_color_solid
187 (src_itr, alpha_itr, dst_itr, w, r, g, b);
188 src_itr += src->stride;
189 alpha_itr += src->stride;
190 dst_itr += dst->stride;
193 for (y = 0; y < h; y++)
195 _soft8_scanline_blend_transp_solid_mul_color_transp
196 (src_itr, alpha_itr, dst_itr, w, a, r, g, b);
197 src_itr += src->stride;
198 alpha_itr += src->stride;
199 dst_itr += dst->stride;
204 _soft8_image_draw_unscaled_mul_color(Soft8_Image * src, Soft8_Image * dst,
205 RGBA_Draw_Context * dc,
206 int src_offset, int dst_offset,
207 int width, int height,
208 DATA8 r, DATA8 g, DATA8 b, DATA8 a)
210 if (src->cache_entry.flags.alpha && (!dst->cache_entry.flags.alpha))
211 _soft8_image_draw_unscaled_transp_solid_mul_color
212 (src, dst, dc, src_offset, dst_offset, width, height, r, g, b, a);
213 else if ((!src->cache_entry.flags.alpha) && (!dst->cache_entry.flags.alpha))
214 _soft8_image_draw_unscaled_solid_solid_mul_color
215 (src, dst, dc, src_offset, dst_offset, width, height, r, g, b, a);
217 ERR("Unsupported draw of unscaled images src->cache_entry.flags.alpha=%d, "
218 "dst->cache_entry.flags.alpha=%d, WITH COLOR MUL 0x%08x",
219 src->cache_entry.flags.alpha, dst->cache_entry.flags.alpha, dc->mul.col);
223 _soft8_image_draw_unscaled_mul(Soft8_Image * src, Soft8_Image * dst,
224 RGBA_Draw_Context * dc,
225 int src_offset, int dst_offset,
226 int width, int height, DATA8 r, DATA8 g,
229 if ((a == r) && (a == g) && (a == b))
230 _soft8_image_draw_unscaled_mul_alpha(src, dst, dc, src_offset,
231 dst_offset, width, height, a);
233 _soft8_image_draw_unscaled_mul_color(src, dst, dc, src_offset,
234 dst_offset, width, height,
239 soft8_image_draw_unscaled(Soft8_Image * src, Soft8_Image * dst,
240 RGBA_Draw_Context * dc,
241 const Eina_Rectangle sr,
242 const Eina_Rectangle dr, const Eina_Rectangle cr)
244 int src_offset_rows, src_offset, dst_offset;
250 r = g = b = a = 0xff;
255 a = A_VAL(&dc->mul.col);
259 r = R_VAL(&dc->mul.col);
260 g = G_VAL(&dc->mul.col);
261 b = B_VAL(&dc->mul.col);
270 mul_gry8 = GRY_8_FROM_COMPONENTS(r, g, b);
273 src_offset_rows = (cr.y - dr.y) + sr.y;
274 src_offset = (src_offset_rows * src->stride) + (cr.x - dr.x) + sr.x;
276 dst_offset = cr.x + (cr.y * dst->stride);
278 if (mul_gry8 == 0xff)
279 _soft8_image_draw_unscaled_no_mul(src, dst, dc, src_offset, dst_offset,
282 _soft8_image_draw_unscaled_mul(src, dst, dc, src_offset, dst_offset,
283 cr.w, cr.h, r, g, b, a);