summaryrefslogtreecommitdiffstats
path: root/common/region.c
diff options
context:
space:
mode:
authorIzik Eidus <ieidus@redhat.com>2010-04-14 19:38:49 +0300
committerIzik Eidus <ieidus@redhat.com>2010-04-14 19:38:49 +0300
commit99341e058f378c1fbf940a065267802028418969 (patch)
treee7334e5d14cac1bf20f0167390e0a81f2016c9b4 /common/region.c
parentc97116aeb925dfa10420ca8baae1d445da23b73d (diff)
downloadspice-99341e058f378c1fbf940a065267802028418969.tar.gz
spice-99341e058f378c1fbf940a065267802028418969.tar.xz
spice-99341e058f378c1fbf940a065267802028418969.zip
spice: server: change update_area command
The new command return dirty area to be used by users that want spice to render localy or into some framebuffer (sdl / vnc) Signed-off-by: Izik Eidus <ieidus@redhat.com>
Diffstat (limited to 'common/region.c')
-rw-r--r--common/region.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/common/region.c b/common/region.c
index 78d1dbcb..f3cf0b28 100644
--- a/common/region.c
+++ b/common/region.c
@@ -363,6 +363,31 @@ SpiceRect *region_dup_rects(const QRegion *rgn, uint32_t *num_rects)
return rects;
}
+void region_ret_rects(const QRegion *rgn, SpiceRect *rects, uint32_t num_rects)
+{
+ pixman_box32_t *boxes;
+ int n, i;
+
+ boxes = pixman_region32_rectangles((pixman_region32_t *)rgn, &n);
+ for (i = 0; i < n && i < num_rects; i++) {
+ rects[i].left = boxes[i].x1;
+ rects[i].top = boxes[i].y1;
+ rects[i].right = boxes[i].x2;
+ rects[i].bottom = boxes[i].y2;
+ }
+
+ if (i && i != n) {
+ int x;
+
+ for (x = 0; x < (n - num_rects); ++x) {
+ rects[i - 1].left = MIN(rects[i - 1].left, boxes[i + x].x1);
+ rects[i - 1].top = MIN(rects[i - 1].top, boxes[i + x].y1);
+ rects[i - 1].right = MAX(rects[i - 1].right, boxes[i + x].x2);
+ rects[i - 1].bottom = MAX(rects[i - 1].bottom, boxes[i + x].y2);
+ }
+ }
+}
+
int region_is_equal(const QRegion *rgn1, const QRegion *rgn2)
{