summaryrefslogtreecommitdiffstats
path: root/common/canvas_utils.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_utils.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_utils.c')
-rw-r--r--common/canvas_utils.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/common/canvas_utils.c b/common/canvas_utils.c
index 1e97e872..4f2456d6 100644
--- a/common/canvas_utils.c
+++ b/common/canvas_utils.c
@@ -175,6 +175,11 @@ pixman_image_t * surface_create(pixman_format_code_t format, int width, int heig
bitmap_info.inf.bmiHeader.biBitCount = 32;
nstride = width * 4;
break;
+ case PIXMAN_x1r5g5b5:
+ case PIXMAN_r5g6b5:
+ bitmap_info.inf.bmiHeader.biBitCount = 16;
+ nstride = SPICE_ALIGN(width * 2, 4);
+ break;
case PIXMAN_a8:
bitmap_info.inf.bmiHeader.biBitCount = 8;
nstride = SPICE_ALIGN(width, 4);
@@ -237,6 +242,10 @@ pixman_image_t * surface_create(pixman_format_code_t format, int width, int heig
case PIXMAN_x8r8g8b8:
stride = width * 4;
break;
+ case PIXMAN_x1r5g5b5:
+ case PIXMAN_r5g6b5:
+ stride = SPICE_ALIGN(width * 2, 4);
+ break;
case PIXMAN_a8:
stride = SPICE_ALIGN(width, 4);
break;