Bug 35113 - provide backend surface type info for sub surfaces
Summary: provide backend surface type info for sub surfaces
Status: RESOLVED FIXED
Alias: None
Product: cairo
Classification: Unclassified
Component: general (show other bugs)
Version: 1.10.3
Hardware: Other Linux (All)
: medium normal
Assignee: Carl Worth
QA Contact: cairo-bugs mailing list
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-03-08 04:51 UTC by Martin Stransky
Modified: 2012-04-19 15:48 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Attachments

Description Martin Stransky 2011-03-08 04:51:03 UTC
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.
Comment 1 Benjamin Otte 2011-03-08 06:37:16 UTC
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?
Comment 2 Martin Stransky 2011-03-09 11:14:55 UTC
Yes, the cairo_subsurface_get_backing_surface() would be great.
Comment 3 Uli Schlachter 2012-01-17 10:14:10 UTC
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;
 }
Comment 4 Chris Wilson 2012-04-19 15:48:42 UTC
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.