[metacity] compositor: add function to convert cairo region to	xserver region
- From: Alberts Muktupāvels <muktupavels src gnome org>
- To: commits-list gnome org
- Cc: 
- Subject: [metacity] compositor: add function to convert cairo region to	xserver region
- Date: Tue, 20 Jan 2015 14:33:59 +0000 (UTC)
commit 289704721b9dcf5c902ecdffcd9029b894c769de
Author: Alberts Muktupāvels <alberts muktupavels gmail com>
Date:   Tue Jan 20 16:19:26 2015 +0200
    compositor: add function to convert cairo region to xserver region
 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 dd99329..2d2588f 100644
--- a/src/compositor/compositor-xrender.c
+++ b/src/compositor/compositor-xrender.c
@@ -599,6 +599,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,
[
Date Prev][
Date Next]   [
Thread Prev][
Thread Next]   
[
Thread Index]
[
Date Index]
[
Author Index]