mirror of
https://gitlab.freedesktop.org/cairo/cairo.git
synced 2026-05-05 13:28:03 +02:00
paginated: unwrap subsurfaces during context creation
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
This commit is contained in:
parent
6b3d53646e
commit
8f99e926c8
2 changed files with 19 additions and 1 deletions
|
|
@ -50,6 +50,7 @@
|
|||
#include "cairo-analysis-surface-private.h"
|
||||
#include "cairo-error-private.h"
|
||||
#include "cairo-image-surface-private.h"
|
||||
#include "cairo-surface-subsurface-private.h"
|
||||
|
||||
static const cairo_surface_backend_t cairo_paginated_surface_backend;
|
||||
|
||||
|
|
@ -652,7 +653,12 @@ static cairo_t *
|
|||
_cairo_paginated_context_create (void *target)
|
||||
{
|
||||
cairo_paginated_surface_t *surface = target;
|
||||
return surface->recording_surface->backend->create_context (surface);
|
||||
|
||||
if (_cairo_surface_is_subsurface (&surface->base))
|
||||
surface = (cairo_paginated_surface_t *)
|
||||
_cairo_surface_subsurface_get_target (&surface->base);
|
||||
|
||||
return surface->recording_surface->backend->create_context (target);
|
||||
}
|
||||
|
||||
static const cairo_surface_backend_t cairo_paginated_surface_backend = {
|
||||
|
|
|
|||
|
|
@ -46,4 +46,16 @@ struct _cairo_surface_subsurface {
|
|||
cairo_surface_t *target;
|
||||
};
|
||||
|
||||
static inline cairo_surface_t *
|
||||
_cairo_surface_subsurface_get_target (cairo_surface_t *surface)
|
||||
{
|
||||
return ((cairo_surface_subsurface_t *) surface)->target;
|
||||
}
|
||||
|
||||
static inline cairo_bool_t
|
||||
_cairo_surface_is_subsurface (cairo_surface_t *surface)
|
||||
{
|
||||
return surface->backend->type == CAIRO_SURFACE_TYPE_SUBSURFACE;
|
||||
}
|
||||
|
||||
#endif /* CAIRO_SURFACE_SUBSURFACE_PRIVATE_H */
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue