summaryrefslogtreecommitdiff
path: root/src/cairo-default-context.c
diff options
context:
space:
mode:
authorUli Schlachter <psychon@znc.in>2012-12-17 17:45:25 +0100
committerUli Schlachter <psychon@znc.in>2012-12-17 18:37:09 +0100
commit749ef6be4d11b95d666b0e5fe06df926b828d655 (patch)
tree998bcc8446868961d094350d737112f5497612de /src/cairo-default-context.c
parent433a5829d7c38a9301346fc5a643e623565c1625 (diff)
downloadcairo-749ef6be4d11b95d666b0e5fe06df926b828d655.tar.gz
context: Use recording surfaces for unbounded groups
The old code uses an uninitialized variable for the extents of the group that is created. This patch makes it use an unbounded recording surface instead. This has the implicit assumption that everything that is unbounded smells like a recording surface. Let's see when this assumption breaks. :-) http://lists.cairographics.org/archives/cairo/2012-October/023585.html Signed-off-by: Uli Schlachter <psychon@znc.in>
Diffstat (limited to 'src/cairo-default-context.c')
-rw-r--r--src/cairo-default-context.c23
1 files changed, 14 insertions, 9 deletions
diff --git a/src/cairo-default-context.c b/src/cairo-default-context.c
index 3d828efc7..fee08f088 100644
--- a/src/cairo-default-context.c
+++ b/src/cairo-default-context.c
@@ -149,23 +149,28 @@ _cairo_default_context_push_group (void *abstract_cr, cairo_content_t content)
} else {
cairo_surface_t *parent_surface;
cairo_rectangle_int_t extents;
- cairo_bool_t is_empty;
+ cairo_bool_t bounded, is_empty;
parent_surface = _cairo_gstate_get_target (cr->gstate);
/* Get the extents that we'll use in creating our new group surface */
- is_empty = _cairo_surface_get_extents (parent_surface, &extents);
+ bounded = _cairo_surface_get_extents (parent_surface, &extents);
if (clip)
+ /* XXX: This assignment just fixes a compiler warning? */
is_empty = _cairo_rectangle_intersect (&extents,
_cairo_clip_get_extents (clip));
- /* XXX unbounded surface creation */
-
- group_surface = _cairo_surface_create_similar_solid (parent_surface,
- content,
- extents.width,
- extents.height,
- CAIRO_COLOR_TRANSPARENT);
+ if (!bounded) {
+ /* XXX: Generic solution? */
+ group_surface = cairo_recording_surface_create (content, NULL);
+ extents.x = extents.y = 0;
+ } else {
+ group_surface = _cairo_surface_create_similar_solid (parent_surface,
+ content,
+ extents.width,
+ extents.height,
+ CAIRO_COLOR_TRANSPARENT);
+ }
status = group_surface->status;
if (unlikely (status))
goto bail;