Signed-off-by: Frediano Ziglio <fziglio@xxxxxxxxxx> --- server/dcc.c | 4 ++-- server/display-channel.c | 14 +++++++------- server/display-channel.h | 7 ++++++- 3 files changed, 15 insertions(+), 10 deletions(-) diff --git a/server/dcc.c b/server/dcc.c index af32de7..be95e1b 100644 --- a/server/dcc.c +++ b/server/dcc.c @@ -144,7 +144,7 @@ void dcc_create_surface(DisplayChannelClient *dcc, int surface_id) } display = DCC_TO_DC(dcc); - flags = is_primary_surface(DCC_TO_DC(dcc), surface_id) ? SPICE_SURFACE_FLAGS_PRIMARY : 0; + flags = is_primary_surface_id(DCC_TO_DC(dcc), surface_id) ? SPICE_SURFACE_FLAGS_PRIMARY : 0; /* don't send redundant create surface commands to client */ if (!dcc || display->common.during_target_migrate || @@ -204,7 +204,7 @@ RedImageItem *dcc_add_surface_area_image(DisplayChannelClient *dcc, /* For 32bit non-primary surfaces we need to keep any non-zero high bytes as the surface may be used as source to an alpha_blend */ - if (!is_primary_surface(display, surface_id) && + if (!is_primary_surface(display, surface) && item->image_format == SPICE_BITMAP_FMT_32BIT && rgb32_data_has_alpha(item->width, item->height, item->stride, item->data, &all_set)) { if (all_set) { diff --git a/server/display-channel.c b/server/display-channel.c index 5cdd0cb..dcbd250 100644 --- a/server/display-channel.c +++ b/server/display-channel.c @@ -181,7 +181,7 @@ static void display_channel_surface_unref(DisplayChannel *display, RedSurface *s } // only primary surface streams are supported - if (is_primary_surface(display, surface->id)) { + if (is_primary_surface(display, surface)) { stop_streams(display); } spice_assert(surface->context.canvas); @@ -226,7 +226,7 @@ static void streams_update_visible_region(DisplayChannel *display, Drawable *dra return; } - if (!is_primary_surface(display, drawable->surface->id)) { + if (!is_primary_surface(display, drawable->surface)) { return; } @@ -629,7 +629,7 @@ static int current_add_with_shadow(DisplayChannel *display, Ring *ring, Drawable // for now putting them on root. // only primary surface streams are supported - if (is_primary_surface(display, item->surface->id)) { + if (is_primary_surface(display, item->surface)) { stream_detach_behind(display, &shadow->base.rgn, NULL); } @@ -642,7 +642,7 @@ static int current_add_with_shadow(DisplayChannel *display, Ring *ring, Drawable region_destroy(&exclude_rgn); streams_update_visible_region(display, item); } else { - if (is_primary_surface(display, item->surface->id)) { + if (is_primary_surface(display, item->surface)) { stream_detach_behind(display, &item->tree_item.base.rgn, item); } } @@ -759,7 +759,7 @@ static int current_add(DisplayChannel *display, Ring *ring, Drawable *drawable) * stream_detach_behind */ current_add_drawable(display, drawable, ring); - if (is_primary_surface(display, drawable->surface->id)) { + if (is_primary_surface(display, drawable->surface)) { stream_detach_behind(display, &drawable->tree_item.base.rgn, drawable); } } @@ -777,7 +777,7 @@ static bool drawable_can_stream(DisplayChannel *display, Drawable *drawable) return FALSE; } - if (!is_primary_surface(display, drawable->surface->id)) { + if (!is_primary_surface(display, drawable->surface)) { return FALSE; } @@ -901,7 +901,7 @@ static void handle_self_bitmap(DisplayChannel *display, Drawable *drawable) /* For 32bit non-primary surfaces we need to keep any non-zero high bytes as the surface may be used as source to an alpha_blend */ - if (!is_primary_surface(display, drawable->surface->id) && + if (!is_primary_surface(display, drawable->surface) && image->u.bitmap.format == SPICE_BITMAP_FMT_32BIT && rgb32_data_has_alpha(width, height, dest_stride, dest, &all_set)) { if (all_set) { diff --git a/server/display-channel.h b/server/display-channel.h index a425364..59ec6a4 100644 --- a/server/display-channel.h +++ b/server/display-channel.h @@ -399,7 +399,7 @@ static inline int has_shadow(RedDrawable *drawable) return drawable->type == QXL_COPY_BITS; } -static inline int is_primary_surface(DisplayChannel *display, uint32_t surface_id) +static inline int is_primary_surface_id(DisplayChannel *display, uint32_t surface_id) { if (surface_id == 0) { return TRUE; @@ -407,6 +407,11 @@ static inline int is_primary_surface(DisplayChannel *display, uint32_t surface_i return FALSE; } +static inline int is_primary_surface(DisplayChannel *display, RedSurface *surface) +{ + return surface->id == 0; +} + static inline void region_add_clip_rects(QRegion *rgn, SpiceClipRects *data) { int i; -- 2.7.4 _______________________________________________ Spice-devel mailing list Spice-devel@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/spice-devel