[Swfdec] 4 commits - libswfdec/swfdec_shape.c libswfdec/swfdec_stroke.c test/dump.c

Benjamin Otte company at kemper.freedesktop.org
Mon Apr 16 02:47:59 PDT 2007


 libswfdec/swfdec_shape.c  |   19 +++++++++++++++----
 libswfdec/swfdec_stroke.c |    6 +++---
 test/dump.c               |    2 +-
 3 files changed, 19 insertions(+), 8 deletions(-)

New commits:
diff-tree 04113e5a83386f59140f248a817f7bf8d6728ddb (from f307c3b4ba316d4d1880e1aeba079878230e3db8)
Author: Benjamin Otte <otte at gnome.org>
Date:   Mon Apr 16 11:42:21 2007 +0200

    add FIXME

diff --git a/libswfdec/swfdec_shape.c b/libswfdec/swfdec_shape.c
index 18f637a..3792582 100644
--- a/libswfdec/swfdec_shape.c
+++ b/libswfdec/swfdec_shape.c
@@ -1007,6 +1007,7 @@ error:
   /* FIXME: there's probably a problem if start and end paths get accumulated in 
    * different ways, this could lead to the morphs not looking like they should. 
    * Need a good testcase for this first though.
+   * FIXME: Also, due to error handling, there needs to be syncing of code paths
    */
   tmp = shape->vecs;
   shape->vecs = morph->end_vecs;
diff-tree f307c3b4ba316d4d1880e1aeba079878230e3db8 (from 707ba1588fcaf3b02491b66df2071c8d702675e1)
Author: Benjamin Otte <otte at gnome.org>
Date:   Mon Apr 16 11:18:51 2007 +0200

    fix possible error with referencing realloc'ed memory

diff --git a/libswfdec/swfdec_shape.c b/libswfdec/swfdec_shape.c
index eb7161a..18f637a 100644
--- a/libswfdec/swfdec_shape.c
+++ b/libswfdec/swfdec_shape.c
@@ -507,7 +507,8 @@ swfdec_shape_accumulate_one_polygon (Swf
       break;
     }
     if (i == paths_len) {
-      SWFDEC_ERROR ("could not find a closed path for style %u", style);
+      SWFDEC_ERROR ("could not find a closed path for style %u, starting at %d %d", style,
+	  paths[start].x_start, paths[start].y_start);
       goto fail;
     }
   }
@@ -794,6 +795,14 @@ swfdec_shape_initialize_from_sub_paths (
 {
   guint i;
 
+#if 0
+  g_print ("\n\n");
+  for (i = 0; i < path_array->len; i++) {
+    SubPath *path = &g_array_index (path_array, SubPath, i);
+    g_print ("%d %d => %d %d  -  %u %u %u\n", path->x_start, path->y_start, path->x_end, path->y_end,
+	path->fill0style, path->fill1style, path->linestyle);
+  }
+#endif
   swfdec_shape_accumulate_fills (shape, (SubPath *) path_array->data, path_array->len);
   swfdec_shape_accumulate_lines (shape, (SubPath *) path_array->data, path_array->len);
   for (i = 0; i < path_array->len; i++) {
@@ -927,13 +936,14 @@ swfdec_morph_shape_get_recs (SwfdecSwfDe
     end_type = swfdec_shape_peek_type (end_bits);
     if (end_type == SWFDEC_SHAPE_TYPE_CHANGE && start_type != SWFDEC_SHAPE_TYPE_CHANGE) {
       SubPath *path;
-      g_array_set_size (start_path_array, start_path_array->len + 1);
-      path = &g_array_index (start_path_array, SubPath, start_path_array->len - 1);
       if (start_path) {
 	start_path->x_end = start_x;
 	start_path->y_end = start_y;
-	*path = *start_path;
       }
+      g_array_set_size (start_path_array, start_path_array->len + 1);
+      path = &g_array_index (start_path_array, SubPath, start_path_array->len - 1);
+      if (start_path)
+	*path = *start_path;
       start_path = path;
       swfdec_path_init (&start_path->path);
       start_path->x_start = start_x;
diff-tree 707ba1588fcaf3b02491b66df2071c8d702675e1 (from 19a76c4b9175c087d0cee96ecc21f83114f70abc)
Author: Benjamin Otte <otte at gnome.org>
Date:   Mon Apr 16 10:39:14 2007 +0200

    fix some debug messages

diff --git a/libswfdec/swfdec_stroke.c b/libswfdec/swfdec_stroke.c
index 893380d..bec454b 100644
--- a/libswfdec/swfdec_stroke.c
+++ b/libswfdec/swfdec_stroke.c
@@ -152,7 +152,7 @@ swfdec_stroke_parse (SwfdecSwfDecoder *d
   stroke->end_width = stroke->start_width;
   stroke->start_color = swfdec_bits_get_color (bits);
   stroke->end_color = stroke->start_color;
-  SWFDEC_LOG ("new stroke stroke: width %u color %08x", stroke->start_width, stroke->start_color);
+  SWFDEC_LOG ("new stroke: width %u color %08x", stroke->start_width, stroke->start_color);
 
   return stroke;
 }
@@ -167,7 +167,7 @@ swfdec_stroke_parse_rgba (SwfdecSwfDecod
   stroke->end_width = stroke->start_width;
   stroke->start_color = swfdec_bits_get_rgba (bits);
   stroke->end_color = stroke->start_color;
-  SWFDEC_LOG ("new stroke stroke: width %u color %08x", stroke->start_width, stroke->start_color);
+  SWFDEC_LOG ("new stroke: width %u color %08x", stroke->start_width, stroke->start_color);
 
   return stroke;
 }
@@ -182,7 +182,7 @@ swfdec_stroke_parse_morph (SwfdecSwfDeco
   stroke->end_width = swfdec_bits_get_u16 (bits);
   stroke->start_color = swfdec_bits_get_rgba (bits);
   stroke->end_color = swfdec_bits_get_rgba (bits);
-  SWFDEC_LOG ("new stroke stroke: width %u => %u color %08X => %08X", 
+  SWFDEC_LOG ("new stroke: width %u => %u color %08X => %08X", 
       stroke->start_width, stroke->end_width,
       stroke->start_color, stroke->end_color);
 
diff-tree 19a76c4b9175c087d0cee96ecc21f83114f70abc (from c396c1d9b1488becf71c3ab32ea5b7cd510b8a47)
Author: Benjamin Otte <otte at gnome.org>
Date:   Mon Apr 16 10:36:55 2007 +0200

    end print with a \n

diff --git a/test/dump.c b/test/dump.c
index 96f9328..01e6289 100644
--- a/test/dump.c
+++ b/test/dump.c
@@ -201,7 +201,7 @@ dump_shape (SwfdecShape *shape)
       }
     } else if (SWFDEC_IS_STROKE (shapevec->pattern)) {
       SwfdecStroke *line = SWFDEC_STROKE (shapevec->pattern);
-      g_print ("line (width %u, color #%08X)", line->start_width, line->start_color);
+      g_print ("line (width %u, color #%08X)\n", line->start_width, line->start_color);
     } else {
       g_print ("not filled\n");
     }


More information about the Swfdec mailing list