Evas masking: Use alpha mask in SW engine draw functions

Work done by Jaeun Choi, rebased & squashed by jpeg.

This commit introduces changes to the low-level draw functions
of the SW engine considering the existence of an alpha mask image.

Features:
- Font masking (TEXT, TEXTBLOCK),
- Rectangle masking,
- Image masking (all image scaling functions should be handled).

The mask image itself is not yet set in the draw context (see
following commits).

@feature

Signed-off-by: Jean-Philippe Andre <jp.andre@samsung.com>
This commit is contained in:
Jaeun Choi 2014-11-13 10:04:00 +09:00 committed by Jean-Philippe Andre
parent a86f799542
commit 9af60b1b04
14 changed files with 471 additions and 93 deletions

View File

@ -524,6 +524,43 @@ evas_common_font_glyph_draw(RGBA_Font_Glyph *fg,
} }
free(src8); free(src8);
} }
else if (dc->clip.mask)
{
RGBA_Gfx_Func func;
DATA8 *src8, *mask;
DATA32 *buf, *ptr, *buf_ptr;
RGBA_Image *im = dc->clip.mask;
int row;
buf = alloca(sizeof(DATA32) * w * h);
// Step 1: alpha glyph drawing
src8 = evas_common_font_glyph_uncompress(fg, NULL, NULL);
if (!src8) return;
// Step 2: color blending to buffer
func = evas_common_gfx_func_composite_mask_color_span_get(col, dst_image->cache_entry.flags.alpha, 1, EVAS_RENDER_COPY);
for (row = y1; row < y2; row++)
{
buf_ptr = buf + (row * w) + x1;
DATA8 *s = src8 + (row * w) + x1;
func(NULL, s, col, buf_ptr, x2 - x1);
}
free(src8);
// Step 3: masking to destination
func = evas_common_gfx_func_composite_pixel_mask_span_get(im->cache_entry.flags.alpha, im->cache_entry.flags.alpha_sparse, dst_image->cache_entry.flags.alpha, dst_pitch, dc->render_op);
for (row = y1; row < y2; row++)
{
mask = im->image.data8
+ (y + row - dc->clip.mask_y) * im->cache_entry.w
+ (x + x1 - dc->clip.mask_x);
ptr = dst + (x + x1) + ((y + row) * dst_pitch);
buf_ptr = buf + (row * w) + x1;
func(buf_ptr, mask, 0, ptr, x2 - x1);
}
}
else else
{ {
// build fast multiply + mask color tables to avoid compute. this works // build fast multiply + mask color tables to avoid compute. this works

View File

@ -10,7 +10,7 @@ EAPI void evas_common_rectangle_draw (RGBA_Image *dst, RGBA_Draw_Context *dc, in
EAPI void evas_common_rectangle_draw_do(const Cutout_Rects *reuse, const Eina_Rectangle *clip, RGBA_Image *dst, RGBA_Draw_Context *dc, int x, int y, int w, int h); EAPI void evas_common_rectangle_draw_do(const Cutout_Rects *reuse, const Eina_Rectangle *clip, RGBA_Image *dst, RGBA_Draw_Context *dc, int x, int y, int w, int h);
EAPI Eina_Bool evas_common_rectangle_draw_prepare(Cutout_Rects **reuse, const RGBA_Image *dst, RGBA_Draw_Context *dc, int x, int y, int w, int h); EAPI Eina_Bool evas_common_rectangle_draw_prepare(Cutout_Rects **reuse, const RGBA_Image *dst, RGBA_Draw_Context *dc, int x, int y, int w, int h);
EAPI void evas_common_rectangle_rgba_draw (RGBA_Image *dst, DATA32 color, int render_op, int x, int y, int w, int h); EAPI void evas_common_rectangle_rgba_draw (RGBA_Image *dst, DATA32 color, int render_op, int x, int y, int w, int h, RGBA_Image *mask_ie, int mask_x, int mask_y);
#endif /* _EVAS_RECTANGLE_H */ #endif /* _EVAS_RECTANGLE_H */

View File

@ -110,6 +110,8 @@ rectangle_draw_internal(RGBA_Image *dst, RGBA_Draw_Context *dc, int x, int y, in
RGBA_Gfx_Func func; RGBA_Gfx_Func func;
int yy; int yy;
DATA32 *ptr; DATA32 *ptr;
DATA8 *mask;
RGBA_Image *mask_ie = dc->clip.mask;
if (!dst->image.data) return; if (!dst->image.data) return;
RECTS_CLIP_TO_RECT(x, y, w, h, dc->clip.x, dc->clip.y, dc->clip.w, dc->clip.h); RECTS_CLIP_TO_RECT(x, y, w, h, dc->clip.x, dc->clip.y, dc->clip.w, dc->clip.h);
@ -132,29 +134,54 @@ rectangle_draw_internal(RGBA_Image *dst, RGBA_Draw_Context *dc, int x, int y, in
# endif # endif
#endif #endif
{ {
func = evas_common_gfx_func_composite_color_span_get(dc->col.col, dst->cache_entry.flags.alpha, w, dc->render_op); if (mask_ie)
func = evas_common_gfx_func_composite_mask_color_span_get(dc->col.col, dst->cache_entry.flags.alpha, w, dc->render_op);
else
func = evas_common_gfx_func_composite_color_span_get(dc->col.col, dst->cache_entry.flags.alpha, w, dc->render_op);
ptr = dst->image.data + (y * dst->cache_entry.w) + x; ptr = dst->image.data + (y * dst->cache_entry.w) + x;
for (yy = 0; yy < h; yy++) for (yy = 0; yy < h; yy++)
{ {
func(NULL, NULL, dc->col.col, ptr, w); if (mask_ie)
{
mask = mask_ie->image.data8
+ (y + yy - dc->clip.mask_y) * mask_ie->cache_entry.w
+ (x - dc->clip.mask_x);
func(NULL, mask, dc->col.col, ptr, w);
}
else
func(NULL, NULL, dc->col.col, ptr, w);
ptr += dst->cache_entry.w; ptr += dst->cache_entry.w;
} }
} }
} }
EAPI void EAPI void
evas_common_rectangle_rgba_draw(RGBA_Image *dst, DATA32 color, int render_op, int x, int y, int w, int h) evas_common_rectangle_rgba_draw(RGBA_Image *dst, DATA32 color, int render_op, int x, int y, int w, int h, RGBA_Image *mask_ie, int mask_x, int mask_y)
{ {
RGBA_Gfx_Func func; RGBA_Gfx_Func func;
DATA32 *ptr; DATA32 *ptr;
DATA8 *mask;
int yy; int yy;
func = evas_common_gfx_func_composite_color_span_get(color, dst->cache_entry.flags.alpha, w, render_op); if (mask_ie)
func = evas_common_gfx_func_composite_mask_color_span_get(color, dst->cache_entry.flags.alpha, w, render_op);
else
func = evas_common_gfx_func_composite_color_span_get(color, dst->cache_entry.flags.alpha, w, render_op);
ptr = dst->image.data + (y * dst->cache_entry.w) + x; ptr = dst->image.data + (y * dst->cache_entry.w) + x;
for (yy = 0; yy < h; yy++) for (yy = 0; yy < h; yy++)
{ {
func(NULL, NULL, color, ptr, w); if (mask_ie)
{
mask = mask_ie->image.data8
+ (y + yy - mask_y) * mask_ie->cache_entry.w
+ (x - mask_x);
func(NULL, mask, color, ptr, w);
}
else
func(NULL, NULL, color, ptr, w);
ptr += dst->cache_entry.w; ptr += dst->cache_entry.w;
} }
} }

View File

@ -13,8 +13,8 @@ EAPI void evas_common_rgba_image_scalecache_dump(void);
EAPI void evas_common_scale_rgba_in_to_out_clip_sample_do (const Cutout_Rects *reuse, const Eina_Rectangle *clip, RGBA_Image *src, RGBA_Image *dst, RGBA_Draw_Context *dc, int src_region_x, int src_region_y, int src_region_w, int src_region_h, int dst_region_x, int dst_region_y, int dst_region_w, int dst_region_h); EAPI void evas_common_scale_rgba_in_to_out_clip_sample_do (const Cutout_Rects *reuse, const Eina_Rectangle *clip, RGBA_Image *src, RGBA_Image *dst, RGBA_Draw_Context *dc, int src_region_x, int src_region_y, int src_region_w, int src_region_h, int dst_region_x, int dst_region_y, int dst_region_w, int dst_region_h);
EAPI void evas_common_scale_rgba_in_to_out_clip_smooth_do (const Cutout_Rects *reuse, const Eina_Rectangle *clip, RGBA_Image *src, RGBA_Image *dst, RGBA_Draw_Context *dc, int src_region_x, int src_region_y, int src_region_w, int src_region_h, int dst_region_x, int dst_region_y, int dst_region_w, int dst_region_h); EAPI void evas_common_scale_rgba_in_to_out_clip_smooth_do (const Cutout_Rects *reuse, const Eina_Rectangle *clip, RGBA_Image *src, RGBA_Image *dst, RGBA_Draw_Context *dc, int src_region_x, int src_region_y, int src_region_w, int src_region_h, int dst_region_x, int dst_region_y, int dst_region_w, int dst_region_h);
EAPI void evas_common_scale_rgba_sample_draw (RGBA_Image *src, RGBA_Image *dst, int dst_clip_x, int dst_clip_y, int dst_clip_w, int dst_clip_h, DATA32 mul_col, int render_op, int src_region_x, int src_region_y, int src_region_w, int src_region_h, int dst_region_x, int dst_region_y, int dst_region_w, int dst_region_h); EAPI void evas_common_scale_rgba_sample_draw (RGBA_Image *src, RGBA_Image *dst, int dst_clip_x, int dst_clip_y, int dst_clip_w, int dst_clip_h, DATA32 mul_col, int render_op, int src_region_x, int src_region_y, int src_region_w, int src_region_h, int dst_region_x, int dst_region_y, int dst_region_w, int dst_region_h, RGBA_Image *mask, int mask_x, int mask_y);
EAPI void evas_common_scale_rgba_smooth_draw (RGBA_Image *src, RGBA_Image *dst, int dst_clip_x, int dst_clip_y, int dst_clip_w, int dst_clip_h, DATA32 mul_col, int render_op, int src_region_x, int src_region_y, int src_region_w, int src_region_h, int dst_region_x, int dst_region_y, int dst_region_w, int dst_region_h); EAPI void evas_common_scale_rgba_smooth_draw (RGBA_Image *src, RGBA_Image *dst, int dst_clip_x, int dst_clip_y, int dst_clip_w, int dst_clip_h, DATA32 mul_col, int render_op, int src_region_x, int src_region_y, int src_region_w, int src_region_h, int dst_region_x, int dst_region_y, int dst_region_w, int dst_region_h, RGBA_Image *mask_ie, int mask_x, int mask_y);
EAPI Eina_Bool evas_common_scale_rgba_in_to_out_clip_prepare (Cutout_Rects **reuse, const RGBA_Image *src, const RGBA_Image *dst, RGBA_Draw_Context *dc, int dst_region_x, int dst_region_y, int dst_region_w, int dst_region_h); EAPI Eina_Bool evas_common_scale_rgba_in_to_out_clip_prepare (Cutout_Rects **reuse, const RGBA_Image *src, const RGBA_Image *dst, RGBA_Draw_Context *dc, int dst_region_x, int dst_region_y, int dst_region_w, int dst_region_h);
#endif /* _EVAS_SCALE_MAIN_H */ #endif /* _EVAS_SCALE_MAIN_H */

View File

@ -59,15 +59,16 @@ evas_common_scale_rgba_in_to_out_clip_sample_do(const Cutout_Rects *reuse,
} }
EAPI void EAPI void
evas_common_scale_rgba_sample_draw(RGBA_Image *src, RGBA_Image *dst, int dst_clip_x, int dst_clip_y, int dst_clip_w, int dst_clip_h, DATA32 mul_col, int render_op, int src_region_x, int src_region_y, int src_region_w, int src_region_h, int dst_region_x, int dst_region_y, int dst_region_w, int dst_region_h) evas_common_scale_rgba_sample_draw(RGBA_Image *src, RGBA_Image *dst, int dst_clip_x, int dst_clip_y, int dst_clip_w, int dst_clip_h, DATA32 mul_col, int render_op, int src_region_x, int src_region_y, int src_region_w, int src_region_h, int dst_region_x, int dst_region_y, int dst_region_w, int dst_region_h, RGBA_Image *mask_ie, int mask_x, int mask_y)
{ {
int x, y; int x, y;
int *lin_ptr; int *lin_ptr;
DATA32 *buf, *dptr; DATA32 *buf, *dptr;
DATA32 **row_ptr; DATA32 **row_ptr;
DATA32 *ptr, *dst_ptr, *src_data, *dst_data; DATA32 *ptr, *dst_ptr, *src_data, *dst_data;
DATA8 *mask;
int src_w, src_h, dst_w, dst_h; int src_w, src_h, dst_w, dst_h;
RGBA_Gfx_Func func; RGBA_Gfx_Func func, func2 = NULL;
if ((!src->image.data) || (!dst->image.data)) return; if ((!src->image.data) || (!dst->image.data)) return;
if (!(RECTS_INTERSECT(dst_region_x, dst_region_y, dst_region_w, dst_region_h, if (!(RECTS_INTERSECT(dst_region_x, dst_region_y, dst_region_w, dst_region_h,
@ -198,21 +199,59 @@ evas_common_scale_rgba_sample_draw(RGBA_Image *src, RGBA_Image *dst, int dst_cli
/* figure out dest start ptr */ /* figure out dest start ptr */
dst_ptr = dst_data + dst_clip_x + (dst_clip_y * dst_w); dst_ptr = dst_data + dst_clip_x + (dst_clip_y * dst_w);
if (mul_col != 0xffffffff) if (!mask_ie)
func = evas_common_gfx_func_composite_pixel_color_span_get(src->cache_entry.flags.alpha, src->cache_entry.flags.alpha_sparse, mul_col, dst->cache_entry.flags.alpha, dst_clip_w, render_op); {
if (mul_col != 0xffffffff)
func = evas_common_gfx_func_composite_pixel_color_span_get(src->cache_entry.flags.alpha, src->cache_entry.flags.alpha_sparse, mul_col, dst->cache_entry.flags.alpha, dst_clip_w, render_op);
else
func = evas_common_gfx_func_composite_pixel_span_get(src->cache_entry.flags.alpha, src->cache_entry.flags.alpha_sparse, dst->cache_entry.flags.alpha, dst_clip_w, render_op);
}
else else
func = evas_common_gfx_func_composite_pixel_span_get(src->cache_entry.flags.alpha, src->cache_entry.flags.alpha_sparse, dst->cache_entry.flags.alpha, dst_clip_w, render_op); {
func = evas_common_gfx_func_composite_pixel_mask_span_get(src->cache_entry.flags.alpha, src->cache_entry.flags.alpha_sparse, dst->cache_entry.flags.alpha, dst_clip_w, render_op);
if (mul_col != 0xffffffff)
func2 = evas_common_gfx_func_composite_pixel_color_span_get(src->cache_entry.flags.alpha, src->cache_entry.flags.alpha_sparse, mul_col, dst->cache_entry.flags.alpha, dst_clip_w, render_op);
}
if ((dst_region_w == src_region_w) && (dst_region_h == src_region_h)) if ((dst_region_w == src_region_w) && (dst_region_h == src_region_h))
{ {
ptr = src_data + (((dst_clip_y - dst_region_y) + src_region_y) * src_w) + ((dst_clip_x - dst_region_x) + src_region_x); ptr = src_data + (((dst_clip_y - dst_region_y) + src_region_y) * src_w) + ((dst_clip_x - dst_region_x) + src_region_x);
for (y = 0; y < dst_clip_h; y++)
{
/* * blend here [clip_w *] ptr -> dst_ptr * */
func(ptr, NULL, mul_col, dst_ptr, dst_clip_w);
ptr += src_w; /* image masking */
dst_ptr += dst_w; if (mask_ie)
{
if (mul_col != 0xffffffff)
buf = alloca(dst_clip_w * sizeof(DATA32));
for (y = 0; y < dst_clip_h; y++)
{
mask = mask_ie->image.data8
+ ((dst_clip_y - mask_y + y) * mask_ie->cache_entry.w)
+ (dst_clip_x - mask_x);
/* * blend here [clip_w *] ptr -> dst_ptr * */
if (mul_col != 0xffffffff)
{
func2(ptr, NULL, mul_col, buf, dst_clip_w);
func(buf, mask, 0, dst_ptr, dst_clip_w);
}
else
func(ptr, mask, 0, dst_ptr, dst_clip_w);
ptr += src_w;
dst_ptr += dst_w;
}
}
else
{
for (y = 0; y < dst_clip_h; y++)
{
/* * blend here [clip_w *] ptr -> dst_ptr * */
func(ptr, NULL, mul_col, dst_ptr, dst_clip_w);
ptr += src_w;
dst_ptr += dst_w;
}
} }
} }
else else
@ -234,20 +273,48 @@ evas_common_scale_rgba_sample_draw(RGBA_Image *src, RGBA_Image *dst, int dst_cli
/* a scanline buffer */ /* a scanline buffer */
buf = alloca(dst_clip_w * sizeof(DATA32)); buf = alloca(dst_clip_w * sizeof(DATA32));
for (y = 0; y < dst_clip_h; y++) /* image masking */
if (mask_ie)
{ {
dst_ptr = buf; for (y = 0; y < dst_clip_h; y++)
for (x = 0; x < dst_clip_w; x++)
{ {
ptr = row_ptr[y] + lin_ptr[x]; dst_ptr = buf;
*dst_ptr = *ptr; mask = mask_ie->image.data8
dst_ptr++; + ((dst_clip_y - mask_y + y) * mask_ie->cache_entry.w)
} + (dst_clip_x - mask_x);
/* * blend here [clip_w *] buf -> dptr * */
func(buf, NULL, mul_col, dptr, dst_clip_w);
dptr += dst_w; for (x = 0; x < dst_clip_w; x++)
{
ptr = row_ptr[y] + lin_ptr[x];
*dst_ptr = *ptr;
dst_ptr++;
}
/* * blend here [clip_w *] buf -> dptr * */
if (mul_col != 0xffffffff) func2(buf, NULL, mul_col, buf, dst_clip_w);
func(buf, mask, 0, dptr, dst_clip_w);
dptr += dst_w;
}
}
else
{
for (y = 0; y < dst_clip_h; y++)
{
dst_ptr = buf;
for (x = 0; x < dst_clip_w; x++)
{
ptr = row_ptr[y] + lin_ptr[x];
*dst_ptr = *ptr;
dst_ptr++;
}
/* * blend here [clip_w *] buf -> dptr * */
func(buf, NULL, mul_col, dptr, dst_clip_w);
dptr += dst_w;
}
} }
} }
} }
@ -265,9 +332,10 @@ scale_rgba_in_to_out_clip_sample_internal(RGBA_Image *src, RGBA_Image *dst,
DATA32 *buf, *dptr; DATA32 *buf, *dptr;
DATA32 **row_ptr; DATA32 **row_ptr;
DATA32 *ptr, *dst_ptr, *src_data, *dst_data; DATA32 *ptr, *dst_ptr, *src_data, *dst_data;
DATA8 *mask;
int dst_clip_x, dst_clip_y, dst_clip_w, dst_clip_h; int dst_clip_x, dst_clip_y, dst_clip_w, dst_clip_h;
int src_w, src_h, dst_w, dst_h; int src_w, src_h, dst_w, dst_h;
RGBA_Gfx_Func func; RGBA_Gfx_Func func, func2 = NULL;
if (!(RECTS_INTERSECT(dst_region_x, dst_region_y, dst_region_w, dst_region_h, 0, 0, dst->cache_entry.w, dst->cache_entry.h))) if (!(RECTS_INTERSECT(dst_region_x, dst_region_y, dst_region_w, dst_region_h, 0, 0, dst->cache_entry.w, dst->cache_entry.h)))
return EINA_FALSE; return EINA_FALSE;
@ -395,10 +463,19 @@ scale_rgba_in_to_out_clip_sample_internal(RGBA_Image *src, RGBA_Image *dst,
/* figure out dest start ptr */ /* figure out dest start ptr */
dst_ptr = dst_data + dst_clip_x + (dst_clip_y * dst_w); dst_ptr = dst_data + dst_clip_x + (dst_clip_y * dst_w);
if (dc->mul.use) if (!dc->clip.mask)
func = evas_common_gfx_func_composite_pixel_color_span_get(src->cache_entry.flags.alpha, src->cache_entry.flags.alpha_sparse, dc->mul.col, dst->cache_entry.flags.alpha, dst_clip_w, dc->render_op); {
if (dc->mul.use)
func = evas_common_gfx_func_composite_pixel_color_span_get(src->cache_entry.flags.alpha, src->cache_entry.flags.alpha_sparse, dc->mul.col, dst->cache_entry.flags.alpha, dst_clip_w, dc->render_op);
else
func = evas_common_gfx_func_composite_pixel_span_get(src->cache_entry.flags.alpha, src->cache_entry.flags.alpha_sparse, dst->cache_entry.flags.alpha, dst_clip_w, dc->render_op);
}
else else
func = evas_common_gfx_func_composite_pixel_span_get(src->cache_entry.flags.alpha, src->cache_entry.flags.alpha_sparse, dst->cache_entry.flags.alpha, dst_clip_w, dc->render_op); {
func = evas_common_gfx_func_composite_pixel_mask_span_get(src->cache_entry.flags.alpha, src->cache_entry.flags.alpha_sparse, dst->cache_entry.flags.alpha, dst_clip_w, dc->render_op);
if (dc->mul.use)
func2 = evas_common_gfx_func_composite_pixel_color_span_get(src->cache_entry.flags.alpha, src->cache_entry.flags.alpha_sparse, dc->mul.col, dst->cache_entry.flags.alpha, dst_clip_w, dc->render_op);
}
if ((dst_region_w == src_region_w) && (dst_region_h == src_region_h)) if ((dst_region_w == src_region_w) && (dst_region_h == src_region_h))
{ {
@ -427,13 +504,44 @@ scale_rgba_in_to_out_clip_sample_internal(RGBA_Image *src, RGBA_Image *dst,
#endif #endif
{ {
ptr = src_data + ((dst_clip_y - dst_region_y + src_region_y) * src_w) + (dst_clip_x - dst_region_x) + src_region_x; ptr = src_data + ((dst_clip_y - dst_region_y + src_region_y) * src_w) + (dst_clip_x - dst_region_x) + src_region_x;
for (y = 0; y < dst_clip_h; y++)
{
/* * blend here [clip_w *] ptr -> dst_ptr * */
func(ptr, NULL, dc->mul.col, dst_ptr, dst_clip_w);
ptr += src_w; /* image masking */
dst_ptr += dst_w; if (dc->clip.mask)
{
RGBA_Image *im = dc->clip.mask;
if (dc->mul.use)
buf = alloca(dst_clip_w * sizeof(DATA32));
for (y = 0; y < dst_clip_h; y++)
{
mask = im->image.data8
+ ((dst_clip_y - dc->clip.mask_y + y) * im->cache_entry.w)
+ (dst_clip_x - dc->clip.mask_x);
/* * blend here [clip_w *] ptr -> dst_ptr * */
if (dc->mul.use)
{
func2(ptr, NULL, dc->mul.col, buf, dst_clip_w);
func(buf, mask, 0, dst_ptr, dst_clip_w);
}
else
func(ptr, mask, 0, dst_ptr, dst_clip_w);
ptr += src_w;
dst_ptr += dst_w;
}
}
else
{
for (y = 0; y < dst_clip_h; y++)
{
/* * blend here [clip_w *] ptr -> dst_ptr * */
func(ptr, NULL, dc->mul.col, dst_ptr, dst_clip_w);
ptr += src_w;
dst_ptr += dst_w;
}
} }
} }
} }
@ -454,7 +562,8 @@ scale_rgba_in_to_out_clip_sample_internal(RGBA_Image *src, RGBA_Image *dst,
#ifdef DIRECT_SCALE #ifdef DIRECT_SCALE
if ((!src->cache_entry.flags.alpha) && if ((!src->cache_entry.flags.alpha) &&
(!dst->cache_entry.flags.alpha) && (!dst->cache_entry.flags.alpha) &&
(!dc->mul.use)) (!dc->mul.use) &&
(!dc->clip.mask))
{ {
for (y = 0; y < dst_clip_h; y++) for (y = 0; y < dst_clip_h; y++)
{ {
@ -475,19 +584,50 @@ scale_rgba_in_to_out_clip_sample_internal(RGBA_Image *src, RGBA_Image *dst,
{ {
/* a scanline buffer */ /* a scanline buffer */
buf = alloca(dst_clip_w * sizeof(DATA32)); buf = alloca(dst_clip_w * sizeof(DATA32));
for (y = 0; y < dst_clip_h; y++)
{
dst_ptr = buf;
for (x = 0; x < dst_clip_w; x++)
{
ptr = row_ptr[y] + lin_ptr[x];
*dst_ptr = *ptr;
dst_ptr++;
}
/* * blend here [clip_w *] buf -> dptr * */
func(buf, NULL, dc->mul.col, dptr, dst_clip_w);
dptr += dst_w; /* image masking */
if (dc->clip.mask)
{
RGBA_Image *im = dc->clip.mask;
for (y = 0; y < dst_clip_h; y++)
{
dst_ptr = buf;
mask = im->image.data8
+ ((dst_clip_y - dc->clip.mask_y + y) * im->cache_entry.w)
+ (dst_clip_x - dc->clip.mask_x);
for (x = 0; x < dst_clip_w; x++)
{
ptr = row_ptr[y] + lin_ptr[x];
*dst_ptr = *ptr;
dst_ptr++;
}
/* * blend here [clip_w *] buf -> dptr * */
if (dc->mul.use) func2(buf, NULL, dc->mul.col, buf, dst_clip_w);
func(buf, mask, 0, dptr, dst_clip_w);
dptr += dst_w;
}
}
else
{
for (y = 0; y < dst_clip_h; y++)
{
dst_ptr = buf;
for (x = 0; x < dst_clip_w; x++)
{
ptr = row_ptr[y] + lin_ptr[x];
*dst_ptr = *ptr;
dst_ptr++;
}
/* * blend here [clip_w *] buf -> dptr * */
func(buf, NULL, dc->mul.col, dptr, dst_clip_w);
dptr += dst_w;
}
} }
} }
} }

View File

@ -148,7 +148,8 @@ evas_common_scale_rgba_in_to_out_clip_smooth_mmx(RGBA_Image *src, RGBA_Image *ds
clip_x, clip_y, clip_w, clip_h, clip_x, clip_y, clip_w, clip_h,
mul_col, dc->render_op, mul_col, dc->render_op,
src_region_x, src_region_y, src_region_w, src_region_h, src_region_x, src_region_y, src_region_w, src_region_h,
dst_region_x, dst_region_y, dst_region_w, dst_region_h); dst_region_x, dst_region_y, dst_region_w, dst_region_h,
dc->clip.mask, dc->clip.mask_x, dc->clip.mask_y);
return EINA_TRUE; return EINA_TRUE;
} }
@ -188,7 +189,8 @@ evas_common_scale_rgba_in_to_out_clip_smooth_neon(RGBA_Image *src, RGBA_Image *d
clip_x, clip_y, clip_w, clip_h, clip_x, clip_y, clip_w, clip_h,
mul_col, dc->render_op, mul_col, dc->render_op,
src_region_x, src_region_y, src_region_w, src_region_h, src_region_x, src_region_y, src_region_w, src_region_h,
dst_region_x, dst_region_y, dst_region_w, dst_region_h); dst_region_x, dst_region_y, dst_region_w, dst_region_h,
dc->clip.mask, dc->clip.mask_x, dc->clip.mask_y);
return EINA_TRUE; return EINA_TRUE;
} }
@ -227,7 +229,8 @@ evas_common_scale_rgba_in_to_out_clip_smooth_c(RGBA_Image *src, RGBA_Image *dst,
clip_x, clip_y, clip_w, clip_h, clip_x, clip_y, clip_w, clip_h,
mul_col, dc->render_op, mul_col, dc->render_op,
src_region_x, src_region_y, src_region_w, src_region_h, src_region_x, src_region_y, src_region_w, src_region_h,
dst_region_x, dst_region_y, dst_region_w, dst_region_h); dst_region_x, dst_region_y, dst_region_w, dst_region_h,
dc->clip.mask, dc->clip.mask_x, dc->clip.mask_y);
return EINA_TRUE; return EINA_TRUE;
} }
@ -265,7 +268,7 @@ evas_common_scale_rgba_in_to_out_clip_smooth(RGBA_Image *src, RGBA_Image *dst,
} }
EAPI void EAPI void
evas_common_scale_rgba_smooth_draw(RGBA_Image *src, RGBA_Image *dst, int dst_clip_x, int dst_clip_y, int dst_clip_w, int dst_clip_h, DATA32 mul_col, int render_op, int src_region_x, int src_region_y, int src_region_w, int src_region_h, int dst_region_x, int dst_region_y, int dst_region_w, int dst_region_h) evas_common_scale_rgba_smooth_draw(RGBA_Image *src, RGBA_Image *dst, int dst_clip_x, int dst_clip_y, int dst_clip_w, int dst_clip_h, DATA32 mul_col, int render_op, int src_region_x, int src_region_y, int src_region_w, int src_region_h, int dst_region_x, int dst_region_y, int dst_region_w, int dst_region_h, RGBA_Image *mask_ie, int mask_x, int mask_y)
{ {
#ifdef BUILD_MMX #ifdef BUILD_MMX
int mmx, sse, sse2; int mmx, sse, sse2;
@ -277,7 +280,8 @@ evas_common_scale_rgba_smooth_draw(RGBA_Image *src, RGBA_Image *dst, int dst_cli
dst_clip_x, dst_clip_y, dst_clip_w, dst_clip_h, dst_clip_x, dst_clip_y, dst_clip_w, dst_clip_h,
mul_col, render_op, mul_col, render_op,
src_region_x, src_region_y, src_region_w, src_region_h, src_region_x, src_region_y, src_region_w, src_region_h,
dst_region_x, dst_region_y, dst_region_w, dst_region_h); dst_region_x, dst_region_y, dst_region_w, dst_region_h,
mask_ie, mask_x, mask_y);
else else
#endif #endif
#ifdef BUILD_NEON #ifdef BUILD_NEON
@ -287,7 +291,8 @@ evas_common_scale_rgba_smooth_draw(RGBA_Image *src, RGBA_Image *dst, int dst_cli
dst_clip_x, dst_clip_y, dst_clip_w, dst_clip_h, dst_clip_x, dst_clip_y, dst_clip_w, dst_clip_h,
mul_col, render_op, mul_col, render_op,
src_region_x, src_region_y, src_region_w, src_region_h, src_region_x, src_region_y, src_region_w, src_region_h,
dst_region_x, dst_region_y, dst_region_w, dst_region_h); dst_region_x, dst_region_y, dst_region_w, dst_region_h,
mask_ie, mask_x, mask_y);
else else
#endif #endif
_evas_common_scale_rgba_in_to_out_clip_smooth_c _evas_common_scale_rgba_in_to_out_clip_smooth_c
@ -295,7 +300,8 @@ evas_common_scale_rgba_smooth_draw(RGBA_Image *src, RGBA_Image *dst, int dst_cli
dst_clip_x, dst_clip_y, dst_clip_w, dst_clip_h, dst_clip_x, dst_clip_y, dst_clip_w, dst_clip_h,
mul_col, render_op, mul_col, render_op,
src_region_x, src_region_y, src_region_w, src_region_h, src_region_x, src_region_y, src_region_w, src_region_h,
dst_region_x, dst_region_y, dst_region_w, dst_region_h); dst_region_x, dst_region_y, dst_region_w, dst_region_h,
mask_ie, mask_x, mask_y);
} }
EAPI void EAPI void

View File

@ -1,5 +1,5 @@
void void
SCALE_FUNC(RGBA_Image *src, RGBA_Image *dst, int dst_clip_x, int dst_clip_y, int dst_clip_w, int dst_clip_h, DATA32 mul_col, int render_op, int src_region_x, int src_region_y, int src_region_w, int src_region_h, int dst_region_x, int dst_region_y, int dst_region_w, int dst_region_h) SCALE_FUNC(RGBA_Image *src, RGBA_Image *dst, int dst_clip_x, int dst_clip_y, int dst_clip_w, int dst_clip_h, DATA32 mul_col, int render_op, int src_region_x, int src_region_y, int src_region_w, int src_region_h, int dst_region_x, int dst_region_y, int dst_region_w, int dst_region_h, RGBA_Image *mask_ie, int mask_x, int mask_y)
{ {
DATA32 *dst_ptr; DATA32 *dst_ptr;
int src_w, src_h, dst_w, dst_h; int src_w, src_h, dst_w, dst_h;

View File

@ -5,7 +5,7 @@
int *yapoints, *yapp; int *yapoints, *yapp;
DATA32 *buf, *src_data; DATA32 *buf, *src_data;
RGBA_Gfx_Func func; RGBA_Gfx_Func func, func2 = NULL;
src_data = src->image.data; src_data = src->image.data;
@ -18,10 +18,20 @@
/* a scanline buffer */ /* a scanline buffer */
buf = alloca(dst_clip_w * sizeof(DATA32)); buf = alloca(dst_clip_w * sizeof(DATA32));
if (mul_col != 0xffffffff) if (!mask_ie)
func = evas_common_gfx_func_composite_pixel_color_span_get(src->cache_entry.flags.alpha, src->cache_entry.flags.alpha_sparse, mul_col, dst->cache_entry.flags.alpha, dst_clip_w, render_op); {
if (mul_col != 0xffffffff)
func = evas_common_gfx_func_composite_pixel_color_span_get(src->cache_entry.flags.alpha, src->cache_entry.flags.alpha_sparse, mul_col, dst->cache_entry.flags.alpha, dst_clip_w, render_op);
else
func = evas_common_gfx_func_composite_pixel_span_get(src->cache_entry.flags.alpha, src->cache_entry.flags.alpha_sparse, dst->cache_entry.flags.alpha, dst_clip_w, render_op);
}
else else
func = evas_common_gfx_func_composite_pixel_span_get(src->cache_entry.flags.alpha, src->cache_entry.flags.alpha_sparse, dst->cache_entry.flags.alpha, dst_clip_w, render_op); {
func = evas_common_gfx_func_composite_pixel_mask_span_get(src->cache_entry.flags.alpha, src->cache_entry.flags.alpha_sparse, dst->cache_entry.flags.alpha, dst_clip_w, render_op);
if (mul_col != 0xffffffff)
func2 = evas_common_gfx_func_composite_pixel_color_span_get(src->cache_entry.flags.alpha, src->cache_entry.flags.alpha_sparse, mul_col, dst->cache_entry.flags.alpha, dst_clip_w, render_op);
}
/* scaling down vertically */ /* scaling down vertically */
if ((dst_region_w >= src_region_w) && if ((dst_region_w >= src_region_w) &&
(dst_region_h < src_region_h)) (dst_region_h < src_region_h))

View File

@ -1,10 +1,12 @@
{ {
int Cx, j; int Cx, j;
DATA32 *pix, *dptr, *pbuf, **yp; DATA32 *pix, *dptr, *pbuf, **yp;
DATA8 *mask;
int r, g, b, a, rr, gg, bb, aa; int r, g, b, a, rr, gg, bb, aa;
int *xp, xap, yap, pos; int *xp, xap, yap, pos;
//int dyy, dxx; //int dyy, dxx;
int w = dst_clip_w; int w = dst_clip_w;
int y;
dptr = dst_ptr; dptr = dst_ptr;
pos = (src_region_y * src_w) + src_region_x; pos = (src_region_y * src_w) + src_region_x;
@ -19,6 +21,7 @@
if (src->cache_entry.flags.alpha) if (src->cache_entry.flags.alpha)
{ {
y = 0;
while (dst_clip_h--) while (dst_clip_h--)
{ {
while (dst_clip_w--) while (dst_clip_w--)
@ -82,7 +85,18 @@
xp++; xapp++; xp++; xapp++;
} }
func(buf, NULL, mul_col, dptr, w); if (!mask_ie)
func(buf, NULL, mul_col, dptr, w);
else
{
mask = mask_ie->image.data8
+ ((dst_clip_y - mask_y + y) * mask_ie->cache_entry.w)
+ (dst_clip_x - mask_x);
if (mul_col != 0xffffffff) func2(buf, NULL, mul_col, buf, w);
func(buf, mask, 0, dptr, w);
}
y++;
pbuf = buf; pbuf = buf;
dptr += dst_w; dst_clip_w = w; dptr += dst_w; dst_clip_w = w;
@ -95,8 +109,9 @@
{ {
#ifdef DIRECT_SCALE #ifdef DIRECT_SCALE
if ((!src->cache_entry.flags.alpha) && if ((!src->cache_entry.flags.alpha) &&
(!dst->cache_entry.flags.alpha) && (!dst->cache_entry.flags.alpha) &&
(mul_col == 0xffffffff)) (mul_col == 0xffffffff) &&
(!mask_ie))
{ {
while (dst_clip_h--) while (dst_clip_h--)
{ {
@ -165,6 +180,7 @@
else else
#endif #endif
{ {
y = 0;
while (dst_clip_h--) while (dst_clip_h--)
{ {
while (dst_clip_w--) while (dst_clip_w--)
@ -221,7 +237,18 @@
xp++; xapp++; xp++; xapp++;
} }
func(buf, NULL, mul_col, dptr, w); if (!mask_ie)
func(buf, NULL, mul_col, dptr, w);
else
{
mask = mask_ie->image.data8
+ ((dst_clip_y - mask_y + y) * mask_ie->cache_entry.w)
+ (dst_clip_x - mask_x);
if (mul_col != 0xffffffff) func2(buf, NULL, mul_col, buf, w);
func(buf, mask, 0, dptr, w);
}
y++;
pbuf = buf; pbuf = buf;
dptr += dst_w; dst_clip_w = w; dptr += dst_w; dst_clip_w = w;

View File

@ -1,8 +1,10 @@
{ {
int Cx, Cy, i, j; int Cx, Cy, i, j;
DATA32 *dptr, *sptr, *pix, *pbuf; DATA32 *dptr, *sptr, *pix, *pbuf;
DATA8 *mask;
int a, r, g, b, rx, gx, bx, ax; int a, r, g, b, rx, gx, bx, ax;
int xap, yap, pos; int xap, yap, pos;
int y;
//int dyy, dxx; //int dyy, dxx;
DATA32 **yp; DATA32 **yp;
@ -24,6 +26,7 @@
#if 1 #if 1
if (src->cache_entry.flags.alpha) if (src->cache_entry.flags.alpha)
{ {
y = 0;
while (dst_clip_h--) while (dst_clip_h--)
{ {
Cy = *yapp >> 16; Cy = *yapp >> 16;
@ -131,7 +134,18 @@
xp++; xapp++; xp++; xapp++;
} }
func(buf, NULL, mul_col, dptr, w); if (!mask_ie)
func(buf, NULL, mul_col, dptr, w);
else
{
mask = mask_ie->image.data8
+ ((dst_clip_y - mask_y + y) * mask_ie->cache_entry.w)
+ (dst_clip_x - mask_x);
if (mul_col != 0xffffffff) func2(buf, NULL, mul_col, buf, w);
func(buf, mask, 0, dptr, w);
}
y++;
pbuf = buf; pbuf = buf;
dptr += dst_w; dst_clip_w = w; dptr += dst_w; dst_clip_w = w;
@ -144,8 +158,9 @@
{ {
#ifdef DIRECT_SCALE #ifdef DIRECT_SCALE
if ((!src->cache_entry.flags.alpha) && if ((!src->cache_entry.flags.alpha) &&
(!dst->cache_entry.flags.alpha) && (!dst->cache_entry.flags.alpha) &&
(mul_col == 0xffffffff)) (mul_col == 0xffffffff) &&
(!mask_ie))
{ {
while (dst_clip_h--) while (dst_clip_h--)
{ {
@ -252,6 +267,7 @@
else else
#endif #endif
{ {
y = 0;
while (dst_clip_h--) while (dst_clip_h--)
{ {
Cy = *yapp >> 16; Cy = *yapp >> 16;
@ -347,7 +363,18 @@
xp++; xapp++; xp++; xapp++;
} }
func(buf, NULL, mul_col, dptr, w); if (!mask_ie)
func(buf, NULL, mul_col, dptr, w);
else
{
mask = mask_ie->image.data8
+ ((dst_clip_y - mask_y + y) * mask_ie->cache_entry.w)
+ (dst_clip_x - mask_x);
if (mul_col != 0xffffffff) func2(buf, NULL, mul_col, buf, w);
func(buf, mask, 0, dptr, w);
}
y++;
pbuf = buf; pbuf = buf;
dptr += dst_w; dst_clip_w = w; dptr += dst_w; dst_clip_w = w;

View File

@ -1,10 +1,12 @@
{ {
int Cy, j; int Cy, j;
DATA32 *dptr, *pix, *pbuf, **yp; DATA32 *dptr, *pix, *pbuf, **yp;
DATA8 *mask;
int r, g, b, a, rr, gg, bb, aa; int r, g, b, a, rr, gg, bb, aa;
int *xp, xap, yap, pos; int *xp, xap, yap, pos;
//int dyy, dxx; //int dyy, dxx;
int w = dst_clip_w; int w = dst_clip_w;
int y;
dptr = dst_ptr; dptr = dst_ptr;
pos = (src_region_y * src_w) + src_region_x; pos = (src_region_y * src_w) + src_region_x;
@ -19,6 +21,7 @@
if (src->cache_entry.flags.alpha) if (src->cache_entry.flags.alpha)
{ {
y = 0;
while (dst_clip_h--) while (dst_clip_h--)
{ {
Cy = *yapp >> 16; Cy = *yapp >> 16;
@ -83,7 +86,18 @@
xp++; xapp++; xp++; xapp++;
} }
func(buf, NULL, mul_col, dptr, w); if (!mask_ie)
func(buf, NULL, mul_col, dptr, w);
else
{
mask = mask_ie->image.data8
+ ((dst_clip_y - mask_y + y) * mask_ie->cache_entry.w)
+ (dst_clip_x - mask_x);
if (mul_col != 0xffffffff) func2(buf, NULL, mul_col, buf, w);
func(buf, mask, 0, dptr, w);
}
y++;
pbuf = buf; pbuf = buf;
dptr += dst_w; dst_clip_w = w; dptr += dst_w; dst_clip_w = w;
@ -96,8 +110,9 @@
{ {
#ifdef DIRECT_SCALE #ifdef DIRECT_SCALE
if ((!src->cache_entry.flags.alpha) && if ((!src->cache_entry.flags.alpha) &&
(!dst->cache_entry.flags.alpha) && (!dst->cache_entry.flags.alpha) &&
(mul_col == 0xffffffff)) (mul_col == 0xffffffff) &&
(!mask_ie))
{ {
while (dst_clip_h--) while (dst_clip_h--)
{ {
@ -166,6 +181,7 @@
else else
#endif #endif
{ {
y = 0;
while (dst_clip_h--) while (dst_clip_h--)
{ {
Cy = *yapp >> 16; Cy = *yapp >> 16;
@ -223,7 +239,18 @@
xp++; xapp++; xp++; xapp++;
} }
func(buf, NULL, mul_col, dptr, w); if (!mask_ie)
func(buf, NULL, mul_col, dptr, w);
else
{
mask = mask_ie->image.data8
+ ((dst_clip_y - mask_y + y) * mask_ie->cache_entry.w)
+ (dst_clip_x - mask_x);
if (mul_col != 0xffffffff) func2(buf, NULL, mul_col, buf, w);
func(buf, mask, 0, dptr, w);
}
y++;
pbuf = buf; pbuf = buf;
dptr += dst_w; dst_clip_w = w; dptr += dst_w; dst_clip_w = w;

View File

@ -10,7 +10,8 @@
DATA32 *psrc, *pdst, *pdst_end; DATA32 *psrc, *pdst, *pdst_end;
DATA32 *buf, *pbuf, *pbuf_end; DATA32 *buf, *pbuf, *pbuf_end;
RGBA_Gfx_Func func = NULL; DATA8 *mask;
RGBA_Gfx_Func func = NULL, func2 = NULL;
/* check value to make overflow(only check value related with overflow) */ /* check value to make overflow(only check value related with overflow) */
if ((src_region_w > SCALE_SIZE_MAX) || if ((src_region_w > SCALE_SIZE_MAX) ||
@ -19,7 +20,7 @@
/* a scanline buffer */ /* a scanline buffer */
pdst = dst_ptr; // it's been set at (dst_clip_x, dst_clip_y) pdst = dst_ptr; // it's been set at (dst_clip_x, dst_clip_y)
pdst_end = pdst + (dst_clip_h * dst_w); pdst_end = pdst + (dst_clip_h * dst_w);
if (mul_col == 0xffffffff) if (mul_col == 0xffffffff && !mask_ie)
{ {
if ((render_op == _EVAS_RENDER_BLEND) && !src->cache_entry.flags.alpha) if ((render_op == _EVAS_RENDER_BLEND) && !src->cache_entry.flags.alpha)
{ direct_scale = 1; buf_step = dst->cache_entry.w; } { direct_scale = 1; buf_step = dst->cache_entry.w; }
@ -33,10 +34,19 @@
if (!direct_scale) if (!direct_scale)
{ {
buf = alloca(dst_clip_w * sizeof(DATA32)); buf = alloca(dst_clip_w * sizeof(DATA32));
if (mul_col != 0xffffffff) if (!mask_ie)
func = evas_common_gfx_func_composite_pixel_color_span_get(src->cache_entry.flags.alpha, src->cache_entry.flags.alpha_sparse, mul_col, dst->cache_entry.flags.alpha, dst_clip_w, render_op); {
else if (mul_col != 0xffffffff)
func = evas_common_gfx_func_composite_pixel_span_get(src->cache_entry.flags.alpha, src->cache_entry.flags.alpha_sparse, dst->cache_entry.flags.alpha, dst_clip_w, render_op); func = evas_common_gfx_func_composite_pixel_color_span_get(src->cache_entry.flags.alpha, src->cache_entry.flags.alpha_sparse, mul_col, dst->cache_entry.flags.alpha, dst_clip_w, render_op);
else
func = evas_common_gfx_func_composite_pixel_span_get(src->cache_entry.flags.alpha, src->cache_entry.flags.alpha_sparse, dst->cache_entry.flags.alpha, dst_clip_w, render_op);
}
else
{
func = evas_common_gfx_func_composite_pixel_mask_span_get(src->cache_entry.flags.alpha, src->cache_entry.flags.alpha_sparse, dst->cache_entry.flags.alpha, dst_clip_w, render_op);
if (mul_col != 0xffffffff)
func2 = evas_common_gfx_func_composite_pixel_color_span_get(src->cache_entry.flags.alpha, src->cache_entry.flags.alpha_sparse, mul_col, dst->cache_entry.flags.alpha, dst_clip_w, render_op);
}
} }
else else
buf = pdst; buf = pdst;
@ -61,6 +71,7 @@
if (drh == srh) if (drh == srh)
{ {
int sxx0 = sxx; int sxx0 = sxx;
int y = 0;
psrc = src->image.data + (src_w * (sry + cy)) + srx; psrc = src->image.data + (src_w * (sry + cy)) + srx;
while (pdst < pdst_end) while (pdst < pdst_end)
{ {
@ -99,7 +110,20 @@
} }
/* * blend here [clip_w *] buf -> dptr * */ /* * blend here [clip_w *] buf -> dptr * */
if (!direct_scale) if (!direct_scale)
func(buf, NULL, mul_col, pdst, dst_clip_w); {
if (!mask_ie)
func(buf, NULL, mul_col, pdst, dst_clip_w);
else
{
mask = mask_ie->image.data8
+ ((dst_clip_y - mask_y + y) * mask_ie->cache_entry.w)
+ (dst_clip_x - mask_x);
if (mul_col != 0xffffffff) func2(buf, NULL, mul_col, buf, dst_clip_w);
func(buf, mask, 0, pdst, dst_clip_w);
}
y++;
}
pdst += dst_w; pdst += dst_w;
psrc += src_w; psrc += src_w;
@ -111,6 +135,7 @@
else if (drw == srw) else if (drw == srw)
{ {
DATA32 *ps = src->image.data + (src_w * sry) + srx + cx; DATA32 *ps = src->image.data + (src_w * sry) + srx + cx;
int y = 0;
while (pdst < pdst_end) while (pdst < pdst_end)
{ {
@ -149,7 +174,20 @@
} }
/* * blend here [clip_w *] buf -> dptr * */ /* * blend here [clip_w *] buf -> dptr * */
if (!direct_scale) if (!direct_scale)
func(buf, NULL, mul_col, pdst, dst_clip_w); {
if (!mask_ie)
func(buf, NULL, mul_col, pdst, dst_clip_w);
else
{
mask = mask_ie->image.data8
+ ((dst_clip_y - mask_y + y) * mask_ie->cache_entry.w)
+ (dst_clip_x - mask_x);
if (mul_col != 0xffffffff) func2(buf, NULL, mul_col, buf, dst_clip_w);
func(buf, mask, 0, pdst, dst_clip_w);
}
y++;
}
pdst += dst_w; pdst += dst_w;
syy += dsyy; syy += dsyy;
buf += buf_step; buf += buf_step;
@ -160,6 +198,7 @@
{ {
DATA32 *ps = src->image.data + (src_w * sry) + srx; DATA32 *ps = src->image.data + (src_w * sry) + srx;
int sxx0 = sxx; int sxx0 = sxx;
int y = 0;
while (pdst < pdst_end) while (pdst < pdst_end)
{ {
@ -277,7 +316,20 @@
} }
/* * blend here [clip_w *] buf -> dptr * */ /* * blend here [clip_w *] buf -> dptr * */
if (!direct_scale) if (!direct_scale)
func(buf, NULL, mul_col, pdst, dst_clip_w); {
if (!mask_ie)
func(buf, NULL, mul_col, pdst, dst_clip_w);
else
{
mask = mask_ie->image.data8
+ ((dst_clip_y - mask_y + y) * mask_ie->cache_entry.w)
+ (dst_clip_x - mask_x);
if (mul_col != 0xffffffff) func2(buf, NULL, mul_col, buf, dst_clip_w);
func(buf, mask, 0, pdst, dst_clip_w);
}
y++;
}
pdst += dst_w; pdst += dst_w;
syy += dsyy; syy += dsyy;

View File

@ -700,6 +700,8 @@ struct _RGBA_Draw_Context
} col; } col;
struct RGBA_Draw_Context_clip { struct RGBA_Draw_Context_clip {
int x, y, w, h; int x, y, w, h;
void *mask;
int mask_x, mask_y;
Eina_Bool use : 1; Eina_Bool use : 1;
} clip; } clip;
Cutout_Rects cutout; Cutout_Rects cutout;

View File

@ -296,6 +296,8 @@ struct _Evas_Thread_Command_Rect
DATA32 color; DATA32 color;
int render_op; int render_op;
int x, y, w, h; int x, y, w, h;
void *mask;
int mask_x, mask_y;
}; };
struct _Evas_Thread_Command_Line struct _Evas_Thread_Command_Line
@ -327,6 +329,8 @@ struct _Evas_Thread_Command_Image
DATA32 mul_col; DATA32 mul_col;
int render_op; int render_op;
int smooth; int smooth;
void *mask;
int mask_x, mask_y;
}; };
struct _Evas_Thread_Command_Font struct _Evas_Thread_Command_Font
@ -341,9 +345,11 @@ struct _Evas_Thread_Command_Font
void *gl_draw; void *gl_draw;
void *font_ext_data; void *font_ext_data;
DATA32 col; DATA32 col;
Eina_Bool clip_use : 1;
Eina_Rectangle clip_rect, ext; Eina_Rectangle clip_rect, ext;
int im_w, im_h; int im_w, im_h;
void *mask;
int mask_x, mask_y;
Eina_Bool clip_use : 1;
}; };
struct _Evas_Thread_Command_Map struct _Evas_Thread_Command_Map
@ -525,7 +531,8 @@ _draw_thread_rectangle_draw(void *data)
evas_common_rectangle_rgba_draw(rect->surface, evas_common_rectangle_rgba_draw(rect->surface,
rect->color, rect->render_op, rect->color, rect->render_op,
rect->x, rect->y, rect->w, rect->h); rect->x, rect->y, rect->w, rect->h,
rect->mask, rect->mask_x, rect->mask_y);
eina_mempool_free(_mp_command_rect, rect); eina_mempool_free(_mp_command_rect, rect);
} }
@ -548,6 +555,9 @@ _draw_rectangle_thread_cmd(RGBA_Image *dst, RGBA_Draw_Context *dc, int x, int y,
cr->y = y; cr->y = y;
cr->w = w; cr->w = w;
cr->h = h; cr->h = h;
cr->mask = dc->clip.mask;
cr->mask_x = dc->clip.mask_x;
cr->mask_y = dc->clip.mask_y;
evas_thread_cmd_enqueue(_draw_thread_rectangle_draw, cr); evas_thread_cmd_enqueue(_draw_thread_rectangle_draw, cr);
} }
@ -1239,14 +1249,16 @@ _draw_thread_image_draw(void *data)
image->clip.x, image->clip.y, image->clip.w, image->clip.h, image->clip.x, image->clip.y, image->clip.w, image->clip.h,
image->mul_col, image->render_op, image->mul_col, image->render_op,
image->src.x, image->src.y, image->src.w, image->src.h, image->src.x, image->src.y, image->src.w, image->src.h,
image->dst.x, image->dst.y, image->dst.w, image->dst.h); image->dst.x, image->dst.y, image->dst.w, image->dst.h,
image->mask, image->mask_x, image->mask_y);
else else
evas_common_scale_rgba_sample_draw evas_common_scale_rgba_sample_draw
(image->image, image->surface, (image->image, image->surface,
image->clip.x, image->clip.y, image->clip.w, image->clip.h, image->clip.x, image->clip.y, image->clip.w, image->clip.h,
image->mul_col, image->render_op, image->mul_col, image->render_op,
image->src.x, image->src.y, image->src.w, image->src.h, image->src.x, image->src.y, image->src.w, image->src.h,
image->dst.x, image->dst.y, image->dst.w, image->dst.h); image->dst.x, image->dst.y, image->dst.w, image->dst.h,
image->mask, image->mask_x, image->mask_y);
eina_mempool_free(_mp_command_image, image); eina_mempool_free(_mp_command_image, image);
} }
@ -1289,6 +1301,9 @@ _image_draw_thread_cmd(RGBA_Image *src, RGBA_Image *dst, RGBA_Draw_Context *dc,
cr->mul_col = dc->mul.use ? dc->mul.col : 0xffffffff; cr->mul_col = dc->mul.use ? dc->mul.col : 0xffffffff;
cr->render_op = dc->render_op; cr->render_op = dc->render_op;
cr->smooth = smooth; cr->smooth = smooth;
cr->mask = dc->clip.mask;
cr->mask_x = dc->clip.mask_x;
cr->mask_y = dc->clip.mask_y;
evas_thread_cmd_enqueue(_draw_thread_image_draw, cr); evas_thread_cmd_enqueue(_draw_thread_image_draw, cr);
@ -1429,13 +1444,15 @@ _map_image_draw(RGBA_Image *src, RGBA_Image *dst, RGBA_Draw_Context *dc, int src
clip_x, clip_y, clip_w, clip_h, clip_x, clip_y, clip_w, clip_h,
mul_col, dc->render_op, mul_col, dc->render_op,
src_x, src_y, src_w, src_h, src_x, src_y, src_w, src_h,
dst_x, dst_y, dst_w, dst_h); dst_x, dst_y, dst_w, dst_h,
dc->clip.mask, dc->clip.mask_x, dc->clip.mask_y);
else else
evas_common_scale_rgba_sample_draw(src, dst, evas_common_scale_rgba_sample_draw(src, dst,
clip_x, clip_y, clip_w, clip_h, clip_x, clip_y, clip_w, clip_h,
mul_col, dc->render_op, mul_col, dc->render_op,
src_x, src_y, src_w, src_h, src_x, src_y, src_w, src_h,
dst_x, dst_y, dst_w, dst_h); dst_x, dst_y, dst_w, dst_h,
dc->clip.mask, dc->clip.mask_x, dc->clip.mask_y);
} }
static Eina_Bool static Eina_Bool
@ -2152,6 +2169,9 @@ _draw_thread_font_draw(void *data)
dc.clip.y = font->clip_rect.y; dc.clip.y = font->clip_rect.y;
dc.clip.w = font->clip_rect.w; dc.clip.w = font->clip_rect.w;
dc.clip.h = font->clip_rect.h; dc.clip.h = font->clip_rect.h;
dc.clip.mask = font->mask;
dc.clip.mask_x = font->mask_x;
dc.clip.mask_y = font->mask_y;
evas_common_font_rgba_draw evas_common_font_rgba_draw
(font->dst, &dc, (font->dst, &dc,
@ -2186,6 +2206,9 @@ _font_draw_thread_cmd(RGBA_Image *dst, RGBA_Draw_Context *dc, int x, int y, Evas
EINA_RECTANGLE_SET(&cf->ext, ext_x, ext_y, ext_w, ext_h); EINA_RECTANGLE_SET(&cf->ext, ext_x, ext_y, ext_w, ext_h);
cf->im_w = im_w; cf->im_w = im_w;
cf->im_h = im_h; cf->im_h = im_h;
cf->mask = dc->clip.mask;
cf->mask_x = dc->clip.mask_x;
cf->mask_y = dc->clip.mask_y;
evas_thread_cmd_enqueue(_draw_thread_font_draw, cf); evas_thread_cmd_enqueue(_draw_thread_font_draw, cf);