add region intersect

This commit is contained in:
Jay Sorg 2016-08-08 23:12:52 -07:00
parent 58c777783b
commit bb7bac2d9b
3 changed files with 26 additions and 2 deletions

View File

@ -67,6 +67,9 @@ pixman_bool_t pixman_region_union (pixman_region16_t *new
pixman_bool_t pixman_region_subtract (pixman_region16_t *reg_d,
pixman_region16_t *reg_m,
pixman_region16_t *reg_s);
pixman_bool_t pixman_region_intersect (pixman_region16_t *new_reg,
pixman_region16_t *reg1,
pixman_region16_t *reg2);
pixman_box16_t * pixman_region_rectangles (pixman_region16_t *region,
int *n_rects);

View File

@ -175,8 +175,9 @@ xrdp_region_delete(struct xrdp_region* self);
int APP_CC
xrdp_region_add_rect(struct xrdp_region* self, struct xrdp_rect* rect);
int APP_CC
xrdp_region_subtract_rect(struct xrdp_region* self,
struct xrdp_rect* rect);
xrdp_region_subtract_rect(struct xrdp_region* self, struct xrdp_rect* rect);
int APP_CC
xrdp_region_intersect_rect(struct xrdp_region* self, struct xrdp_rect* rect);
int APP_CC
xrdp_region_get_rect(struct xrdp_region* self, int index,
struct xrdp_rect* rect);

View File

@ -91,6 +91,26 @@ xrdp_region_subtract_rect(struct xrdp_region *self, struct xrdp_rect *rect)
return 0;
}
/*****************************************************************************/
/* returns error */
int APP_CC
xrdp_region_intersect_rect(struct xrdp_region* self, struct xrdp_rect* rect)
{
struct pixman_region16 lreg;
pixman_region_init_rect(&lreg, rect->left, rect->top,
rect->right - rect->left,
rect->bottom - rect->top);
if (!pixman_region_intersect(self->reg, self->reg, &lreg))
{
pixman_region_fini(&lreg);
return 1;
}
pixman_region_fini(&lreg);
return 0;
}
/*****************************************************************************/
/* returns error */
int APP_CC