evas: fix clipping issue with pipe rendering.
authorcedric <cedric@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Thu, 5 Jul 2012 03:11:47 +0000 (03:11 +0000)
committercedric <cedric@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Thu, 5 Jul 2012 03:11:47 +0000 (03:11 +0000)
git-svn-id: svn+ssh://svn.enlightenment.org/var/svn/e/trunk/evas@73322 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33

src/lib/engines/common/evas_font_draw.c
src/lib/engines/common/evas_pipe.c
src/lib/engines/common/evas_rectangle_main.c
src/lib/engines/common/evas_scale_sample.c
src/lib/engines/common/evas_scale_smooth.c

index d256cb1..6f0b6e7 100644 (file)
@@ -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;
index 44bfc71..946a293 100644 (file)
@@ -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;
index 4074761..33fb053 100644 (file)
@@ -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 ;
      }
index ea10618..5e34a37 100644 (file)
@@ -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,
index ca85203..a3cb379 100644 (file)
@@ -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,