Pekka Lampila
2007-Nov-01 20:29 UTC
[Swfdec] 5 commits - libswfdec/swfdec_as_array.c libswfdec/swfdec_as_object.c libswfdec/swfdec_text_field_movie.c test/image
libswfdec/swfdec_as_array.c | 18 +++++++++++++----- libswfdec/swfdec_as_object.c | 2 ++ libswfdec/swfdec_text_field_movie.c | 12 ++++++++---- test/image/Makefile.am | 16 +++++++++++++++- test/image/text-field-autosize-6.swf |binary test/image/text-field-autosize-6.swf.png |binary test/image/text-field-autosize-7.swf |binary test/image/text-field-autosize-7.swf.png |binary test/image/text-field-autosize-8.swf |binary test/image/text-field-autosize-8.swf.png |binary test/image/text-field-autosize.as | 19 +++++++++++++++++++ test/image/text-field-empty-6.swf |binary test/image/text-field-empty-6.swf.png |binary test/image/text-field-empty-7.swf |binary test/image/text-field-empty-7.swf.png |binary test/image/text-field-empty-8.swf |binary test/image/text-field-empty-8.swf.png |binary test/image/text-field-empty.as | 17 +++++++++++++++++ 18 files changed, 74 insertions(+), 10 deletions(-) New commits: commit 0fc692e316d049cd75d916a1263df03d66cf899f Author: Pekka Lampila <pekka.lampila at iki.fi> Date: Thu Nov 1 21:52:15 2007 +0200 Add an image test for TextField's autoSize diff --git a/test/image/Makefile.am b/test/image/Makefile.am index c40fd37..86c50d3 100644 --- a/test/image/Makefile.am +++ b/test/image/Makefile.am @@ -113,6 +113,13 @@ EXTRA_DIST = \ replace-shape-shape-6.swf.png \ replace-shape-shape-7.swf \ replace-shape-shape-7.swf.png \ + text-field-autosize.as \ + text-field-autosize-6.swf \ + text-field-autosize-6.swf.png \ + text-field-autosize-7.swf \ + text-field-autosize-7.swf.png \ + text-field-autosize-8.swf \ + text-field-autosize-8.swf.png text-field-empty.as \ text-field-empty-6.swf \ text-field-empty-6.swf.png \ diff --git a/test/image/text-field-autosize-6.swf b/test/image/text-field-autosize-6.swf new file mode 100644 index 0000000..c172331 Binary files /dev/null and b/test/image/text-field-autosize-6.swf differ diff --git a/test/image/text-field-autosize-6.swf.png b/test/image/text-field-autosize-6.swf.png new file mode 100644 index 0000000..aab8cf6 Binary files /dev/null and b/test/image/text-field-autosize-6.swf.png differ diff --git a/test/image/text-field-autosize-7.swf b/test/image/text-field-autosize-7.swf new file mode 100644 index 0000000..6660b40 Binary files /dev/null and b/test/image/text-field-autosize-7.swf differ diff --git a/test/image/text-field-autosize-7.swf.png b/test/image/text-field-autosize-7.swf.png new file mode 100644 index 0000000..aab8cf6 Binary files /dev/null and b/test/image/text-field-autosize-7.swf.png differ diff --git a/test/image/text-field-autosize-8.swf b/test/image/text-field-autosize-8.swf new file mode 100644 index 0000000..112067c Binary files /dev/null and b/test/image/text-field-autosize-8.swf differ diff --git a/test/image/text-field-autosize-8.swf.png b/test/image/text-field-autosize-8.swf.png new file mode 100644 index 0000000..aab8cf6 Binary files /dev/null and b/test/image/text-field-autosize-8.swf.png differ diff --git a/test/image/text-field-autosize.as b/test/image/text-field-autosize.as new file mode 100644 index 0000000..3aee9ba --- /dev/null +++ b/test/image/text-field-autosize.as @@ -0,0 +1,19 @@ +// makeswf -v 7 -r 1 -s 200x150 -o text-field-autosize-7.swf text-field-autosize.as + +this.createTextField ("t1", 0, 25, 25, 100, 100); + +t1.autoSize = "left"; +t1.background = true; +t1.backgroundColor = 0xFF0000; + +this.createTextField ("t2", 1, 25, 25, 100, 100); + +t2.autoSize = "center"; +t2.background = true; +t2.backgroundColor = 0x00FF00; + +this.createTextField ("t3", 2, 25, 25, 100, 100); + +t3.autoSize = "right"; +t3.background = true; +t3.backgroundColor = 0x0000FF; commit 9004c86799488b57215561140cf32b984066085c Author: Pekka Lampila <pekka.lampila at iki.fi> Date: Thu Nov 1 21:29:16 2007 +0200 Add an image test for empty TextFields Still missing border testing there, since it's one pixel off diff --git a/test/image/Makefile.am b/test/image/Makefile.am index 52cd656..c40fd37 100644 --- a/test/image/Makefile.am +++ b/test/image/Makefile.am @@ -112,5 +112,12 @@ EXTRA_DIST = \ replace-shape-shape-6.swf \ replace-shape-shape-6.swf.png \ replace-shape-shape-7.swf \ - replace-shape-shape-7.swf.png + replace-shape-shape-7.swf.png \ + text-field-empty.as \ + text-field-empty-6.swf \ + text-field-empty-6.swf.png \ + text-field-empty-7.swf \ + text-field-empty-7.swf.png \ + text-field-empty-8.swf \ + text-field-empty-8.swf.png diff --git a/test/image/text-field-empty-6.swf b/test/image/text-field-empty-6.swf new file mode 100644 index 0000000..274518a Binary files /dev/null and b/test/image/text-field-empty-6.swf differ diff --git a/test/image/text-field-empty-6.swf.png b/test/image/text-field-empty-6.swf.png new file mode 100644 index 0000000..27310dd Binary files /dev/null and b/test/image/text-field-empty-6.swf.png differ diff --git a/test/image/text-field-empty-7.swf b/test/image/text-field-empty-7.swf new file mode 100644 index 0000000..cdfbd91 Binary files /dev/null and b/test/image/text-field-empty-7.swf differ diff --git a/test/image/text-field-empty-7.swf.png b/test/image/text-field-empty-7.swf.png new file mode 100644 index 0000000..27310dd Binary files /dev/null and b/test/image/text-field-empty-7.swf.png differ diff --git a/test/image/text-field-empty-8.swf b/test/image/text-field-empty-8.swf new file mode 100644 index 0000000..7f0bdac Binary files /dev/null and b/test/image/text-field-empty-8.swf differ diff --git a/test/image/text-field-empty-8.swf.png b/test/image/text-field-empty-8.swf.png new file mode 100644 index 0000000..27310dd Binary files /dev/null and b/test/image/text-field-empty-8.swf.png differ diff --git a/test/image/text-field-empty.as b/test/image/text-field-empty.as new file mode 100644 index 0000000..b4b4fce --- /dev/null +++ b/test/image/text-field-empty.as @@ -0,0 +1,17 @@ +// makeswf -v 7 -r 1 -s 200x150 -o text-field-empty-7.swf text-field-empty.as + +this.createTextField ("t1", 0, 25, 25, 50, 50); + +t1.background = true; +t1.backgroundColor = 0x00FF00; + +this.createTextField ("t2", 1, 45, 45, 95, 95); + +// FIXME: we currently render right and bottom border one pixel too early +//t2.border = true; +//t2.borderColor = 0xFF0000; +t2.background = true; +t2.backgroundColor = 0x0000FF; + +// this one won't show up at all +this.createTextField ("t3", 2, 75, 75, 50, 50); commit ff972fbc4a41007638ed62b7d217add4510735ca Author: Pekka Lampila <pekka.lampila at iki.fi> Date: Thu Nov 1 21:14:53 2007 +0200 Some OOM fixes to the array code diff --git a/libswfdec/swfdec_as_array.c b/libswfdec/swfdec_as_array.c index 57fb85e..1c9c61a 100644 --- a/libswfdec/swfdec_as_array.c +++ b/libswfdec/swfdec_as_array.c @@ -761,6 +761,8 @@ swfdec_as_array_concat (SwfdecAsContext *cx, SwfdecAsObject *object, guint argc, const char *var; object_new = swfdec_as_array_new (cx); + if (object_new == NULL) + return; array_new = SWFDEC_AS_ARRAY (object_new); swfdec_as_array_append_array (array_new, object); @@ -814,6 +816,8 @@ swfdec_as_array_slice (SwfdecAsContext *cx, SwfdecAsObject *object, guint argc, } object_new = swfdec_as_array_new (cx); + if (object_new == NULL) + return; array_new = SWFDEC_AS_ARRAY (object_new); swfdec_as_array_append_array_range (array_new, object, start_index, num); @@ -851,6 +855,8 @@ swfdec_as_array_splice (SwfdecAsContext *cx, SwfdecAsObject *object, guint argc, num_add = (argc > 2 ? argc - 2 : 0); object_new = swfdec_as_array_new (cx); + if (object_new == NULL) + return; array_new = SWFDEC_AS_ARRAY (object_new); swfdec_as_array_append_array_range (array_new, object, start_index, @@ -1228,11 +1234,13 @@ swfdec_as_array_do_sort (SwfdecAsObject *object, gint32 options, if (fdata.options & ARRAY_SORT_OPTION_RETURNINDEXEDARRAY) { // make a new array and fill it with numbers based on the order fdata.object_new = swfdec_as_array_new (object->context); - swfdec_as_object_foreach (object, swfdec_as_array_foreach_sort_indexedarray, - &fdata); - // we only have the elements that have been set so far, fill in the blanks - swfdec_as_array_sort_set_undefined_indexedarray (object, &fdata); - SWFDEC_AS_VALUE_SET_OBJECT (ret, fdata.object_new); + if (fdata.object_new != NULL) { + swfdec_as_object_foreach (object, swfdec_as_array_foreach_sort_indexedarray, + &fdata); + // we only have the elements that have been set so far, fill in the blanks + swfdec_as_array_sort_set_undefined_indexedarray (object, &fdata); + SWFDEC_AS_VALUE_SET_OBJECT (ret, fdata.object_new); + } } else { // rename properties based on the new order swfdec_as_object_foreach_rename (object, commit 708c0f6ca1361131a717648117060a31946da1c8 Author: Pekka Lampila <pekka.lampila at iki.fi> Date: Thu Nov 1 20:50:37 2007 +0200 Some fixes to background and border drawing in TextField diff --git a/libswfdec/swfdec_text_field_movie.c b/libswfdec/swfdec_text_field_movie.c index 5d499b2..2780b7e 100644 --- a/libswfdec/swfdec_text_field_movie.c +++ b/libswfdec/swfdec_text_field_movie.c @@ -591,19 +591,23 @@ swfdec_text_field_movie_render (SwfdecMovie *movie, cairo_t *cr, cairo_clip (cr); if (text->background) { - cairo_rectangle (cr, limit.x0, limit.y0, limit.x1, limit.y1); + cairo_rectangle (cr, limit.x0, limit.y0, limit.x1 - limit.x0, limit.y1 - limit.y0); color = swfdec_color_apply_transform (text_movie->background_color, trans); swfdec_color_set_source (cr, color); cairo_fill (cr); } if (text->border) { - cairo_rectangle (cr, movie->original_extents.x0, - movie->original_extents.y0, movie->original_extents.x1, - movie->original_extents.y1); + cairo_rectangle (cr, movie->original_extents.x0 + SWFDEC_DOUBLE_TO_TWIPS (1), + movie->original_extents.y0, movie->original_extents.x1 - + movie->original_extents.x0 - SWFDEC_DOUBLE_TO_TWIPS (1), + movie->original_extents.y1 - movie->original_extents.y0 - + SWFDEC_DOUBLE_TO_TWIPS (1)); color = swfdec_color_apply_transform (text_movie->border_color, trans); swfdec_color_set_source (cr, color); cairo_set_line_width (cr, SWFDEC_DOUBLE_TO_TWIPS (1)); + cairo_set_operator (cr, CAIRO_OPERATOR_OVER); + cairo_set_antialias (cr, CAIRO_ANTIALIAS_NONE); cairo_stroke (cr); } commit cd7ef475d2811b1283cc9a8a2ce0d2a0dd086981 Author: Pekka Lampila <pekka.lampila at iki.fi> Date: Thu Nov 1 20:50:00 2007 +0200 Fix another OOM error, in swfdec_as_object_new diff --git a/libswfdec/swfdec_as_object.c b/libswfdec/swfdec_as_object.c index 665b608..f8b8f77 100644 --- a/libswfdec/swfdec_as_object.c +++ b/libswfdec/swfdec_as_object.c @@ -687,6 +687,8 @@ swfdec_as_object_new (SwfdecAsContext *context) g_assert (context->Object_prototype); object = swfdec_as_object_new_empty (context); + if (object == NULL) + return NULL; SWFDEC_AS_VALUE_SET_OBJECT (&val, context->Object); swfdec_as_object_set_variable_and_flags (object, SWFDEC_AS_STR_constructor, &val, SWFDEC_AS_VARIABLE_HIDDEN | SWFDEC_AS_VARIABLE_PERMANENT);
Possibly Parallel Threads
- 2 commits - libswfdec/swfdec_text_field_movie.c test/image
- 2 commits - libswfdec/swfdec_as_array.c test/trace
- Branch 'vivi' - 9 commits - libswfdec/swfdec_as_array.c libswfdec/swfdec_as_function.c libswfdec/swfdec_as_function.h libswfdec/swfdec_as_internal.h libswfdec/swfdec_as_interpret.c libswfdec/swfdec_as_native_function.c
- 2 commits - libswfdec/swfdec_as_array.c libswfdec/swfdec_asbroadcaster.c libswfdec/swfdec_as_object.c libswfdec/swfdec_as_string.c libswfdec/swfdec_color_as.c libswfdec/swfdec_initialize.as
- 4 commits - libswfdec/swfdec_as_array.c libswfdec/swfdec_as_types.c test/trace