[Swfdec] 10 commits - configure.ac doc/Makefile.am doc/swfdec-sections.txt libswfdec/swfdec_buffer.c libswfdec/swfdec_movie_as_drawing.c test/image test/sound

Benjamin Otte company at kemper.freedesktop.org
Thu Oct 11 04:46:56 PDT 2007


 configure.ac                            |    2 -
 doc/Makefile.am                         |    1 
 doc/swfdec-sections.txt                 |    2 +
 libswfdec/swfdec_buffer.c               |   12 +++++++
 libswfdec/swfdec_movie_as_drawing.c     |   49 ++++++++++++++++++++++++++++----
 test/image/Makefile.am                  |   12 +++++++
 test/image/drawing-zorder-5.swf         |binary
 test/image/drawing-zorder-5.swf.png     |binary
 test/image/drawing-zorder-6.swf         |binary
 test/image/drawing-zorder-6.swf.org.png |binary
 test/image/drawing-zorder-6.swf.png     |binary
 test/image/drawing-zorder-7.swf         |binary
 test/image/drawing-zorder-7.swf.org.png |binary
 test/image/drawing-zorder-7.swf.png     |binary
 test/image/drawing-zorder-8.swf         |binary
 test/image/drawing-zorder-8.swf.org.png |binary
 test/image/drawing-zorder-8.swf.png     |binary
 test/image/drawing-zorder.as            |   19 ++++++++++++
 test/sound/Makefile.am                  |   16 +++++-----
 test/sound/sound.c                      |   10 +++---
 20 files changed, 103 insertions(+), 20 deletions(-)

New commits:
diff-tree 493eff56ead0f496136751c5f7b4c276c22b5466 (from 4c51320f643f83f3556d7e2928095a84bf6a6355)
Author: Benjamin Otte <otte at gnome.org>
Date:   Thu Oct 11 13:46:46 2007 +0200

    we require glib 2.10

