1 #include "evas_common.h"
2 #include "evas_blend_private.h"
4 static void rectangle_draw_internal(RGBA_Image *dst, RGBA_Draw_Context *dc, int x, int y, int w, int h);
7 evas_common_rectangle_init(void)
12 evas_common_rectangle_draw(RGBA_Image *dst, RGBA_Draw_Context *dc, int x, int y, int w, int h)
16 int c, cx, cy, cw, ch;
18 /* handle cutouts here! */
20 if ((w <= 0) || (h <= 0)) return;
21 if (!(RECTS_INTERSECT(x, y, w, h, 0, 0, dst->cache_entry.w, dst->cache_entry.h)))
23 /* save out clip info */
24 c = dc->clip.use; cx = dc->clip.x; cy = dc->clip.y; cw = dc->clip.w; ch = dc->clip.h;
25 evas_common_draw_context_clip_clip(dc, 0, 0, dst->cache_entry.w, dst->cache_entry.h);
26 /* no cutouts - cut right to the chase */
27 if (!dc->cutout.rects)
29 rectangle_draw_internal(dst, dc, x, y, w, h);
33 evas_common_draw_context_clip_clip(dc, x, y, w, h);
34 /* our clip is 0 size.. abort */
35 if ((dc->clip.w > 0) && (dc->clip.h > 0))
37 rects = evas_common_draw_context_apply_cutouts(dc);
38 for (i = 0; i < rects->active; ++i)
41 evas_common_draw_context_set_clip(dc, r->x, r->y, r->w, r->h);
42 rectangle_draw_internal(dst, dc, x, y, w, h);
44 evas_common_draw_context_apply_clear_cutouts(rects);
47 /* restore clip info */
48 dc->clip.use = c; dc->clip.x = cx; dc->clip.y = cy; dc->clip.w = cw; dc->clip.h = ch;
52 rectangle_draw_internal(RGBA_Image *dst, RGBA_Draw_Context *dc, int x, int y, int w, int h)
60 RECTS_CLIP_TO_RECT(x, y, w, h, dc->clip.x, dc->clip.y, dc->clip.w, dc->clip.h);
61 if ((w <= 0) || (h <= 0)) return;
63 maskobj = dc->mask.mask;
66 func = evas_common_gfx_func_composite_mask_color_span_get(dc->col.col,
67 dst, 1, dc->render_op);
68 mask = maskobj->mask.mask;
71 func = evas_common_gfx_func_composite_color_span_get(dc->col.col, dst, w, dc->render_op);
72 ptr = dst->image.data + (y * dst->cache_entry.w) + x;
76 for (yy = 0; yy < h; yy++)
79 if (((yy + y) % dc->sli.h) == dc->sli.y)
82 func(NULL, NULL, dc->col.col, ptr, w);
84 ptr += dst->cache_entry.w;
90 mask += x - dc->mask.x;
92 mask += (y - dc->mask.y) * maskobj->cache_entry.w;
94 for (yy = 0; yy < h; yy++)
97 if (((yy + y) % dc->sli.h) == dc->sli.y)
100 func(NULL, mask, dc->col.col, ptr, w);
102 ptr += dst->cache_entry.w;
103 mask += maskobj->cache_entry.w;
110 /* vim:set ts=8 sw=3 sts=3 expandtab cino=>5n-2f0^-2{2(0W1st0 :*/