[Swfdec-commits] 6 commits - swfdec/swfdec_as_native_function.c swfdec/swfdec_movie.c swfdec/swfdec_sprite_movie_as.c test/trace vivified/code

Benjamin Otte company at kemper.freedesktop.org
Mon Apr 28 03:48:57 PDT 2008


 swfdec/swfdec_as_native_function.c               |    4 +--
 swfdec/swfdec_movie.c                            |    2 +
 swfdec/swfdec_sprite_movie_as.c                  |    4 +--
 test/trace/Makefile.am                           |    9 +++++++
 test/trace/getBounds-local_to_global-5.swf       |binary
 test/trace/getBounds-local_to_global-5.swf.trace |    2 +
 test/trace/getBounds-local_to_global-6.swf       |binary
 test/trace/getBounds-local_to_global-6.swf.trace |    2 +
 test/trace/getBounds-local_to_global-7.swf       |binary
 test/trace/getBounds-local_to_global-7.swf.trace |    2 +
 test/trace/getBounds-local_to_global-8.swf       |binary
 test/trace/getBounds-local_to_global-8.swf.trace |    2 +
 test/trace/getBounds-local_to_global.as          |   29 +++++++++++++++++++++++
 vivified/code/rewrite.c                          |   25 +++++++++++++++++++
 vivified/code/vivi_code_asm_code_default.h       |   16 +++++++++++-
 15 files changed, 91 insertions(+), 6 deletions(-)

New commits:
commit b5dd42a4232a852545eedc7668ad6baa51400260
Author: Benjamin Otte <otte at gnome.org>
Date:   Mon Apr 28 12:40:29 2008 +0200

    add test for just-fixed issue

diff --git a/test/trace/Makefile.am b/test/trace/Makefile.am
index 395c1db..383cbdd 100644
--- a/test/trace/Makefile.am
+++ b/test/trace/Makefile.am
@@ -1237,6 +1237,15 @@ EXTRA_DIST = \
 	get-depth-7.swf.trace \
 	get-depth-8.swf \
 	get-depth-8.swf.trace \
+	getBounds-local_to_global-5.swf \
+	getBounds-local_to_global-5.swf.trace \
+	getBounds-local_to_global-6.swf \
+	getBounds-local_to_global-6.swf.trace \
+	getBounds-local_to_global-7.swf \
+	getBounds-local_to_global-7.swf.trace \
+	getBounds-local_to_global-8.swf \
+	getBounds-local_to_global-8.swf.trace \
+	getBounds-local_to_global.as \
 	getsetproperty-target.as \
 	getsetproperty-target-5.swf \
 	getsetproperty-target-5.swf.trace \
