diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2009-07-04 18:31:49 +0100 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2009-07-04 18:31:49 +0100 |
commit | 2395bba1e66a2623cb288e13effc206f86e5e62e (patch) | |
tree | 96572153708638e6dbcaf4cc9006ae00aeeb1873 /test | |
parent | 9942a89870f7754e28ff334010c4432553cf7d91 (diff) |
[any2ppm] Choose a more appropriate format for the replay content
Actually select a format that matches the request content when replaying
the script to an image.
Diffstat (limited to 'test')
-rw-r--r-- | test/any2ppm.c | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/test/any2ppm.c b/test/any2ppm.c index 31dd0eb4..f35891fb 100644 --- a/test/any2ppm.c +++ b/test/any2ppm.c @@ -240,7 +240,20 @@ _create_image (void *closure, //csi_object_t *dictionary) { cairo_surface_t **out = closure; - *out = cairo_image_surface_create (CAIRO_FORMAT_ARGB32, width, height); + cairo_format_t format; + switch (content) { + case CAIRO_CONTENT_ALPHA: + format = CAIRO_FORMAT_A8; + break; + case CAIRO_CONTENT_COLOR: + format = CAIRO_FORMAT_RGB24; + break; + default: + case CAIRO_CONTENT_COLOR_ALPHA: + format = CAIRO_FORMAT_ARGB32; + break; + } + *out = cairo_image_surface_create (format, width, height); return cairo_surface_reference (*out); } |