summaryrefslogtreecommitdiff
path: root/src/cairo-fixed-private.h
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2012-04-19 15:48:01 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2012-04-19 15:48:01 +0100
commit5e39a8098b88b2e8d25eb46c6bbe8656c9e0260c (patch)
tree2157485c0e1a46b33c64fbf120c8744e1d30d7a5 /src/cairo-fixed-private.h
parent57cfdfd9796531a576060e9304715920e0fdb8fe (diff)
downloadcairo-5e39a8098b88b2e8d25eb46c6bbe8656c9e0260c.tar.gz
dash: Use a epsilon compare for stepping the dash
Due to rounding errors that may creep in comparing against 0.0 is dangerous and may result in an infinite loop whilst generating dashes that consumes all memory. Reported-and-tested-by: Uli Schlachter <psychon@znc.in> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'src/cairo-fixed-private.h')
-rw-r--r--src/cairo-fixed-private.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/cairo-fixed-private.h b/src/cairo-fixed-private.h
index 9a16a037b..b6cc6be7d 100644
--- a/src/cairo-fixed-private.h
+++ b/src/cairo-fixed-private.h
@@ -52,6 +52,8 @@
#define CAIRO_FIXED_ONE_DOUBLE ((double)(1 << CAIRO_FIXED_FRAC_BITS))
#define CAIRO_FIXED_EPSILON ((cairo_fixed_t)(1))
+#define CAIRO_FIXED_ERROR_DOUBLE (1. / (2 * CAIRO_FIXED_ONE_DOUBLE))
+
#define CAIRO_FIXED_FRAC_MASK ((cairo_fixed_t)(((cairo_fixed_unsigned_t)(-1)) >> (CAIRO_FIXED_BITS - CAIRO_FIXED_FRAC_BITS)))
#define CAIRO_FIXED_WHOLE_MASK (~CAIRO_FIXED_FRAC_MASK)