mirror of
https://gitlab.freedesktop.org/cairo/cairo.git
synced 2026-04-03 06:50:41 +02:00
[gl] Add a shortcut from image to gl in clone_similar.
This commit is contained in:
parent
d9d56bb2ed
commit
2ad5c3fc8f
1 changed files with 27 additions and 0 deletions
|
|
@ -475,6 +475,33 @@ _cairo_gl_surface_clone_similar (void *abstract_surface,
|
|||
*clone_offset_y = 0;
|
||||
*clone_out = cairo_surface_reference (src);
|
||||
|
||||
return CAIRO_STATUS_SUCCESS;
|
||||
} else if (_cairo_surface_is_image (src)) {
|
||||
cairo_gl_surface_t *clone;
|
||||
cairo_image_surface_t *image_src = (cairo_image_surface_t *)src;
|
||||
cairo_status_t status;
|
||||
|
||||
clone = (cairo_gl_surface_t *)
|
||||
_cairo_gl_surface_create_similar (&surface->base, src->content,
|
||||
width, height);
|
||||
if (clone == NULL)
|
||||
return CAIRO_INT_STATUS_UNSUPPORTED;
|
||||
if (clone->base.status)
|
||||
return clone->base.status;
|
||||
|
||||
status = _cairo_gl_surface_draw_image (clone, image_src,
|
||||
src_x, src_y,
|
||||
width, height,
|
||||
0, 0);
|
||||
if (status) {
|
||||
cairo_surface_destroy (&clone->base);
|
||||
return status;
|
||||
}
|
||||
|
||||
*clone_out = &clone->base;
|
||||
*clone_offset_x = src_x;
|
||||
*clone_offset_y = src_y;
|
||||
|
||||
return CAIRO_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue