diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2011-10-12 16:19:58 +0100 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2011-10-12 16:19:58 +0100 |
commit | 8f5736b8b15eb2280cde6935c00171cda5c03a29 (patch) | |
tree | b8d9e99da39787164da08fc5e6428e7a6c1132d1 /src/cairo-recording-surface.c | |
parent | 9c63168b5f4cccdda5cad939f6d3f0745202069d (diff) |
recording-surface: Free the contents of the command array when clearing
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'src/cairo-recording-surface.c')
-rw-r--r-- | src/cairo-recording-surface.c | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/src/cairo-recording-surface.c b/src/cairo-recording-surface.c index 7a18b53ac..8bcf5bc6e 100644 --- a/src/cairo-recording-surface.c +++ b/src/cairo-recording-surface.c @@ -661,6 +661,21 @@ _cairo_recording_surface_commit (cairo_recording_surface_t *surface, return _cairo_array_append (&surface->commands, &command); } +static void +_cairo_recording_surface_reset (cairo_recording_surface_t *surface) +{ + /* Reset the commands and temporaries */ + _cairo_recording_surface_finish (surface); + + surface->bbtree.left = surface->bbtree.right = NULL; + surface->bbtree.chain = INVALID_CHAIN; + + surface->indices = NULL; + surface->num_indices = 0; + + _cairo_array_init (&surface->commands, sizeof (cairo_command_t *)); +} + static cairo_int_status_t _cairo_recording_surface_paint (void *abstract_surface, cairo_operator_t op, @@ -674,8 +689,7 @@ _cairo_recording_surface_paint (void *abstract_surface, if (op == CAIRO_OPERATOR_CLEAR && clip == NULL) { if (surface->optimize_clears) { - _cairo_recording_surface_destroy_bbtree (surface); - surface->commands.num_elements = 0; + _cairo_recording_surface_reset (surface); return CAIRO_STATUS_SUCCESS; } } |