Benjamin Otte
2007-Nov-20 22:15 UTC
[Swfdec] 7 commits - libswfdec/swfdec_movie.c libswfdec/swfdec_sprite_movie_as.c test/image
libswfdec/swfdec_movie.c | 4 + libswfdec/swfdec_sprite_movie_as.c | 7 ++ test/image/Makefile.am | 76 +++++++++++++++++++++++ test/image/clip-change-backward-5.swf |binary test/image/clip-change-backward-5.swf.png |binary test/image/clip-change-backward-6.swf |binary test/image/clip-change-backward-6.swf.png |binary test/image/clip-change-backward-7.swf |binary test/image/clip-change-backward-7.swf.png |binary test/image/clip-change-backward-8.swf |binary test/image/clip-change-backward-8.swf.png |binary test/image/clip-change-forward-5.swf |binary test/image/clip-change-forward-5.swf.png |binary test/image/clip-change-forward-6.swf |binary test/image/clip-change-forward-6.swf.png |binary test/image/clip-change-forward-7.swf |binary test/image/clip-change-forward-7.swf.png |binary test/image/clip-change-forward-8.swf |binary test/image/clip-change-forward-8.swf.png |binary test/image/clip-change-remove-5.swf |binary test/image/clip-change-remove-5.swf.png |binary test/image/clip-change-remove-6.swf |binary test/image/clip-change-remove-6.swf.png |binary test/image/clip-change-remove-7.swf |binary test/image/clip-change-remove-7.swf.png |binary test/image/clip-change-remove-8.swf |binary test/image/clip-change-remove-8.swf.png |binary test/image/clip-change-set-5.swf |binary test/image/clip-change-set-5.swf.png |binary test/image/clip-change-set-6.swf |binary test/image/clip-change-set-6.swf.png |binary test/image/clip-change-set-7.swf |binary test/image/clip-change-set-7.swf.png |binary test/image/clip-change-set-8.swf |binary test/image/clip-change-set-8.swf.png |binary test/image/clip-change.c | 75 ++++++++++++++++++++++ test/image/mask-affected-by-clip-5.swf |binary test/image/mask-affected-by-clip-5.swf.png |binary test/image/mask-affected-by-clip-6.swf |binary test/image/mask-affected-by-clip-6.swf.png |binary test/image/mask-affected-by-clip-7.swf |binary test/image/mask-affected-by-clip-7.swf.png |binary test/image/mask-affected-by-clip-8.swf |binary test/image/mask-affected-by-clip-8.swf.png |binary test/image/mask-affected-by-clip.c | 74 ++++++++++++++++++++++ test/image/mask-clip-mask-5.swf |binary test/image/mask-clip-mask-5.swf.png |binary test/image/mask-clip-mask-6.swf |binary test/image/mask-clip-mask-6.swf.png |binary test/image/mask-clip-mask-7.swf |binary test/image/mask-clip-mask-7.swf.png |binary test/image/mask-clip-mask-8.swf |binary test/image/mask-clip-mask-8.swf.png |binary test/image/mask-clip-maskee-5.swf |binary test/image/mask-clip-maskee-5.swf.png |binary test/image/mask-clip-maskee-6.swf |binary test/image/mask-clip-maskee-6.swf.png |binary test/image/mask-clip-maskee-7.swf |binary test/image/mask-clip-maskee-7.swf.png |binary test/image/mask-clip-maskee-8.swf |binary test/image/mask-clip-maskee-8.swf.png |binary test/image/mask-clip.c | 76 +++++++++++++++++++++++ test/image/mask-terminates-clip-mask-5.swf |binary test/image/mask-terminates-clip-mask-5.swf.png |binary test/image/mask-terminates-clip-mask-6.swf |binary test/image/mask-terminates-clip-mask-6.swf.png |binary test/image/mask-terminates-clip-mask-7.swf |binary test/image/mask-terminates-clip-mask-7.swf.png |binary test/image/mask-terminates-clip-mask-8.swf |binary test/image/mask-terminates-clip-mask-8.swf.png |binary test/image/mask-terminates-clip-maskee-5.swf |binary test/image/mask-terminates-clip-maskee-5.swf.png |binary test/image/mask-terminates-clip-maskee-6.swf |binary test/image/mask-terminates-clip-maskee-6.swf.png |binary test/image/mask-terminates-clip-maskee-7.swf |binary test/image/mask-terminates-clip-maskee-7.swf.png |binary test/image/mask-terminates-clip-maskee-8.swf |binary test/image/mask-terminates-clip-maskee-8.swf.png |binary test/image/mask-terminates-clip.c | 76 +++++++++++++++++++++++ 79 files changed, 388 insertions(+) New commits: commit ff69d658cc484bd99d8b3ce6c9b00965d7101854 Author: Benjamin Otte <otte at gnome.org> Date: Tue Nov 20 15:13:44 2007 +0100 test changing clip depth works as expected diff --git a/test/image/Makefile.am b/test/image/Makefile.am index 37e887c..9993ebc 100644 --- a/test/image/Makefile.am +++ b/test/image/Makefile.am @@ -8,6 +8,39 @@ image_LDFLAGS = $(SWFDEC_LIBS) $(CAIRO_LIBS) EXTRA_DIST = \ README \ bw.jpg \ + clip-change.c \ + clip-change-backward-5.swf \ + clip-change-backward-5.swf.png \ + clip-change-backward-6.swf \ + clip-change-backward-6.swf.png \ + clip-change-backward-7.swf \ + clip-change-backward-7.swf.png \ + clip-change-backward-8.swf \ + clip-change-backward-8.swf.png \ + clip-change-forward-5.swf \ + clip-change-forward-5.swf.png \ + clip-change-forward-6.swf \ + clip-change-forward-6.swf.png \ + clip-change-forward-7.swf \ + clip-change-forward-7.swf.png \ + clip-change-forward-8.swf \ + clip-change-forward-8.swf.png \ + clip-change-remove-5.swf \ + clip-change-remove-5.swf.png \ + clip-change-remove-6.swf \ + clip-change-remove-6.swf.png \ + clip-change-remove-7.swf \ + clip-change-remove-7.swf.png \ + clip-change-remove-8.swf \ + clip-change-remove-8.swf.png \ + clip-change-set-5.swf \ + clip-change-set-5.swf.png \ + clip-change-set-6.swf \ + clip-change-set-6.swf.png \ + clip-change-set-7.swf \ + clip-change-set-7.swf.png \ + clip-change-set-8.swf \ + clip-change-set-8.swf.png \ clip-transparent.swf \ clip-transparent.swf.png \ clip-transparent.xml \ diff --git a/test/image/clip-change-backward-5.swf b/test/image/clip-change-backward-5.swf new file mode 100644 index 0000000..7128c6d Binary files /dev/null and b/test/image/clip-change-backward-5.swf differ diff --git a/test/image/clip-change-backward-5.swf.png b/test/image/clip-change-backward-5.swf.png new file mode 100644 index 0000000..bb40989 Binary files /dev/null and b/test/image/clip-change-backward-5.swf.png differ diff --git a/test/image/clip-change-backward-6.swf b/test/image/clip-change-backward-6.swf new file mode 100644 index 0000000..b0af9e3 Binary files /dev/null and b/test/image/clip-change-backward-6.swf differ diff --git a/test/image/clip-change-backward-6.swf.png b/test/image/clip-change-backward-6.swf.png new file mode 100644 index 0000000..c217c9e Binary files /dev/null and b/test/image/clip-change-backward-6.swf.png differ diff --git a/test/image/clip-change-backward-7.swf b/test/image/clip-change-backward-7.swf new file mode 100644 index 0000000..0d7f60f Binary files /dev/null and b/test/image/clip-change-backward-7.swf differ diff --git a/test/image/clip-change-backward-7.swf.png b/test/image/clip-change-backward-7.swf.png new file mode 100644 index 0000000..d746e2f Binary files /dev/null and b/test/image/clip-change-backward-7.swf.png differ diff --git a/test/image/clip-change-backward-8.swf b/test/image/clip-change-backward-8.swf new file mode 100644 index 0000000..da6d318 Binary files /dev/null and b/test/image/clip-change-backward-8.swf differ diff --git a/test/image/clip-change-backward-8.swf.png b/test/image/clip-change-backward-8.swf.png new file mode 100644 index 0000000..b79e227 Binary files /dev/null and b/test/image/clip-change-backward-8.swf.png differ diff --git a/test/image/clip-change-forward-5.swf b/test/image/clip-change-forward-5.swf new file mode 100644 index 0000000..5340404 Binary files /dev/null and b/test/image/clip-change-forward-5.swf differ diff --git a/test/image/clip-change-forward-5.swf.png b/test/image/clip-change-forward-5.swf.png new file mode 100644 index 0000000..1efb023 Binary files /dev/null and b/test/image/clip-change-forward-5.swf.png differ diff --git a/test/image/clip-change-forward-6.swf b/test/image/clip-change-forward-6.swf new file mode 100644 index 0000000..3652a08 Binary files /dev/null and b/test/image/clip-change-forward-6.swf differ diff --git a/test/image/clip-change-forward-6.swf.png b/test/image/clip-change-forward-6.swf.png new file mode 100644 index 0000000..b479443 Binary files /dev/null and b/test/image/clip-change-forward-6.swf.png differ diff --git a/test/image/clip-change-forward-7.swf b/test/image/clip-change-forward-7.swf new file mode 100644 index 0000000..d0afe67 Binary files /dev/null and b/test/image/clip-change-forward-7.swf differ diff --git a/test/image/clip-change-forward-7.swf.png b/test/image/clip-change-forward-7.swf.png new file mode 100644 index 0000000..eb777d4 Binary files /dev/null and b/test/image/clip-change-forward-7.swf.png differ diff --git a/test/image/clip-change-forward-8.swf b/test/image/clip-change-forward-8.swf new file mode 100644 index 0000000..b20a5b7 Binary files /dev/null and b/test/image/clip-change-forward-8.swf differ diff --git a/test/image/clip-change-forward-8.swf.png b/test/image/clip-change-forward-8.swf.png new file mode 100644 index 0000000..9c5c666 Binary files /dev/null and b/test/image/clip-change-forward-8.swf.png differ diff --git a/test/image/clip-change-remove-5.swf b/test/image/clip-change-remove-5.swf new file mode 100644 index 0000000..8a7a63f Binary files /dev/null and b/test/image/clip-change-remove-5.swf differ diff --git a/test/image/clip-change-remove-5.swf.png b/test/image/clip-change-remove-5.swf.png new file mode 100644 index 0000000..7f31154 Binary files /dev/null and b/test/image/clip-change-remove-5.swf.png differ diff --git a/test/image/clip-change-remove-6.swf b/test/image/clip-change-remove-6.swf new file mode 100644 index 0000000..2eb8e3e Binary files /dev/null and b/test/image/clip-change-remove-6.swf differ diff --git a/test/image/clip-change-remove-6.swf.png b/test/image/clip-change-remove-6.swf.png new file mode 100644 index 0000000..acc5d24 Binary files /dev/null and b/test/image/clip-change-remove-6.swf.png differ diff --git a/test/image/clip-change-remove-7.swf b/test/image/clip-change-remove-7.swf new file mode 100644 index 0000000..264c9c9 Binary files /dev/null and b/test/image/clip-change-remove-7.swf differ diff --git a/test/image/clip-change-remove-7.swf.png b/test/image/clip-change-remove-7.swf.png new file mode 100644 index 0000000..b726a19 Binary files /dev/null and b/test/image/clip-change-remove-7.swf.png differ diff --git a/test/image/clip-change-remove-8.swf b/test/image/clip-change-remove-8.swf new file mode 100644 index 0000000..19f8831 Binary files /dev/null and b/test/image/clip-change-remove-8.swf differ diff --git a/test/image/clip-change-remove-8.swf.png b/test/image/clip-change-remove-8.swf.png new file mode 100644 index 0000000..68636e8 Binary files /dev/null and b/test/image/clip-change-remove-8.swf.png differ diff --git a/test/image/clip-change-set-5.swf b/test/image/clip-change-set-5.swf new file mode 100644 index 0000000..204a57a Binary files /dev/null and b/test/image/clip-change-set-5.swf differ diff --git a/test/image/clip-change-set-5.swf.png b/test/image/clip-change-set-5.swf.png new file mode 100644 index 0000000..f28aef6 Binary files /dev/null and b/test/image/clip-change-set-5.swf.png differ diff --git a/test/image/clip-change-set-6.swf b/test/image/clip-change-set-6.swf new file mode 100644 index 0000000..6a34bbc Binary files /dev/null and b/test/image/clip-change-set-6.swf differ diff --git a/test/image/clip-change-set-6.swf.png b/test/image/clip-change-set-6.swf.png new file mode 100644 index 0000000..7338cc3 Binary files /dev/null and b/test/image/clip-change-set-6.swf.png differ diff --git a/test/image/clip-change-set-7.swf b/test/image/clip-change-set-7.swf new file mode 100644 index 0000000..792f874 Binary files /dev/null and b/test/image/clip-change-set-7.swf differ diff --git a/test/image/clip-change-set-7.swf.png b/test/image/clip-change-set-7.swf.png new file mode 100644 index 0000000..8295ce4 Binary files /dev/null and b/test/image/clip-change-set-7.swf.png differ diff --git a/test/image/clip-change-set-8.swf b/test/image/clip-change-set-8.swf new file mode 100644 index 0000000..bacc051 Binary files /dev/null and b/test/image/clip-change-set-8.swf differ diff --git a/test/image/clip-change-set-8.swf.png b/test/image/clip-change-set-8.swf.png new file mode 100644 index 0000000..ffb33bb Binary files /dev/null and b/test/image/clip-change-set-8.swf.png differ diff --git a/test/image/clip-change.c b/test/image/clip-change.c new file mode 100644 index 0000000..9e7da16 --- /dev/null +++ b/test/image/clip-change.c @@ -0,0 +1,75 @@ +/* gcc `pkg-config --libs --cflags libming` clip-change.c -o clip-change && ./clip-change + */ + +#include <ming.h> + +static SWFBlock +get_rectangle (int r, int g, int b) +{ + SWFShape shape; + SWFFillStyle fill; + + shape = newSWFShape (); + fill = SWFShape_addSolidFillStyle (shape, r, g, b, 255); + SWFShape_setRightFillStyle (shape, fill); + SWFShape_drawLineTo (shape, 100, 0); + SWFShape_drawLineTo (shape, 100, 100); + SWFShape_drawLineTo (shape, 0, 100); + SWFShape_drawLineTo (shape, 0, 0); + + return (SWFBlock) shape; +} + +static void +do_movie (int version, int reverse) +{ + const char *suffixes[4] = { "forward", "backward", "remove", "set" }; + char name[100]; + SWFMovie movie; + SWFDisplayItem item, clip; + + movie = newSWFMovieWithVersion (version); + SWFMovie_setRate (movie, 1); + SWFMovie_setDimension (movie, 200, 150); + + clip = SWFMovie_add (movie, get_rectangle (255, 0, 0)); + SWFDisplayItem_setDepth (clip, 0); + if (reverse != 3) + SWFDisplayItem_setMaskLevel (clip, (reverse & 1) ? 3 : 2); + + item = SWFMovie_add (movie, get_rectangle (0, 255, 0)); + SWFDisplayItem_moveTo (item, 0, 50); + SWFDisplayItem_setDepth (item, 2); + + item = SWFMovie_add (movie, get_rectangle (0, 0, 255)); + SWFDisplayItem_moveTo (item, 50, 0); + SWFDisplayItem_setDepth (item, 3); + + SWFMovie_nextFrame (movie); + if (reverse != 2) + SWFDisplayItem_setMaskLevel (clip, (reverse & 1) ? 2 : 3); + else + SWFDisplayItem_setMaskLevel (clip, 0); + SWFMovie_nextFrame (movie); + + sprintf (name, "clip-change-%s-%d.swf", suffixes[reverse], version); + SWFMovie_save (movie, name); +} + +int +main (int argc, char **argv) +{ + int i; + + if (Ming_init ()) + return 1; + + for (i = 8; i >= 5; i--) { + do_movie (i, 0); + do_movie (i, 1); + do_movie (i, 2); + do_movie (i, 3); + } + + return 0; +} commit 0e35e7b5a43d174629969343435fa2f207c46d51 Author: Benjamin Otte <otte at gnome.org> Date: Tue Nov 20 15:02:56 2007 +0100 test that clip depths get terminated correctly diff --git a/test/image/Makefile.am b/test/image/Makefile.am index 2f60523..37e887c 100644 --- a/test/image/Makefile.am +++ b/test/image/Makefile.am @@ -128,6 +128,23 @@ EXTRA_DIST = \ mask-remove-clip-7.swf.png \ mask-remove-clip-8.swf \ mask-remove-clip-8.swf.png \ + mask-terminates-clip.c \ + mask-terminates-clip-mask-5.swf \ + mask-terminates-clip-mask-5.swf.png \ + mask-terminates-clip-mask-6.swf \ + mask-terminates-clip-mask-6.swf.png \ + mask-terminates-clip-mask-7.swf \ + mask-terminates-clip-mask-7.swf.png \ + mask-terminates-clip-mask-8.swf \ + mask-terminates-clip-mask-8.swf.png \ + mask-terminates-clip-maskee-5.swf \ + mask-terminates-clip-maskee-5.swf.png \ + mask-terminates-clip-maskee-6.swf \ + mask-terminates-clip-maskee-6.swf.png \ + mask-terminates-clip-maskee-7.swf \ + mask-terminates-clip-maskee-7.swf.png \ + mask-terminates-clip-maskee-8.swf \ + mask-terminates-clip-maskee-8.swf.png \ mask-textfield.as \ mask-textfield-5.swf \ mask-textfield-5.swf.png \ diff --git a/test/image/mask-terminates-clip-mask-5.swf b/test/image/mask-terminates-clip-mask-5.swf new file mode 100644 index 0000000..5002326 Binary files /dev/null and b/test/image/mask-terminates-clip-mask-5.swf differ diff --git a/test/image/mask-terminates-clip-mask-5.swf.png b/test/image/mask-terminates-clip-mask-5.swf.png new file mode 100644 index 0000000..3ce7aab Binary files /dev/null and b/test/image/mask-terminates-clip-mask-5.swf.png differ diff --git a/test/image/mask-terminates-clip-mask-6.swf b/test/image/mask-terminates-clip-mask-6.swf new file mode 100644 index 0000000..d8a9dbb Binary files /dev/null and b/test/image/mask-terminates-clip-mask-6.swf differ diff --git a/test/image/mask-terminates-clip-mask-6.swf.png b/test/image/mask-terminates-clip-mask-6.swf.png new file mode 100644 index 0000000..779e155 Binary files /dev/null and b/test/image/mask-terminates-clip-mask-6.swf.png differ diff --git a/test/image/mask-terminates-clip-mask-7.swf b/test/image/mask-terminates-clip-mask-7.swf new file mode 100644 index 0000000..0ffede5 Binary files /dev/null and b/test/image/mask-terminates-clip-mask-7.swf differ diff --git a/test/image/mask-terminates-clip-mask-7.swf.png b/test/image/mask-terminates-clip-mask-7.swf.png new file mode 100644 index 0000000..b3c4017 Binary files /dev/null and b/test/image/mask-terminates-clip-mask-7.swf.png differ diff --git a/test/image/mask-terminates-clip-mask-8.swf b/test/image/mask-terminates-clip-mask-8.swf new file mode 100644 index 0000000..acf49a1 Binary files /dev/null and b/test/image/mask-terminates-clip-mask-8.swf differ diff --git a/test/image/mask-terminates-clip-mask-8.swf.png b/test/image/mask-terminates-clip-mask-8.swf.png new file mode 100644 index 0000000..b26ba7b Binary files /dev/null and b/test/image/mask-terminates-clip-mask-8.swf.png differ diff --git a/test/image/mask-terminates-clip-maskee-5.swf b/test/image/mask-terminates-clip-maskee-5.swf new file mode 100644 index 0000000..003ea45 Binary files /dev/null and b/test/image/mask-terminates-clip-maskee-5.swf differ diff --git a/test/image/mask-terminates-clip-maskee-5.swf.png b/test/image/mask-terminates-clip-maskee-5.swf.png new file mode 100644 index 0000000..be6d409 Binary files /dev/null and b/test/image/mask-terminates-clip-maskee-5.swf.png differ diff --git a/test/image/mask-terminates-clip-maskee-6.swf b/test/image/mask-terminates-clip-maskee-6.swf new file mode 100644 index 0000000..5f54552 Binary files /dev/null and b/test/image/mask-terminates-clip-maskee-6.swf differ diff --git a/test/image/mask-terminates-clip-maskee-6.swf.png b/test/image/mask-terminates-clip-maskee-6.swf.png new file mode 100644 index 0000000..081c0a9 Binary files /dev/null and b/test/image/mask-terminates-clip-maskee-6.swf.png differ diff --git a/test/image/mask-terminates-clip-maskee-7.swf b/test/image/mask-terminates-clip-maskee-7.swf new file mode 100644 index 0000000..58f13c2 Binary files /dev/null and b/test/image/mask-terminates-clip-maskee-7.swf differ diff --git a/test/image/mask-terminates-clip-maskee-7.swf.png b/test/image/mask-terminates-clip-maskee-7.swf.png new file mode 100644 index 0000000..a1696d2 Binary files /dev/null and b/test/image/mask-terminates-clip-maskee-7.swf.png differ diff --git a/test/image/mask-terminates-clip-maskee-8.swf b/test/image/mask-terminates-clip-maskee-8.swf new file mode 100644 index 0000000..190b2f9 Binary files /dev/null and b/test/image/mask-terminates-clip-maskee-8.swf differ diff --git a/test/image/mask-terminates-clip-maskee-8.swf.png b/test/image/mask-terminates-clip-maskee-8.swf.png new file mode 100644 index 0000000..a90bedd Binary files /dev/null and b/test/image/mask-terminates-clip-maskee-8.swf.png differ diff --git a/test/image/mask-terminates-clip.c b/test/image/mask-terminates-clip.c new file mode 100644 index 0000000..c9bf074 --- /dev/null +++ b/test/image/mask-terminates-clip.c @@ -0,0 +1,76 @@ +/* gcc `pkg-config --libs --cflags libming` mask-terminates-clip.c -o mask-terminates-clip && ./mask-terminates-clip + */ + +#include <ming.h> + +static SWFBlock +get_rectangle (int r, int g, int b) +{ + SWFMovieClip clip; + SWFShape shape; + SWFFillStyle fill; + + clip = newSWFMovieClip (); + shape = newSWFShape (); + fill = SWFShape_addSolidFillStyle (shape, r, g, b, 255); + SWFShape_setRightFillStyle (shape, fill); + SWFShape_drawLineTo (shape, 100, 0); + SWFShape_drawLineTo (shape, 100, 100); + SWFShape_drawLineTo (shape, 0, 100); + SWFShape_drawLineTo (shape, 0, 0); + + SWFMovieClip_add (clip, (SWFBlock) shape); + SWFMovieClip_nextFrame (clip); + return (SWFBlock) clip; +} + +static void +do_movie (int version, int reverse) +{ + char name[100]; + SWFMovie movie; + SWFDisplayItem item; + + movie = newSWFMovieWithVersion (version); + SWFMovie_setRate (movie, 1); + SWFMovie_setDimension (movie, 200, 150); + + item = SWFMovie_add (movie, get_rectangle (255, 0, 0)); + SWFDisplayItem_setDepth (item, 0); + SWFDisplayItem_setName (item, "a"); + SWFDisplayItem_setMaskLevel (item, 2); + + item = SWFMovie_add (movie, get_rectangle (0, 255, 0)); + SWFDisplayItem_moveTo (item, 0, 50); + SWFDisplayItem_setDepth (item, 1); + SWFDisplayItem_setName (item, "b"); + + item = SWFMovie_add (movie, get_rectangle (0, 0, 255)); + SWFDisplayItem_moveTo (item, 50, 0); + SWFDisplayItem_setDepth (item, 3); + SWFDisplayItem_setName (item, "c"); + + SWFMovie_add (movie, (SWFBlock) newSWFAction ( + reverse ? "a.setMask (c); a.setMask (null);" : "c.setMask (a); c.setMask (null);" + )); + SWFMovie_nextFrame (movie); + + sprintf (name, "mask-terminates-clip-%s-%d.swf", reverse ? "mask" : "maskee", version); + SWFMovie_save (movie, name); +} + +int +main (int argc, char **argv) +{ + int i; + + if (Ming_init ()) + return 1; + + for (i = 8; i >= 5; i--) { + do_movie (i, 0); + do_movie (i, 1); + } + + return 0; +} commit 8edfa12eacffccd4209e0f97bdb4c42e059c03a4 Author: Benjamin Otte <otte at gnome.org> Date: Tue Nov 20 15:00:45 2007 +0100 also unset clip depth of mask, not just of the masked movie diff --git a/libswfdec/swfdec_sprite_movie_as.c b/libswfdec/swfdec_sprite_movie_as.c index 49cc39f..549661c 100644 --- a/libswfdec/swfdec_sprite_movie_as.c +++ b/libswfdec/swfdec_sprite_movie_as.c @@ -564,6 +564,13 @@ swfdec_sprite_movie_setMask (SwfdecAsContext *cx, SwfdecAsObject *object, mask->masked_by = NULL; mask->mask_of = movie; swfdec_movie_invalidate (mask); + if (mask->clip_depth) { + g_assert (mask->parent); + swfdec_movie_invalidate (mask->parent); + mask->clip_depth = 0; + } else { + swfdec_movie_invalidate (mask); + } } } commit f5ebe8fcf28fb651881cefabaf0b09eaa56a6773 Author: Benjamin Otte <otte at gnome.org> Date: Tue Nov 20 14:57:21 2007 +0100 update to show the differences better diff --git a/test/image/mask-clip-mask-5.swf b/test/image/mask-clip-mask-5.swf index 8704afc..ed39179 100644 Binary files a/test/image/mask-clip-mask-5.swf and b/test/image/mask-clip-mask-5.swf differ diff --git a/test/image/mask-clip-mask-5.swf.png b/test/image/mask-clip-mask-5.swf.png index 8d0b3cd..ed58510 100644 Binary files a/test/image/mask-clip-mask-5.swf.png and b/test/image/mask-clip-mask-5.swf.png differ diff --git a/test/image/mask-clip-mask-6.swf b/test/image/mask-clip-mask-6.swf index 589c342..ea8dbd7 100644 Binary files a/test/image/mask-clip-mask-6.swf and b/test/image/mask-clip-mask-6.swf differ diff --git a/test/image/mask-clip-mask-6.swf.png b/test/image/mask-clip-mask-6.swf.png index 9c90f63..f83d475 100644 Binary files a/test/image/mask-clip-mask-6.swf.png and b/test/image/mask-clip-mask-6.swf.png differ diff --git a/test/image/mask-clip-mask-7.swf b/test/image/mask-clip-mask-7.swf index bce3f46..256116d 100644 Binary files a/test/image/mask-clip-mask-7.swf and b/test/image/mask-clip-mask-7.swf differ diff --git a/test/image/mask-clip-mask-7.swf.png b/test/image/mask-clip-mask-7.swf.png index e0c0804..b47d602 100644 Binary files a/test/image/mask-clip-mask-7.swf.png and b/test/image/mask-clip-mask-7.swf.png differ diff --git a/test/image/mask-clip-mask-8.swf b/test/image/mask-clip-mask-8.swf index 5bca159..0553fcd 100644 Binary files a/test/image/mask-clip-mask-8.swf and b/test/image/mask-clip-mask-8.swf differ diff --git a/test/image/mask-clip-mask-8.swf.png b/test/image/mask-clip-mask-8.swf.png index 8234a76..89a993c 100644 Binary files a/test/image/mask-clip-mask-8.swf.png and b/test/image/mask-clip-mask-8.swf.png differ diff --git a/test/image/mask-clip-maskee-5.swf b/test/image/mask-clip-maskee-5.swf index 23b7a21..379e7b6 100644 Binary files a/test/image/mask-clip-maskee-5.swf and b/test/image/mask-clip-maskee-5.swf differ diff --git a/test/image/mask-clip-maskee-5.swf.png b/test/image/mask-clip-maskee-5.swf.png index 1e79316..c2a759f 100644 Binary files a/test/image/mask-clip-maskee-5.swf.png and b/test/image/mask-clip-maskee-5.swf.png differ diff --git a/test/image/mask-clip-maskee-6.swf b/test/image/mask-clip-maskee-6.swf index 0196b6c..35490be 100644 Binary files a/test/image/mask-clip-maskee-6.swf and b/test/image/mask-clip-maskee-6.swf differ diff --git a/test/image/mask-clip-maskee-6.swf.png b/test/image/mask-clip-maskee-6.swf.png index f0db8e4..f1b6cc7 100644 Binary files a/test/image/mask-clip-maskee-6.swf.png and b/test/image/mask-clip-maskee-6.swf.png differ diff --git a/test/image/mask-clip-maskee-7.swf b/test/image/mask-clip-maskee-7.swf index e2b0aa7..f011e50 100644 Binary files a/test/image/mask-clip-maskee-7.swf and b/test/image/mask-clip-maskee-7.swf differ diff --git a/test/image/mask-clip-maskee-7.swf.png b/test/image/mask-clip-maskee-7.swf.png index 6a41da6..b202326 100644 Binary files a/test/image/mask-clip-maskee-7.swf.png and b/test/image/mask-clip-maskee-7.swf.png differ diff --git a/test/image/mask-clip-maskee-8.swf b/test/image/mask-clip-maskee-8.swf index 6f28387..760174a 100644 Binary files a/test/image/mask-clip-maskee-8.swf and b/test/image/mask-clip-maskee-8.swf differ diff --git a/test/image/mask-clip-maskee-8.swf.png b/test/image/mask-clip-maskee-8.swf.png index c3aa7a4..d4c5c0e 100644 Binary files a/test/image/mask-clip-maskee-8.swf.png and b/test/image/mask-clip-maskee-8.swf.png differ diff --git a/test/image/mask-clip.c b/test/image/mask-clip.c index 5bea68e..44cf5a0 100644 --- a/test/image/mask-clip.c +++ b/test/image/mask-clip.c @@ -41,11 +41,11 @@ do_movie (int version, int reverse) SWFDisplayItem_setMaskLevel (item, 2); item = SWFMovie_add (movie, get_rectangle (0, 255, 0)); - SWFDisplayItem_moveTo (item, 50, 0); + SWFDisplayItem_moveTo (item, 0, 50); SWFDisplayItem_setDepth (item, 1); SWFDisplayItem_setName (item, "b"); - item = SWFMovie_add (movie, get_rectangle (0, 255, 0)); + item = SWFMovie_add (movie, get_rectangle (0, 0, 255)); SWFDisplayItem_moveTo (item, 50, 0); SWFDisplayItem_setDepth (item, 3); SWFDisplayItem_setName (item, "c"); commit 75eae9e6bb75b08a64352bf00c3e3c829b9add91 Author: Benjamin Otte <otte at gnome.org> Date: Tue Nov 20 14:53:34 2007 +0100 and another test that lay here diff --git a/test/image/Makefile.am b/test/image/Makefile.am index be9b413..2f60523 100644 --- a/test/image/Makefile.am +++ b/test/image/Makefile.am @@ -93,6 +93,23 @@ EXTRA_DIST = \ mask-and-clip-8-8.swf.png \ mask-and-clip-9-8.swf \ mask-and-clip-9-8.swf.png \ + mask-clip.c \ + mask-clip-mask-5.swf \ + mask-clip-mask-5.swf.png \ + mask-clip-mask-6.swf \ + mask-clip-mask-6.swf.png \ + mask-clip-mask-7.swf \ + mask-clip-mask-7.swf.png \ + mask-clip-mask-8.swf \ + mask-clip-mask-8.swf.png \ + mask-clip-maskee-5.swf \ + mask-clip-maskee-5.swf.png \ + mask-clip-maskee-6.swf \ + mask-clip-maskee-6.swf.png \ + mask-clip-maskee-7.swf \ + mask-clip-maskee-7.swf.png \ + mask-clip-maskee-8.swf \ + mask-clip-maskee-8.swf.png \ mask-different-parent.as \ mask-different-parent-5.swf \ mask-different-parent-5.swf.png \ diff --git a/test/image/mask-clip-mask-5.swf b/test/image/mask-clip-mask-5.swf new file mode 100644 index 0000000..8704afc Binary files /dev/null and b/test/image/mask-clip-mask-5.swf differ diff --git a/test/image/mask-clip-mask-5.swf.png b/test/image/mask-clip-mask-5.swf.png new file mode 100644 index 0000000..8d0b3cd Binary files /dev/null and b/test/image/mask-clip-mask-5.swf.png differ diff --git a/test/image/mask-clip-mask-6.swf b/test/image/mask-clip-mask-6.swf new file mode 100644 index 0000000..589c342 Binary files /dev/null and b/test/image/mask-clip-mask-6.swf differ diff --git a/test/image/mask-clip-mask-6.swf.png b/test/image/mask-clip-mask-6.swf.png new file mode 100644 index 0000000..9c90f63 Binary files /dev/null and b/test/image/mask-clip-mask-6.swf.png differ diff --git a/test/image/mask-clip-mask-7.swf b/test/image/mask-clip-mask-7.swf new file mode 100644 index 0000000..bce3f46 Binary files /dev/null and b/test/image/mask-clip-mask-7.swf differ diff --git a/test/image/mask-clip-mask-7.swf.png b/test/image/mask-clip-mask-7.swf.png new file mode 100644 index 0000000..e0c0804 Binary files /dev/null and b/test/image/mask-clip-mask-7.swf.png differ diff --git a/test/image/mask-clip-mask-8.swf b/test/image/mask-clip-mask-8.swf new file mode 100644 index 0000000..5bca159 Binary files /dev/null and b/test/image/mask-clip-mask-8.swf differ diff --git a/test/image/mask-clip-mask-8.swf.png b/test/image/mask-clip-mask-8.swf.png new file mode 100644 index 0000000..8234a76 Binary files /dev/null and b/test/image/mask-clip-mask-8.swf.png differ diff --git a/test/image/mask-clip-maskee-5.swf b/test/image/mask-clip-maskee-5.swf new file mode 100644 index 0000000..23b7a21 Binary files /dev/null and b/test/image/mask-clip-maskee-5.swf differ diff --git a/test/image/mask-clip-maskee-5.swf.png b/test/image/mask-clip-maskee-5.swf.png new file mode 100644 index 0000000..1e79316 Binary files /dev/null and b/test/image/mask-clip-maskee-5.swf.png differ diff --git a/test/image/mask-clip-maskee-6.swf b/test/image/mask-clip-maskee-6.swf new file mode 100644 index 0000000..0196b6c Binary files /dev/null and b/test/image/mask-clip-maskee-6.swf differ diff --git a/test/image/mask-clip-maskee-6.swf.png b/test/image/mask-clip-maskee-6.swf.png new file mode 100644 index 0000000..f0db8e4 Binary files /dev/null and b/test/image/mask-clip-maskee-6.swf.png differ diff --git a/test/image/mask-clip-maskee-7.swf b/test/image/mask-clip-maskee-7.swf new file mode 100644 index 0000000..e2b0aa7 Binary files /dev/null and b/test/image/mask-clip-maskee-7.swf differ diff --git a/test/image/mask-clip-maskee-7.swf.png b/test/image/mask-clip-maskee-7.swf.png new file mode 100644 index 0000000..6a41da6 Binary files /dev/null and b/test/image/mask-clip-maskee-7.swf.png differ diff --git a/test/image/mask-clip-maskee-8.swf b/test/image/mask-clip-maskee-8.swf new file mode 100644 index 0000000..6f28387 Binary files /dev/null and b/test/image/mask-clip-maskee-8.swf differ diff --git a/test/image/mask-clip-maskee-8.swf.png b/test/image/mask-clip-maskee-8.swf.png new file mode 100644 index 0000000..c3aa7a4 Binary files /dev/null and b/test/image/mask-clip-maskee-8.swf.png differ diff --git a/test/image/mask-clip.c b/test/image/mask-clip.c new file mode 100644 index 0000000..5bea68e --- /dev/null +++ b/test/image/mask-clip.c @@ -0,0 +1,76 @@ +/* gcc `pkg-config --libs --cflags libming` mask-clip.c -o mask-clip && ./mask-clip + */ + +#include <ming.h> + +static SWFBlock +get_rectangle (int r, int g, int b) +{ + SWFMovieClip clip; + SWFShape shape; + SWFFillStyle fill; + + clip = newSWFMovieClip (); + shape = newSWFShape (); + fill = SWFShape_addSolidFillStyle (shape, r, g, b, 255); + SWFShape_setRightFillStyle (shape, fill); + SWFShape_drawLineTo (shape, 100, 0); + SWFShape_drawLineTo (shape, 100, 100); + SWFShape_drawLineTo (shape, 0, 100); + SWFShape_drawLineTo (shape, 0, 0); + + SWFMovieClip_add (clip, (SWFBlock) shape); + SWFMovieClip_nextFrame (clip); + return (SWFBlock) clip; +} + +static void +do_movie (int version, int reverse) +{ + char name[100]; + SWFMovie movie; + SWFDisplayItem item; + + movie = newSWFMovieWithVersion (version); + SWFMovie_setRate (movie, 1); + SWFMovie_setDimension (movie, 200, 150); + + item = SWFMovie_add (movie, get_rectangle (255, 0, 0)); + SWFDisplayItem_setDepth (item, 0); + SWFDisplayItem_setName (item, "a"); + SWFDisplayItem_setMaskLevel (item, 2); + + item = SWFMovie_add (movie, get_rectangle (0, 255, 0)); + SWFDisplayItem_moveTo (item, 50, 0); + SWFDisplayItem_setDepth (item, 1); + SWFDisplayItem_setName (item, "b"); + + item = SWFMovie_add (movie, get_rectangle (0, 255, 0)); + SWFDisplayItem_moveTo (item, 50, 0); + SWFDisplayItem_setDepth (item, 3); + SWFDisplayItem_setName (item, "c"); + + SWFMovie_add (movie, (SWFBlock) newSWFAction ( + reverse ? "c.setMask (b);" : "b.setMask (c);" + )); + SWFMovie_nextFrame (movie); + + sprintf (name, "mask-clip-%s-%d.swf", reverse ? "mask" : "maskee", version); + SWFMovie_save (movie, name); +} + +int +main (int argc, char **argv) +{ + int i; + + if (Ming_init ()) + return 1; + + for (i = 8; i >= 5; i--) { + do_movie (i, 0); + do_movie (i, 1); + } + + return 0; +} commit d32cb706d27af3ba09d3c85c69e1437030cd8661 Author: Benjamin Otte <otte at gnome.org> Date: Tue Nov 20 14:46:49 2007 +0100 add another test diff --git a/test/image/Makefile.am b/test/image/Makefile.am index bf4e192..be9b413 100644 --- a/test/image/Makefile.am +++ b/test/image/Makefile.am @@ -51,6 +51,15 @@ EXTRA_DIST = \ load-jpeg-7.swf.png \ load-jpeg-8.swf \ load-jpeg-8.swf.png \ + mask-affected-by-clip.c \ + mask-affected-by-clip-5.swf \ + mask-affected-by-clip-5.swf.png \ + mask-affected-by-clip-6.swf \ + mask-affected-by-clip-6.swf.png \ + mask-affected-by-clip-7.swf \ + mask-affected-by-clip-7.swf.png \ + mask-affected-by-clip-8.swf \ + mask-affected-by-clip-8.swf.png \ mask-and-clip.c \ mask-and-clip-0-8.swf \ mask-and-clip-0-8.swf.png \ diff --git a/test/image/mask-affected-by-clip-5.swf b/test/image/mask-affected-by-clip-5.swf new file mode 100644 index 0000000..b109c07 Binary files /dev/null and b/test/image/mask-affected-by-clip-5.swf differ diff --git a/test/image/mask-affected-by-clip-5.swf.png b/test/image/mask-affected-by-clip-5.swf.png new file mode 100644 index 0000000..9a47f72 Binary files /dev/null and b/test/image/mask-affected-by-clip-5.swf.png differ diff --git a/test/image/mask-affected-by-clip-6.swf b/test/image/mask-affected-by-clip-6.swf new file mode 100644 index 0000000..d4d0f87 Binary files /dev/null and b/test/image/mask-affected-by-clip-6.swf differ diff --git a/test/image/mask-affected-by-clip-6.swf.png b/test/image/mask-affected-by-clip-6.swf.png new file mode 100644 index 0000000..3094937 Binary files /dev/null and b/test/image/mask-affected-by-clip-6.swf.png differ diff --git a/test/image/mask-affected-by-clip-7.swf b/test/image/mask-affected-by-clip-7.swf new file mode 100644 index 0000000..da356c0 Binary files /dev/null and b/test/image/mask-affected-by-clip-7.swf differ diff --git a/test/image/mask-affected-by-clip-7.swf.png b/test/image/mask-affected-by-clip-7.swf.png new file mode 100644 index 0000000..0277bd5 Binary files /dev/null and b/test/image/mask-affected-by-clip-7.swf.png differ diff --git a/test/image/mask-affected-by-clip-8.swf b/test/image/mask-affected-by-clip-8.swf new file mode 100644 index 0000000..7d40ed6 Binary files /dev/null and b/test/image/mask-affected-by-clip-8.swf differ diff --git a/test/image/mask-affected-by-clip-8.swf.png b/test/image/mask-affected-by-clip-8.swf.png new file mode 100644 index 0000000..1f4d160 Binary files /dev/null and b/test/image/mask-affected-by-clip-8.swf.png differ diff --git a/test/image/mask-affected-by-clip.c b/test/image/mask-affected-by-clip.c new file mode 100644 index 0000000..45cd0c3 --- /dev/null +++ b/test/image/mask-affected-by-clip.c @@ -0,0 +1,74 @@ +/* gcc `pkg-config --libs --cflags libming` mask-affected-by-clip.c -o mask-affected-by-clip && ./mask-affected-by-clip + */ + +#include <ming.h> + +static SWFBlock +get_rectangle (int r, int g, int b) +{ + SWFMovieClip clip; + SWFShape shape; + SWFFillStyle fill; + + clip = newSWFMovieClip (); + shape = newSWFShape (); + fill = SWFShape_addSolidFillStyle (shape, r, g, b, 255); + SWFShape_setRightFillStyle (shape, fill); + SWFShape_drawLineTo (shape, 100, 0); + SWFShape_drawLineTo (shape, 100, 100); + SWFShape_drawLineTo (shape, 0, 100); + SWFShape_drawLineTo (shape, 0, 0); + + SWFMovieClip_add (clip, (SWFBlock) shape); + SWFMovieClip_nextFrame (clip); + return (SWFBlock) clip; +} + +static void +do_movie (int version) +{ + char name[100]; + SWFMovie movie; + SWFDisplayItem item; + + movie = newSWFMovieWithVersion (version); + SWFMovie_setRate (movie, 1); + SWFMovie_setDimension (movie, 200, 150); + + item = SWFMovie_add (movie, get_rectangle (255, 0, 0)); + SWFDisplayItem_setDepth (item, 0); + SWFDisplayItem_setMaskLevel (item, 2); + + item = SWFMovie_add (movie, get_rectangle (0, 255, 0)); + SWFDisplayItem_moveTo (item, 50, 25); + SWFDisplayItem_setDepth (item, 1); + SWFDisplayItem_setName (item, "b"); + + item = SWFMovie_add (movie, get_rectangle (0, 0, 255)); + SWFDisplayItem_moveTo (item, 25, 50); + SWFDisplayItem_setDepth (item, 3); + SWFDisplayItem_setName (item, "c"); + + SWFMovie_add (movie, (SWFBlock) newSWFAction ( + "c.setMask (b);" + )); + SWFMovie_nextFrame (movie); + + sprintf (name, "mask-affected-by-clip-%d.swf", version); + SWFMovie_save (movie, name); +} + +int +main (int argc, char **argv) +{ + int i; + + if (Ming_init ()) + return 1; + + for (i = 8; i >= 5; i--) { + do_movie (i); + } + + return 0; +} commit 28d614b8c2b909a9a27eb9b06c57e1eb916b8129 Author: Benjamin Otte <otte at gnome.org> Date: Tue Nov 20 12:46:27 2007 +0100 update the movie's matrix before computing the to/from-global matrix diff --git a/libswfdec/swfdec_movie.c b/libswfdec/swfdec_movie.c index a3772c8..0fbf8a2 100644 --- a/libswfdec/swfdec_movie.c +++ b/libswfdec/swfdec_movie.c @@ -571,6 +571,8 @@ swfdec_movie_global_to_local_matrix (SwfdecMovie *movie, cairo_matrix_t *matrix) cairo_matrix_init_identity (matrix); while (movie) { + if (movie->cache_state >= SWFDEC_MOVIE_INVALID_MATRIX) + swfdec_movie_update (movie); cairo_matrix_multiply (matrix, &movie->inverse_matrix, matrix); movie = movie->parent; } @@ -584,6 +586,8 @@ swfdec_movie_local_to_global_matrix (SwfdecMovie *movie, cairo_matrix_t *matrix) cairo_matrix_init_identity (matrix); while (movie) { + if (movie->cache_state >= SWFDEC_MOVIE_INVALID_MATRIX) + swfdec_movie_update (movie); cairo_matrix_multiply (matrix, matrix, &movie->matrix); movie = movie->parent; }
Apparently Analagous Threads
- Branch 'as' - 5 commits - libswfdec/swfdec_graphic_movie.c libswfdec/swfdec_movie.c libswfdec/swfdec_sprite_movie.c test/image
- Branch 'as' - 8 commits - libswfdec/swfdec_movie.c libswfdec/swfdec_sprite.c libswfdec/swfdec_sprite.h libswfdec/swfdec_sprite_movie.c libswfdec/swfdec_sprite_movie.h libswfdec/swfdec_swf_decoder.c libswfdec/swfdec_swf_decoder.h
- Branch 'as' - 6 commits - libswfdec/swfdec_as_interpret.c libswfdec/swfdec_movie.c libswfdec/swfdec_sprite_movie_as.c test/trace
- 6 commits - libswfdec/swfdec_as_interpret.c libswfdec/swfdec_movie.c test/trace
- 2 commits - libswfdec/swfdec_audio_event.c test/sound