mirror of
https://gitlab.uni-freiburg.de/opensourcevdi/spice
synced 2025-12-27 15:45:54 +00:00
display: factor out current_find_intersects_rect
Acked-by: Fabiano Fidêncio <fidencio@redhat.com>
This commit is contained in:
parent
3d0f4e3642
commit
00526f0733
@ -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);
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user