diff --git a/test/trace/getBounds-local_to_global-5.swf b/test/trace/getBounds-local_to_global-5.swf
new file mode 100644
index 0000000..174bf35
Binary files /dev/null and b/test/trace/getBounds-local_to_global-5.swf differ
diff --git a/test/trace/getBounds-local_to_global-5.swf.trace b/test/trace/getBounds-local_to_global-5.swf.trace
new file mode 100644
index 0000000..972db0a
--- /dev/null
+++ b/test/trace/getBounds-local_to_global-5.swf.trace
@@ -0,0 +1,2 @@
+This exposes a bug in the internal matrix cache update routines, where some matrix conversion function did not ensure the matrix was properly updated. This might explain why the test looks so constructed.
+.getBounds () = { , , , }
diff --git a/test/trace/getBounds-local_to_global-6.swf b/test/trace/getBounds-local_to_global-6.swf
new file mode 100644
index 0000000..f7b311d
Binary files /dev/null and b/test/trace/getBounds-local_to_global-6.swf differ
diff --git a/test/trace/getBounds-local_to_global-6.swf.trace b/test/trace/getBounds-local_to_global-6.swf.trace
new file mode 100644
index 0000000..709269f
--- /dev/null
+++ b/test/trace/getBounds-local_to_global-6.swf.trace
@@ -0,0 +1,2 @@
+This exposes a bug in the internal matrix cache update routines, where some matrix conversion function did not ensure the matrix was properly updated. This might explain why the test looks so constructed.
+_level0.a.getBounds (_level0.b) = { 0, 0, 25, 100}
diff --git a/test/trace/getBounds-local_to_global-7.swf b/test/trace/getBounds-local_to_global-7.swf
new file mode 100644
index 0000000..d2824d1
Binary files /dev/null and b/test/trace/getBounds-local_to_global-7.swf differ
diff --git a/test/trace/getBounds-local_to_global-7.swf.trace b/test/trace/getBounds-local_to_global-7.swf.trace
new file mode 100644
index 0000000..709269f
--- /dev/null
+++ b/test/trace/getBounds-local_to_global-7.swf.trace
@@ -0,0 +1,2 @@
+This exposes a bug in the internal matrix cache update routines, where some matrix conversion function did not ensure the matrix was properly updated. This might explain why the test looks so constructed.
+_level0.a.getBounds (_level0.b) = { 0, 0, 25, 100}
diff --git a/test/trace/getBounds-local_to_global-8.swf b/test/trace/getBounds-local_to_global-8.swf
new file mode 100644
index 0000000..79a5937
Binary files /dev/null and b/test/trace/getBounds-local_to_global-8.swf differ
diff --git a/test/trace/getBounds-local_to_global-8.swf.trace b/test/trace/getBounds-local_to_global-8.swf.trace
new file mode 100644
index 0000000..709269f
--- /dev/null
+++ b/test/trace/getBounds-local_to_global-8.swf.trace
@@ -0,0 +1,2 @@
+This exposes a bug in the internal matrix cache update routines, where some matrix conversion function did not ensure the matrix was properly updated. This might explain why the test looks so constructed.
+_level0.a.getBounds (_level0.b) = { 0, 0, 25, 100}
diff --git a/test/trace/getBounds-local_to_global.as b/test/trace/getBounds-local_to_global.as
new file mode 100644
index 0000000..f12b858
--- /dev/null
+++ b/test/trace/getBounds-local_to_global.as
@@ -0,0 +1,29 @@
+// makeswf -v 7 -s 200x150 -r 1 -o getBounds-local_to_global.swf getBounds-local_to_global.as
+
+trace ("This exposes a bug in the internal matrix cache update routines, where some matrix conversion function did not ensure the matrix was properly updated. This might explain why the test looks so constructed.");
+
+rectangle = function (mc, color, x, y, w, h)
+{
+  mc.beginFill (color);
+  mc.moveTo (x, y);
+  mc.lineTo (x, y + h);
+  mc.lineTo (x + w, y + h);
+  mc.lineTo (x + w, y);
+  mc.lineTo (x, y);
+  mc.endFill ();
+};
+
+createEmptyMovieClip ("a", 0);
+a.createEmptyMovieClip ("a", 0);
+rectangle (a.a, 0xFF, 0, 0, 100, 100);
+a.getBounds ();
+a._xscale = 50;
+
+createEmptyMovieClip ("b", 1);
+rectangle (b, 0xFF, 0, 0, 100, 100);
+b._xscale = 200;
+
+bounds = a.a.getBounds (b);
+trace (a + ".getBounds (" + b + ") = { " + bounds.xMin + ", " + bounds.yMin + ", " + bounds.xMax +", " + bounds.yMax + "}");
+
+getURL ("fscommand:quit", "");
commit 4bf27d31f5bcd99b33c2814809c68b9f4746de67
Author: Benjamin Otte <otte at gnome.org>
Date:   Mon Apr 28 12:39:18 2008 +0200

    update cache before using the matrix

diff --git a/swfdec/swfdec_movie.c b/swfdec/swfdec_movie.c
index 6bcef36..5502a28 100644
--- a/swfdec/swfdec_movie.c
+++ b/swfdec/swfdec_movie.c
@@ -474,6 +474,8 @@ swfdec_movie_local_to_global (SwfdecMovie *movie, double *x, double *y)
   g_return_if_fail (y != NULL);
 
   do {
+    if (movie->cache_state >= SWFDEC_MOVIE_INVALID_MATRIX)
+      swfdec_movie_update (movie);
     cairo_matrix_transform_point (&movie->matrix, x, y);
   } while ((movie = movie->parent));
 }
commit d3332ec74912032ad1bd6a4ca84da619c3dba4a0
Author: Benjamin Otte <otte at gnome.org>
Date:   Mon Apr 28 12:36:41 2008 +0200

    doc typo