diff --git a/configure.ac b/configure.ac
index 3aa5e4c..6abc3ff 100644
--- a/configure.ac
+++ b/configure.ac
@@ -71,7 +71,7 @@ AC_ARG_WITH(pkg-config-path, 
 dnl Check for essential libraries first:
 dnl ====================================
 
-GLIB_VER=2.4
+GLIB_VER=2.10
 PKG_CHECK_MODULES(GLIB, glib-2.0 >= $GLIB_VER gobject-2.0 >= $GLIB_VER,
 		HAVE_GLIB=yes, HAVE_GLIB=no)
 if test "$HAVE_GLIB" = "no"; then
diff-tree 4c51320f643f83f3556d7e2928095a84bf6a6355 (from 7e8de82a117d33035f9dfb45894d860c2163ead3)
Author: Benjamin Otte <otte at gnome.org>
Date:   Thu Oct 11 12:01:33 2007 +0200

    fix names of files in EXTRA_DIST

diff --git a/test/sound/Makefile.am b/test/sound/Makefile.am
index e576d5e..41e5e2b 100644
--- a/test/sound/Makefile.am
+++ b/test/sound/Makefile.am
@@ -19,20 +19,20 @@ sound_LDFLAGS = $(SWFDEC_LIBS) $(CAIRO_L
 EXTRA_DIST = \
 	README \
 	adpcm-2.swf \
-	adpcm-2.swf.0.0.raw \
+	adpcm-2.swf.1.0.raw \
 	adpcm-2-2.swf \
-	adpcm-2-2.swf.0.0.raw \
+	adpcm-2-2.swf.1.0.raw \
 	adpcm-3.swf \
-	adpcm-3.swf.0.0.raw \
+	adpcm-3.swf.1.0.raw \
 	adpcm-3-2.swf \
-	adpcm-3-2.swf.0.0.raw \
+	adpcm-3-2.swf.1.0.raw \
 	adpcm-4.swf \
-	adpcm-4.swf.0.0.raw \
+	adpcm-4.swf.1.0.raw \
 	adpcm-4-2.swf \
-	adpcm-4-2.swf.0.0.raw \
+	adpcm-4-2.swf.1.0.raw \
 	adpcm-5.swf \
-	adpcm-5.swf.0.0.raw \
+	adpcm-5.swf.1.0.raw \
 	adpcm-5-2.swf \
-	adpcm-5-2.swf.0.0.raw
+	adpcm-5-2.swf.1.0.raw
 
 CLEANFILES = tmp
diff-tree 7e8de82a117d33035f9dfb45894d860c2163ead3 (from 4ddda3f1c1054b750cfa2ba83ccefdda50b76a60)
Author: Benjamin Otte <otte at gnome.org>
Date:   Thu Oct 11 12:00:51 2007 +0200

    document SwfdecBufferFreeFunc

diff --git a/libswfdec/swfdec_buffer.c b/libswfdec/swfdec_buffer.c
index f0edd90..2c43f9d 100644
--- a/libswfdec/swfdec_buffer.c
+++ b/libswfdec/swfdec_buffer.c
@@ -59,6 +59,15 @@
  * swfdec_buffer_new_from_file() without the need for a different API.
  */
 
+/**
+ * SwfdecBufferFreeFunc:
+ * @data: The data to free
+ * @priv: The private data registered for passing to this function
+ *
+ * This is the function prototype for the function that is called for freeing
+ * the memory pointed to by a buffer. See swfdec_buffer_new() for an example.
+ */
+
 GType
 swfdec_buffer_get_type (void)
 {
@@ -80,7 +89,8 @@ swfdec_buffer_get_type (void)
  * <informalexample><programlisting>SwfdecBuffer *buffer = swfdec_buffer_new ();
  * buffer->data = mydata;
  * buffer->length = mydata_length;
- * buffer->free = mydata_freefunc;</programlisting></informalexample>
+ * buffer->free = mydata_freefunc;
+ * buffer->priv = mydata_private;</programlisting></informalexample>
  *
  * Returns: a new #SwfdecBuffer referencing nothing.
  **/
diff-tree 4ddda3f1c1054b750cfa2ba83ccefdda50b76a60 (from 8025ba8f522cfdb4bc0452d627ecb9f5fd57a55e)
Author: Benjamin Otte <otte at gnome.org>
Date:   Thu Oct 11 12:00:28 2007 +0200

    fix lookup of files to compare with

diff --git a/test/sound/sound.c b/test/sound/sound.c
index 2053446..cdb6f01 100644
--- a/test/sound/sound.c
+++ b/test/sound/sound.c
@@ -95,8 +95,11 @@ typedef struct {
 static void
 audio_added (SwfdecPlayer *player, SwfdecAudio *audio, TestData *data)
 {
-  char *name = g_strdup_printf ("%s.%u.%u.raw", data->filename, data->current_frame, data->current_frame_audio);
+  char *basename = g_path_get_basename (data->filename);
+  char *name = g_strdup_printf ("%s.%u.%u.raw", basename, data->current_frame, data->current_frame_audio);
   GList *found = g_list_find_custom (data->files, name, (GCompareFunc) strcmp);
+
+  g_free (basename);
   if (found == NULL) {
     g_print ("  ERROR: %s wasn't found\n", name);
     data->success = FALSE;
@@ -173,7 +176,7 @@ run_test (const char *filename)
   SwfdecPlayer *player = NULL;
   guint i, msecs;
   GError *error = NULL;
-  char *dirname, *basename, *file;
+  char *dirname, *basename;
   const char *name;
   GDir *dir;
   GList *walk;
@@ -193,8 +196,7 @@ run_test (const char *filename)
       continue;
     if (!g_str_has_suffix (name, ".raw"))
       continue;
-    file = g_build_filename (dirname, name, NULL);
-    data.files = g_list_prepend (data.files, file);
+    data.files = g_list_prepend (data.files, g_strdup (name));
   }
   g_dir_close (dir);
   g_free (dirname);
diff-tree 8025ba8f522cfdb4bc0452d627ecb9f5fd57a55e (from 522c0811d50b4711393a190ffb90ff44f900ded5)
Author: Benjamin Otte <otte at gnome.org>
Date:   Thu Oct 11 11:37:58 2007 +0200

    add new symbols

diff --git a/doc/swfdec-sections.txt b/doc/swfdec-sections.txt
index 2bf4585..e269718 100644
--- a/doc/swfdec-sections.txt
+++ b/doc/swfdec-sections.txt
@@ -127,6 +127,7 @@ swfdec_system_get_type
 <TITLE>SwfdecBuffer</TITLE>
 SwfdecBuffer
 SwfdecBufferQueue
+SwfdecBufferFreeFunc
 swfdec_buffer_new
 swfdec_buffer_new_and_alloc
 swfdec_buffer_new_and_alloc0
@@ -368,6 +369,7 @@ swfdec_as_array_insert_with_flags
 swfdec_as_array_push
 swfdec_as_array_push_with_flags
 swfdec_as_array_get_length
+swfdec_as_array_set_length
 swfdec_as_array_get_value
 swfdec_as_array_set_value
 swfdec_as_array_remove
diff-tree 522c0811d50b4711393a190ffb90ff44f900ded5 (from 91f6647d5e409a1002a68ec55e115b1f812e4824)
Author: Benjamin Otte <otte at gnome.org>
Date:   Thu Oct 11 11:37:33 2007 +0200

    exclude swfdec_text_format.h

diff --git a/doc/Makefile.am b/doc/Makefile.am
index d4bd69e..bfe7279 100644
--- a/doc/Makefile.am
+++ b/doc/Makefile.am
@@ -129,6 +129,7 @@ IGNORE_HFILES= \
 	swfdec_swf_instance.h \
 	swfdec_tag.h \
 	swfdec_text.h \
+	swfdec_text_format.h \
 	swfdec_types.h \
 	swfdec_utils.h \
 	swfdec_video.h \
diff-tree 91f6647d5e409a1002a68ec55e115b1f812e4824 (from 24f7a0aa475f8eb58863d575ced46d272d1ece2c)
Author: Benjamin Otte <otte at gnome.org>
Date:   Thu Oct 11 11:31:14 2007 +0200

    add test for recent zorder fix

diff --git a/test/image/Makefile.am b/test/image/Makefile.am
index 6f04fd6..52cd656 100644
--- a/test/image/Makefile.am
+++ b/test/image/Makefile.am
@@ -22,6 +22,18 @@ EXTRA_DIST = \
 	duplicate-depth-6.swf.png \
 	duplicate-depth-7.swf \
 	duplicate-depth-7.swf.png \
+	drawing-zorder.as \
+	drawing-zorder-5.swf \
+	drawing-zorder-5.swf.png \
+	drawing-zorder-6.swf \
+	drawing-zorder-6.swf.org.png \
+	drawing-zorder-6.swf.png \
+	drawing-zorder-7.swf \
+	drawing-zorder-7.swf.org.png \
+	drawing-zorder-7.swf.png \
+	drawing-zorder-8.swf \
+	drawing-zorder-8.swf.org.png \
+	drawing-zorder-8.swf.png \
 	fillstyle-order.swf \
 	fillstyle-order.swf.png \
 	fillstyle-order.xml \
diff --git a/test/image/drawing-zorder-5.swf b/test/image/drawing-zorder-5.swf
new file mode 100644
index 0000000..34015ea
Binary files /dev/null and b/test/image/drawing-zorder-5.swf differ
diff --git a/test/image/drawing-zorder-5.swf.png b/test/image/drawing-zorder-5.swf.png
new file mode 100644
index 0000000..800ae04
Binary files /dev/null and b/test/image/drawing-zorder-5.swf.png differ
diff --git a/test/image/drawing-zorder-6.swf b/test/image/drawing-zorder-6.swf
new file mode 100644
index 0000000..7f9e999
Binary files /dev/null and b/test/image/drawing-zorder-6.swf differ
diff --git a/test/image/drawing-zorder-6.swf.org.png b/test/image/drawing-zorder-6.swf.org.png
new file mode 100644
index 0000000..04371db
Binary files /dev/null and b/test/image/drawing-zorder-6.swf.org.png differ
diff --git a/test/image/drawing-zorder-6.swf.png b/test/image/drawing-zorder-6.swf.png
new file mode 100644
index 0000000..5223d52
Binary files /dev/null and b/test/image/drawing-zorder-6.swf.png differ
diff --git a/test/image/drawing-zorder-7.swf b/test/image/drawing-zorder-7.swf
new file mode 100644
index 0000000..02ee49e
Binary files /dev/null and b/test/image/drawing-zorder-7.swf differ
diff --git a/test/image/drawing-zorder-7.swf.org.png b/test/image/drawing-zorder-7.swf.org.png
new file mode 100644
index 0000000..5fbdc88
Binary files /dev/null and b/test/image/drawing-zorder-7.swf.org.png differ
diff --git a/test/image/drawing-zorder-7.swf.png b/test/image/drawing-zorder-7.swf.png
new file mode 100644
index 0000000..5223d52
Binary files /dev/null and b/test/image/drawing-zorder-7.swf.png differ
diff --git a/test/image/drawing-zorder-8.swf b/test/image/drawing-zorder-8.swf
new file mode 100644
index 0000000..a5d84ac
Binary files /dev/null and b/test/image/drawing-zorder-8.swf differ
diff --git a/test/image/drawing-zorder-8.swf.org.png b/test/image/drawing-zorder-8.swf.org.png
new file mode 100644
index 0000000..3f6714d
Binary files /dev/null and b/test/image/drawing-zorder-8.swf.org.png differ
diff --git a/test/image/drawing-zorder-8.swf.png b/test/image/drawing-zorder-8.swf.png
new file mode 100644
index 0000000..5223d52
Binary files /dev/null and b/test/image/drawing-zorder-8.swf.png differ
diff --git a/test/image/drawing-zorder.as b/test/image/drawing-zorder.as
new file mode 100644
index 0000000..cd32c9e
--- /dev/null
+++ b/test/image/drawing-zorder.as
@@ -0,0 +1,19 @@
+// makeswf -v 7 -s 200x150 -r 1 -o drawing-zorder.swf drawing-zorder.as
+
+beginFill (0xFF);
+lineStyle (10, 0xFF00);
+moveTo (0, 0);
+lineTo (0, 100);
+lineTo (100, 100);
+lineTo (100, 0);
+lineTo (0, 0);
+endFill ();
+beginFill (0xFF0000);
+moveTo (50, 50);
+lineTo (50, 150);
+lineTo (150, 150);
+lineTo (150, 50);
+lineTo (50, 50);
+endFill ();
+
+//loadMovie ("FSCommand:quit", "");
diff-tree 24f7a0aa475f8eb58863d575ced46d272d1ece2c (from d0afac4245b82d3ef21ba02389c31de33b8526bd)
Author: Benjamin Otte <otte at gnome.org>
Date:   Thu Oct 11 11:22:37 2007 +0200

    fix z-order problems with lineStyle/fillStyle

diff --git a/libswfdec/swfdec_movie_as_drawing.c b/libswfdec/swfdec_movie_as_drawing.c
index 0fc7e87..d77ef99 100644
--- a/libswfdec/swfdec_movie_as_drawing.c
+++ b/libswfdec/swfdec_movie_as_drawing.c
@@ -32,12 +32,50 @@
 /* FIXME: This whole code assumes it works for MovieClip, Button and TextField
  * objects. If it only works for MovieClip objects, fix this. */
 
+static SwfdecDraw *
+swfdec_stroke_copy (SwfdecDraw *draw)
+{
+  SwfdecStroke *sstroke = SWFDEC_STROKE (draw);
+  SwfdecStroke *dstroke = g_object_new (SWFDEC_TYPE_STROKE, NULL);
+
+  dstroke->start_width = sstroke->start_width;
+  dstroke->start_color = sstroke->start_color;
+  if (sstroke->pattern)
+    dstroke->pattern = g_object_ref (sstroke->pattern);
+  dstroke->start_cap = sstroke->start_cap;
+  dstroke->end_cap = sstroke->end_cap;
+  dstroke->join = sstroke->join;
+  dstroke->miter_limit = sstroke->miter_limit;
+  dstroke->no_vscale = sstroke->no_vscale;
+  dstroke->no_hscale = sstroke->no_hscale;
+
+  return SWFDEC_DRAW (dstroke);
+}
+
+static void
+swfdec_sprite_movie_end_fill (SwfdecMovie *movie, SwfdecDraw *new)
+{
+  /* FIXME: need to cairo_close_path()? */
+  movie->draw_fill = new;
+  if (new == NULL)
+    return;
+
+  movie->draws = g_slist_append (movie->draws, new);
+
+  /* need to begin a new line segment to ensure proper stacking order */
+  if (movie->draw_line) {
+    movie->draw_line = swfdec_stroke_copy (movie->draw_line);
+    movie->draws = g_slist_append (movie->draws, movie->draw_line);
+  }
+}
+
 SWFDEC_AS_NATIVE (901, 1, swfdec_sprite_movie_beginFill)
 void
 swfdec_sprite_movie_beginFill (SwfdecAsContext *cx, SwfdecAsObject *object,
     guint argc, SwfdecAsValue *argv, SwfdecAsValue *rval)
 {
   SwfdecMovie *movie;
+  SwfdecDraw *draw;
   int color, alpha;
 
   SWFDEC_AS_CHECK (SWFDEC_TYPE_MOVIE, &movie, "|ii", &color, &alpha);
@@ -53,9 +91,9 @@ swfdec_sprite_movie_beginFill (SwfdecAsC
     alpha = SWFDEC_COLOR_COMBINE (0, 0, 0, 255);
   }
   color = color | alpha;
-  movie->draw_fill = SWFDEC_DRAW (swfdec_pattern_new_color (color));
-  swfdec_path_move_to (&movie->draw_fill->path, movie->draw_x, movie->draw_y);
-  movie->draws = g_slist_append (movie->draws, movie->draw_fill);
+  draw = SWFDEC_DRAW (swfdec_pattern_new_color (color));
+  swfdec_path_move_to (&draw->path, movie->draw_x, movie->draw_y);
+  swfdec_sprite_movie_end_fill (movie, draw);
 }
 
 SWFDEC_AS_NATIVE (901, 2, swfdec_sprite_movie_beginGradientFill)
@@ -192,8 +230,7 @@ swfdec_sprite_movie_endFill (SwfdecAsCon
   SwfdecMovie *movie;
 
   SWFDEC_AS_CHECK (SWFDEC_TYPE_MOVIE, &movie, "");
-  /* FIXME: need to cairo_close_path()? */
-  movie->draw_fill = NULL;
+  swfdec_sprite_movie_end_fill (movie, NULL);
 }
 
 SWFDEC_AS_NATIVE (901, 8, swfdec_sprite_movie_clear)
diff-tree d0afac4245b82d3ef21ba02389c31de33b8526bd (from parents)
Merge: a91d93cdefa62444d2b24e188203f220648b387c 1842d3858b37ce64020a91b2056415177594c266
Author: Benjamin Otte <otte at gnome.org>
Date:   Thu Oct 11 10:08:34 2007 +0200

    Merge branch 'master' of ssh://company@git.freedesktop.org/git/swfdec/swfdec

diff-tree a91d93cdefa62444d2b24e188203f220648b387c (from d622c9688417c3efd36e3f39a64654296a458e84)
Author: Benjamin Otte <otte at gnome.org>
Date:   Thu Oct 11 09:38:51 2007 +0200

    make new drawn stuff appear above old stuff, not below it

diff --git a/libswfdec/swfdec_movie_as_drawing.c b/libswfdec/swfdec_movie_as_drawing.c
index 11cba2f..0fc7e87 100644
--- a/libswfdec/swfdec_movie_as_drawing.c
+++ b/libswfdec/swfdec_movie_as_drawing.c
@@ -55,7 +55,7 @@ swfdec_sprite_movie_beginFill (SwfdecAsC
   color = color | alpha;
   movie->draw_fill = SWFDEC_DRAW (swfdec_pattern_new_color (color));
   swfdec_path_move_to (&movie->draw_fill->path, movie->draw_x, movie->draw_y);
-  movie->draws = g_slist_prepend (movie->draws, movie->draw_fill);
+  movie->draws = g_slist_append (movie->draws, movie->draw_fill);
 }
 
 SWFDEC_AS_NATIVE (901, 2, swfdec_sprite_movie_beginGradientFill)
@@ -181,7 +181,7 @@ swfdec_sprite_movie_lineStyle (SwfdecAsC
   stroke->start_width = SWFDEC_DOUBLE_TO_TWIPS (width);
   movie->draw_line = SWFDEC_DRAW (stroke);
   swfdec_path_move_to (&movie->draw_line->path, movie->draw_x, movie->draw_y);
-  movie->draws = g_slist_prepend (movie->draws, movie->draw_line);
+  movie->draws = g_slist_append (movie->draws, movie->draw_line);
 }
 
 SWFDEC_AS_NATIVE (901, 7, swfdec_sprite_movie_endFill)


More information about the Swfdec mailing list