X-Git-Url: http://git.asbjorn.biz/?a=blobdiff_plain;f=lib%2Fdevices%2Fpolyops.c;h=de035339a5dbd6cbb6f4abe160ac5f2ee194eb40;hb=7fb4a4ac393f19a0b8a8998a2f1deac88c97eda0;hp=416797c9eec59aba01cd5007519c20d8008dad47;hpb=cfb7bd544f259200542b74152ff919595a9da86c;p=swftools.git diff --git a/lib/devices/polyops.c b/lib/devices/polyops.c index 416797c..de03533 100644 --- a/lib/devices/polyops.c +++ b/lib/devices/polyops.c @@ -105,7 +105,11 @@ void polyops_startclip(struct _gfxdevice*dev, gfxline_t*line) a gfxline into a gfxpoly- for polygons which are too complex or just degenerate, this might fail. So handle all the cases where polygon conversion or intersection - might go awry */ + might go awry + UPDATE: this is not needed anymore. The new gfxpoly + implementation is stable enough so it always returns + a valid result. Still, it's good practice. + */ if(!poly && !oldclip) { i->out->startclip(i->out,line); currentclip = 0; @@ -305,6 +309,9 @@ void polyops_drawchar(struct _gfxdevice*dev, gfxfont_t*font, int glyphnr, gfxcol if(i->clip && i->clip->poly) { gfxbbox_t bbox = gfxline_getbbox(glyph); gfxpoly_t*dummybox = gfxpoly_createbox(bbox.xmin,bbox.ymin,bbox.xmax,bbox.ymax, DEFAULT_GRID); + gfxline_t*dummybox2 = gfxline_from_gfxpoly(dummybox); + bbox = gfxline_getbbox(dummybox2); + gfxline_free(dummybox2); char ok=0; gfxline_t*gfxline = handle_poly(dev, dummybox, &ok); @@ -312,12 +319,15 @@ void polyops_drawchar(struct _gfxdevice*dev, gfxfont_t*font, int glyphnr, gfxcol gfxbbox_t bbox2 = gfxline_getbbox(gfxline); double w = bbox2.xmax - bbox2.xmin; double h = bbox2.ymax - bbox2.ymin; - if(w < 0.001 || h < 0.001) /* character was clipped completely */ { - } else if(fabs((bbox.xmax - bbox.xmin) - w) > 0.05 || - fabs((bbox.ymax - bbox.ymin) - h) > 0.05) { + if(fabs((bbox.xmax - bbox.xmin) - w) > DEFAULT_GRID*2 || + fabs((bbox.ymax - bbox.ymin) - h) > DEFAULT_GRID*2) { /* notable change in character size: character was clipped TODO: how to deal with diagonal cuts? */ + msg(" Character %d was clipped: (%f,%f,%f,%f) -> (%f,%f,%f,%f)", + glyphnr, + bbox.xmin,bbox.ymin,bbox.xmax,bbox.ymax, + bbox2.xmin,bbox2.ymin,bbox2.xmax,bbox2.ymax); polyops_fill(dev, glyph, color); } else { if(i->out) i->out->drawchar(i->out, font, glyphnr, color, matrix);