summaryrefslogtreecommitdiff
path: root/src/compositor/region-utils.c
diff options
context:
space:
mode:
authorJonas Ã…dahl <jadahl@gmail.com>2015-03-02 22:56:35 +0800
committerRay Strode <rstrode@redhat.com>2015-03-03 14:53:15 -0500
commitbbcee174ced72b7d447aa185d7413f382b3fbf96 (patch)
treee6d3f4808faacd12a9258914220b1c986ec59d9d /src/compositor/region-utils.c
parent9c6e6ea3813666bb31ed4f614d93079be8b84e7e (diff)
downloadmutter-bbcee174ced72b7d447aa185d7413f382b3fbf96.tar.gz
wayland: Make the surface actor set its own state
Since the surface actor knows more about how it draws itself, instead of pushing texture state (buffer and scale), input region and opaque region from MetaWaylandSurface after having transformed into what the surface actor expects, make the surface actor set its own state given what state the Wayland surface is in. https://bugzilla.gnome.org/show_bug.cgi?id=744933
Diffstat (limited to 'src/compositor/region-utils.c')
-rw-r--r--src/compositor/region-utils.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/src/compositor/region-utils.c b/src/compositor/region-utils.c
index a78321d11..1b970ba27 100644
--- a/src/compositor/region-utils.c
+++ b/src/compositor/region-utils.c
@@ -172,6 +172,35 @@ meta_region_iterator_next (MetaRegionIterator *iter)
}
}
+cairo_region_t *
+meta_region_scale (cairo_region_t *region, int scale)
+{
+ int n_rects, i;
+ cairo_rectangle_int_t *rects;
+ cairo_region_t *scaled_region;
+
+ if (scale == 1)
+ return cairo_region_copy (region);
+
+ n_rects = cairo_region_num_rectangles (region);
+
+ rects = g_malloc (sizeof(cairo_rectangle_int_t) * n_rects);
+ for (i = 0; i < n_rects; i++)
+ {
+ cairo_region_get_rectangle (region, i, &rects[i]);
+ rects[i].x *= scale;
+ rects[i].y *= scale;
+ rects[i].width *= scale;
+ rects[i].height *= scale;
+ }
+
+ scaled_region = cairo_region_create_rectangles (rects, n_rects);
+
+ g_free (rects);
+
+ return scaled_region;
+}
+
static void
add_expanded_rect (MetaRegionBuilder *builder,
int x,