git.asbjorn.biz
/
swftools.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
s/GetDataSize/GetTagLen/g
[swftools.git]
/
pdf2swf
/
swfoutput.cc
diff --git
a/pdf2swf/swfoutput.cc
b/pdf2swf/swfoutput.cc
index
74c982d
..
de6ace2
100644
(file)
--- a/
pdf2swf/swfoutput.cc
+++ b/
pdf2swf/swfoutput.cc
@@
-606,7
+606,7
@@
SWFFont::~SWFFont()
logf("<verbose> Font %s has %d used characters",fontid, usednum);
TAG*ftag = swf_InsertTag(swf.firstTag,ST_DEFINEFONT);
swf_SetU16(ftag, this->swfid);
logf("<verbose> Font %s has %d used characters",fontid, usednum);
TAG*ftag = swf_InsertTag(swf.firstTag,ST_DEFINEFONT);
swf_SetU16(ftag, this->swfid);
- int initpos = swf_GetDataSize(ftag);
+ int initpos = swf_GetTagLen(ftag);
swfmatrix m;
m.m11 = m.m22 = 1;
m.m21 = m.m12 = 0;
swfmatrix m;
m.m11 = m.m22 = 1;
m.m21 = m.m12 = 0;
@@
-615,12
+615,12
@@
SWFFont::~SWFFont()
for(t=0;t<swfcharpos;t++)
{
for(t=0;t<swfcharpos;t++)
{
- ptr[t] = swf_GetDataSize(ftag);
+ ptr[t] = swf_GetTagLen(ftag);
swf_SetU16(ftag, 0x1234);
}
for(t=0;t<swfcharpos;t++)
{
swf_SetU16(ftag, 0x1234);
}
for(t=0;t<swfcharpos;t++)
{
- *(U16*)&ftag->data[ptr[t]] = swf_GetDataSize(ftag)-initpos;
+ *(U16*)&ftag->data[ptr[t]] = swf_GetTagLen(ftag)-initpos;
swflastx=0;
swflasty=0;
swf_SetU8(ftag,0x10); //0 fill bits, 0 linestyle bits
swflastx=0;
swflasty=0;
swf_SetU8(ftag,0x10); //0 fill bits, 0 linestyle bits
@@
-1295,15
+1295,21
@@
int swfoutput_drawimagejpeg(struct swfoutput*obj, char*filename, int sizex,int s
double x3,double y3,
double x4,double y4)
{
double x3,double y3,
double x4,double y4)
{
+ TAG*oldtag;
if(shapeid>=0)
endshape();
if(textid>=0)
endtext();
int bitid = ++currentswfid;
if(shapeid>=0)
endshape();
if(textid>=0)
endtext();
int bitid = ++currentswfid;
+ oldtag = tag;
tag = swf_InsertTag(tag,ST_DEFINEBITSJPEG2);
swf_SetU16(tag, bitid);
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;
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)
{
double x3,double y3,
double x4,double y4)
{
+ TAG*oldtag;
if(shapeid>=0)
endshape();
if(textid>=0)
endtext();
int bitid = ++currentswfid;
if(shapeid>=0)
endshape();
if(textid>=0)
endtext();
int bitid = ++currentswfid;
+ oldtag = tag;
tag = swf_InsertTag(tag,ST_DEFINEBITSLOSSLESS);
swf_SetU16(tag, bitid);
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;
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)
{
double x3,double y3,
double x4,double y4)
{
+ TAG*oldtag;
if(shapeid>=0)
endshape();
if(textid>=0)
endtext();
int bitid = ++currentswfid;
if(shapeid>=0)
endshape();
if(textid>=0)
endtext();
int bitid = ++currentswfid;
+ oldtag = tag;
tag = swf_InsertTag(tag,ST_DEFINEBITSLOSSLESS2);
swf_SetU16(tag, bitid);
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;
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)
{
double x3,double y3,
double x4,double y4)
{
+ if(id<0) return;
if(shapeid>=0)
endshape();
if(textid>=0)
if(shapeid>=0)
endshape();
if(textid>=0)