summaryrefslogtreecommitdiffstats
path: root/common/canvas_utils.c
diff options
context:
space:
mode:
authorAlexander Larsson <alexl@redhat.com>2010-04-19 16:31:45 +0200
committerAlexander Larsson <alexl@redhat.com>2010-04-23 16:41:42 +0200
commit4f5a09a73d4659e6aaf6537bf9c582df7fe39f00 (patch)
tree611f839c79fffc4583ebd27199d2f7695718777b /common/canvas_utils.c
parent774e5bd36f4fc156dd744a455ff7ddda27441568 (diff)
downloadspice-4f5a09a73d4659e6aaf6537bf9c582df7fe39f00.tar.gz
spice-4f5a09a73d4659e6aaf6537bf9c582df7fe39f00.tar.xz
spice-4f5a09a73d4659e6aaf6537bf9c582df7fe39f00.zip
Make each surface its own depth/format
Surface creation now specifies the exact format, not only the bit depth of each surface which is used for rendering. Additionally we now actually store the surfaces in that format, instead of converting everything to 32bpp when drawing or e.g. handling palettes.
Diffstat (limited to 'common/canvas_utils.c')
-rw-r--r--common/canvas_utils.c15
1 files changed, 4 insertions, 11 deletions
diff --git a/common/canvas_utils.c b/common/canvas_utils.c
index 4f2456d6..1f6eca67 100644
--- a/common/canvas_utils.c
+++ b/common/canvas_utils.c
@@ -283,11 +283,11 @@ pixman_image_t *surface_create_stride(pixman_format_code_t format, int width, in
return __surface_create_stride(format, width, height, stride);
}
-pixman_image_t *alloc_lz_image_surface(LzDecodeUsrData *canvas_data, LzImageType type, int width,
+pixman_image_t *alloc_lz_image_surface(LzDecodeUsrData *canvas_data,
+ pixman_format_code_t pixman_format, int width,
int height, int gross_pixels, int top_down)
{
int stride;
- int alpha;
pixman_image_t *surface = NULL;
stride = (gross_pixels / height) * 4;
@@ -296,18 +296,11 @@ pixman_image_t *alloc_lz_image_surface(LzDecodeUsrData *canvas_data, LzImageType
stride = -stride;
}
- if (type == LZ_IMAGE_TYPE_RGB32) {
- alpha = 0;
- } else if (type == LZ_IMAGE_TYPE_RGBA) {
- alpha = 1;
- } else {
- CANVAS_ERROR("unexpected image type");
- }
- surface = surface_create_stride(
+ surface = surface_create_stride(
#ifdef WIN32
canvas_data->dc,
#endif
- alpha ? PIXMAN_a8r8g8b8 : PIXMAN_x8r8g8b8, width, height, stride);
+ pixman_format, width, height, stride);
canvas_data->out_surface = surface;
return surface;
}