[Spice-devel] [PATCH spice-server 1/2] display: Remove extra parameters from create_canvas_for_surface

Pavel Grunt pgrunt at redhat.com
Tue Nov 24 23:58:25 PST 2015


From: Marc-André Lureau <marcandre.lureau at gmail.com>

Get them from the surface

Acked-by: Pavel Grunt <pgrunt at redhat.com>
---
 server/display-channel.c | 16 +++++-----------
 1 file changed, 5 insertions(+), 11 deletions(-)

diff --git a/server/display-channel.c b/server/display-channel.c
index 051d597..45a63eb 100644
--- a/server/display-channel.c
+++ b/server/display-channel.c
@@ -1483,16 +1483,14 @@ static void send_create_surface(DisplayChannel *display, int surface_id, int ima
 }
 
 static SpiceCanvas*
-create_canvas_for_surface(DisplayChannel *display, RedSurface *surface,
-                          uint32_t renderer, uint32_t width, uint32_t height,
-                          int32_t stride, uint32_t format, void *line_0)
+create_canvas_for_surface(DisplayChannel *display, RedSurface *surface, uint32_t renderer)
 {
     SpiceCanvas *canvas;
 
     switch (renderer) {
     case RED_RENDERER_SW:
-        canvas = canvas_create_for_data(width, height, format,
-                                        line_0, stride,
+        canvas = canvas_create_for_data(surface->context.width, surface->context.height, surface->context.format,
+                                        surface->context.line_0, surface->context.stride,
                                         &display->image_cache.base,
                                         &display->image_surfaces, NULL, NULL, NULL);
         surface->context.top_down = TRUE;
@@ -1535,9 +1533,7 @@ void display_channel_create_surface(DisplayChannel *display, uint32_t surface_id
     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,
-                                                            width, height, stride,
-                                                            surface->context.format, line_0);
+        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");
         }
@@ -1548,9 +1544,7 @@ void display_channel_create_surface(DisplayChannel *display, uint32_t surface_id
     }
 
     for (i = 0; i < display->num_renderers; i++) {
-        surface->context.canvas = create_canvas_for_surface(display, surface, display->renderers[i],
-                                                            width, height, stride,
-                                                            surface->context.format, line_0);
+        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)
-- 
2.5.0



More information about the Spice-devel mailing list