Bail on NULL utf8 string.

Don't add two consecutive, identical points when decomposing the spline, (which was leading to an infinte loop in the stroke algorithm when it found a slope of (0,0)).
This commit is contained in:
Carl Worth 2004-05-07 18:52:01 +00:00
parent 9faef192af
commit 1e20a2db0f
7 changed files with 28 additions and 4 deletions

View file

@ -1,3 +1,12 @@
2004-05-07 Carl Worth <cworth@isi.edu>
* src/cairo_ft_font.c (_utf8_to_ucs4): Bail on NULL utf8 string.
* src/cairo_spline.c (_cairo_spline_add_point): Don't add two
consecutive, identical points when decomposing the spline, (which
was leading to an infinte loop in the stroke algorithm when it
found a slope of (0,0)).
2004-05-04 Carl Worth <cworth@isi.edu>
* src/cairo_png_surface.c (cairo_png_surface_create): Move all

4
TODO
View file

@ -60,8 +60,8 @@ functions:
* Re-implement the trapezoid rasterization algorithm according to the
new "specification".
* Stroking degenerate paths should still draw caps. Round caps are
easy; square should probably draw an axis aligned square.
* Stroking closed, degenerate paths should still draw caps. Round
caps are easy; square should probably draw an axis aligned square.
* Verification, profiling, optimization.

View file

@ -241,7 +241,7 @@ _utf8_to_ucs4 (char const *utf8,
size_t n = 0, alloc = 0;
FcChar32 u = 0;
if (ucs4 == NULL || nchars == NULL)
if (utf8 == NULL || ucs4 == NULL || nchars == NULL)
return;
len = strlen (utf8);

View file

@ -118,6 +118,13 @@ static cairo_status_t
_cairo_spline_add_point (cairo_spline_t *spline, cairo_point_t *point)
{
cairo_status_t status;
cairo_point_t *prev;
if (spline->num_points) {
prev = &spline->points[spline->num_points - 1];
if (prev->x == point->x && prev->y == point->y)
return CAIRO_STATUS_SUCCESS;
}
if (spline->num_points >= spline->points_size) {
status = _cairo_spline_grow_by (spline, CAIRO_SPLINE_GROWTH_INC);

View file

@ -378,6 +378,7 @@ cairo_fill_extents (cairo_t *cr,
void
cairo_init_clip (cairo_t *cr);
/* Note: cairo_clip does not consume the current path */
void
cairo_clip (cairo_t *cr);

View file

@ -241,7 +241,7 @@ _utf8_to_ucs4 (char const *utf8,
size_t n = 0, alloc = 0;
FcChar32 u = 0;
if (ucs4 == NULL || nchars == NULL)
if (utf8 == NULL || ucs4 == NULL || nchars == NULL)
return;
len = strlen (utf8);

View file

@ -118,6 +118,13 @@ static cairo_status_t
_cairo_spline_add_point (cairo_spline_t *spline, cairo_point_t *point)
{
cairo_status_t status;
cairo_point_t *prev;
if (spline->num_points) {
prev = &spline->points[spline->num_points - 1];
if (prev->x == point->x && prev->y == point->y)
return CAIRO_STATUS_SUCCESS;
}
if (spline->num_points >= spline->points_size) {
status = _cairo_spline_grow_by (spline, CAIRO_SPLINE_GROWTH_INC);