3 #endif /* ifdef HAVE_CONFIG_H */
7 #include "ecore_xcb_private.h"
19 * [x] XIntersectRegion
21 * [x] XUnionRectWithRegion
32 EAPI Ecore_X_XRegion *
35 pixman_region16_t *region;
37 region = (pixman_region16_t *)malloc (sizeof (pixman_region16_t));
41 pixman_region_init(region);
43 return (Ecore_X_XRegion *)region;
44 } /* ecore_x_xregion_new */
47 ecore_x_xregion_free(Ecore_X_XRegion *region)
52 pixman_region_fini(region);
54 } /* ecore_x_xregion_free */
57 ecore_x_xregion_set(Ecore_X_XRegion *region, Ecore_X_GC gc)
59 xcb_rectangle_t *rects;
60 pixman_box16_t *boxes;
67 boxes = pixman_region_rectangles ((pixman_region16_t *)region, &num);
69 if (!boxes || (num == 0))
72 rects = (xcb_rectangle_t *)malloc(sizeof(xcb_rectangle_t) * num);
76 for (i = 0; i < num; i++)
78 rects[i].x = boxes[i].x1;
79 rects[i].y = boxes[i].y1;
80 rects[i].width = boxes[i].x2 - boxes[i].x1 + 1;
81 rects[i].height = boxes[i].y2 - boxes[i].y1 + 1;
84 xcb_set_clip_rectangles(_ecore_xcb_conn,
85 XCB_CLIP_ORDERING_YX_BANDED,
91 } /* ecore_x_xregion_set */
94 ecore_x_xregion_translate(Ecore_X_XRegion *region, int x, int y)
99 pixman_region_translate((pixman_region16_t *)region, x, y);
100 } /* ecore_x_xregion_translate */
103 ecore_x_xregion_intersect(Ecore_X_XRegion *dst, Ecore_X_XRegion *r1, Ecore_X_XRegion *r2)
105 return pixman_region_intersect((pixman_region16_t *)dst, (pixman_region16_t *)r1, (pixman_region16_t *)r2);
106 } /* ecore_x_xregion_intersect */
109 ecore_x_xregion_union(Ecore_X_XRegion *dst, Ecore_X_XRegion *r1, Ecore_X_XRegion *r2)
111 return pixman_region_union((pixman_region16_t *)dst, (pixman_region16_t *)r1, (pixman_region16_t *)r2);
112 } /* ecore_x_xregion_union */
115 ecore_x_xregion_union_rect(Ecore_X_XRegion *dst, Ecore_X_XRegion *src, Ecore_X_Rectangle *rect)
117 return pixman_region_union_rect((pixman_region16_t *)dst, (pixman_region16_t *)src,
118 rect->x, rect->y, rect->width, rect->height);
119 } /* ecore_x_xregion_union_rect */
122 ecore_x_xregion_subtract(Ecore_X_XRegion *dst, Ecore_X_XRegion *rm, Ecore_X_XRegion *rs)
124 return pixman_region_subtract((pixman_region16_t *)dst, (pixman_region16_t *)rm, (pixman_region16_t *)rs);
125 } /* ecore_x_xregion_subtract */
128 ecore_x_xregion_is_empty(Ecore_X_XRegion *region)
133 return !pixman_region_not_empty((pixman_region16_t *)region);
134 } /* ecore_x_xregion_is_empty */
137 ecore_x_xregion_is_equal(Ecore_X_XRegion *r1, Ecore_X_XRegion *r2)
142 return pixman_region_equal((pixman_region16_t *)r1, (pixman_region16_t *)r2);
143 } /* ecore_x_xregion_is_equal */
146 ecore_x_xregion_point_contain(Ecore_X_XRegion *region, int x, int y)
151 return pixman_region_contains_point((pixman_region16_t *)region, x, y, NULL);
152 } /* ecore_x_xregion_point_contain */
155 ecore_x_xregion_rect_contain(Ecore_X_XRegion *region, Ecore_X_Rectangle *rect)
159 if (!region || !rect)
164 box.x2 = rect->x + rect->width - 1;
165 box.y2 = rect->y + rect->height - 1;
167 return pixman_region_contains_rectangle((pixman_region16_t *)region, &box);
168 } /* ecore_x_xregion_rect_contain */