summaryrefslogtreecommitdiff
path: root/src/cairo-fixed-private.h
diff options
context:
space:
mode:
authorAndrea Canciani <ranma42@gmail.com>2010-06-16 22:54:08 +0200
committerAndrea Canciani <ranma42@gmail.com>2010-06-16 22:59:46 +0200
commit3cd07559328b60e3da85debb805cb4a3fc4abc22 (patch)
treedaaeeeffc77736b26075e0927d4124e3ab29a871 /src/cairo-fixed-private.h
parent8689d75caaa9c6ee42976873d21684fa9f48834f (diff)
downloadcairo-3cd07559328b60e3da85debb805cb4a3fc4abc22.tar.gz
correct rounding computation
cairo_fixed_integer_round[_down] were adding an unsigned mask value before shifting its result, causing the shift to be computed as logical (unsigned) right shift, thus producing incorrect values for negative inputs. Making the mask value signed fixes this issue. Bug report by cu: http://lists.cairographics.org/archives/cairo/2010-June/020115.html
Diffstat (limited to 'src/cairo-fixed-private.h')
-rw-r--r--src/cairo-fixed-private.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/cairo-fixed-private.h b/src/cairo-fixed-private.h
index 66898a20f..8873056cf 100644
--- a/src/cairo-fixed-private.h
+++ b/src/cairo-fixed-private.h
@@ -52,7 +52,7 @@
#define CAIRO_FIXED_ONE_DOUBLE ((double)(1 << CAIRO_FIXED_FRAC_BITS))
#define CAIRO_FIXED_EPSILON ((cairo_fixed_t)(1))
-#define CAIRO_FIXED_FRAC_MASK (((cairo_fixed_unsigned_t)(-1)) >> (CAIRO_FIXED_BITS - CAIRO_FIXED_FRAC_BITS))
+#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)
static inline cairo_fixed_t