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

Pekka Lampila medar at kemper.freedesktop.org
Fri Aug 17 14:49:23 PDT 2007


 libswfdec/swfdec_sprite_movie_as.c  |   25 ++++++++++++++++++++++++-
 test/trace/Makefile.am              |    7 +++++++
 test/trace/forin-delete-5.swf       |binary
 test/trace/forin-delete-5.swf.trace |    1 +
 test/trace/forin-delete-6.swf       |binary
 test/trace/forin-delete-6.swf.trace |    1 +
 test/trace/forin-delete-7.swf       |binary
 test/trace/forin-delete-7.swf.trace |    1 +
 test/trace/forin-delete.as          |   14 ++++++++++++++
 9 files changed, 48 insertions(+), 1 deletion(-)

New commits:
diff-tree 223cc7d4adec6429f56efa8750e04345ccd85bfd (from 76e35412ea974749804920a47678db8c1242487b)
Author: Pekka Lampila <pekka.lampila at iki.fi>
Date:   Wed Jul 18 19:56:45 2007 +0300

    Implement hitTest for x, y coordinates (without shapeFlag)

diff --git a/libswfdec/swfdec_sprite_movie_as.c b/libswfdec/swfdec_sprite_movie_as.c
index f18597c..5eea43f 100644
--- a/libswfdec/swfdec_sprite_movie_as.c
+++ b/libswfdec/swfdec_sprite_movie_as.c
@@ -208,8 +208,31 @@ swfdec_sprite_movie_hitTest (SwfdecAsCon
 	SWFDEC_OBJECT (other)->extents.x1, SWFDEC_OBJECT (other)->extents.y1);
 #endif
     SWFDEC_AS_VALUE_SET_BOOLEAN (rval, swfdec_rect_intersect (NULL, &movie_rect, &other_rect));
+  } else if (argc >= 2) {
+    SwfdecRect movie_rect;
+    double x, y;
+
+    x = swfdec_as_value_to_number (cx, &argv[0]);
+    y = swfdec_as_value_to_number (cx, &argv[1]);
+
+    if (argc >= 3) {
+      if (swfdec_as_value_to_boolean (cx, &argv[2])) {
+	SWFDEC_FIXME ("hitTest's shapeFlag parameter not supported");
+	// just continue...
+      }
+    }
+
+    swfdec_movie_update (movie);
+    movie_rect = movie->original_extents;
+    while (movie->parent) {
+      swfdec_rect_transform (&movie_rect, &movie_rect, &movie->matrix);
+      movie = movie->parent;
+    }
+
+    SWFDEC_AS_VALUE_SET_BOOLEAN (rval, swfdec_rect_contains (&movie_rect,
+	  SWFDEC_PLAYER (cx)->mouse_x, SWFDEC_PLAYER (cx)->mouse_y));
   } else {
-    SWFDEC_ERROR ("hitTest for x, y coordinate not implemented");
+    SWFDEC_FIXME ("hitText with 0 parameters, what to do?");
   }
 }
 
diff-tree 76e35412ea974749804920a47678db8c1242487b (from db0818e50daf6422c947fba7a38aaccef6d6f070)
Author: Pekka Lampila <pekka.lampila at iki.fi>
Date:   Sat Aug 18 00:45:41 2007 +0300

    Add test for deleting properties when in for in loop

diff --git a/test/trace/forin-delete-5.swf b/test/trace/forin-delete-5.swf
new file mode 100644
index 0000000..8dcd58a
Binary files /dev/null and b/test/trace/forin-delete-5.swf differ
diff --git a/test/trace/forin-delete-5.swf.trace b/test/trace/forin-delete-5.swf.trace
new file mode 100644
index 0000000..c970f17
--- /dev/null
+++ b/test/trace/forin-delete-5.swf.trace
@@ -0,0 +1 @@
+0,1,2,3,4,5,6,7,8,9
diff --git a/test/trace/forin-delete-6.swf b/test/trace/forin-delete-6.swf
new file mode 100644
index 0000000..c2ed5d5
Binary files /dev/null and b/test/trace/forin-delete-6.swf differ
diff --git a/test/trace/forin-delete-6.swf.trace b/test/trace/forin-delete-6.swf.trace
new file mode 100644
index 0000000..c970f17
--- /dev/null
+++ b/test/trace/forin-delete-6.swf.trace
@@ -0,0 +1 @@
+0,1,2,3,4,5,6,7,8,9
diff --git a/test/trace/forin-delete-7.swf b/test/trace/forin-delete-7.swf
new file mode 100644
index 0000000..07e6f12
Binary files /dev/null and b/test/trace/forin-delete-7.swf differ
diff --git a/test/trace/forin-delete-7.swf.trace b/test/trace/forin-delete-7.swf.trace
new file mode 100644
index 0000000..c970f17
--- /dev/null
+++ b/test/trace/forin-delete-7.swf.trace
@@ -0,0 +1 @@
+0,1,2,3,4,5,6,7,8,9
diff --git a/test/trace/forin-delete.as b/test/trace/forin-delete.as
new file mode 100644
index 0000000..696fdaf
--- /dev/null
+++ b/test/trace/forin-delete.as
@@ -0,0 +1,14 @@
+// makeswf -v 7 -r 1 -o forin-delete-7.swf forin-delete.as
+
+obj = new Object ();
+for (var i = 0; i < 10; i++) {
+  obj[i] = "something";
+}
+a = new Array();
+for (var prop in obj) {
+  a.push (prop);
+  delete obj[prop];
+}
+trace (a.sort ());
+
+loadMovie ("FSCommand:quit", "");
diff-tree db0818e50daf6422c947fba7a38aaccef6d6f070 (from af55385468269795f5f4d14cb8746dfd3d7be245)
Author: Pekka Lampila <pekka.lampila at iki.fi>
Date:   Sat Aug 18 00:44:10 2007 +0300

    Forgot to add propflags test to Makefile.am

diff --git a/test/trace/Makefile.am b/test/trace/Makefile.am
index 45b56a8..9f3becf 100644
--- a/test/trace/Makefile.am
+++ b/test/trace/Makefile.am
@@ -787,6 +787,13 @@ EXTRA_DIST = \
 	prototype-movie-8.swf.trace \
 	prototypes.swf \
 	prototypes.swf.trace \
+	propflags.as \
+	propflags-5.swf \
+	propflags-5.swf.trace \
+	propflags-6.swf \
+	propflags-6.swf.trace \
+	propflags-7.swf \
+	propflags-7.swf.trace \
 	register-count.swf \
 	register-count.swf.trace \
 	register-count.xml \


More information about the Swfdec mailing list