X-Git-Url: http://git.asbjorn.biz/?a=blobdiff_plain;f=pdf2swf%2Fswfoutput.cc;h=93f2a847049e0d22710e86649e3446aeeff4237f;hb=ef0c7e7e45b0084d411395e75553db77742b2632;hp=8f021823df6e073c1d399f024958e68ea861c449;hpb=e8c86b153f18dff6813377f45df89b2ebdfddf77;p=swftools.git diff --git a/pdf2swf/swfoutput.cc b/pdf2swf/swfoutput.cc index 8f02182..93f2a84 100644 --- a/pdf2swf/swfoutput.cc +++ b/pdf2swf/swfoutput.cc @@ -97,8 +97,8 @@ typedef struct _swfoutput_internal int lastwasfill; int shapeisempty; char fill; - int max_x; - int max_y; + int min_x,max_x; + int min_y,max_y; TAG* cliptags[128]; int clipshapes[128]; U32 clipdepths[128]; @@ -808,12 +808,18 @@ void drawpath2poly(struct swfoutput *obj, SWF_OUTLINE*outline, struct swfmatrix* tmp->last = 0; while(1) { + double previousx = x, previousy = y; if(tmp) { x += (tmp->dest.x/(float)0xffff); y += (tmp->dest.y/(float)0xffff); } if(!tmp || tmp->type == SWF_PATHTYPE_MOVE) { if(valid && last) { + if(fabs(lastx-previousx)<0.001 && fabs(lasty-previousy)<0.001) { + /* endpoints match- the path is closed. + Don't bother to draw endings */ + drawShortPath(obj, lastx, lasty, m, last); + } if(last->type == SWF_PATHTYPE_LINE && t1linelen(obj,last)>line_width*2 && lastwasline && line_cap != LINE_CAP_ROUND) drawShortPathWithStraightEnds(obj, lastx, lasty, m, last, valid, line_cap, line_join, line_width); @@ -828,7 +834,7 @@ void drawpath2poly(struct swfoutput *obj, SWF_OUTLINE*outline, struct swfmatrix* lasty = y; } else { if(!last) - last = tmp; + last = tmp; //remember last stroke start (first segment after moveto) valid++; } @@ -1507,6 +1513,8 @@ void swfoutput_newpage(struct swfoutput*obj, int pageNum, int movex, int movey, swf_PlaceObjectFree(&obj); } + i->min_x = x1; + i->min_y = y1; i->max_x = x2; i->max_y = y2; @@ -1718,8 +1726,9 @@ static void endshape(swfoutput*obj, int clipdepth) fixAreas(obj); if(i->shapeisempty || + /*bbox empty?*/ (i->bboxrect.xmin == i->bboxrect.xmax && - i->bboxrect.ymin == i->bboxrect.ymax)) + i->bboxrect.ymin == i->bboxrect.ymax)) { // delete the shape again, we didn't do anything cancelshape(obj); @@ -2238,8 +2247,8 @@ static void drawimage(struct swfoutput*obj, int bitid, int sizex,int sizey, m.r0 = (int)(65536*20*(p1.x-p2.x)/sizey); m.sy = -(int)(65536*20*(p1.y-p2.y)/sizey); - m.tx = (int)(p1.x*20); - m.ty = (int)(p1.y*20); + m.tx = (int)(p1.x*20) - 10; + m.ty = (int)(p1.y*20) - 10; /* shape */ myshapeid = ++i->currentswfid;