aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_region.c
diff options
context:
space:
mode:
Diffstat (limited to 'libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_region.c')
-rw-r--r--libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_region.c159
1 files changed, 0 insertions, 159 deletions
diff --git a/libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_region.c b/libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_region.c
deleted file mode 100644
index a221d8f..0000000
--- a/libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_region.c
+++ /dev/null
@@ -1,159 +0,0 @@
1#include "ecore_xcb_private.h"
2#include <pixman.h>
3
4/*
5 * [ ] XPolygonRegion
6 * [ ] XShrinkRegion
7 * [ ] XClipBox
8 * [ ] XXorRegion
9 */
10
11EAPI Ecore_X_XRegion *
12ecore_x_xregion_new()
13{
14 pixman_region16_t *region;
15
16 region = (pixman_region16_t *)malloc(sizeof(pixman_region16_t));
17 if (!region) return NULL;
18
19 pixman_region_init(region);
20
21 return (Ecore_X_XRegion *)region;
22}
23
24EAPI void
25ecore_x_xregion_free(Ecore_X_XRegion *region)
26{
27 if (!region) return;
28
29 pixman_region_fini(region);
30 free(region);
31}
32
33EAPI Eina_Bool
34ecore_x_xregion_set(Ecore_X_XRegion *region,
35 Ecore_X_GC gc)
36{
37 xcb_rectangle_t *rects;
38 pixman_box16_t *boxes;
39 int num = 0, i = 0;
40
41 CHECK_XCB_CONN;
42
43 if (!region) return EINA_FALSE;
44
45 boxes = pixman_region_rectangles((pixman_region16_t *)region, &num);
46 if ((!boxes) || (num == 0)) return EINA_FALSE;
47
48 rects = (xcb_rectangle_t *)malloc(sizeof(xcb_rectangle_t) * num);
49 if (!rects) return EINA_FALSE;
50
51 for (i = 0; i < num; i++)
52 {
53 rects[i].x = boxes[i].x1;
54 rects[i].y = boxes[i].y1;
55 rects[i].width = boxes[i].x2 - boxes[i].x1 + 1;
56 rects[i].height = boxes[i].y2 - boxes[i].y1 + 1;
57 }
58
59 xcb_set_clip_rectangles(_ecore_xcb_conn, XCB_CLIP_ORDERING_YX_BANDED,
60 gc, 0, 0, num, rects);
61
62// ecore_x_flush();
63 return EINA_TRUE;
64}
65
66EAPI void
67ecore_x_xregion_translate(Ecore_X_XRegion *region,
68 int x,
69 int y)
70{
71 if (!region) return;
72
73 pixman_region_translate((pixman_region16_t *)region, x, y);
74}
75
76EAPI Eina_Bool
77ecore_x_xregion_intersect(Ecore_X_XRegion *dst,
78 Ecore_X_XRegion *r1,
79 Ecore_X_XRegion *r2)
80{
81 return pixman_region_intersect((pixman_region16_t *)dst,
82 (pixman_region16_t *)r1,
83 (pixman_region16_t *)r2);
84}
85
86EAPI Eina_Bool
87ecore_x_xregion_union(Ecore_X_XRegion *dst,
88 Ecore_X_XRegion *r1,
89 Ecore_X_XRegion *r2)
90{
91 return pixman_region_union((pixman_region16_t *)dst,
92 (pixman_region16_t *)r1,
93 (pixman_region16_t *)r2);
94}
95
96EAPI Eina_Bool
97ecore_x_xregion_union_rect(Ecore_X_XRegion *dst,
98 Ecore_X_XRegion *src,
99 Ecore_X_Rectangle *rect)
100{
101 return pixman_region_union_rect((pixman_region16_t *)dst,
102 (pixman_region16_t *)src,
103 rect->x, rect->y, rect->width, rect->height);
104}
105
106EAPI Eina_Bool
107ecore_x_xregion_subtract(Ecore_X_XRegion *dst,
108 Ecore_X_XRegion *rm,
109 Ecore_X_XRegion *rs)
110{
111 return pixman_region_subtract((pixman_region16_t *)dst,
112 (pixman_region16_t *)rm,
113 (pixman_region16_t *)rs);
114}
115
116EAPI Eina_Bool
117ecore_x_xregion_is_empty(Ecore_X_XRegion *region)
118{
119 if (!region) return EINA_TRUE;
120
121 return !pixman_region_not_empty((pixman_region16_t *)region);
122}
123
124EAPI Eina_Bool
125ecore_x_xregion_is_equal(Ecore_X_XRegion *r1,
126 Ecore_X_XRegion *r2)
127{
128 if ((!r1) || (!r2)) return EINA_FALSE;
129
130 return pixman_region_equal((pixman_region16_t *)r1,
131 (pixman_region16_t *)r2);
132}
133
134EAPI Eina_Bool
135ecore_x_xregion_point_contain(Ecore_X_XRegion *region,
136 int x,
137 int y)
138{
139 if (!region) return EINA_FALSE;
140
141 return pixman_region_contains_point((pixman_region16_t *)region, x, y, NULL);
142}
143
144EAPI Eina_Bool
145ecore_x_xregion_rect_contain(Ecore_X_XRegion *region,
146 Ecore_X_Rectangle *rect)
147{
148 pixman_box16_t box;
149
150 if ((!region) || (!rect)) return EINA_FALSE;
151
152 box.x1 = rect->x;
153 box.y1 = rect->y;
154 box.x2 = rect->x + rect->width - 1;
155 box.y2 = rect->y + rect->height - 1;
156
157 return pixman_region_contains_rectangle((pixman_region16_t *)region, &box);
158}
159