worker: move red_pipes_remove_drawable

Acked-by: Fabiano Fidêncio <fidencio@redhat.com>
This commit is contained in:
Marc-André Lureau 2013-10-01 17:11:10 +02:00 committed by Frediano Ziglio
parent 4ca383b261
commit 7258e5a688
3 changed files with 18 additions and 20 deletions

View File

@ -398,6 +398,20 @@ static void current_remove_drawable(DisplayChannel *display, Drawable *item)
display->current_size--;
}
static void drawable_remove_from_pipes(Drawable *drawable)
{
DrawablePipeItem *dpi;
RingItem *item, *next;
RING_FOREACH_SAFE(item, next, &drawable->pipes) {
dpi = SPICE_CONTAINEROF(item, DrawablePipeItem, base);
if (pipe_item_is_linked(&dpi->dpi_pipe_item)) {
red_channel_client_pipe_remove_and_release(RED_CHANNEL_CLIENT(dpi->dcc),
&dpi->dpi_pipe_item);
}
}
}
static void current_remove(DisplayChannel *display, TreeItem *item)
{
TreeItem *now = item;
@ -410,7 +424,7 @@ static void current_remove(DisplayChannel *display, TreeItem *item)
if (now->type == TREE_ITEM_TYPE_DRAWABLE) {
Drawable *drawable = SPICE_CONTAINEROF(now, Drawable, tree_item);
ring_item = now->siblings_link.prev;
red_pipes_remove_drawable(drawable);
drawable_remove_from_pipes(drawable);
current_remove_drawable(display, drawable);
} else {
Container *container = (Container *)now;
@ -477,7 +491,7 @@ static int current_add_equal(DisplayChannel *display, DrawItem *item, TreeItem *
} else {
pipes_add_drawable(display, drawable);
}
red_pipes_remove_drawable(other_drawable);
drawable_remove_from_pipes(other_drawable);
display_channel_drawable_unref(display, other_drawable);
return TRUE;
}
@ -519,7 +533,7 @@ static int current_add_equal(DisplayChannel *display, DrawItem *item, TreeItem *
}
}
/* not sending other_drawable where possible */
red_pipes_remove_drawable(other_drawable);
drawable_remove_from_pipes(other_drawable);
display_channel_drawable_unref(display, other_drawable);
return TRUE;
@ -528,7 +542,7 @@ static int current_add_equal(DisplayChannel *display, DrawItem *item, TreeItem *
case QXL_EFFECT_OPAQUE_BRUSH:
if (is_same_geometry(drawable, other_drawable)) {
current_add_drawable(display, drawable, &other->siblings_link);
red_pipes_remove_drawable(other_drawable);
drawable_remove_from_pipes(other_drawable);
current_remove_drawable(display, other_drawable);
pipes_add_drawable(display, drawable);
return TRUE;

View File

@ -445,6 +445,4 @@ static inline void draw_depend_on_me(DisplayChannel *display, uint32_t surface_i
}
}
void red_pipes_remove_drawable(Drawable *drawable);
#endif /* DISPLAY_CHANNEL_H_ */

View File

@ -188,20 +188,6 @@ static PipeItem *dcc_get_tail(DisplayChannelClient *dcc)
return (PipeItem*)ring_get_tail(&RED_CHANNEL_CLIENT(dcc)->pipe);
}
void red_pipes_remove_drawable(Drawable *drawable)
{
DrawablePipeItem *dpi;
RingItem *item, *next;
RING_FOREACH_SAFE(item, next, &drawable->pipes) {
dpi = SPICE_CONTAINEROF(item, DrawablePipeItem, base);
if (pipe_item_is_linked(&dpi->dpi_pipe_item)) {
red_channel_client_pipe_remove_and_release(RED_CHANNEL_CLIENT(dpi->dcc),
&dpi->dpi_pipe_item);
}
}
}
static uint8_t *common_alloc_recv_buf(RedChannelClient *rcc, uint16_t type, uint32_t size)
{
CommonChannel *common = SPICE_CONTAINEROF(rcc->channel, CommonChannel, base);