[Swfdec] 3 commits - libswfdec/swfdec_movie.c test/trace

Benjamin Otte company at kemper.freedesktop.org
Wed Jan 2 06:16:03 PST 2008


 libswfdec/swfdec_movie.c               |   36 ++++++++++++++++++++++++++++++---
 test/trace/Makefile.am                 |    9 ++++++++
 test/trace/movie-enumerate-5.swf       |binary
 test/trace/movie-enumerate-5.swf.trace |    2 +
 test/trace/movie-enumerate-6.swf       |binary
 test/trace/movie-enumerate-6.swf.trace |    2 +
 test/trace/movie-enumerate-7.swf       |binary
 test/trace/movie-enumerate-7.swf.trace |    2 +
 test/trace/movie-enumerate-8.swf       |binary
 test/trace/movie-enumerate-8.swf.trace |    4 +++
 test/trace/movie-enumerate.as          |   21 +++++++++++++++++++
 11 files changed, 73 insertions(+), 3 deletions(-)

New commits:
commit b3a807b0b04229926daa53cbd56f87ba943a19e0
Author: Benjamin Otte <otte at gnome.org>
Date:   Wed Jan 2 15:15:55 2008 +0100

    add test for enumerating MovieClip objects

diff --git a/test/trace/Makefile.am b/test/trace/Makefile.am
index 00fdf11..7b9ff52 100644
--- a/test/trace/Makefile.am
+++ b/test/trace/Makefile.am
@@ -1535,6 +1535,15 @@ EXTRA_DIST = \
 	mouse-show-hide-6.swf.trace \
 	mouse-show-hide-7.swf \
 	mouse-show-hide-7.swf.trace \
+	movie-enumerate.as \
+	movie-enumerate-5.swf \
+	movie-enumerate-5.swf.trace \
+	movie-enumerate-6.swf \
+	movie-enumerate-6.swf.trace \
+	movie-enumerate-7.swf \
+	movie-enumerate-7.swf.trace \
+	movie-enumerate-8.swf \
+	movie-enumerate-8.swf.trace \
 	movieclip-get-swf-version.as \
 	movieclip-get-swf-version-5.swf \
 	movieclip-get-swf-version-5.swf.trace \
diff --git a/test/trace/movie-enumerate-5.swf b/test/trace/movie-enumerate-5.swf
new file mode 100644
index 0000000..b30bd1e
Binary files /dev/null and b/test/trace/movie-enumerate-5.swf differ
diff --git a/test/trace/movie-enumerate-5.swf.trace b/test/trace/movie-enumerate-5.swf.trace
new file mode 100644
index 0000000..97d71bb
--- /dev/null
+++ b/test/trace/movie-enumerate-5.swf.trace
@@ -0,0 +1,2 @@
+$version,foreach
+
diff --git a/test/trace/movie-enumerate-6.swf b/test/trace/movie-enumerate-6.swf
new file mode 100644
index 0000000..ea42f6c
Binary files /dev/null and b/test/trace/movie-enumerate-6.swf differ
diff --git a/test/trace/movie-enumerate-6.swf.trace b/test/trace/movie-enumerate-6.swf.trace
new file mode 100644
index 0000000..00fe42e
--- /dev/null
+++ b/test/trace/movie-enumerate-6.swf.trace
@@ -0,0 +1,2 @@
+$version,a,foreach
+
diff --git a/test/trace/movie-enumerate-7.swf b/test/trace/movie-enumerate-7.swf
new file mode 100644
index 0000000..ef1e1b6
Binary files /dev/null and b/test/trace/movie-enumerate-7.swf differ
diff --git a/test/trace/movie-enumerate-7.swf.trace b/test/trace/movie-enumerate-7.swf.trace
new file mode 100644
index 0000000..00fe42e
--- /dev/null
+++ b/test/trace/movie-enumerate-7.swf.trace
@@ -0,0 +1,2 @@
+$version,a,foreach
+
diff --git a/test/trace/movie-enumerate-8.swf b/test/trace/movie-enumerate-8.swf
new file mode 100644
index 0000000..80ae55d
Binary files /dev/null and b/test/trace/movie-enumerate-8.swf differ
diff --git a/test/trace/movie-enumerate-8.swf.trace b/test/trace/movie-enumerate-8.swf.trace
new file mode 100644
index 0000000..2e665cb
--- /dev/null
+++ b/test/trace/movie-enumerate-8.swf.trace
@@ -0,0 +1,4 @@
+$version,a,foreach
+
+a
+
diff --git a/test/trace/movie-enumerate.as b/test/trace/movie-enumerate.as
new file mode 100644
index 0000000..45f5462
--- /dev/null
+++ b/test/trace/movie-enumerate.as
@@ -0,0 +1,21 @@
+// makeswf -v 7 -s 200x150 -r 1 -o movie-enumerate.swf movie-enumerate.as
+
+createEmptyMovieClip ("a", 0);
+a.createEmptyMovieClip ("a", 0);
+function foreach (m) {
+  var a = [];
+  for (var i in m)
+    a.push (i);
+  a.sort ();
+  trace (a);
+  ASSetPropFlags (m, null, 16383);
+  a = [];
+  for (var j in a)
+    a.push (j);
+  a.sort ();
+  trace (a);
+};
+foreach (this);
+foreach (a);
+
+loadMovie ("fscommand:quit", "");
commit d880e730c35bdc0623986a3c6729b938fb280921
Author: Benjamin Otte <otte at gnome.org>
Date:   Wed Jan 2 15:11:12 2008 +0100

    fix invalidation rectangle computation for masks
    
    Previously they were not computed at all (oops) and that could cause masked
    movies to disappear...

