mirror of
https://gitlab.freedesktop.org/cairo/cairo.git
synced 2026-01-06 05:00:17 +01:00
[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.
This commit is contained in:
parent
9942a89870
commit
2395bba1e6
1 changed files with 14 additions and 1 deletions
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue