mirror of
https://gitlab.freedesktop.org/cairo/cairo.git
synced 2026-01-08 13:00:28 +01:00
[image] Clone the format for a similar surface with identical content
Honour the incoming surface format when we are asked to create a similar surface with identical content. The goal of cairo_surface_create_similar() is to create an intermediate with similar characteristics to the original that can be used in place of the original and be quick to copy to the original. Matching the format for the same content, ensures that the blits between the two need only be a memcpy.
This commit is contained in:
parent
ed94d7caad
commit
6a19a82efd
1 changed files with 9 additions and 2 deletions
|
|
@ -760,12 +760,19 @@ _cairo_format_bits_per_pixel (cairo_format_t format)
|
|||
}
|
||||
|
||||
static cairo_surface_t *
|
||||
_cairo_image_surface_create_similar (void *abstract_src,
|
||||
_cairo_image_surface_create_similar (void *abstract_other,
|
||||
cairo_content_t content,
|
||||
int width,
|
||||
int height)
|
||||
{
|
||||
assert (CAIRO_CONTENT_VALID (content));
|
||||
cairo_image_surface_t *other = abstract_other;
|
||||
|
||||
if (content == other->base.content) {
|
||||
return _cairo_image_surface_create_with_pixman_format (NULL,
|
||||
other->pixman_format,
|
||||
width, height,
|
||||
0);
|
||||
}
|
||||
|
||||
return _cairo_image_surface_create_with_content (content,
|
||||
width, height);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue