[Swfdec] 4 commits - libswfdec/swfdec_shape_parser.c test/image

Benjamin Otte company at kemper.freedesktop.org
Fri Dec 14 09:26:19 PST 2007


 libswfdec/swfdec_shape_parser.c |    8 ++--
 test/image/Makefile.am          |   11 ++++++
 test/image/morph-end-4.swf      |binary
 test/image/morph-end-4.swf.png  |binary
 test/image/morph-end-5.swf      |binary
 test/image/morph-end-5.swf.png  |binary
 test/image/morph-end-6.swf      |binary
 test/image/morph-end-6.swf.png  |binary
 test/image/morph-end-7.swf      |binary
 test/image/morph-end-7.swf.png  |binary
 test/image/morph-end-8.swf      |binary
 test/image/morph-end-8.swf.png  |binary
 test/image/morph-end.c          |   65 ++++++++++++++++++++++++++++++++++++++++
 13 files changed, 80 insertions(+), 4 deletions(-)

New commits:
commit 13fdcb05ecb88120ca8319ae3ca5645aeb7f0480
Author: Benjamin Otte <otte at gnome.org>
Date:   Fri Dec 14 14:07:43 2007 +0100

    add test that ensures morph shapes continue working

diff --git a/test/image/Makefile.am b/test/image/Makefile.am
index 1ae8261..393c856 100644
--- a/test/image/Makefile.am
+++ b/test/image/Makefile.am
@@ -219,6 +219,17 @@ EXTRA_DIST = \
 	mask-with-textfield-7.swf.png \
 	mask-with-textfield-8.swf \
 	mask-with-textfield-8.swf.png \
+	morph-end.c \
+	morph-end-4.swf \
+	morph-end-4.swf.png \
+	morph-end-5.swf \
+	morph-end-5.swf.png \
+	morph-end-6.swf \
+	morph-end-6.swf.png \
+	morph-end-7.swf \
+	morph-end-7.swf.png \
+	morph-end-8.swf \
+	morph-end-8.swf.png \
 	morph-gradient.c \
 	morph-gradient-4.swf \
 	morph-gradient-4.swf.png \
diff --git a/test/image/morph-end-4.swf b/test/image/morph-end-4.swf
new file mode 100644
index 0000000..4b00445
Binary files /dev/null and b/test/image/morph-end-4.swf differ
diff --git a/test/image/morph-end-4.swf.png b/test/image/morph-end-4.swf.png
new file mode 100644
index 0000000..143b5e7
Binary files /dev/null and b/test/image/morph-end-4.swf.png differ
diff --git a/test/image/morph-end-5.swf b/test/image/morph-end-5.swf
new file mode 100644
index 0000000..59a5f3e
Binary files /dev/null and b/test/image/morph-end-5.swf differ
diff --git a/test/image/morph-end-5.swf.png b/test/image/morph-end-5.swf.png
new file mode 100644
index 0000000..57257c7
Binary files /dev/null and b/test/image/morph-end-5.swf.png differ
diff --git a/test/image/morph-end-6.swf b/test/image/morph-end-6.swf
new file mode 100644
index 0000000..564ecbc
Binary files /dev/null and b/test/image/morph-end-6.swf differ
diff --git a/test/image/morph-end-6.swf.png b/test/image/morph-end-6.swf.png
new file mode 100644
index 0000000..92ce74d
Binary files /dev/null and b/test/image/morph-end-6.swf.png differ
diff --git a/test/image/morph-end-7.swf b/test/image/morph-end-7.swf
new file mode 100644
index 0000000..6093c08
Binary files /dev/null and b/test/image/morph-end-7.swf differ
diff --git a/test/image/morph-end-7.swf.png b/test/image/morph-end-7.swf.png
new file mode 100644
index 0000000..c6c468a
Binary files /dev/null and b/test/image/morph-end-7.swf.png differ
diff --git a/test/image/morph-end-8.swf b/test/image/morph-end-8.swf
new file mode 100644
index 0000000..313fa80
Binary files /dev/null and b/test/image/morph-end-8.swf differ
diff --git a/test/image/morph-end-8.swf.png b/test/image/morph-end-8.swf.png
new file mode 100644
index 0000000..382ef39
Binary files /dev/null and b/test/image/morph-end-8.swf.png differ
diff --git a/test/image/morph-end.c b/test/image/morph-end.c
new file mode 100644
index 0000000..2445796
--- /dev/null
+++ b/test/image/morph-end.c
@@ -0,0 +1,65 @@
+/* gcc -Wall `pkg-config --libs --cflags libming glib-2.0` morph-end.c -o morph-end && ./morph-end
+ */
+
+#include <ming.h>
+#include <glib.h>
+#include <stdio.h>
+
+extern void
+SWFMatrix_set (SWFMatrix m, float a, float b, float c, float d, int x, int y);
+
+
+static void do_shape (SWFShape shape, int i)
+{
+  SWFFillStyle style;
+
+  style = SWFShape_addSolidFillStyle (shape, 255, i ? 255 : 0, 0, 255);
+
+  i = i ? 10 : 50;
+  SWFShape_setLeftFillStyle (shape, style);
+  SWFShape_movePenTo (shape, i, i);
+  SWFShape_drawLineTo (shape, i, 2 * i);
+  SWFShape_drawLineTo (shape, 2 * i, 2 * i);
+  SWFShape_drawLineTo (shape, 2 * i, i);
+  SWFShape_drawLineTo (shape, i, i);
+
+}
+
+static void
+do_movie (int version)
+{
+  SWFMovie movie;
+  SWFMorph morph;
+  SWFDisplayItem item;
+  char *s;
+
+  movie = newSWFMovieWithVersion (version);
+  SWFMovie_setRate (movie, 1);
+  SWFMovie_setDimension (movie, 200, 150);
+
+  morph = newSWFMorphShape ();
+
+  do_shape (SWFMorph_getShape1 (morph), 0);
+  do_shape (SWFMorph_getShape2 (morph), 1);
+  item = SWFMovie_add (movie, morph);
+  SWFDisplayItem_setRatio (item, 1.0);
+  SWFMovie_nextFrame (movie);
+
+  s = g_strdup_printf ("morph-end-%d.swf", version);
+  SWFMovie_save (movie, s);
+  g_free (s);
+}
+
+int
+main (int argc, char **argv)
+{
+  int i;
+
+  if (Ming_init ())
+    return 1;
+
+  for (i = 4; i < 9; i++)
+    do_movie (i);
+
+  return 0;
+}
commit c48bbf23d83846fcd78a672d1e383827b0801d1e
Author: Benjamin Otte <otte at gnome.org>
Date:   Fri Dec 14 14:05:30 2007 +0100

    use the right shapes when computing morph shapes
    
    This patch makes morph shapes work again. They were broken since 0.5.2 or so,
    but apparently noone noticed.

