X-Git-Url: http://git.asbjorn.biz/?a=blobdiff_plain;f=lib%2Fgfxpoly%2Fconvert.c;h=dae58b6c6932272aaaec9eca73e6a6141c7c1414;hb=6ff87df3f198989c39e4adca06e0e92069a29edd;hp=9d8ecab32508ab806916ff7aab4880d2eb4a13b1;hpb=be6d3cbb485c5f7e9dd6fe22bf54245c79b10b71;p=swftools.git diff --git a/lib/gfxpoly/convert.c b/lib/gfxpoly/convert.c index 9d8ecab..dae58b6 100644 --- a/lib/gfxpoly/convert.c +++ b/lib/gfxpoly/convert.c @@ -12,12 +12,13 @@ static inline int32_t convert_coord(double x, double z) { - /* we clamp to 31 bit instead of 32 bit because we use - a (x1-x2) shortcut when comparing coordinates + /* we clamp to 26 bit because: + a) we use a (x1-x2) shortcut when comparing coordinates + b) we need to be able to multiply two coordinates and store them in a double w/o loss of precision */ x *= z; - if(x < -0x40000000) x = -0x40000000; - if(x > 0x3fffffff) x = 0x3fffffff; + if(x < -0x2000000) x = -0x2000000; + if(x > 0x1ffffff) x = 0x1ffffff; return ceil(x); }