summaryrefslogtreecommitdiffstats
path: root/server/red_worker.c
diff options
context:
space:
mode:
Diffstat (limited to 'server/red_worker.c')
-rw-r--r--server/red_worker.c33
1 files changed, 10 insertions, 23 deletions
diff --git a/server/red_worker.c b/server/red_worker.c
index 28927285..af3a8883 100644
--- a/server/red_worker.c
+++ b/server/red_worker.c
@@ -7795,25 +7795,6 @@ static void red_migrate_display(RedWorker *worker)
}
}
-static SpiceCanvas *create_cairo_context(RedWorker *worker, uint32_t width, uint32_t height,
- int32_t stride, uint8_t depth, void *line_0)
-{
- SpiceCanvas *canvas;
- pixman_image_t *surface;
-
- surface = pixman_image_create_bits(PIXMAN_x8r8g8b8, width, height,
- (uint32_t *)line_0,
- stride);
- if (surface == NULL) {
- red_error("create cairo surface failed");
- }
- canvas = canvas_create(surface, depth, &worker->image_cache.base,
- &worker->image_surfaces, NULL,
- &worker->preload_group_virt_mapping);
- pixman_image_unref (surface);
- return canvas;
-}
-
static SpiceCanvas *create_ogl_context_common(RedWorker *worker, OGLCtx *ctx, uint32_t width,
uint32_t height, int32_t stride, uint8_t depth)
{
@@ -7870,22 +7851,28 @@ static SpiceCanvas *create_ogl_pixmap_context(RedWorker *worker, uint32_t width,
static inline void *create_canvas_for_surface(RedWorker *worker, RedSurface *surface,
uint32_t renderer, uint32_t width, uint32_t height,
- int32_t stride, uint8_t depth, void *line_0)
+ int32_t stride, uint32_t format, void *line_0)
{
SpiceCanvas *canvas;
switch (renderer) {
case RED_RENDERER_CAIRO:
- canvas = create_cairo_context(worker, width, height, stride, depth, line_0);
+ canvas = canvas_create_for_data(width, height, format,
+ line_0, stride,
+ &worker->image_cache.base,
+ &worker->image_surfaces, NULL,
+ &worker->preload_group_virt_mapping);
surface->context.top_down = TRUE;
surface->context.canvas_draws_on_surface = TRUE;
return canvas;
case RED_RENDERER_OGL_PBUF:
- canvas = create_ogl_pbuf_context(worker, width, height, stride, depth);
+ canvas = create_ogl_pbuf_context(worker, width, height, stride,
+ SPICE_SURFACE_FMT_DEPTH(format));
surface->context.top_down = FALSE;
return canvas;
case RED_RENDERER_OGL_PIXMAP:
- canvas = create_ogl_pixmap_context(worker, width, height, stride, depth);
+ canvas = create_ogl_pixmap_context(worker, width, height, stride,
+ SPICE_SURFACE_FMT_DEPTH(format));
surface->context.top_down = FALSE;
return canvas;
default: