[Swfdec] 2 commits - libswfdec/swfdec_text_field_movie.c test/image

Pekka Lampila medar at kemper.freedesktop.org
Thu Nov 1 14:33:39 PDT 2007


 libswfdec/swfdec_text_field_movie.c             |    6 ++++--
 test/image/Makefile.am                          |    7 +++++++
 test/image/text-field-color-transform-6.swf     |binary
 test/image/text-field-color-transform-6.swf.png |binary
 test/image/text-field-color-transform-7.swf     |binary
 test/image/text-field-color-transform-7.swf.png |binary
 test/image/text-field-color-transform-8.swf     |binary
 test/image/text-field-color-transform-8.swf.png |binary
 test/image/text-field-color-transform.as        |   22 ++++++++++++++++++++++
 9 files changed, 33 insertions(+), 2 deletions(-)

New commits:
commit 01fddeb3385c067726193de587ed3115f9d0b86b
Author: Pekka Lampila <pekka.lampila at iki.fi>
Date:   Thu Nov 1 23:12:18 2007 +0200

    Add an image test for applying Color transform to TextField

diff --git a/test/image/Makefile.am b/test/image/Makefile.am
index 86c50d3..0bf8a9a 100644
--- a/test/image/Makefile.am
+++ b/test/image/Makefile.am
@@ -120,6 +120,13 @@ EXTRA_DIST = \
 	text-field-autosize-7.swf.png \
 	text-field-autosize-8.swf \
 	text-field-autosize-8.swf.png
+	text-field-color-transform.as \
+	text-field-color-transform-6.swf \
+	text-field-color-transform-6.swf.png \
+	text-field-color-transform-7.swf \
+	text-field-color-transform-7.swf.png \
+	text-field-color-transform-8.swf \
+	text-field-color-transform-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-color-transform-6.swf b/test/image/text-field-color-transform-6.swf
new file mode 100644
index 0000000..aae0b9d
Binary files /dev/null and b/test/image/text-field-color-transform-6.swf differ
diff --git a/test/image/text-field-color-transform-6.swf.png b/test/image/text-field-color-transform-6.swf.png
new file mode 100644
index 0000000..8fba5d8
Binary files /dev/null and b/test/image/text-field-color-transform-6.swf.png differ
diff --git a/test/image/text-field-color-transform-7.swf b/test/image/text-field-color-transform-7.swf
new file mode 100644
index 0000000..df53263
Binary files /dev/null and b/test/image/text-field-color-transform-7.swf differ
diff --git a/test/image/text-field-color-transform-7.swf.png b/test/image/text-field-color-transform-7.swf.png
new file mode 100644
index 0000000..cca6db5
Binary files /dev/null and b/test/image/text-field-color-transform-7.swf.png differ
diff --git a/test/image/text-field-color-transform-8.swf b/test/image/text-field-color-transform-8.swf
new file mode 100644
index 0000000..8098670
Binary files /dev/null and b/test/image/text-field-color-transform-8.swf differ
diff --git a/test/image/text-field-color-transform-8.swf.png b/test/image/text-field-color-transform-8.swf.png
new file mode 100644
index 0000000..6cc7ebd
Binary files /dev/null and b/test/image/text-field-color-transform-8.swf.png differ
diff --git a/test/image/text-field-color-transform.as b/test/image/text-field-color-transform.as
new file mode 100644
index 0000000..2ef86cb
--- /dev/null
+++ b/test/image/text-field-color-transform.as
@@ -0,0 +1,22 @@
+// makeswf -v 7 -r 1 -s 200x150 -o text-field-color-transform-7.swf text-field-color-transform.as
+
+var c1 = new Color (this);
+c1.setTransform ({ ra: 50, rb: 244, ga: 40, gb: 112, ba: 12, bb: 90, aa: 40, ab: 70});
+
+this.createTextField ("t1", 0, 25, 25, 300, 300);
+
+t1.border = true;
+t1.background = true;
+t1.backgroundColor = 0xAA0000;
+
+this.createTextField ("t2", 1, 25, 50, 300, 300);
+
+t2.border = true;
+t2.background = true;
+t2.backgroundColor = 0x00AA00;
+
+this.createTextField ("t3", 2, 50, 25, 300, 300);
+
+t2.border = true;
+t3.background = true;
+t3.backgroundColor = 0x0000AA;
commit 7b5224e080b19eb0c2c62c0d1bb1244cdb6e26b6
Author: Pekka Lampila <pekka.lampila at iki.fi>
Date:   Thu Nov 1 23:11:11 2007 +0200

    Don't use alpha from transforms for TextField's border or background color

diff --git a/libswfdec/swfdec_text_field_movie.c b/libswfdec/swfdec_text_field_movie.c
index 2780b7e..979580e 100644
--- a/libswfdec/swfdec_text_field_movie.c
+++ b/libswfdec/swfdec_text_field_movie.c
@@ -593,7 +593,8 @@ swfdec_text_field_movie_render (SwfdecMovie *movie, cairo_t *cr,
   if (text->background) {
     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);
+    // always use full alpha
+    swfdec_color_set_source (cr, (color & 0xffffff) + (255 << 24));
     cairo_fill (cr);
   }
 
@@ -604,7 +605,8 @@ swfdec_text_field_movie_render (SwfdecMovie *movie, cairo_t *cr,
 	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);
+    // always use full alpha
+    swfdec_color_set_source (cr, (color & 0xffffff) + (255 << 24));
     cairo_set_line_width (cr, SWFDEC_DOUBLE_TO_TWIPS (1));
     cairo_set_operator (cr, CAIRO_OPERATOR_OVER);
     cairo_set_antialias (cr, CAIRO_ANTIALIAS_NONE);


More information about the Swfdec mailing list