It would be great to have a mechanism to get a type of backend surface for subsurface type. For instance Firefox uses a surface cache and the surface type is checked here.
I remember us arguing about this for a while on IRC before 1.10 was released. IIRC the consensus back then was that we want to have public API to get the backing surface, but I think we couldn't agree on a name, so we didn't do it. Would something like cairo_surface_t *cairo_subsurface_get_backing_surface(cairo_surace_t *subsurface); do what you want?
Yes, the cairo_subsurface_get_backing_surface() would be great.
I think the following commit is relevant here: commit ba855a12e8d686f2137f82d317791f3ec4a68fc0 Author: Chris Wilson <chris@chris-wilson.co.uk> Date: Fri Oct 14 16:01:27 2011 +0100 xlib-xp diff --git a/src/cairo-surface-subsurface.c b/src/cairo-surface-subsurface.c index 48d10fb..b93604f 100644 --- a/src/cairo-surface-subsurface.c +++ b/src/cairo-surface-subsurface.c @@ -577,6 +577,7 @@ cairo_surface_create_for_rectangle (cairo_surface_t *target, } surface->target = cairo_surface_reference (target); + surface->base.type = surface->target->type; return &surface->base; } @@ -609,6 +610,7 @@ _cairo_surface_create_for_rectangle_int (cairo_surface_t *target, surface->extents.x += target->device_transform.x0; surface->extents.y += target->device_transform.y0; surface->target = cairo_surface_reference (target); + surface->base.type = surface->target->type; return &surface->base; }
Looks like I accidentally fixed this as every public surface should have a public type, and was already established convention that Cairo masked the internal proxies such as paginated surfaces and reported the underlying surface type instead. We are missing a couple of getters for retrieving the target surface if you happen to have a good thesaurus handy. However, the original bug is now resolved...
Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.