diff --git a/libswfdec/swfdec_movie.c b/libswfdec/swfdec_movie.c
index 400ca2e..547155b 100644
--- a/libswfdec/swfdec_movie.c
+++ b/libswfdec/swfdec_movie.c
@@ -950,12 +950,20 @@ swfdec_movie_render (SwfdecMovie *movie, cairo_t *cr,
     cairo_pattern_t *mask;
     if (movie->parent == movie->masked_by->parent) {
       cairo_transform (cr, &movie->inverse_matrix);
+      rect = *inval;
     } else {
-      cairo_matrix_t mat;
+      cairo_matrix_t mat, mat2;
       swfdec_movie_local_to_global_matrix (movie, &mat);
+      swfdec_movie_global_to_local_matrix (movie->masked_by, &mat2);
+      cairo_matrix_multiply (&mat, &mat2, &mat);
       cairo_transform (cr, &mat);
-      swfdec_movie_global_to_local_matrix (movie->masked_by, &mat);
-      cairo_transform (cr, &mat);
+      if (cairo_matrix_invert (&mat) == CAIRO_STATUS_SUCCESS && FALSE) {
+	swfdec_rect_transform (&rect, &rect, &mat);
+      } else {
+	SWFDEC_INFO ("non-invertible matrix when computing invalid area");
+	rect.x0 = rect.y0 = -G_MAXDOUBLE;
+	rect.x1 = rect.y1 = G_MAXDOUBLE;
+      }
     }
     mask = swfdec_movie_mask (cr, movie->masked_by, &rect);
     cairo_pop_group_to_source (cr);
commit ee0ca0c65736ac7a285df6f4ddf347797894851f
Author: Benjamin Otte <otte at gnome.org>
Date:   Wed Jan 2 14:41:03 2008 +0100

    include children movieclips in a movie's foreach function

diff --git a/libswfdec/swfdec_movie.c b/libswfdec/swfdec_movie.c
index f06a289..400ca2e 100644
--- a/libswfdec/swfdec_movie.c
+++ b/libswfdec/swfdec_movie.c
@@ -1227,6 +1227,27 @@ swfdec_movie_set_variable (SwfdecAsObject *object, const char *variable,
   SWFDEC_AS_OBJECT_CLASS (swfdec_movie_parent_class)->set (object, variable, val, flags);
 }
 
+static gboolean
+swfdec_movie_foreach_variable (SwfdecAsObject *object, SwfdecAsVariableForeach func, gpointer data)
+{
+  SwfdecMovie *movie = SWFDEC_MOVIE (object);
+  SwfdecAsValue val;
+  GList *walk;
+  gboolean ret;
+
+  ret = SWFDEC_AS_OBJECT_CLASS (swfdec_movie_parent_class)->foreach (object, func, data);
+
+  for (walk = movie->list; walk && ret; walk = walk->next) {
+    SwfdecMovie *cur = walk->data;
+    if (cur->original_name == SWFDEC_AS_STR_EMPTY)
+      continue;
+    SWFDEC_AS_VALUE_SET_OBJECT (&val, walk->data);
+    ret &= func (object, cur->name, &val, 0, data);
+  }
+
+  return ret;
+}
+
 static char *
 swfdec_movie_get_debug (SwfdecAsObject *object)
 {
@@ -1434,6 +1455,7 @@ swfdec_movie_class_init (SwfdecMovieClass * movie_class)
   asobject_class->mark = swfdec_movie_mark;
   asobject_class->get = swfdec_movie_get_variable;
   asobject_class->set = swfdec_movie_set_variable;
+  asobject_class->foreach = swfdec_movie_foreach_variable;
   asobject_class->debug = swfdec_movie_get_debug;
 
   g_object_class_install_property (object_class, PROP_DEPTH,


More information about the Swfdec mailing list