[Swfdec] Branch 'as' - 4 commits - libswfdec/swfdec_debugger.c libswfdec/swfdec_movie.c libswfdec/swfdec_movie.h libswfdec/swfdec_sprite_movie.c test/image
Benjamin Otte
company at kemper.freedesktop.org
Thu Jun 28 02:45:27 PDT 2007
libswfdec/swfdec_debugger.c | 4 -
libswfdec/swfdec_movie.c | 8 +-
libswfdec/swfdec_movie.h | 2
libswfdec/swfdec_sprite_movie.c | 2
test/image/Makefile.am | 3
test/image/placeobject-ratio.swf |binary
test/image/placeobject-ratio.swf.png |binary
test/image/placeobject-ratio.xml | 137 +++++++++++++++++++++++++++++++++++
8 files changed, 148 insertions(+), 8 deletions(-)
New commits:
diff-tree c7622a13456a723bef13fd0a1b80a4060758af70 (from 0fcbb5ec49536a791f197016ebdcffbcc5790c20)
Author: Benjamin Otte <otte at gnome.org>
Date: Thu Jun 28 11:45:19 2007 +0200
add check for ratio replacing
diff --git a/test/image/Makefile.am b/test/image/Makefile.am
index d63d933..a0e80ef 100644
--- a/test/image/Makefile.am
+++ b/test/image/Makefile.am
@@ -26,6 +26,9 @@ EXTRA_DIST = \
negative-color-transform.c \
negative-color-transform.swf \
negative-color-transform.swf.png \
+ placeobject-ratio.swf \
+ placeobject-ratio.swf.png \
+ placeobject-ratio.xml \
replace.c \
replace-button-button-5.swf \
replace-button-button-5.swf.png \
diff --git a/test/image/placeobject-ratio.swf b/test/image/placeobject-ratio.swf
new file mode 100644
index 0000000..ed3573d
Binary files /dev/null and b/test/image/placeobject-ratio.swf differ
diff --git a/test/image/placeobject-ratio.swf.png b/test/image/placeobject-ratio.swf.png
new file mode 100644
index 0000000..a39f9e8
Binary files /dev/null and b/test/image/placeobject-ratio.swf.png differ
diff --git a/test/image/placeobject-ratio.xml b/test/image/placeobject-ratio.xml
new file mode 100644
index 0000000..9ef2a5d
--- /dev/null
+++ b/test/image/placeobject-ratio.xml
@@ -0,0 +1,137 @@
+<?xml version="1.0"?>
+<swf version="6" compressed="1">
+ <!-- swfmill xml2swf placeobject-ratio.xml placeobject-ratio.swf -->
+ <!-- Check that replace PlaceObject calls that don't modify the ratio _really_
+ don't modify the ratio. -->
+ <Header framerate="100" frames="1">
+ <size>
+ <Rectangle left="0" right="4000" top="0" bottom="3000"/>
+ </size>
+ <tags>
+ <SetBackgroundColor>
+ <color>
+ <Color red="255" green="255" blue="255"/>
+ </color>
+ </SetBackgroundColor>
+ <UnknownTag id="0x18"/>
+ <DefineShape objectID="1">
+ <bounds>
+ <Rectangle left="0" right="1000" top="0" bottom="1000"/>
+ </bounds>
+ <styles>
+ <StyleList>
+ <fillStyles>
+ <Solid>
+ <color>
+ <Color red="255" green="0" blue="0"/>
+ </color>
+ </Solid>
+ </fillStyles>
+ <lineStyles/>
+ </StyleList>
+ </styles>
+ <shapes>
+ <Shape>
+ <edges>
+ <ShapeSetup x="0" y="0" fillStyle0="1"/>
+ <LineTo x="1000" y="0"/>
+ <LineTo x="0" y="1000"/>
+ <LineTo x="-1000" y="0"/>
+ <LineTo x="0" y="-1000"/>
+ <ShapeSetup/>
+ </edges>
+ </Shape>
+ </shapes>
+ </DefineShape>
+ <DefineSprite objectID="2" frames="1">
+ <tags>
+ <PlaceObject2 replace="0" depth="1" objectID="1">
+ <transform>
+ <Transform transX="0" transY="0"/>
+ </transform>
+ </PlaceObject2>
+ <ShowFrame/>
+ <End/>
+ </tags>
+ </DefineSprite>
+ <DefineShape objectID="3">
+ <bounds>
+ <Rectangle left="0" right="1000" top="0" bottom="1000"/>
+ </bounds>
+ <styles>
+ <StyleList>
+ <fillStyles>
+ <Solid>
+ <color>
+ <Color red="128" green="128" blue="128"/>
+ </color>
+ </Solid>
+ </fillStyles>
+ <lineStyles/>
+ </StyleList>
+ </styles>
+ <shapes>
+ <Shape>
+ <edges>
+ <ShapeSetup x="0" y="0" fillStyle0="1"/>
+ <LineTo x="1000" y="0"/>
+ <LineTo x="0" y="1000"/>
+ <LineTo x="-1000" y="0"/>
+ <LineTo x="0" y="-1000"/>
+ <ShapeSetup/>
+ </edges>
+ </Shape>
+ </shapes>
+ </DefineShape>
+ <DefineSprite objectID="4" frames="1">
+ <tags>
+ <PlaceObject2 replace="0" depth="1" objectID="3">
+ <transform>
+ <Transform transX="0" transY="0"/>
+ </transform>
+ </PlaceObject2>
+ <ShowFrame/>
+ <End/>
+ </tags>
+ </DefineSprite>
+ <DefineSprite objectID="5" frames="26">
+ <tags>
+ <PlaceObject2 replace="0" depth="1" objectID="2">
+ </PlaceObject2>
+ <ShowFrame/>
+ <RemoveObject2 depth="1"/>
+ <PlaceObject2 replace="0" depth="1" objectID="4" morph="5">
+ </PlaceObject2>
+ <ShowFrame/>
+ <PlaceObject2 replace="1" depth="1">
+ </PlaceObject2>
+ <DoAction>
+ <actions>
+ <Dictionary>
+ <strings>
+ <String value="gotoAndStop"/>
+ </strings>
+ </Dictionary>
+ <PushData>
+ <items>
+ <StackInteger value="1"/>
+ <StackInteger value="1"/>
+ <StackDictionaryLookup index="0"/>
+ </items>
+ </PushData>
+ <CallFunction/>
+ <Pop/>
+ <EndAction/>
+ </actions>
+ </DoAction>
+ <ShowFrame/>
+ <End/>
+ </tags>
+ </DefineSprite>
+ <PlaceObject2 replace="0" depth="1" objectID="5" morph="5">
+ </PlaceObject2>
+ <ShowFrame/>
+ <End/>
+ </tags>
+ </Header>
+</swf>
diff-tree 0fcbb5ec49536a791f197016ebdcffbcc5790c20 (from 8c3f00f5d0e59cdeee7b53799567ba5e151d9599)
Author: Benjamin Otte <otte at gnome.org>
Date: Thu Jun 28 11:44:02 2007 +0200
check invalid constant pool indexes instead of crashing
diff --git a/libswfdec/swfdec_debugger.c b/libswfdec/swfdec_debugger.c
index 52ae539..141935b 100644
--- a/libswfdec/swfdec_debugger.c
+++ b/libswfdec/swfdec_debugger.c
@@ -111,11 +111,11 @@ swfdec_debugger_print_push (ScriptParser
goto error;
}
id = type == 8 ? swfdec_bits_get_u8 (&bits) : swfdec_bits_get_u16 (&bits);
- s = swfdec_constant_pool_get (parser->constant_pool, id);
- if (!s) {
+ if (id >= swfdec_constant_pool_size (parser->constant_pool)) {
SWFDEC_ERROR ("constant pool size too small");
goto error;
}
+ s = swfdec_constant_pool_get (parser->constant_pool, id);
g_string_append_c (string, '"');
g_string_append (string, s);
g_string_append_c (string, '"');
diff-tree 8c3f00f5d0e59cdeee7b53799567ba5e151d9599 (from 8667de8f3c4c44801a950f58aae4b3a6bd0a5c17)
Author: Benjamin Otte <otte at gnome.org>
Date: Thu Jun 28 11:43:38 2007 +0200
don't replace ration and clip depth if it didn't change
(I still don't like this _set_static_properties() API)
diff --git a/libswfdec/swfdec_movie.c b/libswfdec/swfdec_movie.c
index e157437..d7403c5 100644
--- a/libswfdec/swfdec_movie.c
+++ b/libswfdec/swfdec_movie.c
@@ -943,10 +943,11 @@ swfdec_movie_new (SwfdecPlayer *player,
*/
void
swfdec_movie_set_static_properties (SwfdecMovie *movie, const cairo_matrix_t *transform,
- const SwfdecColorTransform *ctrans, guint ratio, int clip_depth, SwfdecEventList *events)
+ const SwfdecColorTransform *ctrans, int ratio, int clip_depth, SwfdecEventList *events)
{
g_return_if_fail (SWFDEC_IS_MOVIE (movie));
g_return_if_fail (clip_depth >= -16384 || clip_depth <= 0);
+ g_return_if_fail (ratio >= -1);
if (movie->modified) {
SWFDEC_LOG ("%s has already been modified by scripts, ignoring updates", movie->name);
@@ -963,11 +964,11 @@ swfdec_movie_set_static_properties (Swfd
movie->original_ctrans = *ctrans;
swfdec_movie_invalidate (movie);
}
- if (ratio != movie->original_ratio) {
+ if (ratio >= 0 && (guint) ratio != movie->original_ratio) {
movie->original_ratio = ratio;
swfdec_movie_queue_update (movie, SWFDEC_MOVIE_INVALID_EXTENTS);
}
- if (clip_depth != movie->clip_depth) {
+ if (clip_depth && clip_depth != movie->clip_depth) {
movie->clip_depth = clip_depth;
/* FIXME: is this correct? */
swfdec_movie_invalidate (movie->parent ? movie->parent : movie);
diff --git a/libswfdec/swfdec_movie.h b/libswfdec/swfdec_movie.h
index a347951..3f957a1 100644
--- a/libswfdec/swfdec_movie.h
+++ b/libswfdec/swfdec_movie.h
@@ -175,7 +175,7 @@ void swfdec_movie_set_static_properties
(SwfdecMovie * movie,
const cairo_matrix_t * transform,
const SwfdecColorTransform *ctrans,
- guint ratio,
+ int ratio,
int clip_depth,
SwfdecEventList * events);
void swfdec_movie_invalidate (SwfdecMovie * movie);
diff --git a/libswfdec/swfdec_sprite_movie.c b/libswfdec/swfdec_sprite_movie.c
index 457644e..1712104 100644
--- a/libswfdec/swfdec_sprite_movie.c
+++ b/libswfdec/swfdec_sprite_movie.c
@@ -165,7 +165,7 @@ swfdec_sprite_movie_perform_place (Swfde
ratio = swfdec_bits_get_u16 (bits);
SWFDEC_LOG (" ratio = %d", ratio);
} else {
- ratio = 0;
+ ratio = -1;
}
if (has_name) {
diff-tree 8667de8f3c4c44801a950f58aae4b3a6bd0a5c17 (from 81472f980827d624a88339abd8db0e40c8aaf453)
Author: Benjamin Otte <otte at gnome.org>
Date: Wed Jun 27 19:20:18 2007 +0200
allow creating movies in depths < 16384
createEmptyMovieClip allows this
diff --git a/libswfdec/swfdec_movie.c b/libswfdec/swfdec_movie.c
index 0b0d463..e157437 100644
--- a/libswfdec/swfdec_movie.c
+++ b/libswfdec/swfdec_movie.c
@@ -881,7 +881,6 @@ swfdec_movie_new (SwfdecPlayer *player,
gsize size;
g_return_val_if_fail (SWFDEC_IS_PLAYER (player), NULL);
- g_return_val_if_fail (depth > -16385, NULL); /* the lower depths are for deleted movies */
g_return_val_if_fail (parent == NULL || SWFDEC_IS_MOVIE (parent), NULL);
g_return_val_if_fail (graphic == NULL || SWFDEC_IS_GRAPHIC (graphic), NULL);
More information about the Swfdec
mailing list