summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/cairo-fixed-private.h13
-rw-r--r--src/cairo-path-stroke-boxes.c25
-rw-r--r--src/cairo-path-stroke-polygon.c1
-rw-r--r--src/cairo-path-stroke-traps.c1
-rw-r--r--src/cairo-path-stroke.c1
5 files changed, 5 insertions, 36 deletions
diff --git a/src/cairo-fixed-private.h b/src/cairo-fixed-private.h
index 8ee895b92..9ff8f7503 100644
--- a/src/cairo-fixed-private.h
+++ b/src/cairo-fixed-private.h
@@ -53,9 +53,6 @@
#define CAIRO_FIXED_ONE_DOUBLE ((double)(1 << CAIRO_FIXED_FRAC_BITS))
#define CAIRO_FIXED_EPSILON ((cairo_fixed_t)(1))
-#define CAIRO_FIXED_MAX (~0u >> (CAIRO_FIXED_FRAC_BITS + 1))
-#define CAIRO_FIXED_MIN (-(int)CAIRO_FIXED_MAX)
-
#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)))
@@ -126,16 +123,6 @@ _cairo_fixed_from_double (double d)
#endif
}
-static inline cairo_bool_t
-_cairo_fixed_from_double_safe (cairo_fixed_t *f, double d)
-{
- if (unlikely (d < CAIRO_FIXED_MIN || d > CAIRO_FIXED_MAX))
- return FALSE;
-
- *f = _cairo_fixed_from_double (d);
- return TRUE;
-}
-
#else
# error Please define a magic number for your fixed point type!
# error See cairo-fixed-private.h for details.
diff --git a/src/cairo-path-stroke-boxes.c b/src/cairo-path-stroke-boxes.c
index 9d3ffe9e3..7f25bf76c 100644
--- a/src/cairo-path-stroke-boxes.c
+++ b/src/cairo-path-stroke-boxes.c
@@ -98,8 +98,6 @@ _cairo_rectilinear_stroker_init (cairo_rectilinear_stroker_t *stroker,
cairo_antialias_t antialias,
cairo_boxes_t *boxes)
{
- double half_line_width;
-
/* This special-case rectilinear stroker only supports
* miter-joined lines (not curves) and a translation-only matrix
* (though it could probably be extended to support a matrix with
@@ -129,22 +127,15 @@ _cairo_rectilinear_stroker_init (cairo_rectilinear_stroker_t *stroker,
if (! _cairo_matrix_is_scale (ctm))
return FALSE;
- half_line_width = stroke_style->line_width / 2.0;
-
- if (! _cairo_fixed_from_double_safe (&stroker->half_line_x,
- fabs(ctm->xx) * half_line_width))
- return FALSE;
- assert (stroker->half_line_x > 0);
-
- if (! _cairo_fixed_from_double_safe (&stroker->half_line_y,
- fabs(ctm->yy) * half_line_width))
- return FALSE;
- assert (stroker->half_line_y > 0);
-
stroker->stroke_style = stroke_style;
stroker->ctm = ctm;
stroker->antialias = antialias;
+ stroker->half_line_x =
+ _cairo_fixed_from_double (fabs(ctm->xx) * stroke_style->line_width / 2.0);
+ stroker->half_line_y =
+ _cairo_fixed_from_double (fabs(ctm->yy) * stroke_style->line_width / 2.0);
+
stroker->open_sub_path = FALSE;
stroker->segments = stroker->segments_embedded;
stroker->segments_size = ARRAY_LENGTH (stroker->segments_embedded);
@@ -296,8 +287,6 @@ _cairo_rectilinear_stroker_emit_segments (cairo_rectilinear_stroker_t *stroker)
box.p1.x = b->x;
box.p2.x = a->x;
}
- assert (box.p1.x < box.p2.x);
-
if (a->y < b->y) {
box.p1.y = a->y;
box.p2.y = b->y;
@@ -305,7 +294,6 @@ _cairo_rectilinear_stroker_emit_segments (cairo_rectilinear_stroker_t *stroker)
box.p1.y = b->y;
box.p2.y = a->y;
}
- assert (box.p1.y < box.p2.y);
status = _cairo_boxes_add (stroker->boxes, stroker->antialias, &box);
if (unlikely (status))
@@ -416,8 +404,6 @@ _cairo_rectilinear_stroker_emit_segments_dashed (cairo_rectilinear_stroker_t *st
box.p1.x = b->x;
box.p2.x = a->x;
}
- assert (box.p1.x < box.p2.x);
-
if (a->y < b->y) {
box.p1.y = a->y;
box.p2.y = b->y;
@@ -425,7 +411,6 @@ _cairo_rectilinear_stroker_emit_segments_dashed (cairo_rectilinear_stroker_t *st
box.p1.y = b->y;
box.p2.y = a->y;
}
- assert (box.p1.y < box.p2.y);
status = _cairo_boxes_add (stroker->boxes, stroker->antialias, &box);
if (unlikely (status))
diff --git a/src/cairo-path-stroke-polygon.c b/src/cairo-path-stroke-polygon.c
index a68feb62c..e5082bbec 100644
--- a/src/cairo-path-stroke-polygon.c
+++ b/src/cairo-path-stroke-polygon.c
@@ -1276,7 +1276,6 @@ _cairo_path_fixed_stroke_to_polygon (const cairo_path_fixed_t *path,
for (i = 1; i < polygon->num_limits; i++)
_cairo_box_add_box (&stroker.bounds, &polygon->limits[i]);
- /* XXX check overflow */
_cairo_stroke_style_max_distance_from_path (style, path, ctm, &dx, &dy);
fdx = _cairo_fixed_from_double (dx);
fdy = _cairo_fixed_from_double (dy);
diff --git a/src/cairo-path-stroke-traps.c b/src/cairo-path-stroke-traps.c
index aad9c7f5a..da54e5a35 100644
--- a/src/cairo-path-stroke-traps.c
+++ b/src/cairo-path-stroke-traps.c
@@ -146,7 +146,6 @@ stroker_init (struct stroker *stroker,
_cairo_stroke_style_max_line_distance_from_path (stroker->style, path,
stroker->ctm, &dx, &dy);
- /* XXX check overflow */
fdx = _cairo_fixed_from_double (dx);
fdy = _cairo_fixed_from_double (dy);
diff --git a/src/cairo-path-stroke.c b/src/cairo-path-stroke.c
index b4fab7ad6..4d4ede813 100644
--- a/src/cairo-path-stroke.c
+++ b/src/cairo-path-stroke.c
@@ -110,7 +110,6 @@ _cairo_stroker_limit (cairo_stroker_t *stroker,
_cairo_stroke_style_max_distance_from_path (&stroker->style, path,
stroker->ctm, &dx, &dy);
- /* XXX report overflow! */
fdx = _cairo_fixed_from_double (dx);
fdy = _cairo_fixed_from_double (dy);