diff --git a/libswfdec/swfdec_shape_parser.c b/libswfdec/swfdec_shape_parser.c
index 2c99e46..fc42fdf 100644
--- a/libswfdec/swfdec_shape_parser.c
+++ b/libswfdec/swfdec_shape_parser.c
@@ -272,7 +272,7 @@ swfdec_shape_parser_finish (SwfdecShapeParser *parser)
       continue;
     if (style->subpaths) {
       swfdec_style_finish (style, (SwfdecSubPath *) (void *) parser->subpaths->data, 
-	  parser->subpaths2->len ? (SwfdecSubPath *) (void *) parser->subpaths->data : NULL, FALSE);
+	  parser->subpaths2->len ? (SwfdecSubPath *) (void *) parser->subpaths2->data : NULL, FALSE);
       parser->draws = g_slist_prepend (parser->draws, g_object_ref (style->draw));
     } else if (parser->parse_fill) {
       SWFDEC_WARNING ("fillstyle %u has no path", i);
@@ -286,7 +286,7 @@ swfdec_shape_parser_finish (SwfdecShapeParser *parser)
       continue;
     if (style->subpaths) {
       swfdec_style_finish (style, (SwfdecSubPath *) (void *) parser->subpaths->data, 
-	  parser->subpaths2->len ? (SwfdecSubPath *) (void *) parser->subpaths->data : NULL, TRUE);
+	  parser->subpaths2->len ? (SwfdecSubPath *) (void *) parser->subpaths2->data : NULL, TRUE);
       parser->draws = g_slist_prepend (parser->draws, g_object_ref (style->draw));
     } else {
       SWFDEC_WARNING ("linestyle %u has no path", i);
commit 1fd62fee9fde941cee68984eed8739801c9492aa
Author: Benjamin Otte <otte at gnome.org>
Date:   Fri Dec 14 14:04:40 2007 +0100

    add correct check for shortcut when using morph shapes

diff --git a/libswfdec/swfdec_shape_parser.c b/libswfdec/swfdec_shape_parser.c
index 77ff3c1..2c99e46 100644
--- a/libswfdec/swfdec_shape_parser.c
+++ b/libswfdec/swfdec_shape_parser.c
@@ -349,7 +349,8 @@ swfdec_shape_parser_end_path (SwfdecShapeParser *parser, SwfdecSubPath *path1, S
       SwfdecStyle *style = &g_array_index (parser->fillstyles, 
 	  SwfdecStyle, parser->fill1style - 1);
 
-      if (swfdec_sub_path_match (path1, path1)) {
+      if (swfdec_sub_path_match (path1, path1) &&
+	  (path2 == NULL || swfdec_sub_path_match (path2, path2))) {
 	style->subpaths = g_slist_prepend (style->subpaths, 
 	    GUINT_TO_POINTER (parser->subpaths->len - 1));
       } else {
commit 09b33dbed3d33512025f9d76b404d8f60d3c6322
Author: Benjamin Otte <otte at gnome.org>
Date:   Fri Dec 14 14:03:27 2007 +0100

    remove unused variable

diff --git a/libswfdec/swfdec_shape_parser.c b/libswfdec/swfdec_shape_parser.c
index 4eba39a..77ff3c1 100644
--- a/libswfdec/swfdec_shape_parser.c
+++ b/libswfdec/swfdec_shape_parser.c
@@ -66,7 +66,6 @@ swfdec_sub_path_match (SwfdecSubPath *from, SwfdecSubPath *to)
 typedef struct {
   SwfdecDraw *		draw;		/* drawing operation that should take the subpaths or NULL on parsing error */
   GSList *		subpaths;	/* indexes into SubPath array */
-  GSList *		subpaths2;	/* indexes into SubPath array */
 } SwfdecStyle;
 
 struct _SwfdecShapeParser {


More information about the Swfdec mailing list