diff --git a/server/dcc.cpp b/server/dcc.cpp index a0161637..bc4b77fd 100644 --- a/server/dcc.cpp +++ b/server/dcc.cpp @@ -236,18 +236,14 @@ dcc_add_surface_area_image(DisplayChannelClient *dcc, int surface_id, } } -void dcc_push_surface_image(DisplayChannelClient *dcc, int surface_id) +void dcc_push_surface_image(DisplayChannelClient *dcc, RedSurface *surface) { - DisplayChannel *display; SpiceRect area; - RedSurface *surface; if (!dcc) { return; } - display = DCC_TO_DC(dcc); - surface = &display->priv->surfaces[surface_id]; if (!surface->context.canvas) { return; } @@ -257,7 +253,7 @@ void dcc_push_surface_image(DisplayChannelClient *dcc, int surface_id) /* not allowing lossy compression because probably, especially if it is a primary surface, it combines both "picture-like" areas with areas that are more "artificial"*/ - dcc_add_surface_area_image(dcc, surface_id, &area, dcc->get_pipe().end(), FALSE); + dcc_add_surface_area_image(dcc, surface->id, &area, dcc->get_pipe().end(), false); } static void add_drawable_surface_images(DisplayChannelClient *dcc, Drawable *drawable) @@ -272,7 +268,7 @@ static void add_drawable_surface_images(DisplayChannelClient *dcc, Drawable *dra } dcc_create_surface(dcc, surface); display_channel_current_flush(display, surface); - dcc_push_surface_image(dcc, surface_id); + dcc_push_surface_image(dcc, surface); } } @@ -282,7 +278,7 @@ static void add_drawable_surface_images(DisplayChannelClient *dcc, Drawable *dra dcc_create_surface(dcc, drawable->surface); display_channel_current_flush(display, drawable->surface); - dcc_push_surface_image(dcc, drawable->surface->id); + dcc_push_surface_image(dcc, drawable->surface); } RedDrawablePipeItem::RedDrawablePipeItem(DisplayChannelClient *init_dcc, Drawable *init_drawable): @@ -416,7 +412,7 @@ void dcc_start(DisplayChannelClient *dcc) display_channel_current_flush(display, &display->priv->surfaces[0]); dcc->pipe_add_type(RED_PIPE_ITEM_TYPE_INVAL_PALETTE_CACHE); dcc_create_surface(dcc, &display->priv->surfaces[0]); - dcc_push_surface_image(dcc, 0); + dcc_push_surface_image(dcc, &display->priv->surfaces[0]); dcc_push_monitors_config(dcc); dcc->pipe_add_empty_msg(SPICE_MSG_DISPLAY_MARK); dcc_create_all_streams(dcc); diff --git a/server/dcc.h b/server/dcc.h index 4b8abf64..2693d55f 100644 --- a/server/dcc.h +++ b/server/dcc.h @@ -115,8 +115,6 @@ void dcc_video_stream_agent_clip (DisplayCha VideoStreamAgent *agent); void dcc_create_stream (DisplayChannelClient *dcc, VideoStream *stream); -void dcc_push_surface_image (DisplayChannelClient *dcc, - int surface_id); void dcc_palette_cache_reset (DisplayChannelClient *dcc); void dcc_palette_cache_palette (DisplayChannelClient *dcc, SpicePalette *palette, @@ -139,6 +137,7 @@ int dcc_compress_image (DisplayCha compress_send_data_t* o_comp_data); void dcc_create_surface(DisplayChannelClient *dcc, struct RedSurface *surface); +void dcc_push_surface_image(DisplayChannelClient *dcc, struct RedSurface *surface); bool dcc_clear_surface_drawables_from_pipe(DisplayChannelClient *dcc, RedSurface *surface, bool wait_if_used); void dcc_add_surface_area_image(DisplayChannelClient *dcc, int surface_id, diff --git a/server/display-channel.cpp b/server/display-channel.cpp index c7d4d959..aa4bccb2 100644 --- a/server/display-channel.cpp +++ b/server/display-channel.cpp @@ -2050,8 +2050,9 @@ static void send_create_surface(DisplayChannel *display, RedSurface *surface, in FOREACH_DCC(display, dcc) { dcc_create_surface(dcc, surface); - if (image_ready) - dcc_push_surface_image(dcc, surface->id); + if (image_ready) { + dcc_push_surface_image(dcc, surface); + } } }