summaryrefslogtreecommitdiffstats
path: root/common/canvas_base.c
diff options
context:
space:
mode:
authorAlexander Larsson <alexl@redhat.com>2010-04-19 16:19:43 +0200
committerAlexander Larsson <alexl@redhat.com>2010-04-23 16:36:35 +0200
commit98d91203c5d2f6f7249f38941466857b6a566f5d (patch)
treecdc2b54152f0be3d668ed49b903a35886fcc1c99 /common/canvas_base.c
parent619c37af17406f77c7cb76f3b72bbfc268383d91 (diff)
downloadspice-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 'common/canvas_base.c')
-rw-r--r--common/canvas_base.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/common/canvas_base.c b/common/canvas_base.c
index 9852da9e..fb101fda 100644
--- a/common/canvas_base.c
+++ b/common/canvas_base.c
@@ -176,6 +176,7 @@ typedef struct CanvasBase {
unsigned long max;
#endif
+ uint32_t format;
int width;
int height;
pixman_region32_t canvas_region;
@@ -3175,7 +3176,7 @@ inline static void canvas_base_init_ops(SpiceCanvasOps *ops)
}
static int canvas_base_init(CanvasBase *canvas, SpiceCanvasOps *ops,
- int width, int height, int depth
+ int width, int height, uint32_t format
#ifdef CAIRO_CANVAS_CACHE
, SpiceImageCache *bits_cache
, SpicePaletteCache *palette_cache
@@ -3218,7 +3219,10 @@ static int canvas_base_init(CanvasBase *canvas, SpiceCanvasOps *ops,
canvas->surfaces = surfaces;
canvas->glz_data.decoder = glz_decoder;
- if (depth == 16) {
+ canvas->format = format;
+
+ /* TODO: This is all wrong now */
+ if (SPICE_SURFACE_FMT_DEPTH(format) == 16) {
canvas->color_shift = 5;
canvas->color_mask = 0x1f;
} else {