X-Git-Url: http://git.asbjorn.biz/?a=blobdiff_plain;f=pdf2swf%2Fswfoutput.cc;h=4644df3bd73858565f316c7ece0c063109d825f5;hb=5ac0a484d6e3398aa3174e1d1f2be9b3e3561bd0;hp=74c982dc1b1fd81bc939137e8d8361c92bbd4da2;hpb=e029c9c4c2ee6b4d944a7c46bd39d35d4aa56213;p=swftools.git diff --git a/pdf2swf/swfoutput.cc b/pdf2swf/swfoutput.cc index 74c982d..4644df3 100644 --- a/pdf2swf/swfoutput.cc +++ b/pdf2swf/swfoutput.cc @@ -1295,15 +1295,21 @@ int swfoutput_drawimagejpeg(struct swfoutput*obj, char*filename, int sizex,int s double x3,double y3, double x4,double y4) { + TAG*oldtag; if(shapeid>=0) endshape(); if(textid>=0) endtext(); int bitid = ++currentswfid; + oldtag = tag; tag = swf_InsertTag(tag,ST_DEFINEBITSJPEG2); swf_SetU16(tag, bitid); - swf_SetJPEGBits(tag, filename, jpegquality); + if(swf_SetJPEGBits(tag, filename, jpegquality)<0) { + swf_DeleteTag(tag); + tag = oldtag; + return -1; + } drawimage(obj, bitid, sizex, sizey, x1,y1,x2,y2,x3,y3,x4,y4); return bitid; @@ -1315,15 +1321,21 @@ int swfoutput_drawimagelossless(struct swfoutput*obj, RGBA*mem, int sizex,int si double x3,double y3, double x4,double y4) { + TAG*oldtag; if(shapeid>=0) endshape(); if(textid>=0) endtext(); int bitid = ++currentswfid; + oldtag = tag; tag = swf_InsertTag(tag,ST_DEFINEBITSLOSSLESS); swf_SetU16(tag, bitid); - swf_SetLosslessBits(tag,sizex,sizey,mem, BMF_32BIT); + if(swf_SetLosslessBits(tag,sizex,sizey,mem, BMF_32BIT)<0) { + swf_DeleteTag(tag); + tag = oldtag; + return -1; + } drawimage(obj, bitid, sizex, sizey, x1,y1,x2,y2,x3,y3,x4,y4); return bitid; @@ -1335,15 +1347,21 @@ int swfoutput_drawimagelossless256(struct swfoutput*obj, U8*mem, RGBA*pal, int s double x3,double y3, double x4,double y4) { + TAG*oldtag; if(shapeid>=0) endshape(); if(textid>=0) endtext(); int bitid = ++currentswfid; + oldtag = tag; tag = swf_InsertTag(tag,ST_DEFINEBITSLOSSLESS2); swf_SetU16(tag, bitid); - swf_SetLosslessBitsIndexed(tag,sizex,sizey,mem, pal, 256); + if(swf_SetLosslessBitsIndexed(tag,sizex,sizey,mem, pal, 256)<0) { + swf_DeleteTag(tag); + tag = oldtag; + return -1; + } drawimage(obj, bitid, sizex, sizey, x1,y1,x2,y2,x3,y3,x4,y4); return bitid; @@ -1355,6 +1373,7 @@ void swfoutput_drawimageagain(struct swfoutput*obj, int id, int sizex,int sizey, double x3,double y3, double x4,double y4) { + if(id<0) return; if(shapeid>=0) endshape(); if(textid>=0)