[cairo-commit] 3 commits - src/cairoint.h src/cairo-matrix.c src/cairo-path-stroke.c src/cairo-pen.c test/.gitignore test/leaky-dashed-rectangle-ps-ref.png test/leaky-dashed-rectangle-ref.png test/Makefile.am

Chris Wilson ickle at kemper.freedesktop.org
Fri Aug 8 02:11:44 PDT 2008


 src/cairo-matrix.c                     |   13 ++++++-------
 src/cairo-path-stroke.c                |    7 ++-----
 src/cairo-pen.c                        |    8 +-------
 src/cairoint.h                         |    4 ++--
 test/.gitignore                        |    7 +++++++
 test/Makefile.am                       |    3 ++-
 test/leaky-dashed-rectangle-ps-ref.png |binary
 test/leaky-dashed-rectangle-ref.png    |binary
 8 files changed, 20 insertions(+), 22 deletions(-)

New commits:
commit 322c3ef7f94c67d00c6113d0b8ae92a82b67e8a4
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Fri Aug 8 10:09:55 2008 +0100

    [.gitignore] Update list of tests

diff --git a/test/.gitignore b/test/.gitignore
index 1edaff3..a0c275e 100644
--- a/test/.gitignore
+++ b/test/.gitignore
@@ -25,6 +25,7 @@ clip-operator
 clip-push-group
 clip-twice
 clip-zero
+clipped-group
 close-path
 composite-integer-translate-over
 composite-integer-translate-over-repeat
@@ -49,6 +50,7 @@ degenerate-path
 degenerate-pen
 device-offset
 device-offset-positive
+device-offset-scale
 extend-pad
 extend-pad-similar
 extend-reflect
@@ -93,6 +95,7 @@ infinite-join
 in-fill-empty-trapezoid
 in-fill-trapezoid
 invalid-matrix
+large-clip
 large-font
 large-source
 leaky-dash
@@ -193,6 +196,10 @@ text-antialias-none
 text-antialias-subpixel
 text-cache-crash
 text-glyph-range
+text-lcd-filter-fir3
+text-lcd-filter-fir5
+text-lcd-filter-intra-pixel
+text-lcd-filter-none
 text-pattern
 text-rotate
 text-transform
commit 893b50a98068fa3912c90c8b70c423a3da72a91c
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Fri Aug 8 10:05:53 2008 +0100

    [test] Update reference image for leaky-dashed-rectangle.
    
    Bah, it seems someone fixed the code and the error lay in discrepancies
    with the antialiasing in the reference image.

diff --git a/test/Makefile.am b/test/Makefile.am
index 5af7c08..0148f4e 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -461,7 +461,8 @@ REFERENCE_IMAGES = \
 	leaky-dash-ps-rgb24-ref.png	\
 	leaky-dash-quartz-ref.png	\
 	leaky-dash-ref.png	\
-	leaky-dashed-rectangle-ref.png	\
+	leaky-dashed-rectangle-ref.png		\
+	leaky-dashed-rectangle-ps-ref.png	\
 	leaky-polygon-ref.png	\
 	leaky-polygon-ps-ref.png	\
 	linear-gradient-reflect-ref.png	\
diff --git a/test/leaky-dashed-rectangle-ps-ref.png b/test/leaky-dashed-rectangle-ps-ref.png
new file mode 100644
index 0000000..e432de2
Binary files /dev/null and b/test/leaky-dashed-rectangle-ps-ref.png differ
diff --git a/test/leaky-dashed-rectangle-ref.png b/test/leaky-dashed-rectangle-ref.png
index e432de2..332d2fd 100644
Binary files a/test/leaky-dashed-rectangle-ref.png and b/test/leaky-dashed-rectangle-ref.png differ
commit 49fb0e834ecf31ac61735e2e35a1b486d5290db6
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Fri Aug 8 09:11:10 2008 +0100

    [matrix] Prefer a return parameter for _compute_determinant().
    
    Returning a double tends to be slightly more efficient than passing a
    pointer to fill, and is a lot easier to read.

diff --git a/src/cairo-matrix.c b/src/cairo-matrix.c
index b704cde..7676c50 100644
--- a/src/cairo-matrix.c
+++ b/src/cairo-matrix.c
@@ -488,7 +488,7 @@ cairo_matrix_invert (cairo_matrix_t *matrix)
     /* inv (A) = 1/det (A) * adj (A) */
     double det;
 
