git.asbjorn.biz
/
swftools.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
font colour changes
[swftools.git]
/
lib
/
modules
/
swfobject.c
diff --git
a/lib/modules/swfobject.c
b/lib/modules/swfobject.c
index
8d69e96
..
a9507ab
100644
(file)
--- a/
lib/modules/swfobject.c
+++ b/
lib/modules/swfobject.c
@@
-24,13
+24,17
@@
int swf_ObjectPlace(TAG * t,U16 id,U16 depth,MATRIX * m,CXFORM * cx,U8 * name)
{ U8 flags;
if (!t) return -1;
{ U8 flags;
if (!t) return -1;
+ if(cx && cx->r1==0 && cx->g1==0 && cx->b1==0 && cx->a1==0
+ && cx->r0==256 && cx->g0==256 && cx->b0==256 && cx->a0==256)
+ cx = 0;
+
flags = (id?PF_CHAR:0)|(m?PF_MATRIX:0)|(cx?PF_CXFORM:0)|(name?PF_NAME:0)|((m||cx)&&(!id)?PF_MOVE:0);
swf_SetU8(t,flags);
swf_SetU16(t,depth);
if (flags&PF_CHAR) swf_SetU16(t,id);
if (flags&PF_MATRIX) swf_SetMatrix(t,m);
flags = (id?PF_CHAR:0)|(m?PF_MATRIX:0)|(cx?PF_CXFORM:0)|(name?PF_NAME:0)|((m||cx)&&(!id)?PF_MOVE:0);
swf_SetU8(t,flags);
swf_SetU16(t,depth);
if (flags&PF_CHAR) swf_SetU16(t,id);
if (flags&PF_MATRIX) swf_SetMatrix(t,m);
- if (flags&PF_CXFORM) swf_SetCXForm(t,cx,(cx->a0!=256)||(cx->a1));
+ if (flags&PF_CXFORM) swf_SetCXForm(t,cx,1);
if (flags&PF_RATIO) swf_SetU16(t,0);
if (flags&PF_NAME) swf_SetString(t,name);
if (flags&PF_RATIO) swf_SetU16(t,0);
if (flags&PF_NAME) swf_SetString(t,name);
@@
-40,6
+44,10
@@
int swf_ObjectPlace(TAG * t,U16 id,U16 depth,MATRIX * m,CXFORM * cx,U8 * name)
int swf_ObjectPlaceClip(TAG * t,U16 id,U16 depth,MATRIX * m,CXFORM * cx,U8 * name, U16 clipaction)
{ U8 flags;
if (!t) return -1;
int swf_ObjectPlaceClip(TAG * t,U16 id,U16 depth,MATRIX * m,CXFORM * cx,U8 * name, U16 clipaction)
{ U8 flags;
if (!t) return -1;
+
+ if(cx && cx->r1==0 && cx->g1==0 && cx->b1==0 && cx->a1==0
+ && cx->r0==256 && cx->g0==256 && cx->b0==256 && cx->a0==256)
+ cx = 0;
flags = (id?PF_CHAR:0)|(m?PF_MATRIX:0)|(cx?PF_CXFORM:0)|(name?PF_NAME:0)|
((m||cx)&&(!id)?PF_MOVE:0)|(clipaction?PF_CLIPACTION:0);
flags = (id?PF_CHAR:0)|(m?PF_MATRIX:0)|(cx?PF_CXFORM:0)|(name?PF_NAME:0)|
((m||cx)&&(!id)?PF_MOVE:0)|(clipaction?PF_CLIPACTION:0);
@@
-48,10
+56,12
@@
int swf_ObjectPlaceClip(TAG * t,U16 id,U16 depth,MATRIX * m,CXFORM * cx,U8 * nam
swf_SetU16(t,depth);
if (flags&PF_CHAR) swf_SetU16(t,id);
if (flags&PF_MATRIX) swf_SetMatrix(t,m);
swf_SetU16(t,depth);
if (flags&PF_CHAR) swf_SetU16(t,id);
if (flags&PF_MATRIX) swf_SetMatrix(t,m);
- if (flags&PF_CXFORM) swf_SetCXForm(t,cx,(cx->a0!=256)||(cx->a1));
+ if (flags&PF_CXFORM) swf_SetCXForm(t,cx,1);
if (flags&PF_RATIO) swf_SetU16(t,0);
if (flags&PF_RATIO) swf_SetU16(t,0);
- if (flags&PF_NAME) swf_SetString(t,name);
+
+ /* ??? The spec states that name comes first? */
if (flags&PF_CLIPACTION) swf_SetU16(t, clipaction);
if (flags&PF_CLIPACTION) swf_SetU16(t, clipaction);
+ if (flags&PF_NAME) swf_SetString(t,name);
return 0;
}
return 0;
}
@@
-108,11
+118,12
@@
void swf_SetPlaceObject(TAG * t,SWFPLACEOBJECT* obj)
swf_SetU16(t,obj->depth);
if (flags&PF_CHAR) swf_SetU16(t,obj->id);
if (flags&PF_MATRIX) swf_SetMatrix(t,&obj->matrix);
swf_SetU16(t,obj->depth);
if (flags&PF_CHAR) swf_SetU16(t,obj->id);
if (flags&PF_MATRIX) swf_SetMatrix(t,&obj->matrix);
- if (flags&PF_CXFORM) swf_SetCXForm(t,&obj->cxform,(obj->cxform.a0!=256)||
- (obj->cxform.a1));
+ if (flags&PF_CXFORM) swf_SetCXForm(t,&obj->cxform,1);
if (flags&PF_RATIO) swf_SetU16(t,obj->ratio);
if (flags&PF_RATIO) swf_SetU16(t,obj->ratio);
- if (flags&PF_NAME) swf_SetString(t,obj->name);
+
+ /* ??? The spec states that name comes first? */
if (flags&PF_CLIPACTION) swf_SetU16(t,obj->clipdepth);
if (flags&PF_CLIPACTION) swf_SetU16(t,obj->clipdepth);
+ if (flags&PF_NAME) swf_SetString(t,obj->name);
if (flags&PF_ACTIONEVENT) {
// ...
}
if (flags&PF_ACTIONEVENT) {
// ...
}
@@
-121,12
+132,19
@@
void swf_SetPlaceObject(TAG * t,SWFPLACEOBJECT* obj)
void swf_GetPlaceObject(TAG * tag,SWFPLACEOBJECT* obj)
{
void swf_GetPlaceObject(TAG * tag,SWFPLACEOBJECT* obj)
{
- U8 flags = swf_GetU8(tag);
- memset(obj,0,sizeof(SWFPLACEOBJECT));
+ U8 flags;
if(!tag) {
if(!tag) {
- swf_GetMatrix(0,&obj->matrix);
- swf_GetCXForm(0,&obj->cxform,1);
+ memset(obj, 0, sizeof(SWFPLACEOBJECT));
+ swf_GetMatrix(0, &obj->matrix);
+ swf_GetCXForm(0, &obj->cxform, 1);
+ return;
}
}
+
+ flags = swf_GetU8(tag);
+ memset(obj,0,sizeof(SWFPLACEOBJECT));
+
+ swf_GetMatrix(0,&obj->matrix);
+ swf_GetCXForm(0,&obj->cxform,1);
obj->depth = swf_GetU16(tag);
//flags&1: move
obj->depth = swf_GetU16(tag);
//flags&1: move
@@
-134,15
+152,18
@@
void swf_GetPlaceObject(TAG * tag,SWFPLACEOBJECT* obj)
if(flags&4) swf_GetMatrix(tag, &obj->matrix);
if(flags&8) swf_GetCXForm(tag, &obj->cxform,1);
if(flags&16) obj->ratio = swf_GetU16(tag);
if(flags&4) swf_GetMatrix(tag, &obj->matrix);
if(flags&8) swf_GetCXForm(tag, &obj->cxform,1);
if(flags&16) obj->ratio = swf_GetU16(tag);
+ if(flags&64)
+ obj->clipdepth = swf_GetU16(tag); //clip
if(flags&32) {
if(flags&32) {
- int l = strlen(&tag->data[tag->pos]);
- int t = 0;
- U8*data = malloc(l+1);
+ int l,t;
+ U8*data;
+ swf_ResetReadBits(tag);
+ l = strlen(&tag->data[tag->pos]);
+ t = 0;
+ data = malloc(l+1);
obj->name = data;
while((data[t++] = swf_GetU8(tag)));
}
obj->name = data;
while((data[t++] = swf_GetU8(tag)));
}
- if(flags&64)
- obj->clipdepth = swf_GetU16(tag); //clip
/* Actionscript ignored (for now) */
obj->actions = 0;
/* Actionscript ignored (for now) */
obj->actions = 0;