[cairo] Change of _cairo_meta_surface_get_extents
Emmanuel Pacaud
emmanuel.pacaud at univ-poitiers.fr
Fri May 5 10:02:25 PDT 2006
Hi,
Last push_group related tests added to testsuite trig a nasty behaviour
in SVG backend.
Currently, this backend returns a meta-surface on a call to
create_similar. And push_group uses a call to get_extents when creating
the subsurface it needs.
But meta_surface::get_extents returns CAIRO_MAXSHORT for height and
width.
So, when using push_group in a surface created via create_similar from a
SVG surface, the resulting subsurface has a size of
CAIRO_MAXSHORT*CAIRO_MAXSHORT.
Which is not good, especially when this subsurface is rendered via image
fallback (a CAIRO_MAXSHORT*CAIRO_MAXSHORT image is huge, isn't it ?).
Here's a quick fix for this issue:
diff --git a/src/cairo-meta-surface.c b/src/cairo-meta-surface.c
index 9a8ce7b..5436328 100644
--- a/src/cairo-meta-surface.c
+++ b/src/cairo-meta-surface.c
@@ -547,10 +547,12 @@ static cairo_int_status_t
_cairo_meta_surface_get_extents (void
*abstract_surface,
cairo_rectangle_fixed_t *rectangle)
{
+ cairo_meta_surface_t *meta = abstract_surface;
+
rectangle->x = 0;
rectangle->y = 0;
- rectangle->width = CAIRO_MAXSHORT;
- rectangle->height = CAIRO_MAXSHORT;
+ rectangle->width = meta->width_pixels;
+ rectangle->height = meta->height_pixels;
return CAIRO_STATUS_SUCCESS;
}
If I've understood correctly the purpose of get_extents, it's not the
right fix. But I'm not sure any backend implements get_extents the way
it should.
Ok to push ?
Emmanuel.
More information about the cairo
mailing list