X-Git-Url: http://git.asbjorn.it/?a=blobdiff_plain;f=pdf2swf%2Fswfoutput.cc;h=0488bf30c39bdfc3a404d05c8be79da14ef1fd8e;hb=48a0d4e20356793d3e244ec1865f01030409e939;hp=854cac4a8a717a465a52c8fbfdbaab6a3a34a1bc;hpb=49b5309d4910ff28785c905db5d16895f4f46ae1;p=swftools.git diff --git a/pdf2swf/swfoutput.cc b/pdf2swf/swfoutput.cc index 854cac4..0488bf3 100644 --- a/pdf2swf/swfoutput.cc +++ b/pdf2swf/swfoutput.cc @@ -61,7 +61,7 @@ struct fontlist_t double config_ppmsubpixels=0; double config_jpegsubpixels=0; -int config_opennewwindow=0; +int config_opennewwindow=1; int config_ignoredraworder=0; int config_drawonlyshapes=0; int config_jpegquality=85; @@ -793,6 +793,8 @@ static void endtext(swfoutput*obj) swf_GetMatrix(0, &m); /* set unit matrix- the real matrix is in the placeobject */ swf_SetMatrix(i->tag,&m); + msg(" Placing text (%d characters) as ID %d", i->chardatapos, i->textid); + putcharacters(obj, i->tag); swf_SetU8(i->tag,0); i->tag = swf_InsertTag(i->tag,ST_PLACEOBJECT2); @@ -916,10 +918,10 @@ void swfoutput_setfont(struct swfoutput*obj, char*fontid, char*filename) if(getScreenLogLevel() >= LOGLEVEL_DEBUG) { // print font information - msg(" Font %s (%s)",swffont->name, filename); + msg(" Font %s (%s)",fontid, filename); msg(" | ID: %d", swffont->id); msg(" | Version: %d", swffont->version); - msg(" | Name: %s", fontid); + msg(" | Name: %s", swffont->name); msg(" | Numchars: %d", swffont->numchars); msg(" | Maxascii: %d", swffont->maxascii); msg(" | Style: %d", swffont->style); @@ -1437,7 +1439,6 @@ int swfoutput_save(struct swfoutput* obj, char*filename) if(filename) close(fi); - msg(" SWF written\n"); return 1; } @@ -1530,7 +1531,7 @@ void swfoutput_linktourl(struct swfoutput*obj, char*url, swfcoord*points) if(i->textid>=0) endtext(obj); - if(config_opennewwindow) + if(!config_opennewwindow) actions = action_GetUrl(0, url, "_parent"); else actions = action_GetUrl(0, url, "_this"); @@ -2096,12 +2097,20 @@ gfxline_t* SVPtogfxline(ArtSVP*svp) } } +/* TODO */ +static int imageInCache(swfoutput*obj, void*data, int width, int height) +{ + return -1; +} +static void addImageToCache(swfoutput*obj, void*data, int width, int height) +{ +} + static int add_image(swfoutput_internal*i, gfximage_t*img, int targetwidth, int targetheight, int* newwidth, int* newheight) { swfoutput*obj = i->obj; RGBA*newpic = 0; RGBA*mem = (RGBA*)img->data; - int bitid = getNewID(obj); int sizex = img->width; int sizey = img->height; @@ -2159,11 +2168,19 @@ static int add_image(swfoutput_internal*i, gfximage_t*img, int targetwidth, int } printf("\n");*/ - i->tag = swf_AddImage(i->tag, bitid, mem, sizex, sizey, config_jpegquality); + int bitid = -1; + int cacheid = imageInCache(obj, mem, sizex, sizey); + + if(cacheid<=0) { + bitid = getNewID(obj); + i->tag = swf_AddImage(i->tag, bitid, mem, sizex, sizey, config_jpegquality); + addImageToCache(obj, mem, sizex, sizey); + } else { + bitid = cacheid; + } if(newpic) free(newpic); - return bitid; } @@ -2407,6 +2424,8 @@ void swf_stroke(gfxdevice_t*dev, gfxline_t*line, gfxcoord_t width, gfxcolor_t*co ArtSVP* svp = gfxstrokeToSVP(line, width, cap_style, joint_style, miterLimit); gfxline_t*gfxline = SVPtogfxline(svp); dev->fill(dev, gfxline, color); + free(gfxline); + art_svp_free(svp); } } void swf_fill(gfxdevice_t*dev, gfxline_t*line, gfxcolor_t*color)