diff options
Diffstat (limited to 'libraries/evas/src/lib/engines/common/evas_rectangle_main.c')
-rw-r--r-- | libraries/evas/src/lib/engines/common/evas_rectangle_main.c | 73 |
1 files changed, 73 insertions, 0 deletions
diff --git a/libraries/evas/src/lib/engines/common/evas_rectangle_main.c b/libraries/evas/src/lib/engines/common/evas_rectangle_main.c new file mode 100644 index 0000000..28aaf16 --- /dev/null +++ b/libraries/evas/src/lib/engines/common/evas_rectangle_main.c | |||
@@ -0,0 +1,73 @@ | |||
1 | #include "evas_common.h" | ||
2 | #include "evas_blend_private.h" | ||
3 | |||
4 | static void rectangle_draw_internal(RGBA_Image *dst, RGBA_Draw_Context *dc, int x, int y, int w, int h); | ||
5 | |||
6 | EAPI void | ||
7 | evas_common_rectangle_init(void) | ||
8 | { | ||
9 | } | ||
10 | |||
11 | EAPI void | ||
12 | evas_common_rectangle_draw(RGBA_Image *dst, RGBA_Draw_Context *dc, int x, int y, int w, int h) | ||
13 | { | ||
14 | Cutout_Rects *rects; | ||
15 | Cutout_Rect *r; | ||
16 | int c, cx, cy, cw, ch; | ||
17 | int i; | ||
18 | /* handle cutouts here! */ | ||
19 | |||
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))) | ||
22 | return; | ||
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) | ||
28 | { | ||
29 | rectangle_draw_internal(dst, dc, x, y, w, h); | ||
30 | } | ||
31 | else | ||
32 | { | ||
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)) | ||
36 | { | ||
37 | rects = evas_common_draw_context_apply_cutouts(dc); | ||
38 | for (i = 0; i < rects->active; ++i) | ||
39 | { | ||
40 | r = rects->rects + 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); | ||
43 | } | ||
44 | evas_common_draw_context_apply_clear_cutouts(rects); | ||
45 | } | ||
46 | } | ||
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; | ||
49 | } | ||
50 | |||
51 | static void | ||
52 | rectangle_draw_internal(RGBA_Image *dst, RGBA_Draw_Context *dc, int x, int y, int w, int h) | ||
53 | { | ||
54 | RGBA_Gfx_Func func; | ||
55 | int yy; | ||
56 | DATA32 *ptr; | ||
57 | |||
58 | RECTS_CLIP_TO_RECT(x, y, w, h, dc->clip.x, dc->clip.y, dc->clip.w, dc->clip.h); | ||
59 | if ((w <= 0) || (h <= 0)) return; | ||
60 | |||
61 | func = evas_common_gfx_func_composite_color_span_get(dc->col.col, dst, w, dc->render_op); | ||
62 | ptr = dst->image.data + (y * dst->cache_entry.w) + x; | ||
63 | for (yy = 0; yy < h; yy++) | ||
64 | { | ||
65 | #ifdef EVAS_SLI | ||
66 | if (((yy + y) % dc->sli.h) == dc->sli.y) | ||
67 | #endif | ||
68 | { | ||
69 | func(NULL, NULL, dc->col.col, ptr, w); | ||
70 | } | ||
71 | ptr += dst->cache_entry.w; | ||
72 | } | ||
73 | } | ||