diff --git a/swfdec/swfdec_as_native_function.c b/swfdec/swfdec_as_native_function.c
index 74ba3e6..71d01af 100644
--- a/swfdec/swfdec_as_native_function.c
+++ b/swfdec/swfdec_as_native_function.c
@@ -252,8 +252,8 @@ swfdec_as_native_function_set_construct_type (SwfdecAsNativeFunction *function,
  * <listitem><para>"n": convert to number. Requires a %double pointer
  *                 </para></listitem>
  * <listitem><para>"o": convert to object. Requires a #SwfdecAsObject pointer.
- *                 If the conversion fails, this function immediately return %
- *                 FALSE.</para></listitem>
+ *                 If the conversion fails, this function immediately returns
+ *                 %FALSE.</para></listitem>
  * <listitem><para>"O": convert to object or %NULL. Requires a #SwfdecAsObject
  *                 pointer.</para></listitem>
  * <listitem><para>"s": convert to garbage-collected string. Requires a const 
commit b59703394eaff4fac53253e9fa9c26a7dca79e7b
Author: Benjamin Otte <otte at gnome.org>
Date:   Mon Apr 28 12:15:11 2008 +0200

    clean up code

diff --git a/swfdec/swfdec_sprite_movie_as.c b/swfdec/swfdec_sprite_movie_as.c
index c7146f5..3644d51 100644
--- a/swfdec/swfdec_sprite_movie_as.c
+++ b/swfdec/swfdec_sprite_movie_as.c
@@ -791,7 +791,7 @@ swfdec_sprite_movie_getBounds (SwfdecAsContext *cx, SwfdecAsObject *object,
   SwfdecAsObject *obj;
   SwfdecMovie *movie;
 
-  SWFDEC_AS_CHECK (SWFDEC_TYPE_MOVIE, (gpointer)&movie, "");
+  SWFDEC_AS_CHECK (SWFDEC_TYPE_MOVIE, &movie, "");
 
   obj= swfdec_as_object_new_empty (cx);
   if (obj== NULL)
@@ -815,7 +815,7 @@ swfdec_sprite_movie_getBounds (SwfdecAsContext *cx, SwfdecAsObject *object,
 
     if (movie->parent)
       swfdec_movie_rect_local_to_global (movie->parent, &rect);
-    swfdec_movie_rect_global_to_local ((other != NULL ? other : movie), &rect);
+    swfdec_movie_rect_global_to_local (other, &rect);
 
     x0 = rect.x0;
     y0 = rect.y0;
commit 2adcd7efac1a63bbca3894dead77b85c6d04ea79
Author: Benjamin Otte <otte at gnome.org>
Date:   Mon Apr 28 11:55:03 2008 +0200

    add --getters flag to print the return value of aver GetVariable and GetMember

diff --git a/vivified/code/rewrite.c b/vivified/code/rewrite.c
index 47014b0..cc0df6a 100644
--- a/vivified/code/rewrite.c
+++ b/vivified/code/rewrite.c
@@ -38,6 +38,7 @@
 typedef enum {
   REWRITE_TRACE_FUNCTION_NAME = (1 << 0),
   REWRITE_RANDOM              = (1 << 1),
+  REWRITE_GETTERS	      = (1 << 2),
 
   REWRITE_INIT		      =	(1 << 17)
 } RewriteOptions;
@@ -203,6 +204,23 @@ replace_random (ViviCodeAssembler *assembler, guint init)
   }
 }
 
+static void
+rewrite_getters (ViviCodeAssembler *assembler)
+{
+  guint i;
+
+  for (i = 0; i < vivi_code_assembler_get_n_codes (assembler); i++) {
+    ViviCodeAsm *code = vivi_code_assembler_get_code (assembler, i);
+    if (VIVI_IS_CODE_ASM_GET_VARIABLE (code) ||
+	VIVI_IS_CODE_ASM_GET_MEMBER (code)) {
+      i++;
+      INSERT_CODE (assembler, i, vivi_code_asm_push_duplicate_new ());
+      INSERT_CODE (assembler, i, vivi_code_asm_trace_new ());
+      i--;
+    }
+  }
+}
+
 /*** INFRASTRUCTURE ***/
 
 static SwfdecBuffer *
@@ -221,6 +239,8 @@ do_script (SwfdecBuffer *buffer, guint flags, const char *name, guint version)
     insert_function_trace (assembler, name);
   if (flags & REWRITE_RANDOM)
     replace_random (assembler, flags & REWRITE_INIT);
+  if (flags & REWRITE_GETTERS)
+    rewrite_getters (assembler);
 
   script = vivi_code_assembler_assemble_script (assembler, version, &error);
   g_object_unref (assembler);
@@ -377,8 +397,10 @@ main (int argc, char *argv[])
   SwfdecBuffer *buffer;
   gboolean trace_function_names = FALSE;
   gboolean random = FALSE;
+  gboolean getters = FALSE;
 
   GOptionEntry options[] = {
+    { "getters", 'g', 0, G_OPTION_ARG_NONE, &getters, "trace all variable get operations", NULL },
     { "trace-function-names", 'n', 0, G_OPTION_ARG_NONE, &trace_function_names, "trace names of called functions", NULL },
     { "no-random", 'r', 0, G_OPTION_ARG_NONE, &random, "replace all random values with 0", NULL },
     { NULL }
@@ -417,7 +439,8 @@ main (int argc, char *argv[])
 
   buffer = process_buffer (buffer,
       (trace_function_names ? REWRITE_TRACE_FUNCTION_NAME : 0) |
-      (random ? REWRITE_RANDOM : 0));
+      (random ? REWRITE_RANDOM : 0) |
+      (getters ? REWRITE_GETTERS : 0));
   if (buffer == NULL) {
     g_printerr ("\"%s\": Broken Flash file\n", argv[1]);
     return 1;
commit 1da9e565d92fbbd6c880cb943b0af6930c69a818
Author: Benjamin Otte <otte at gnome.org>
Date:   Mon Apr 28 11:54:54 2008 +0200

    add more macros

diff --git a/vivified/code/vivi_code_asm_code_default.h b/vivified/code/vivi_code_asm_code_default.h
index 179fc53..c3ca285 100644
--- a/vivified/code/vivi_code_asm_code_default.h
+++ b/vivified/code/vivi_code_asm_code_default.h
@@ -36,7 +36,21 @@ ViviCodeAsm *		vivi_code_asm_ ## underscore_name ## _new	(void);
 
 #include "vivi_code_defaults.h"
 
-#define VIVI_TYPE_CODE_ASM_RANDOM                    (vivi_code_asm_random_get_type())
+#define VIVI_TYPE_CODE_ASM_GET_MEMBER                    (vivi_code_asm_get_member_get_type())
+#define VIVI_IS_CODE_ASM_GET_MEMBER(obj)                 (G_TYPE_CHECK_INSTANCE_TYPE ((obj), VIVI_TYPE_CODE_ASM_GET_MEMBER))
+#define VIVI_IS_CODE_ASM_GET_MEMBER_CLASS(klass)         (G_TYPE_CHECK_CLASS_TYPE ((klass), VIVI_TYPE_CODE_ASM_GET_MEMBER))
+#define VIVI_CODE_ASM_GET_MEMBER(obj)                    (G_TYPE_CHECK_INSTANCE_CAST ((obj), VIVI_TYPE_CODE_ASM_GET_MEMBER, ViviCodeAsmGetMember))
+#define VIVI_CODE_ASM_GET_MEMBER_CLASS(klass)            (G_TYPE_CHECK_CLASS_CAST ((klass), VIVI_TYPE_CODE_ASM_GET_MEMBER, ViviCodeAsmGetMemberClass))
+#define VIVI_CODE_ASM_GET_MEMBER_GET_CLASS(obj)          (G_TYPE_INSTANCE_GET_CLASS ((obj), VIVI_TYPE_CODE_ASM_GET_MEMBER, ViviCodeAsmGetMemberClass))
+
+#define VIVI_TYPE_CODE_ASM_GET_VARIABLE                    (vivi_code_asm_get_variable_get_type())
+#define VIVI_IS_CODE_ASM_GET_VARIABLE(obj)                 (G_TYPE_CHECK_INSTANCE_TYPE ((obj), VIVI_TYPE_CODE_ASM_GET_VARIABLE))
+#define VIVI_IS_CODE_ASM_GET_VARIABLE_CLASS(klass)         (G_TYPE_CHECK_CLASS_TYPE ((klass), VIVI_TYPE_CODE_ASM_GET_VARIABLE))
+#define VIVI_CODE_ASM_GET_VARIABLE(obj)                    (G_TYPE_CHECK_INSTANCE_CAST ((obj), VIVI_TYPE_CODE_ASM_GET_VARIABLE, ViviCodeAsmGetVariable))
+#define VIVI_CODE_ASM_GET_VARIABLE_CLASS(klass)            (G_TYPE_CHECK_CLASS_CAST ((klass), VIVI_TYPE_CODE_ASM_GET_VARIABLE, ViviCodeAsmGetVariableClass))
+#define VIVI_CODE_ASM_GET_VARIABLE_GET_CLASS(obj)          (G_TYPE_INSTANCE_GET_CLASS ((obj), VIVI_TYPE_CODE_ASM_GET_VARIABLE, ViviCodeAsmGetVariableClass))
+
+#define VIVI_TYPE_CODE_ASM_RANDOM		     (vivi_code_asm_random_get_type())
 #define VIVI_IS_CODE_ASM_RANDOM(obj)                 (G_TYPE_CHECK_INSTANCE_TYPE ((obj), VIVI_TYPE_CODE_ASM_RANDOM))
 #define VIVI_IS_CODE_ASM_RANDOM_CLASS(klass)         (G_TYPE_CHECK_CLASS_TYPE ((klass), VIVI_TYPE_CODE_ASM_RANDOM))
 #define VIVI_CODE_ASM_RANDOM(obj)                    (G_TYPE_CHECK_INSTANCE_CAST ((obj), VIVI_TYPE_CODE_ASM_RANDOM, ViviCodeAsmRandom))


More information about the Swfdec-commits mailing list