[cairo-commit] src/cairo-analysis-surface.c

Adrian Johnson ajohnson at kemper.freedesktop.org
Fri Feb 22 03:09:53 PST 2008


 src/cairo-analysis-surface.c |   20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

New commits:
commit eae259168fc4318f2a67f3107f953648e7ab925e
Author: Adrian Johnson <ajohnson at redneon.com>
Date:   Fri Feb 22 21:07:31 2008 +1030

    Using correct surface size and clip when analyzing meta surface patterns
    
    The surface size and clip needs to be saved before and restored after
    replaying meta surface patterns back to the analysis surface. The clip
    is reset and the correct surface size is set before replaying the meta
    surface.

diff --git a/src/cairo-analysis-surface.c b/src/cairo-analysis-surface.c
index edface2..0a50cd3 100644
--- a/src/cairo-analysis-surface.c
+++ b/src/cairo-analysis-surface.c
@@ -71,11 +71,28 @@ _cairo_analysis_surface_analyze_meta_surface_pattern (cairo_analysis_surface_t *
     cairo_status_t status;
     cairo_bool_t old_has_ctm;
     cairo_matrix_t old_ctm, p2d;
+    cairo_rectangle_int_t old_clip;
+    cairo_rectangle_int_t meta_extents;
+    int old_width;
+    int old_height;
 
     assert (pattern->type == CAIRO_PATTERN_TYPE_SURFACE);
     surface_pattern = (cairo_surface_pattern_t *) pattern;
     assert (_cairo_surface_is_meta (surface_pattern->surface));
 
+    old_width = surface->width;
+    old_height = surface->height;
+    old_clip = surface->current_clip;
+    status = _cairo_surface_get_extents (surface_pattern->surface, &meta_extents);
+    if (status)
+	return status;
+
+    surface->width = meta_extents.width;
+    surface->height = meta_extents.height;
+    surface->current_clip.x = 0;
+    surface->current_clip.y = 0;
+    surface->current_clip.width = surface->width;
+    surface->current_clip.height = surface->height;
     old_ctm = surface->ctm;
     old_has_ctm = surface->has_ctm;
     p2d = pattern->matrix;
@@ -93,6 +110,9 @@ _cairo_analysis_surface_analyze_meta_surface_pattern (cairo_analysis_surface_t *
 
     surface->ctm = old_ctm;
     surface->has_ctm = old_has_ctm;
+    surface->current_clip = old_clip;
+    surface->width = old_width;
+    surface->height = old_height;
 
     return status;
 }


More information about the cairo-commit mailing list