summaryrefslogtreecommitdiff
path: root/src/cairo.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/cairo.c')
-rw-r--r--src/cairo.c20
1 files changed, 13 insertions, 7 deletions
diff --git a/src/cairo.c b/src/cairo.c
index 4cdf6853..ddc8d4a9 100644
--- a/src/cairo.c
+++ b/src/cairo.c
@@ -82,6 +82,7 @@ static const cairo_t _cairo_nil = {
cairo_status_t
_cairo_error (cairo_status_t status)
{
+ CAIRO_ENSURE_UNIQUE;
assert (_cairo_status_is_error (status));
return status;
@@ -648,10 +649,10 @@ _current_source_matches_solid (cairo_t *cr,
if (current->type != CAIRO_PATTERN_TYPE_SOLID)
return FALSE;
- _cairo_restrict_value (&red, 0.0, 1.0);
- _cairo_restrict_value (&green, 0.0, 1.0);
- _cairo_restrict_value (&blue, 0.0, 1.0);
- _cairo_restrict_value (&alpha, 0.0, 1.0);
+ red = _cairo_restrict_value (red, 0.0, 1.0);
+ green = _cairo_restrict_value (green, 0.0, 1.0);
+ blue = _cairo_restrict_value (blue, 0.0, 1.0);
+ alpha = _cairo_restrict_value (alpha, 0.0, 1.0);
_cairo_color_init_rgba (&color, red, green, blue, alpha);
return _cairo_color_equal (&color,
@@ -855,7 +856,10 @@ cairo_get_source (cairo_t *cr)
* is less than @tolerance. The default value is 0.1. A larger
* value will give better performance, a smaller value, better
* appearance. (Reducing the value from the default value of 0.1
- * is unlikely to improve appearance significantly.)
+ * is unlikely to improve appearance significantly.) The accuracy of paths
+ * within Cairo is limited by the precision of its internal arithmetic, and
+ * the prescribed @tolerance is restricted to the smallest
+ * representable internal value.
**/
void
cairo_set_tolerance (cairo_t *cr, double tolerance)
@@ -865,7 +869,8 @@ cairo_set_tolerance (cairo_t *cr, double tolerance)
if (cr->status)
return;
- _cairo_restrict_value (&tolerance, CAIRO_TOLERANCE_MINIMUM, tolerance);
+ if (tolerance < CAIRO_TOLERANCE_MINIMUM)
+ tolerance = CAIRO_TOLERANCE_MINIMUM;
status = _cairo_gstate_set_tolerance (cr->gstate, tolerance);
if (unlikely (status))
@@ -959,7 +964,8 @@ cairo_set_line_width (cairo_t *cr, double width)
if (cr->status)
return;
- _cairo_restrict_value (&width, 0.0, width);
+ if (width < 0.)
+ width = 0.;
status = _cairo_gstate_set_line_width (cr->gstate, width);
if (unlikely (status))