X-Git-Url: http://git.asbjorn.biz/?p=swftools.git;a=blobdiff_plain;f=lib%2Fpdf%2FGFXOutputDev.cc;h=e96314859ebef1b9fc6870fcc96adf9e6f598152;hp=eda022087d6bab398bab63367e8ee43aef03ce1f;hb=e0a27e1bd83ff2d60745dd6030e0f5ef7ef97b82;hpb=289ddc3e15e4bac347fb1a18732a6d3ec5657ffd diff --git a/lib/pdf/GFXOutputDev.cc b/lib/pdf/GFXOutputDev.cc index eda0220..e963148 100644 --- a/lib/pdf/GFXOutputDev.cc +++ b/lib/pdf/GFXOutputDev.cc @@ -132,7 +132,7 @@ static void dbg(const char*format, ...) if(!verbose) return; va_start(arglist, format); - vsprintf(buf, format, arglist); + vsnprintf(buf, sizeof(buf)-1, format, arglist); va_end(arglist); l = strlen(buf); while(l && buf[l-1]=='\n') { @@ -791,6 +791,31 @@ void dump_outline(gfxline_t*line) } } +void gfxPath_dump(GfxPath*path) +{ + int num = path->getNumSubpaths(); + int t; + int cpos=0; + for(t = 0; t < num; t++) { + GfxSubpath *subpath = path->getSubpath(t); + int subnum = subpath->getNumPoints(); + int s; + for(s=0;sgetX(s); + double y=subpath->getY(s); + if(s==0 && !subpath->getCurve(s)) { + printf("M %f %f\n", x, y); + } else if(s==0 && subpath->getCurve(s)) { + printf("E %f %f\n", x, y); + } else if(subpath->getCurve(s)) { + printf("C %f %f\n", x, y); + } else { + printf("T %f %f\n", x, y); + } + } + } +} + gfxline_t* GFXOutputDev::gfxPath_to_gfxline(GfxState*state, GfxPath*path, int closed, int user_movex, int user_movey) { int num = path->getNumSubpaths(); @@ -1155,8 +1180,8 @@ void GFXOutputDev::strokeGfxline(GfxState *state, gfxline_t*line, int flags) } if(flags&STROKE_FILL) { - gfxpoly_t* poly = gfxpoly_strokeToPoly(line, width, capType, joinType, miterLimit); - gfxline_t*gfxline = gfxpoly_to_gfxline(poly); + gfxpoly_t* poly = gfxpoly_from_stroke(line, width, capType, joinType, miterLimit, DEFAULT_GRID); + gfxline_t*gfxline = gfxline_from_gfxpoly(poly); if(getLogLevel() >= LOGLEVEL_TRACE) { dump_outline(gfxline); } @@ -1170,7 +1195,7 @@ void GFXOutputDev::strokeGfxline(GfxState *state, gfxline_t*line, int flags) device->fill(device, gfxline, &col); } gfxline_free(gfxline); - gfxpoly_free(poly); + gfxpoly_destroy(poly); } else { if(flags&STROKE_CLIP) msg(" Stroke&clip not supported at the same time"); @@ -1223,7 +1248,7 @@ void GFXOutputDev::clip(GfxState *state) msg(" clip"); gfxline_t*line = gfxPath_to_gfxline(state, path, 1, user_movex + clipmovex, user_movey + clipmovey); if(config_optimize_polygons) { - gfxline_t*line2 = gfxline_circularToEvenOdd(line); + gfxline_t*line2 = gfxpoly_circular_to_evenodd(line, DEFAULT_GRID); gfxline_free(line); line = line2; } @@ -2444,7 +2469,7 @@ void GFXOutputDev::fill(GfxState *state) GfxPath * path = state->getPath(); gfxline_t*line= gfxPath_to_gfxline(state, path, 1, user_movex + clipmovex, user_movey + clipmovey); if(config_optimize_polygons) { - gfxline_t*line2 = gfxline_circularToEvenOdd(line); + gfxline_t*line2 = gfxpoly_circular_to_evenodd(line, DEFAULT_GRID); gfxline_free(line); line = line2; } @@ -2598,9 +2623,9 @@ void GFXOutputDev::endTransparencyGroup(GfxState *state) this->device = states[statepos].olddevice; if(!this->device) { - msg(" bad state nesting in transparency group- PDF file broken?"); - /* if these errors occur more often, we should build a seperate - transparency group stack, like xpdf/SplashOutputDev.cc does */ + msg(" Bad state nesting in transparency group"); + msg(" Notice: this is a known problem, which will be fixed in 0.9.1"); + msg(" In the meantime, please convert the file with -s poly2bitmap"); restoreState(state); this->device = states[statepos].olddevice; }