[cairo-commit] 2 commits - src/cairo-clip.c src/cairo-recording-surface.c

Chris Wilson ickle at kemper.freedesktop.org
Wed Oct 12 08:23:17 PDT 2011


 src/cairo-clip.c              |    6 +++++-
 src/cairo-recording-surface.c |   18 ++++++++++++++++--
 2 files changed, 21 insertions(+), 3 deletions(-)

New commits:
commit 8f5736b8b15eb2280cde6935c00171cda5c03a29
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Wed Oct 12 16:19:58 2011 +0100

    recording-surface: Free the contents of the command array when clearing
    
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/src/cairo-recording-surface.c b/src/cairo-recording-surface.c
index 7a18b53..8bcf5bc 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;
 	}
     }
commit 9c63168b5f4cccdda5cad939f6d3f0745202069d
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Wed Oct 12 16:19:33 2011 +0100

    clip: Replace the original clip when transforming
    
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/src/cairo-clip.c b/src/cairo-clip.c
index 0fabe39..c89e8be 100644
--- a/src/cairo-clip.c
+++ b/src/cairo-clip.c
@@ -423,7 +423,7 @@ _cairo_clip_translate (cairo_clip_t *clip, int tx, int ty)
     cairo_clip_path_t *clip_path;
 
     if (clip == NULL || _cairo_clip_is_all_clipped (clip))
-	return (cairo_clip_t *)clip;
+	return clip;
 
     if (tx == 0 && ty == 0)
 	return clip;
@@ -532,6 +532,9 @@ _cairo_clip_transform (cairo_clip_t *clip, const cairo_matrix_t *m)
 {
     cairo_clip_t *copy;
 
+    if (clip == NULL || _cairo_clip_is_all_clipped (clip))
+	return clip;
+
     if (_cairo_matrix_is_translation (m))
 	return _cairo_clip_translate (clip, m->x0, m->y0);
 
@@ -556,6 +559,7 @@ _cairo_clip_transform (cairo_clip_t *clip, const cairo_matrix_t *m)
     if (clip->path)
 	copy = _cairo_clip_intersect_clip_path_transformed (copy, clip->path,m);
 
+    _cairo_clip_destroy (clip);
     return copy;
 }
 


More information about the cairo-commit mailing list