[Swfdec-commits] 6 commits - swfdec/swfdec_bitmap_data.c swfdec/swfdec_movie.c test/image test/trace

Benjamin Otte company at kemper.freedesktop.org
Fri Sep 5 07:01:47 PDT 2008


 swfdec/swfdec_bitmap_data.c                                |    5 +
 swfdec/swfdec_movie.c                                      |    2 
 test/image/BitmapData-draw-movie-transformed-5.swf         |binary
 test/image/BitmapData-draw-movie-transformed-5.swf.png     |binary
 test/image/BitmapData-draw-movie-transformed-6.swf         |binary
 test/image/BitmapData-draw-movie-transformed-6.swf.png     |binary
 test/image/BitmapData-draw-movie-transformed-7.swf         |binary
 test/image/BitmapData-draw-movie-transformed-7.swf.png     |binary
 test/image/BitmapData-draw-movie-transformed-8.swf         |binary
 test/image/BitmapData-draw-movie-transformed-8.swf.org.png |binary
 test/image/BitmapData-draw-movie-transformed-8.swf.png     |binary
 test/image/BitmapData-draw-movie-transformed.as            |   22 +++++++
 test/image/Makefile.am                                     |    9 +++
 test/image/README                                          |   36 ++++++-------
 test/trace/README                                          |   19 ++----
 15 files changed, 61 insertions(+), 32 deletions(-)

New commits:
commit 056957b4534f819521888767461c959d7b868af6
Author: Benjamin Otte <otte at gnome.org>
Date:   Fri Sep 5 15:59:48 2008 +0200

    update test to check the correct matrix is used

diff --git a/test/image/BitmapData-draw-movie-transformed-5.swf b/test/image/BitmapData-draw-movie-transformed-5.swf
index a875ccf..ad6b8b4 100644
Binary files a/test/image/BitmapData-draw-movie-transformed-5.swf and b/test/image/BitmapData-draw-movie-transformed-5.swf differ
diff --git a/test/image/BitmapData-draw-movie-transformed-5.swf.png b/test/image/BitmapData-draw-movie-transformed-5.swf.png
index df82671..bffec78 100644
Binary files a/test/image/BitmapData-draw-movie-transformed-5.swf.png and b/test/image/BitmapData-draw-movie-transformed-5.swf.png differ
diff --git a/test/image/BitmapData-draw-movie-transformed-6.swf b/test/image/BitmapData-draw-movie-transformed-6.swf
index 527e7b3..ba401d8 100644
Binary files a/test/image/BitmapData-draw-movie-transformed-6.swf and b/test/image/BitmapData-draw-movie-transformed-6.swf differ
diff --git a/test/image/BitmapData-draw-movie-transformed-6.swf.png b/test/image/BitmapData-draw-movie-transformed-6.swf.png
index 9ae568b..1cd2126 100644
Binary files a/test/image/BitmapData-draw-movie-transformed-6.swf.png and b/test/image/BitmapData-draw-movie-transformed-6.swf.png differ
diff --git a/test/image/BitmapData-draw-movie-transformed-7.swf b/test/image/BitmapData-draw-movie-transformed-7.swf
index 0147474..88c00d7 100644
Binary files a/test/image/BitmapData-draw-movie-transformed-7.swf and b/test/image/BitmapData-draw-movie-transformed-7.swf differ
diff --git a/test/image/BitmapData-draw-movie-transformed-7.swf.png b/test/image/BitmapData-draw-movie-transformed-7.swf.png
index e69bd9f..cb4359f 100644
Binary files a/test/image/BitmapData-draw-movie-transformed-7.swf.png and b/test/image/BitmapData-draw-movie-transformed-7.swf.png differ
diff --git a/test/image/BitmapData-draw-movie-transformed-8.swf b/test/image/BitmapData-draw-movie-transformed-8.swf
index fd9fe40..06157f9 100644
Binary files a/test/image/BitmapData-draw-movie-transformed-8.swf and b/test/image/BitmapData-draw-movie-transformed-8.swf differ
diff --git a/test/image/BitmapData-draw-movie-transformed-8.swf.org.png b/test/image/BitmapData-draw-movie-transformed-8.swf.org.png
new file mode 100644
index 0000000..5a91772
Binary files /dev/null and b/test/image/BitmapData-draw-movie-transformed-8.swf.org.png differ
diff --git a/test/image/BitmapData-draw-movie-transformed-8.swf.png b/test/image/BitmapData-draw-movie-transformed-8.swf.png
index 003e878..4c768b2 100644
Binary files a/test/image/BitmapData-draw-movie-transformed-8.swf.png and b/test/image/BitmapData-draw-movie-transformed-8.swf.png differ
diff --git a/test/image/BitmapData-draw-movie-transformed.as b/test/image/BitmapData-draw-movie-transformed.as
index b981ac5..493cd81 100644
--- a/test/image/BitmapData-draw-movie-transformed.as
+++ b/test/image/BitmapData-draw-movie-transformed.as
@@ -5,7 +5,7 @@ createEmptyMovieClip ("a", 0);
 a._x = 200;
 a._y = 150;
 a._xscale = -100;
