diff options
author | Victor Kareh <[email protected]> | 2019-05-22 11:41:46 -0400 |
---|---|---|
committer | Victor Kareh <[email protected]> | 2019-06-05 10:49:37 -0400 |
commit | 05e91c38dd0ed59b7d55f1460eb7863ebd11ad0e (patch) | |
tree | cac9443ff9c8b6da2f403eeb5a4dbe305b3836f9 /src/compositor | |
parent | 43a58511565f293653f98e0dc77f240bd4d5e10f (diff) | |
download | marco-05e91c38dd0ed59b7d55f1460eb7863ebd11ad0e.tar.bz2 marco-05e91c38dd0ed59b7d55f1460eb7863ebd11ad0e.tar.xz |
compositor: add function to convert cairo region to xserver region
upstream commit:
https://gitlab.gnome.org/GNOME/metacity/commit/28970472
Diffstat (limited to 'src/compositor')
-rw-r--r-- | src/compositor/compositor-xrender.c | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/src/compositor/compositor-xrender.c b/src/compositor/compositor-xrender.c index 103d246b..fa85105d 100644 --- a/src/compositor/compositor-xrender.c +++ b/src/compositor/compositor-xrender.c @@ -596,6 +596,35 @@ double shadow_offsets_y[LAST_SHADOW_TYPE] = {SHADOW_SMALL_OFFSET_Y, SHADOW_MEDIUM_OFFSET_Y, SHADOW_LARGE_OFFSET_Y}; +static XserverRegion +cairo_region_to_xserver_region (Display *xdisplay, + cairo_region_t *region) +{ + int n_rects, i; + XRectangle *rects; + XserverRegion xregion; + + n_rects = cairo_region_num_rectangles (region); + rects = g_new (XRectangle, n_rects); + + for (i = 0; i < n_rects; i++) + { + cairo_rectangle_int_t rect; + + cairo_region_get_rectangle (region, i, &rect); + + rects[i].x = rect.x; + rects[i].y = rect.y; + rects[i].width = rect.width; + rects[i].height = rect.height; + } + + xregion = XFixesCreateRegion (xdisplay, rects, n_rects); + g_free (rects); + + return xregion; +} + static void shadow_clip (Display *xdisplay, Picture shadow_picture, |