git.asbjorn.biz
/
swftools.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
added items.
[swftools.git]
/
src
/
png2swf.c
diff --git
a/src/png2swf.c
b/src/png2swf.c
index
e01e0b9
..
b1827ed
100644
(file)
--- a/
src/png2swf.c
+++ b/
src/png2swf.c
@@
-85,10
+85,10
@@
int MovieFinish(SWF * swf, TAG * t, char *sname)
if FAILED(swf_WriteCGI(swf)) fprintf(stderr,"WriteCGI() failed.\n");
} else {
if(global.version >= 6) {
if FAILED(swf_WriteCGI(swf)) fprintf(stderr,"WriteCGI() failed.\n");
} else {
if(global.version >= 6) {
- if (swf_WriteSWC(handle, swf)<0)
+ if (swf_WriteSWC(f, swf)<0)
fprintf(stderr, "Unable to write output file: %s\n", sname);
} else {
fprintf(stderr, "Unable to write output file: %s\n", sname);
} else {
- if (swf_WriteSWF(handle, swf)<0)
+ if (swf_WriteSWF(f, swf)<0)
fprintf(stderr, "Unable to write output file: %s\n", sname);
}
if (f != so)
fprintf(stderr, "Unable to write output file: %s\n", sname);
}
if (f != so)
@@
-315,11
+315,11
@@
void applyfilter4(int mode, U8*src, U8*old, U8*dest, int width)
unsigned char lastr=0;
unsigned char lastg=0;
unsigned char lastb=0;
unsigned char lastr=0;
unsigned char lastg=0;
unsigned char lastb=0;
- unsigned char lasta=0;
+ unsigned char lasta=0; //TODO: 255?
unsigned char upperlastr=0;
unsigned char upperlastg=0;
unsigned char upperlastb=0;
unsigned char upperlastr=0;
unsigned char upperlastg=0;
unsigned char upperlastb=0;
- unsigned char upperlasta=0;
+ unsigned char upperlasta=0; //TODO: 255?
if(mode==0) {
for(x=0;x<width;x++) {
if(mode==0) {
for(x=0;x<width;x++) {
@@
-570,7
+570,7
@@
TAG *MovieAddFrame(SWF * swf, TAG * t, char *sname, int id)
if(!y) {
old = firstline;
if(!y) {
old = firstline;
- memset(old, 0, header.width*4);
+ memset(old, 0, header.width*4); //TODO: fill alpha with 255?
} else {
old = &data2[(y-1)*header.width*4];
}
} else {
old = &data2[(y-1)*header.width*4];
}
@@
-635,12
+635,13
@@
TAG *MovieAddFrame(SWF * swf, TAG * t, char *sname, int id)
}
}
} else {
}
}
} else {
- palettelen = 256;
+ int mult = (0x1ff>>header.bpp);
+ palettelen = 1<<header.bpp;
rgba = (RGBA*)malloc(palettelen*sizeof(RGBA));
rgba = (RGBA*)malloc(palettelen*sizeof(RGBA));
- for(i=0;i<256;i++) {
- rgba[i].r = i;
- rgba[i].g = i;
- rgba[i].b = i;
+ for(i=0;i<palettelen;i++) {
+ rgba[i].r = i*mult;
+ rgba[i].g = i*mult;
+ rgba[i].b = i*mult;
}
}
}
}
@@
-791,8
+792,8
@@
int args_callback_option(char *arg, char *val)
break;
case 'z':
break;
case 'z':
- global.version = 1;
- res = 1;
+ global.version = 6;
+ res = 0;
break;
case 'C':
break;
case 'C':
@@
-899,9
+900,11
@@
int main(int argc, char **argv)
global.version = 4;
processargs(argc, argv);
global.version = 4;
processargs(argc, argv);
-
- if(global.nfiles<=0)
+
+ if(global.nfiles<=0) {
+ fprintf(stderr, "No png files found in arguments\n");
return 1;
return 1;
+ }
if (VERBOSE(2))
fprintf(stderr, "Processing %i file(s)...\n", global.nfiles);
if (VERBOSE(2))
fprintf(stderr, "Processing %i file(s)...\n", global.nfiles);