-a._yscale = -100;
+a._yscale = -20000;
 
 m = new flash.geom.Matrix ();
 m.createGradientBox (50, 50, -1.57, 0, 70);
commit 2508ce240b2dde6e5f6bf8ebba3413e5fda9a067
Author: Benjamin Otte <otte at gnome.org>
Date:   Fri Sep 5 15:59:27 2008 +0200

    use the correct matrix

diff --git a/swfdec/swfdec_bitmap_data.c b/swfdec/swfdec_bitmap_data.c
index 2a64ce2..5c3ed45 100644
--- a/swfdec/swfdec_bitmap_data.c
+++ b/swfdec/swfdec_bitmap_data.c
@@ -536,7 +536,7 @@ swfdec_bitmap_data_draw (SwfdecAsContext *cx, SwfdecAsObject *object,
     SwfdecMovie *movie = SWFDEC_MOVIE (o);
     swfdec_movie_update (movie);
     cairo_scale (cr, 1.0 / SWFDEC_TWIPS_SCALE_FACTOR, 1.0 / SWFDEC_TWIPS_SCALE_FACTOR);
-    cairo_transform (cr, &movie->matrix);
+    cairo_transform (cr, &movie->inverse_matrix);
     swfdec_movie_render (movie, cr, &ctrans);
   } else {
     SWFDEC_FIXME ("BitmapData.draw() with a %s?", G_OBJECT_TYPE_NAME (o));
commit 4989774b4496021dcb6e807b2542bdefcf1a5329
Author: Benjamin Otte <otte at gnome.org>
Date:   Fri Sep 5 15:54:08 2008 +0200

    update README files

diff --git a/test/image/README b/test/image/README
index a430943..44572e8 100644
--- a/test/image/README
+++ b/test/image/README
@@ -8,19 +8,20 @@ the place to start.
 
 How does it work?
 
-  ./image [FILE1 [FILE2 [...]]]
-The program image in this directory takes all files on the command line or all
-files in the current directory and runs them. Running consists of instancing a
-SwfdecPlayer and advancing $FILE 10 times. After that, the current state of 
-the player is rendered to an image and compared to the reference image named
-$FILE.png. The image must be in PNG format. Comparing in this context means
-checking that the difference between the red, green, blue and alpha channel for
-every pixel isn't greater than a given threshold. Currently the threshold is
-set to 3 to account for rounding errors.
+  ../swfdec-test [FILE1 [FILE2 [...]]]
+The default script for swfdec-test in this directory takes all files on the 
+command line or all files in the current directory and runs them. Running 
+consists of instancing a SwfdecPlayer and advancing $FILE 10 times. After 
+that, the current state of the player is rendered to an image and compared 
+to the reference image named $FILE.png. The image must be in PNG format. 
+Comparing in this context means checking that the difference between the 
+red, green, blue and alpha channel for every pixel isn't greater than a 
+given threshold. Currently the threshold is set to 3 to account for rounding 
+errors.
 If the environment variable SWFDEC_TEST_DUMP is set, for every failed test the
-image containing the player's output is dumped to $FILE.dump.png. If available,
-a difference image detailing the differences between the reference image and
-the current image is saved to $FILE.diff.png.
+image containing the player's output is dumped to $FILE.dump.png. If the
+reference image is available, an image detailing the differences between the
+reference image and the current image is saved to $FILE.diff.png.
 
 
 How do I run my new test?
@@ -28,16 +29,14 @@ How do I run my new test?
 Create a file to test, say "test.swf", and create a corresponding file for the
 expected output image. In this case that would be "test.swf.png". After that, 
 just call the image application with your file, like this:
-  ./image test.swf
-You may need to build the image application if you haven't run make check 
-before, just run make image.
+  ../swfdec-test test.swf
 
 
 How do I create the expected reference image?
 
 Ideally you create a SWF file where the image doesn't change. Alternatively
-use a low frame rate. Play the file with the Adobe Flash Player in Wine and 
-take a screenshot of its output.
+use a low frame rate. Play the file with the Adobe Flash Player and take a 
+screenshot of its output.
 If the Swfdec output doesn't match exactly, but is close enough, use that 
 output as the reference image but keep the original expected output, too. Name
 it $FILE.org.png.
@@ -48,5 +47,4 @@ How do I add a test to the testsuite?
 Just put the file and its reference image - and the original reference image, 
 too, if available (see above) - into this directory and add them all
 to EXTRA_DIST in Makefile.am. It should appear in the output when running 
-make check. (Note that the order of files tested during make check is pretty 
-much random.)
+make check.
diff --git a/test/trace/README b/test/trace/README
index 730ec0c..50c9e67 100644
--- a/test/trace/README
+++ b/test/trace/README
@@ -2,8 +2,8 @@ This directory contains tests using the tracing functionality of Actionscript.
 
 How does it work?
 
-  ./trace [FILE1 [FILE2 [...]]]
-The program trace in this directory takes all files on the command line or all
+  ../swfdec-test [FILE1 [FILE2 [...]]]
+The default script in this directory takes all files on the command line or all
 files in the current directory and runs them. Running consists of instancing a
 SwfdecPlayer and iterating $FILE until 10 frames have passed. Everytime the 
 trace function is invoked by that player, its output is appended to a buffer. 
@@ -26,7 +26,7 @@ Why don't you autogenerate the SWF files from sources but include them?
 
 An important thing to note is that this testsuite is supposed to test the 
 correct handling of SWF files, so the reference file must be an SWF file. Since
-Open Source tools could produce different SWF files depending on version, we
+Open Source tools could produce different SWF files depending on their version,
 the testsuite could end up testing different files. This is something that is
 definitely not wanted. Consider the source files annotations only.
 
@@ -35,17 +35,15 @@ How do I run my new test?
 
 Create a file to test, say "test.swf", and put the expected output in the
 corresponding trace file, in this case "test.swf.trace". After that, just call
-the trace application with your file, like this:
-  ./trace test.swf
-You may need to build the trace application if you haven't run make check 
-before, just run make trace.
+the test application with your file, like this:
+  ../swfdec-test test.swf
 
 
 How do I create a trace file?
 
-The suggested method is to use a Flash authoring environment (like Flash Studio
-or Flash MX), enable debugging and just copy the output this produces. 
-Unfortunately this requires access to these tools, since they are expensive.
+The suggested method is to use a Flash debugging player and configure that 
+player to dump the trace poutput to a file. An example of how to do this can be
+found at http://blogs.gnome.org/otte/2007/06/10/how-to-do-tests/
 
 
 How do I add a test to the testsuite?
@@ -53,5 +51,4 @@ How do I add a test to the testsuite?
 Just put the file, its trace file and if you have them, source files used for
 creating the file into this directory and add all of them to EXTRA_DIST in 
 Makefile.am. The file should appear in the output when running make check. 
-(Note that the order of files tested during make check is pretty much random.)
 
commit 4a5543639f47e317335acb4c221e77027c39f390
Author: Benjamin Otte <otte at gnome.org>
Date:   Fri Sep 5 14:06:58 2008 +0200

    this is a FIXME

diff --git a/swfdec/swfdec_movie.c b/swfdec/swfdec_movie.c
index 3941228..396d5f1 100644
--- a/swfdec/swfdec_movie.c
+++ b/swfdec/swfdec_movie.c
@@ -720,7 +720,7 @@ swfdec_movie_get_operator_for_blend_mode (guint blend_mode)
     case SWFDEC_BLEND_MODE_INVERT:
     case SWFDEC_BLEND_MODE_OVERLAY:
     case SWFDEC_BLEND_MODE_HARDLIGHT:
-      SWFDEC_WARNING ("blend mode %u unimplemented in cairo", blend_mode);
+      SWFDEC_FIXME ("blend mode %u unimplemented in cairo", blend_mode);
       return CAIRO_OPERATOR_OVER;
     default:
       SWFDEC_WARNING ("invalid blend mode %u", blend_mode);
commit 778c2172e689663d58183230b14fac1c8476adca
Author: Benjamin Otte <otte at gnome.org>
Date:   Fri Sep 5 14:04:28 2008 +0200

    add a test for the recent fix

diff --git a/test/image/BitmapData-draw-movie-transformed-5.swf b/test/image/BitmapData-draw-movie-transformed-5.swf
new file mode 100644
index 0000000..a875ccf
Binary files /dev/null and b/test/image/BitmapData-draw-movie-transformed-5.swf differ
diff --git a/test/image/BitmapData-draw-movie-transformed-5.swf.png b/test/image/BitmapData-draw-movie-transformed-5.swf.png
new file mode 100644
index 0000000..df82671
Binary files /dev/null and b/test/image/BitmapData-draw-movie-transformed-5.swf.png differ
diff --git a/test/image/BitmapData-draw-movie-transformed-6.swf b/test/image/BitmapData-draw-movie-transformed-6.swf
new file mode 100644
index 0000000..527e7b3
Binary files /dev/null and b/test/image/BitmapData-draw-movie-transformed-6.swf differ
diff --git a/test/image/BitmapData-draw-movie-transformed-6.swf.png b/test/image/BitmapData-draw-movie-transformed-6.swf.png
new file mode 100644
index 0000000..9ae568b
Binary files /dev/null and b/test/image/BitmapData-draw-movie-transformed-6.swf.png differ
diff --git a/test/image/BitmapData-draw-movie-transformed-7.swf b/test/image/BitmapData-draw-movie-transformed-7.swf
new file mode 100644
index 0000000..0147474
Binary files /dev/null and b/test/image/BitmapData-draw-movie-transformed-7.swf differ
diff --git a/test/image/BitmapData-draw-movie-transformed-7.swf.png b/test/image/BitmapData-draw-movie-transformed-7.swf.png
new file mode 100644
index 0000000..e69bd9f
Binary files /dev/null and b/test/image/BitmapData-draw-movie-transformed-7.swf.png differ
diff --git a/test/image/BitmapData-draw-movie-transformed-8.swf b/test/image/BitmapData-draw-movie-transformed-8.swf
new file mode 100644
index 0000000..fd9fe40
Binary files /dev/null and b/test/image/BitmapData-draw-movie-transformed-8.swf differ
diff --git a/test/image/BitmapData-draw-movie-transformed-8.swf.png b/test/image/BitmapData-draw-movie-transformed-8.swf.png
new file mode 100644
index 0000000..003e878
Binary files /dev/null and b/test/image/BitmapData-draw-movie-transformed-8.swf.png differ
diff --git a/test/image/BitmapData-draw-movie-transformed.as b/test/image/BitmapData-draw-movie-transformed.as
new file mode 100644
index 0000000..b981ac5
--- /dev/null
+++ b/test/image/BitmapData-draw-movie-transformed.as
@@ -0,0 +1,22 @@
+// makeswf -v 7 -s 200x150 -r 1 -o BitmapData-draw-movie-transformed.swf BitmapData-draw-movie-transformed.as
+
+createEmptyMovieClip ("a", 0);
+
+a._x = 200;
+a._y = 150;
+a._xscale = -100;
+a._yscale = -100;
+
+m = new flash.geom.Matrix ();
+m.createGradientBox (50, 50, -1.57, 0, 70);
+a.beginGradientFill ("linear", [0xFF, 0xFF00], [100, 100], [0, 255], m);
+a.lineTo (0, 150);
+a.lineTo (200, 150);
+a.lineTo (200, 0);
+a.lineTo (0, 0);
+a.endFill ();
+
+bd = new flash.display.BitmapData (200, 150, true);
+bd.draw (a);
+a.removeMovieClip ();
+attachBitmap (bd, 0);
diff --git a/test/image/Makefile.am b/test/image/Makefile.am
index 5625314..00809b0 100644
--- a/test/image/Makefile.am
+++ b/test/image/Makefile.am
@@ -29,6 +29,15 @@ EXTRA_DIST = \
 	BitmapData-draw-8.swf \
 	BitmapData-draw-8.swf.png \
 	BitmapData-draw.as \
+	BitmapData-draw-movie-transformed-5.swf \
+	BitmapData-draw-movie-transformed-5.swf.png \
+	BitmapData-draw-movie-transformed-6.swf \
+	BitmapData-draw-movie-transformed-6.swf.png \
+	BitmapData-draw-movie-transformed-7.swf \
+	BitmapData-draw-movie-transformed-7.swf.png \
+	BitmapData-draw-movie-transformed-8.swf \
+	BitmapData-draw-movie-transformed-8.swf.png \
+	BitmapData-draw-movie-transformed.as \
 	README \
 	background-5.swf \
 	background-5.swf.png \
commit 3870bb0edb0aea35c9ab372c5a808fd0b4f915eb
Author: Benjamin Otte <otte at gnome.org>
Date:   Fri Sep 5 14:01:15 2008 +0200

    apply the movie's matrix before rendering in BitmapData.draw

diff --git a/swfdec/swfdec_bitmap_data.c b/swfdec/swfdec_bitmap_data.c
index 91d0234..2a64ce2 100644
--- a/swfdec/swfdec_bitmap_data.c
+++ b/swfdec/swfdec_bitmap_data.c
@@ -533,8 +533,11 @@ swfdec_bitmap_data_draw (SwfdecAsContext *cx, SwfdecAsObject *object,
       cairo_paint (cr);
     }
   } else if (SWFDEC_IS_MOVIE (o)) {
+    SwfdecMovie *movie = SWFDEC_MOVIE (o);
+    swfdec_movie_update (movie);
     cairo_scale (cr, 1.0 / SWFDEC_TWIPS_SCALE_FACTOR, 1.0 / SWFDEC_TWIPS_SCALE_FACTOR);
-    swfdec_movie_render (SWFDEC_MOVIE (o), cr, &ctrans);
+    cairo_transform (cr, &movie->matrix);
+    swfdec_movie_render (movie, cr, &ctrans);
   } else {
     SWFDEC_FIXME ("BitmapData.draw() with a %s?", G_OBJECT_TYPE_NAME (o));
   }


More information about the Swfdec-commits mailing list