From: kramm Date: Sun, 6 Apr 2008 16:48:51 +0000 (+0000) Subject: added libart changes from 2.3.16 to 2.3.20 X-Git-Tag: buttons-working~268 X-Git-Url: http://git.asbjorn.biz/?p=swftools.git;a=commitdiff_plain;h=3a3813dce687c2a99181ccae01c4a5dde409c976 added libart changes from 2.3.16 to 2.3.20 --- diff --git a/lib/art/art_affine.c b/lib/art/art_affine.c index 166ae9f..9f332a3 100644 --- a/lib/art/art_affine.c +++ b/lib/art/art_affine.c @@ -124,7 +124,7 @@ art_ftoa (char str[80], double x) *p++ = '-'; x = -x; } - if (floor (x + EPSILON / 2) < 1) + if ((int)floor ((x + EPSILON / 2) < 1)) { *p++ = '0'; *p++ = '.'; @@ -147,7 +147,7 @@ art_ftoa (char str[80], double x) x -= floor (x + EPSILON / 2); for (j = i; j < 6; j++) x *= 10; - ix = (int)floor (x + 0.5); + ix = floor (x + 0.5); for (j = 0; j < i; j++) ix *= 10; diff --git a/lib/art/art_vpath_bpath.c b/lib/art/art_vpath_bpath.c index 55a46e6..3f9afe7 100644 --- a/lib/art/art_vpath_bpath.c +++ b/lib/art/art_vpath_bpath.c @@ -164,9 +164,19 @@ art_vpath_render_bez (ArtVpath **p_vpath, int *pn, int *pn_max, /* z3_0_dot is dist z0-z3 squared */ z3_0_dot = x3_0 * x3_0 + y3_0 * y3_0; - /* todo: this test is far from satisfactory. */ if (z3_0_dot < 0.001) - goto nosubdivide; + { + /* if start and end point are almost identical, the flatness tests + * don't work properly, so fall back on testing whether both of + * the other two control points are the same as the start point, + * too. + */ + if (hypot(x1 - x0, y1 - y0) < 0.001 + && hypot(x2 - x0, y2 - y0) < 0.001) + goto nosubdivide; + else + goto subdivide; + } /* we can avoid subdivision if: @@ -203,6 +213,7 @@ art_vpath_render_bez (ArtVpath **p_vpath, int *pn, int *pn_max, if (z2_dot + z2_dot > z3_0_dot) goto subdivide; + nosubdivide: /* don't subdivide */ art_vpath_add_point (p_vpath, pn, pn_max,