summaryrefslogtreecommitdiff
path: root/src/compositor/compositor-xrender.c
diff options
context:
space:
mode:
authorVictor Kareh <[email protected]>2019-05-22 11:41:46 -0400
committerraveit65 <[email protected]>2019-06-16 18:12:44 +0200
commit9d4142448b6cd3292a86a24eb070ce13e462d092 (patch)
tree89b1168a29b7aaf0624d7f55750244d69d7d0571 /src/compositor/compositor-xrender.c
parent4a0299e379d32bc57b8f4fa7b05f0722d4d2d3f6 (diff)
downloadmarco-9d4142448b6cd3292a86a24eb070ce13e462d092.tar.bz2
marco-9d4142448b6cd3292a86a24eb070ce13e462d092.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/compositor-xrender.c')
-rw-r--r--src/compositor/compositor-xrender.c29
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,