[Spice-commits] server/display-channel.c
Frediano Ziglio
fziglio at kemper.freedesktop.org
Thu Nov 26 05:51:26 PST 2015
server/display-channel.c | 32 +++++++++++++-------------------
1 file changed, 13 insertions(+), 19 deletions(-)
New commits:
commit f6e5cbdf32511d70976b2a10a4a2ceb7a0035643
Author: Marc-André Lureau <marcandre.lureau at gmail.com>
Date: Wed Nov 25 08:58:26 2015 +0100
display: Simplify display_channel_create_surface
Acked-by: Fabiano FidĂȘncio <fidencio at redhat.com>
diff --git a/server/display-channel.c b/server/display-channel.c
index 0d8f105..52f5ad0 100644
--- a/server/display-channel.c
+++ b/server/display-channel.c
@@ -1542,7 +1542,6 @@ void display_channel_create_surface(DisplayChannel *display, uint32_t surface_id
void *line_0, int data_is_valid, int send_client)
{
RedSurface *surface = &display->surfaces[surface_id];
- uint32_t i;
spice_warn_if(surface->context.canvas);
@@ -1566,28 +1565,23 @@ void display_channel_create_surface(DisplayChannel *display, uint32_t surface_id
ring_init(&surface->depend_on_me);
region_init(&surface->draw_dirty_region);
surface->refs = 1;
- if (display->renderer != RED_RENDERER_INVALID) {
- surface->context.canvas = create_canvas_for_surface(display, surface, display->renderer);
- if (!surface->context.canvas) {
- spice_critical("drawing canvas creating failed - can`t create same type canvas");
- }
-
- if (send_client)
- send_create_surface(display, surface_id, data_is_valid);
- return;
- }
- for (i = 0; i < display->num_renderers; i++) {
- surface->context.canvas = create_canvas_for_surface(display, surface, display->renderers[i]);
- if (surface->context.canvas) { //no need canvas check
- display->renderer = display->renderers[i];
- if (send_client)
- send_create_surface(display, surface_id, data_is_valid);
- return;
+ if (display->renderer == RED_RENDERER_INVALID) {
+ int i;
+ for (i = 0; i < display->num_renderers; i++) {
+ surface->context.canvas = create_canvas_for_surface(display, surface, display->renderers[i]);
+ if (surface->context.canvas) {
+ display->renderer = display->renderers[i];
+ break;
+ }
}
+ } else {
+ surface->context.canvas = create_canvas_for_surface(display, surface, display->renderer);
}
- spice_critical("unable to create drawing canvas");
+ spice_return_if_fail(surface->context.canvas);
+ if (send_client)
+ send_create_surface(display, surface_id, data_is_valid);
}
static void on_disconnect(RedChannelClient *rcc)
More information about the Spice-commits
mailing list