mirror of
https://gitlab.freedesktop.org/cairo/cairo.git
synced 2026-01-26 08:30:31 +01:00
Revert "stroker: Check for scaling overflow in computing half line widths"
This reverts commit 91b25005d6 because it
causes lots of new crashes due to assertion failures.
This commit is contained in:
parent
91b25005d6
commit
9d44136ef8
5 changed files with 5 additions and 36 deletions
|
|
@ -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.
|
||||
|
|
|
|||
|
|
@ -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))
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue