summaryrefslogtreecommitdiff
path: root/src/lib/evas/common/evas_draw_main.c
diff options
context:
space:
mode:
authorJean-Philippe Andre <jp.andre@samsung.com>2015-09-03 12:03:23 +0900
committerJean-Philippe Andre <jp.andre@samsung.com>2015-09-04 11:11:39 +0900
commit69cbbc2184050330c4a70b2432001be717e20a4b (patch)
tree251f1cccf923bc26eb4d3889e9bbb8bee342bb85 /src/lib/evas/common/evas_draw_main.c
parentbcbf7d14e66b7438a7756198d2d6a84c9df672b5 (diff)
evas: Add internal context_dup function
This will simplify some code related to clipping and masking.
Diffstat (limited to 'src/lib/evas/common/evas_draw_main.c')
-rw-r--r--src/lib/evas/common/evas_draw_main.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/lib/evas/common/evas_draw_main.c b/src/lib/evas/common/evas_draw_main.c
index 01ba20c..5830d70 100644
--- a/src/lib/evas/common/evas_draw_main.c
+++ b/src/lib/evas/common/evas_draw_main.c
@@ -11,6 +11,20 @@ evas_common_draw_context_cutouts_new(void)
11 return rects; 11 return rects;
12} 12}
13 13
14static void
15evas_common_draw_context_cutouts_dup(Cutout_Rects *rects2, const Cutout_Rects *rects)
16{
17 if (!rects) return;
18 rects2->active = rects->active;
19 rects2->max = rects->max;
20 if (rects->max > 0)
21 {
22 const size_t sz = sizeof(Cutout_Rect) * rects->max;
23 rects2->rects = malloc(sz);
24 memcpy(rects2->rects, rects->rects, sz);
25 }
26}
27
14EAPI void 28EAPI void
15evas_common_draw_context_cutouts_free(Cutout_Rects* rects) 29evas_common_draw_context_cutouts_free(Cutout_Rects* rects)
16{ 30{
@@ -81,6 +95,18 @@ evas_common_draw_context_new(void)
81 return dc; 95 return dc;
82} 96}
83 97
98EAPI RGBA_Draw_Context *
99evas_common_draw_context_dup(RGBA_Draw_Context *dc)
100{
101 RGBA_Draw_Context *dc2;
102
103 if (!dc) return evas_common_draw_context_new();
104 dc2 = calloc(1, sizeof(RGBA_Draw_Context));
105 memcpy(dc2, dc, sizeof(RGBA_Draw_Context));
106 evas_common_draw_context_cutouts_dup(&dc2->cutout, &dc->cutout);
107 return dc2;
108}
109
84EAPI void 110EAPI void
85evas_common_draw_context_free(RGBA_Draw_Context *dc) 111evas_common_draw_context_free(RGBA_Draw_Context *dc)
86{ 112{