[cairo-commit] src/cairoint.h src/cairo-path-stroke.c

Behdad Esfahbod behdad at kemper.freedesktop.org
Mon Jan 21 22:03:09 PST 2008


 src/cairo-path-stroke.c |    8 ++++----
 src/cairoint.h          |    4 ++++
 2 files changed, 8 insertions(+), 4 deletions(-)

New commits:
commit 95f3b425e6fb31b364b08e53e072fac4f5ed0733
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Tue Jan 22 01:03:02 2008 -0500

    [cairo-path-stroke] Use M_SQRT2 for constant value

diff --git a/src/cairo-path-stroke.c b/src/cairo-path-stroke.c
index 9ebfce3..5705e0a 100644
--- a/src/cairo-path-stroke.c
+++ b/src/cairo-path-stroke.c
@@ -1359,10 +1359,10 @@ _cairo_path_fixed_stroke_rectilinear (cairo_path_fixed_t	*path,
     if (stroke_style->line_join	!= CAIRO_LINE_JOIN_MITER)
 	return CAIRO_INT_STATUS_UNSUPPORTED;
     /* If the miter limit turns right angles into bevels, then we
-     * can't usethis optimization. Remember, the ratio is
-     * 1/sin(ɸ/2). So the cutoff is 1/sin(π/4.0) or ⎷2 or
-     * approximately 1.414213562373095, which we round for safety. */
-    if (stroke_style->miter_limit < 1.415)
+     * can't use this optimization. Remember, the ratio is
+     * 1/sin(ɸ/2). So the cutoff is 1/sin(π/4.0) or ⎷2,
+     * which we round for safety. */
+    if (stroke_style->miter_limit < M_SQRT2)
 	return CAIRO_INT_STATUS_UNSUPPORTED;
     if (stroke_style->dash)
 	return CAIRO_INT_STATUS_UNSUPPORTED;
diff --git a/src/cairoint.h b/src/cairoint.h
index 4c72d7c..0dc6871 100644
--- a/src/cairoint.h
+++ b/src/cairoint.h
@@ -94,6 +94,10 @@ _cairo_win32_tmpfile (void);
 #define M_PI 3.14159265358979323846
 #endif
 
+#ifndef M_SQRT2
+#define M_SQRT2 1.41421356237309504880
+#endif
+
 #undef  ARRAY_LENGTH
 #define ARRAY_LENGTH(__array) ((int) (sizeof (__array) / sizeof (__array[0])))
 


More information about the cairo-commit mailing list