summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarc-André Lureau <marcandre.lureau@gmail.com>2015-11-23 17:02:04 +0000
committerFabiano Fidêncio <fidencio@redhat.com>2015-11-25 14:54:32 +0100
commit00526f0733a2afa68ba74aca73d66f454597fd80 (patch)
tree7ce46fbc2750ec3e1029927ce342a6487db20b41
parent3d0f4e3642aa5610e99a60ae92627bd7b0450b55 (diff)
downloadspice-master.zip
spice-master.tar.gz
spice-master.tar.xz
display: factor out current_find_intersects_rectHEADmaster
Acked-by: Fabiano Fidêncio <fidencio@redhat.com>
-rw-r--r--server/display-channel.c45
1 files changed, 26 insertions, 19 deletions
diff --git a/server/display-channel.c b/server/display-channel.c
index d2ee523..e158d59 100644
--- a/server/display-channel.c
+++ b/server/display-channel.c
@@ -1305,6 +1305,30 @@ static void draw_until(DisplayChannel *display, RedSurface *surface, Drawable *l
} while (now != last);
}
+static Drawable* current_find_intersects_rect(Ring *current, const SpiceRect *area)
+{
+ Ring *ring;
+ RingItem *ring_item;
+ QRegion rgn;
+ Drawable *last = NULL;
+
+ ring = current;
+ ring_item = ring;
+ region_init(&rgn);
+ region_add(&rgn, area);
+
+ while ((ring_item = ring_next(ring, ring_item))) {
+ Drawable *now = SPICE_CONTAINEROF(ring_item, Drawable, surface_list_link);
+ if (region_intersects(&rgn, &now->tree_item.base.rgn)) {
+ last = now;
+ break;
+ }
+ }
+
+ region_destroy(&rgn);
+ return last;
+}
+
/*
* Renders drawables for updating the requested area, but only drawables that are older
* than 'last' (exclusive).
@@ -1376,11 +1400,8 @@ void display_channel_draw_till(DisplayChannel *display, const SpiceRect *area, i
void display_channel_draw(DisplayChannel *display, const SpiceRect *area, int surface_id)
{
RedSurface *surface;
- Ring *ring;
- RingItem *ring_item;
- QRegion rgn;
Drawable *last;
- Drawable *now;
+
spice_debug("surface %d: area ==>", surface_id);
rect_debug(area);
@@ -1391,21 +1412,7 @@ void display_channel_draw(DisplayChannel *display, const SpiceRect *area, int su
surface = &display->surfaces[surface_id];
- last = NULL;
- ring = &surface->current_list;
- ring_item = ring;
-
- region_init(&rgn);
- region_add(&rgn, area);
- while ((ring_item = ring_next(ring, ring_item))) {
- now = SPICE_CONTAINEROF(ring_item, Drawable, surface_list_link);
- if (region_intersects(&rgn, &now->tree_item.base.rgn)) {
- last = now;
- break;
- }
- }
- region_destroy(&rgn);
-
+ last = current_find_intersects_rect(&surface->current_list, area);
if (last)
draw_until(display, surface, last);