diff options
author | Alexander Larsson <alexl@redhat.com> | 2010-04-19 16:19:43 +0200 |
---|---|---|
committer | Alexander Larsson <alexl@redhat.com> | 2010-04-23 16:36:35 +0200 |
commit | 98d91203c5d2f6f7249f38941466857b6a566f5d (patch) | |
tree | cdc2b54152f0be3d668ed49b903a35886fcc1c99 /server/red_worker.c | |
parent | 619c37af17406f77c7cb76f3b72bbfc268383d91 (diff) | |
download | spice-98d91203c5d2f6f7249f38941466857b6a566f5d.tar.gz spice-98d91203c5d2f6f7249f38941466857b6a566f5d.tar.xz spice-98d91203c5d2f6f7249f38941466857b6a566f5d.zip |
Make client canvas and pixmaps handle more formats and simplify
We now support 16bit format pixmaps as well as the old ones. Including
both 555 and 565 modes.
We drop the palette argument for pixmap construction as it was only
used for black/white anyway.
Canvas creation is simplified so that there is no separate set_mode
state. Canvases are already created in the right mode and never change.
Diffstat (limited to 'server/red_worker.c')
-rw-r--r-- | server/red_worker.c | 33 |
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: |