[cairo-commit] 3 commits - src/cairo-meta-surface.c test/fallback-resolution.c

Behdad Esfahbod behdad at kemper.freedesktop.org
Mon Nov 5 10:54:30 PST 2007


 src/cairo-meta-surface.c   |   11 ++++++-----
 test/fallback-resolution.c |    6 +++++-
 2 files changed, 11 insertions(+), 6 deletions(-)

New commits:
commit 570714b2b4e0b7aea58142bcba37a9eb7945cf09
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Mon Aug 14 21:34:40 2006 -0400

    [test/fallback-resolution] set tolerance to a large value to see how it performs
    in different fallback resolutions.

diff --git a/test/fallback-resolution.c b/test/fallback-resolution.c
index 3dc5062..07b4f10 100644
--- a/test/fallback-resolution.c
+++ b/test/fallback-resolution.c
@@ -123,6 +123,7 @@ main (void)
 	}
 
 	cr = cairo_create (surface);
+	cairo_set_tolerance (cr, 3.0);
 
 	for (page = 0; page < num_pages; page++)
 	{
commit 5acbef20213ad354cc835f6d15811e333ee38e74
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Mon Aug 14 21:34:03 2006 -0400

    [test] fallback-resolution: center text

diff --git a/test/fallback-resolution.c b/test/fallback-resolution.c
index 10ed964..3dc5062 100644
--- a/test/fallback-resolution.c
+++ b/test/fallback-resolution.c
@@ -47,6 +47,7 @@ static void
 draw_with_ppi (cairo_t *cr, double width, double height, double ppi)
 {
     char message[80];
+    cairo_text_extents_t extents;
 
     cairo_save (cr);
 
@@ -63,10 +64,12 @@ draw_with_ppi (cairo_t *cr, double width, double height, double ppi)
 	       0, 2.0 * M_PI);
     cairo_fill (cr);
 
-    cairo_move_to (cr, .4 * SIZE/2.0, SIZE/2.0);
     sprintf (message, "Fallback PPI: %g", ppi);
     cairo_set_source_rgb (cr, 1, 1, 1); /* white */
     cairo_set_font_size (cr, .1 * SIZE / 2.0);
+    cairo_text_extents (cr, message, &extents);
+    cairo_move_to (cr, (SIZE-extents.width)/2.0-extents.x_bearing,
+		       (SIZE-extents.height)/2.0-extents.y_bearing);
     cairo_show_text (cr, message);
 
     cairo_restore (cr);
commit 7f21bfb0a8265095d68bb5ff6afae7553683a776
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Mon Aug 14 21:33:13 2006 -0400

    [meta-surface] Adjust tolerance when replaying to surfaces with device scale
    
    such that we get a consistent look with different fallback resolutions.

diff --git a/src/cairo-meta-surface.c b/src/cairo-meta-surface.c
index deda858..0b03cc7 100644
--- a/src/cairo-meta-surface.c
+++ b/src/cairo-meta-surface.c
@@ -667,6 +667,7 @@ _cairo_meta_surface_replay_internal (cairo_surface_t	     *surface,
     cairo_bool_t has_device_transform = _cairo_surface_has_device_transform (target);
     cairo_matrix_t *device_transform = &target->device_transform;
     cairo_path_fixed_t path_copy, *dev_path;
+    double tolerance_multiplier = _cairo_matrix_transformed_circle_major_axis (device_transform, 1.0);
 
     if (surface->status)
 	return surface->status;
@@ -739,7 +740,7 @@ _cairo_meta_surface_replay_internal (cairo_surface_t	     *surface,
 					    &command->stroke.style,
 					    &dev_ctm,
 					    &dev_ctm_inverse,
-					    command->stroke.tolerance,
+					    command->stroke.tolerance * tolerance_multiplier,
 					    command->stroke.antialias);
 	    break;
 	}
@@ -771,7 +772,7 @@ _cairo_meta_surface_replay_internal (cairo_surface_t	     *surface,
 						     command->fill.op,
 						     &command->fill.source.base,
 						     command->fill.fill_rule,
-						     command->fill.tolerance,
+						     command->fill.tolerance * tolerance_multiplier,
 						     command->fill.antialias,
 						     dev_path,
 						     stroke_command->stroke.op,
@@ -779,7 +780,7 @@ _cairo_meta_surface_replay_internal (cairo_surface_t	     *surface,
 						     &stroke_command->stroke.style,
 						     &dev_ctm,
 						     &dev_ctm_inverse,
-						     stroke_command->stroke.tolerance,
+						     stroke_command->stroke.tolerance * tolerance_multiplier,
 						     stroke_command->stroke.antialias);
 		i++;
 	    } else
@@ -788,7 +789,7 @@ _cairo_meta_surface_replay_internal (cairo_surface_t	     *surface,
 					      &command->fill.source.base,
 					      dev_path,
 					      command->fill.fill_rule,
-					      command->fill.tolerance,
+					      command->fill.tolerance * tolerance_multiplier,
 					      command->fill.antialias);
 	    break;
 	}
@@ -831,7 +832,7 @@ _cairo_meta_surface_replay_internal (cairo_surface_t	     *surface,
 	    else
 		status = _cairo_clip_clip (&clip, dev_path,
 					   command->intersect_clip_path.fill_rule,
-					   command->intersect_clip_path.tolerance,
+					   command->intersect_clip_path.tolerance * tolerance_multiplier,
 					   command->intersect_clip_path.antialias,
 					   target);
             assert (status == 0);


More information about the cairo-commit mailing list