-    _cairo_matrix_compute_determinant (matrix, &det);
+    det = _cairo_matrix_compute_determinant (matrix);
 
     if (! ISFINITE (det))
 	return _cairo_error (CAIRO_STATUS_INVALID_MATRIX);
@@ -508,21 +508,20 @@ _cairo_matrix_is_invertible (const cairo_matrix_t *matrix)
 {
     double det;
 
-    _cairo_matrix_compute_determinant (matrix, &det);
+    det = _cairo_matrix_compute_determinant (matrix);
 
     return ISFINITE (det) && det != 0.;
 }
 
-void
-_cairo_matrix_compute_determinant (const cairo_matrix_t *matrix,
-				   double		*det)
+double
+_cairo_matrix_compute_determinant (const cairo_matrix_t *matrix)
 {
     double a, b, c, d;
 
     a = matrix->xx; b = matrix->yx;
     c = matrix->xy; d = matrix->yy;
 
-    *det = a*d - b*c;
+    return a*d - b*c;
 }
 
 /* Compute the amount that each basis vector is scaled by. */
@@ -532,7 +531,7 @@ _cairo_matrix_compute_scale_factors (const cairo_matrix_t *matrix,
 {
     double det;
 
-    _cairo_matrix_compute_determinant (matrix, &det);
+    det = _cairo_matrix_compute_determinant (matrix);
 
     if (! ISFINITE (det))
 	return _cairo_error (CAIRO_STATUS_INVALID_MATRIX);
diff --git a/src/cairo-path-stroke.c b/src/cairo-path-stroke.c
index d72ccf3..3663ba7 100644
--- a/src/cairo-path-stroke.c
+++ b/src/cairo-path-stroke.c
@@ -169,11 +169,8 @@ _cairo_stroker_init (cairo_stroker_t		*stroker,
     stroker->tolerance = tolerance;
     stroker->traps = traps;
 
-    _cairo_matrix_compute_determinant (stroker->ctm, &stroker->ctm_determinant);
-    if (stroker->ctm_determinant >= 0.0)
-	stroker->ctm_det_positive = TRUE;
-    else
-	stroker->ctm_det_positive = FALSE;
+    stroker->ctm_determinant = _cairo_matrix_compute_determinant (stroker->ctm);
+    stroker->ctm_det_positive = stroker->ctm_determinant >= 0.0;
 
     status = _cairo_pen_init (&stroker->pen,
 		              stroke_style->line_width / 2.0,
diff --git a/src/cairo-pen.c b/src/cairo-pen.c
index 4a882d5..425b3b9 100644
--- a/src/cairo-pen.c
+++ b/src/cairo-pen.c
@@ -53,17 +53,11 @@ _cairo_pen_init (cairo_pen_t	*pen,
 {
     int i;
     int reflect;
-    double  det;
 
     pen->radius = radius;
     pen->tolerance = tolerance;
 
-    _cairo_matrix_compute_determinant (ctm, &det);
-    if (det >= 0) {
-	reflect = 0;
-    } else {
-	reflect = 1;
-    }
+    reflect = _cairo_matrix_compute_determinant (ctm) < 0.;
 
     pen->num_vertices = _cairo_pen_vertices_needed (tolerance,
 						    radius,
diff --git a/src/cairoint.h b/src/cairoint.h
index e333555..a6c9e3f 100644
--- a/src/cairoint.h
+++ b/src/cairoint.h
@@ -2136,8 +2136,8 @@ _cairo_matrix_transform_bounding_box_fixed (const cairo_matrix_t *matrix,
 cairo_private cairo_bool_t
 _cairo_matrix_is_invertible (const cairo_matrix_t *matrix);
 
-cairo_private void
-_cairo_matrix_compute_determinant (const cairo_matrix_t *matrix, double *det);
+cairo_private double
+_cairo_matrix_compute_determinant (const cairo_matrix_t *matrix);
 
 cairo_private cairo_status_t
 _cairo_matrix_compute_scale_factors (const cairo_matrix_t *matrix,


More information about the cairo-commit mailing list