From a99bf2c9b6f47fde68f627623eec9e7ab86db0f0 Mon Sep 17 00:00:00 2001 From: Cedric BAIL Date: Thu, 5 Jul 2012 03:11:47 +0000 Subject: [PATCH] evas: fix clipping issue with pipe rendering. SVN revision: 73322 --- .../src/lib/engines/common/evas_font_draw.c | 49 +++++-------------- .../evas/src/lib/engines/common/evas_pipe.c | 15 +++--- .../lib/engines/common/evas_rectangle_main.c | 4 +- .../lib/engines/common/evas_scale_sample.c | 2 +- .../lib/engines/common/evas_scale_smooth.c | 2 +- 5 files changed, 22 insertions(+), 50 deletions(-) diff --git a/legacy/evas/src/lib/engines/common/evas_font_draw.c b/legacy/evas/src/lib/engines/common/evas_font_draw.c index d256cb1fd4..6f0b6e7aa2 100644 --- a/legacy/evas/src/lib/engines/common/evas_font_draw.c +++ b/legacy/evas/src/lib/engines/common/evas_font_draw.c @@ -382,9 +382,13 @@ evas_common_font_draw_do(const Cutout_Rects *reuse, const Eina_Rectangle *clip, if (!reuse) { - evas_common_draw_context_set_clip(dc, clip->x, clip->y, clip->w, clip->h); + evas_common_draw_context_clip_clip(dc, + clip->x, clip->y, + clip->w, clip->h); evas_common_font_draw_internal(dst, dc, x, y, text_props, - func, clip->x, clip->y, clip->w, clip->h, + func, + dc->clip.x, dc->clip.y, + dc->clip.w, dc->clip.h, im_w, im_h); return ; } @@ -393,7 +397,7 @@ evas_common_font_draw_do(const Cutout_Rects *reuse, const Eina_Rectangle *clip, { r = reuse->rects + i; - EINA_RECTANGLE_SET(&area, r->x, r->y, r->w, r->h); + EINA_RECTANGLE_SET(&area, r->x, r->y, r->w - 1, r->h - 1); if (!eina_rectangle_intersection(&area, clip)) continue ; evas_common_draw_context_set_clip(dc, area.x, area.y, area.w, area.h); evas_common_font_draw_internal(dst, dc, x, y, text_props, @@ -405,7 +409,6 @@ evas_common_font_draw_do(const Cutout_Rects *reuse, const Eina_Rectangle *clip, EAPI Eina_Bool evas_common_font_draw_prepare_cutout(Cutout_Rects *reuse, RGBA_Image *dst, RGBA_Draw_Context *dc, RGBA_Gfx_Func *func) { - int ext_x, ext_y, ext_w, ext_h; int im_w, im_h; im_w = dst->cache_entry.w; @@ -413,43 +416,13 @@ evas_common_font_draw_prepare_cutout(Cutout_Rects *reuse, RGBA_Image *dst, RGBA_ *func = evas_common_gfx_func_composite_mask_color_span_get(dc->col.col, dst, 1, dc->render_op); - ext_x = 0; ext_y = 0; ext_w = im_w; ext_h = im_h; - if (dc->clip.use) - { - ext_x = dc->clip.x; - ext_y = dc->clip.y; - ext_w = dc->clip.w; - ext_h = dc->clip.h; - if (ext_x < 0) - { - ext_w += ext_x; - ext_x = 0; - } - if (ext_y < 0) - { - ext_h += ext_y; - ext_y = 0; - } - if ((ext_x + ext_w) > im_w) - ext_w = im_w - ext_x; - if ((ext_y + ext_h) > im_h) - ext_h = im_h - ext_y; - } - if (ext_w <= 0) return EINA_FALSE; - if (ext_h <= 0) return EINA_FALSE; + evas_common_draw_context_clip_clip(dc, 0, 0, im_w, im_h); + if (dc->clip.w <= 0) return EINA_FALSE; + if (dc->clip.h <= 0) return EINA_FALSE; if (dc->cutout.rects) { - evas_common_draw_context_clip_clip(dc, 0, 0, dst->cache_entry.w, dst->cache_entry.h); - /* our clip is 0 size.. abort */ - if ((dc->clip.w > 0) && (dc->clip.h > 0)) - { - reuse = evas_common_draw_context_apply_cutouts(dc, reuse); - } - else - { - return EINA_FALSE; - } + reuse = evas_common_draw_context_apply_cutouts(dc, reuse); } return EINA_TRUE; diff --git a/legacy/evas/src/lib/engines/common/evas_pipe.c b/legacy/evas/src/lib/engines/common/evas_pipe.c index 44bfc71307..946a29341a 100644 --- a/legacy/evas/src/lib/engines/common/evas_pipe.c +++ b/legacy/evas/src/lib/engines/common/evas_pipe.c @@ -287,14 +287,12 @@ evas_common_pipe_rectangle_draw_do(RGBA_Image *dst, const RGBA_Pipe_Op *op, cons static Eina_Bool evas_common_pipe_rectangle_prepare(void *data, RGBA_Image *dst, RGBA_Pipe_Op *op) { - RGBA_Draw_Context context; Cutout_Rects *recycle; Thinfo *info = data; Eina_Bool r; recycle = evas_pipe_cutout_rects_pop(info); - memcpy(&(context), &(op->context), sizeof(RGBA_Draw_Context)); - r = evas_common_rectangle_draw_prepare(recycle, dst, &context, + r = evas_common_rectangle_draw_prepare(recycle, dst, &(op->context), op->op.rect.x, op->op.rect.y, op->op.rect.w, op->op.rect.h); if (recycle->active) op->rects = recycle; @@ -436,14 +434,13 @@ evas_common_pipe_text_draw_do(RGBA_Image *dst, const RGBA_Pipe_Op *op, const RGB static Eina_Bool evas_common_pipe_text_draw_prepare(void *data, RGBA_Image *dst, RGBA_Pipe_Op *op) { - RGBA_Draw_Context context; Cutout_Rects *recycle; Thinfo *info = data; Eina_Bool r; recycle = evas_pipe_cutout_rects_pop(info); - memcpy(&(context), &(op->context), sizeof(RGBA_Draw_Context)); - r = evas_common_font_draw_prepare_cutout(recycle, dst, &context, &(op->op.text.func)); + r = evas_common_font_draw_prepare_cutout(recycle, dst, &(op->context), + &(op->op.text.func)); if (recycle->active) op->rects = recycle; else evas_pipe_cutout_rects_push(info, recycle); @@ -485,14 +482,14 @@ evas_common_pipe_op_image_free(RGBA_Pipe_Op *op) static Eina_Bool evas_common_pipe_op_image_prepare(void *data, RGBA_Image *dst, RGBA_Pipe_Op *op) { - RGBA_Draw_Context context; Cutout_Rects *recycle; Thinfo *info = data; Eina_Bool r; recycle = evas_pipe_cutout_rects_pop(info); - memcpy(&(context), &(op->context), sizeof(RGBA_Draw_Context)); - r = evas_common_scale_rgba_in_to_out_clip_prepare(recycle, op->op.image.src, dst, &(context), + r = evas_common_scale_rgba_in_to_out_clip_prepare(recycle, + op->op.image.src, dst, + &(op->context), op->op.image.dx, op->op.image.dy, op->op.image.dw, op->op.image.dh); if (recycle->active) op->rects = recycle; diff --git a/legacy/evas/src/lib/engines/common/evas_rectangle_main.c b/legacy/evas/src/lib/engines/common/evas_rectangle_main.c index 40747613b9..33fb053ac9 100644 --- a/legacy/evas/src/lib/engines/common/evas_rectangle_main.c +++ b/legacy/evas/src/lib/engines/common/evas_rectangle_main.c @@ -80,7 +80,9 @@ evas_common_rectangle_draw_do(const Cutout_Rects *reuse, if (!reuse) { - evas_common_draw_context_set_clip(dc, clip->x, clip->y, clip->w, clip->h); + evas_common_draw_context_clip_clip(dc, + clip->x, clip->y, + clip->w, clip->h); rectangle_draw_internal(dst, dc, x, y, w, h); return ; } diff --git a/legacy/evas/src/lib/engines/common/evas_scale_sample.c b/legacy/evas/src/lib/engines/common/evas_scale_sample.c index ea1061802d..5e34a37825 100644 --- a/legacy/evas/src/lib/engines/common/evas_scale_sample.c +++ b/legacy/evas/src/lib/engines/common/evas_scale_sample.c @@ -109,7 +109,7 @@ evas_common_scale_rgba_in_to_out_clip_sample_do(const Cutout_Rects *reuse, if (!reuse) { - evas_common_draw_context_set_clip(dc, clip->x, clip->y, clip->w, clip->h); + evas_common_draw_context_clip_clip(dc, clip->x, clip->y, clip->w, clip->h); scale_rgba_in_to_out_clip_sample_internal(src, dst, dc, src_region_x, src_region_y, src_region_w, src_region_h, diff --git a/legacy/evas/src/lib/engines/common/evas_scale_smooth.c b/legacy/evas/src/lib/engines/common/evas_scale_smooth.c index ca852033c8..a3cb379069 100644 --- a/legacy/evas/src/lib/engines/common/evas_scale_smooth.c +++ b/legacy/evas/src/lib/engines/common/evas_scale_smooth.c @@ -551,7 +551,7 @@ evas_common_scale_rgba_in_to_out_clip_smooth_do(const Cutout_Rects *reuse, # endif if (!reuse) { - evas_common_draw_context_set_clip(dc, clip->x, clip->y, clip->w, clip->h); + evas_common_draw_context_clip_clip(dc, clip->x, clip->y, clip->w, clip->h); # ifdef BUILD_MMX if (mmx) evas_common_scale_rgba_in_to_out_clip_smooth_mmx(src, dst, dc,