git.asbjorn.biz
/
swftools.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge branch 'master' into gfxpoly
[swftools.git]
/
src
/
png2swf.c
diff --git
a/src/png2swf.c
b/src/png2swf.c
index
ffca258
..
05366fc
100644
(file)
--- a/
src/png2swf.c
+++ b/
src/png2swf.c
@@
-119,7
+119,7
@@
int png_read_chunk(char (*head)[4], int*destlen, U8**destdata, FILE*fi)
return 0;
if(!fread(head, 4, 1, fi))
return 0;
return 0;
if(!fread(head, 4, 1, fi))
return 0;
- len = REVERSESWAP32(len);
+ len = BE_32_TO_NATIVE(len);
if(destlen) *destlen = len;
if(destdata) {
if(len)
if(destlen) *destlen = len;
if(destdata) {
if(len)
@@
-143,7
+143,7
@@
unsigned int png_get_dword(FILE*fi)
{
unsigned int a;
fread(&a,4,1,fi);
{
unsigned int a;
fread(&a,4,1,fi);
- return REVERSESWAP32(a);
+ return BE_32_TO_NATIVE(a);
}
struct png_header
}
struct png_header
@@
-163,7
+163,7
@@
int png_read_header(FILE*fi, struct png_header*header)
U8 head2[8];
U8*data;
fread(head2,8,1,fi);
U8 head2[8];
U8*data;
fread(head2,8,1,fi);
- if(strncmp(head,head2,4))
+ if(strncmp((char*)head,(char*)head2,4))
return 0;
while(png_read_chunk(&id, &len, &data, fi))
return 0;
while(png_read_chunk(&id, &len, &data, fi))
@@
-173,8
+173,8
@@
int png_read_header(FILE*fi, struct png_header*header)
if(!strncasecmp(id, "IHDR", 4)) {
char a,b,c,f,i;
if(len < 8) exit(1);
if(!strncasecmp(id, "IHDR", 4)) {
char a,b,c,f,i;
if(len < 8) exit(1);
- header->width = REVERSESWAP32(*(U32*)&data[0]);
- header->height = REVERSESWAP32(*(U32*)&data[4]);
+ header->width = BE_32_TO_NATIVE(*(U32*)&data[0]);
+ header->height = BE_32_TO_NATIVE(*(U32*)&data[4]);
a = data[8]; // should be 8
b = data[9]; // should be 3(indexed), 2(rgb), 0(grayscale) or 6(truecolor+alpha)
a = data[8]; // should be 8
b = data[9]; // should be 3(indexed), 2(rgb), 0(grayscale) or 6(truecolor+alpha)
@@
-197,7
+197,7
@@
int png_read_header(FILE*fi, struct png_header*header)
exit(1);
}
if(a!=8 && (b==2 || b==6)) {
exit(1);
}
if(a!=8 && (b==2 || b==6)) {
- fprintf(stderr, "Bpp %d in mode %d not supported!\n", a);
+ fprintf(stderr, "Bpp %d in mode %d not supported!\n", b, a);
exit(1);
}
if(c!=0) {
exit(1);
}
if(c!=0) {
@@
-553,7
+553,7
@@
TAG* PNG2Image(TAG*t, U16 id, char*filename, int*width, int*height)
}
if(!zimagedata || uncompress(imagedata, &imagedatalen, zimagedata, zimagedatalen) != Z_OK) {
}
if(!zimagedata || uncompress(imagedata, &imagedatalen, zimagedata, zimagedatalen) != Z_OK) {
- fprintf(stderr, "Couldn't uncompress IDAT chunk (%d bytes) in %s!\n", imagedatalen, filename);
+ fprintf(stderr, "Couldn't uncompress IDAT chunk (%lu bytes) in %s!\n", imagedatalen, filename);
if(zimagedata)
free(zimagedata);
return 0;
if(zimagedata)
free(zimagedata);
return 0;
@@
-751,7
+751,14
@@
TAG *MovieAddFrame(SWF * swf, TAG * t, char *sname, int id)
int width=0, height=0;
int width=0, height=0;
+#ifndef HAVE_JPEGLIB
if(global.mkjpeg) {
if(global.mkjpeg) {
+ global.mkjpeg = 0;
+ msg("<warning> No jpeg support compiled in");
+ }
+#endif
+ if(global.mkjpeg) {
+#ifdef HAVE_JPEGLIB
RGBA*data = 0;
getPNG(sname, &width, &height, (unsigned char**)&data);
if(!data)
RGBA*data = 0;
getPNG(sname, &width, &height, (unsigned char**)&data);
if(!data)
@@
-765,6
+772,7
@@
TAG *MovieAddFrame(SWF * swf, TAG * t, char *sname, int id)
swf_SetU16(t, id);
swf_SetJPEGBits2(t, width,height,data,global.mkjpeg);
}
swf_SetU16(t, id);
swf_SetJPEGBits2(t, width,height,data,global.mkjpeg);
}
+#endif
} else if(1) {
RGBA*data = 0;
getPNG(sname, &width, &height, (unsigned char**)&data);
} else if(1) {
RGBA*data = 0;
getPNG(sname, &width, &height, (unsigned char**)&data);
@@
-784,8
+792,8
@@
TAG *MovieAddFrame(SWF * swf, TAG * t, char *sname, int id)
swf_GetMatrix(NULL, &m);
m.sx = (int)(20 * 0x10000);
m.sy = (int)(20 * 0x10000);
swf_GetMatrix(NULL, &m);
m.sx = (int)(20 * 0x10000);
m.sy = (int)(20 * 0x10000);
- m.tx = -10;
- m.ty = -10;
+ m.tx = 0;
+ m.ty = 0;
fs = swf_ShapeAddBitmapFillStyle(s, &m, id, 1);
swf_SetU16(t, id + 1); // id
fs = swf_ShapeAddBitmapFillStyle(s, &m, id, 1);
swf_SetU16(t, id + 1); // id
@@
-1072,7
+1080,7
@@
int main(int argc, char **argv)
global.framerate = 1.0;
global.verbose = 1;
global.framerate = 1.0;
global.verbose = 1;
- global.version = 6;
+ global.version = 8;
global.scale = 1.0;
processargs(argc, argv);
global.scale = 1.0;
processargs(argc, argv);