[Swfdec-commits] 5 commits - swfdec-gtk/swfdec_gtk_keys.c swfdec/swfdec_keys.h swfdec/swfdec_player.c swfdec/swfdec_sprite.c swfdec/swfdec_sprite_movie.c swfdec/swfdec_sprite_movie.h test/image test/swfdec_test_plugin.c

Benjamin Otte company at kemper.freedesktop.org
Mon Apr 14 12:06:00 PDT 2008


 swfdec-gtk/swfdec_gtk_keys.c    |    6 +--
 swfdec/swfdec_keys.h            |    2 +
 swfdec/swfdec_player.c          |    2 +
 swfdec/swfdec_sprite.c          |    1 
 swfdec/swfdec_sprite_movie.c    |   11 ++++--
 swfdec/swfdec_sprite_movie.h    |    3 -
 test/image/Makefile.am          |    9 +++++
 test/image/background-5.swf     |binary
 test/image/background-5.swf.png |binary
 test/image/background-6.swf     |binary
 test/image/background-6.swf.png |binary
 test/image/background-7.swf     |binary
 test/image/background-7.swf.png |binary
 test/image/background-8.swf     |binary
 test/image/background-8.swf.png |binary
 test/image/background.xml       |   69 ++++++++++++++++++++++++++++++++++++++++
 test/swfdec_test_plugin.c       |    4 ++
 17 files changed, 95 insertions(+), 12 deletions(-)

New commits:
commit 678cb194b13740a80ddd71c69918f9cfa6bf61fb
Author: Benjamin Otte <otte at gnome.org>
Date:   Mon Apr 14 21:03:27 2008 +0200

    add a test for background handling

diff --git a/test/image/Makefile.am b/test/image/Makefile.am
index 9061e65..1ea37e9 100644
--- a/test/image/Makefile.am
+++ b/test/image/Makefile.am
@@ -3,6 +3,15 @@ check-local: ../swfdec-test
 
 EXTRA_DIST = \
 	README \
+	background-5.swf \
+	background-5.swf.png \
+	background-6.swf \
+	background-6.swf.png \
+	background-7.swf \
+	background-7.swf.png \
+	background-8.swf \
+	background-8.swf.png \
+	background.xml \
 	bw.jpg \
 	clip-change.c \
 	clip-change-backward-5.swf \
diff --git a/test/image/background-5.swf b/test/image/background-5.swf
new file mode 100644
index 0000000..ab5b7cc
Binary files /dev/null and b/test/image/background-5.swf differ
diff --git a/test/image/background-5.swf.png b/test/image/background-5.swf.png
new file mode 100644
index 0000000..7340313
Binary files /dev/null and b/test/image/background-5.swf.png differ
diff --git a/test/image/background-6.swf b/test/image/background-6.swf
new file mode 100644
index 0000000..92c1483
Binary files /dev/null and b/test/image/background-6.swf differ
diff --git a/test/image/background-6.swf.png b/test/image/background-6.swf.png
new file mode 100644
index 0000000..d83887e
Binary files /dev/null and b/test/image/background-6.swf.png differ
diff --git a/test/image/background-7.swf b/test/image/background-7.swf
new file mode 100644
index 0000000..4265e47
Binary files /dev/null and b/test/image/background-7.swf differ
diff --git a/test/image/background-7.swf.png b/test/image/background-7.swf.png
new file mode 100644
index 0000000..76f94bb
Binary files /dev/null and b/test/image/background-7.swf.png differ
diff --git a/test/image/background-8.swf b/test/image/background-8.swf
new file mode 100644
index 0000000..7905450
Binary files /dev/null and b/test/image/background-8.swf differ
diff --git a/test/image/background-8.swf.png b/test/image/background-8.swf.png
new file mode 100644
index 0000000..1a43e68
Binary files /dev/null and b/test/image/background-8.swf.png differ
diff --git a/test/image/background.xml b/test/image/background.xml
new file mode 100644
index 0000000..9686698
--- /dev/null
+++ b/test/image/background.xml
@@ -0,0 +1,69 @@
+<?xml version="1.0"?>
+<swf version="8" compressed="1">
+  <Header framerate="30" frames="366">
+    <size>
+      <Rectangle left="0" right="4000" top="0" bottom="3000"/>
+    </size>
+    <tags>
+      <FileAttributes hasMetaData="0" useNetwork="0"/>
+      <SetBackgroundColor>
+        <color>
+          <Color red="0" green="0" blue="255"/>
+        </color>
+      </SetBackgroundColor>
+      <DefineShape2 objectID="1">
+        <bounds>
+          <Rectangle left="0" right="20" top="0" bottom="20"/>
+        </bounds>
+        <styles>
+          <StyleList>
+            <fillStyles>
+	      <Solid>
+		<color>
+		  <Color red="0" green="255" blue="0" alpha="255"/>
+		</color>
+	      </Solid>
+            </fillStyles>
+	    <lineStyles />
+          </StyleList>
+        </styles>
+        <shapes>
+          <Shape>
+            <edges>
+              <ShapeSetup x="20" y="20" fillStyle0="1"/>
+              <LineTo x="0" y="20"/>
+              <LineTo x="20" y="0"/>
+              <LineTo x="0" y="-20"/>
+              <LineTo x="-20" y="0"/>
+              <ShapeSetup/>
+            </edges>
+          </Shape>
+        </shapes>
+      </DefineShape2>
+      <DefineSprite objectID="2" frames="1">
+        <tags>
+	  <SetBackgroundColor>
+	    <color>
+	      <Color red="255" green="0" blue="0"/>
+	    </color>
+	  </SetBackgroundColor>
+	  <PlaceObject2 depth="0" objectID="1">
+            <transform>
+              <Transform transX="0" transY="0"/>
+            </transform>
+	  </PlaceObject2>
+	  <PlaceObject2 depth="1" objectID="1">
+            <transform>
+              <Transform transX="1980" transY="1980"/>
+            </transform>
+	  </PlaceObject2>
+	  <ShowFrame/>
+          <End/>
+        </tags>
+      </DefineSprite>
+      <PlaceObject2 depth="1" objectID="2" />
+      <ShowFrame/>
+      <End/>
+    </tags>
+  </Header>
+</swf>
commit a4a6a13ea6a382f3d06fe1e02d916b93b3e08fb7
Author: Benjamin Otte <otte at gnome.org>
Date:   Mon Apr 14 21:00:00 2008 +0200

    we keep no bgcolor in the movie anymore

diff --git a/swfdec/swfdec_sprite_movie.h b/swfdec/swfdec_sprite_movie.h
index 967b530..41cf451 100644
--- a/swfdec/swfdec_sprite_movie.h
+++ b/swfdec/swfdec_sprite_movie.h
@@ -49,9 +49,6 @@ struct _SwfdecSpriteMovie
   guint			n_frames;	/* amount of frames */
   gboolean		playing;	/* TRUE if the movie automatically advances */
 
-  /* color information */
-  SwfdecColor		bgcolor;	/* background color (only used on main sprite) */
-
   /* audio stream handling */
   guint			sound_frame;	/* current sound frame */
   SwfdecAudio *		sound_stream;	/* stream that currently plays */
commit 4d56b3ab4edd8266ecc591da5b5770ab026da0b4
Author: Benjamin Otte <otte at gnome.org>
Date:   Mon Apr 14 20:58:13 2008 +0200

    rework background handling again
    
    - we need to draw the full background all the time
    - draw the background from the sprite directly, otherwise it won't pick up
      changes after it was created

diff --git a/swfdec/swfdec_sprite.c b/swfdec/swfdec_sprite.c
index cf639fe..645cf09 100644
--- a/swfdec/swfdec_sprite.c
+++ b/swfdec/swfdec_sprite.c
@@ -137,7 +137,6 @@ swfdec_sprite_create_movie (SwfdecGraphic *graphic, gsize *size)
 
   ret->sprite = SWFDEC_SPRITE (graphic);
   ret->n_frames = ret->sprite->n_frames;
-  ret->bgcolor = ret->sprite->bgcolor;
   *size = sizeof (SwfdecSpriteMovie);
 
   return SWFDEC_MOVIE (ret);
diff --git a/swfdec/swfdec_sprite_movie.c b/swfdec/swfdec_sprite_movie.c
index f62b6a4..4a50db2 100644
--- a/swfdec/swfdec_sprite_movie.c
+++ b/swfdec/swfdec_sprite_movie.c
@@ -764,11 +764,14 @@ swfdec_sprite_movie_render (SwfdecMovie *mov, cairo_t *cr,
     const SwfdecColorTransform *trans, const SwfdecRect *inval)
 {
   SwfdecSpriteMovie *movie = SWFDEC_SPRITE_MOVIE (mov);
+  SwfdecResource *resource;
 
-  if (movie->bgcolor) {
-    cairo_rectangle (cr, mov->original_extents.x0, mov->original_extents.y0,
-	mov->original_extents.x1, mov->original_extents.y1);
-    swfdec_color_set_source (cr, movie->bgcolor);
+  resource = swfdec_movie_get_own_resource (mov);
+  if (resource && movie->sprite && movie->sprite->bgcolor) {
+    cairo_rectangle (cr, 0, 0, 
+	resource->decoder->width * SWFDEC_TWIPS_SCALE_FACTOR,
+	resource->decoder->height * SWFDEC_TWIPS_SCALE_FACTOR);
+    swfdec_color_set_source (cr, movie->sprite->bgcolor);
     cairo_fill (cr);
   }
 
commit 13d223364bc4cda7f7c3b1412c94608fc70a796a
Author: Pavel Roskin <proski at gnu.org>
Date:   Mon Apr 14 15:48:06 2008 +0200

    Enable dot and comma in text input

diff --git a/swfdec-gtk/swfdec_gtk_keys.c b/swfdec-gtk/swfdec_gtk_keys.c
index 69e0a6e..122e8ec 100644
--- a/swfdec-gtk/swfdec_gtk_keys.c
+++ b/swfdec-gtk/swfdec_gtk_keys.c
@@ -34,8 +34,8 @@ static const guint8 flash_keycodes[] = {
   /*  40 */ SWFDEC_KEY_D, SWFDEC_KEY_F, SWFDEC_KEY_G, SWFDEC_KEY_H, SWFDEC_KEY_J,
   /*  45 */ SWFDEC_KEY_K, SWFDEC_KEY_L, SWFDEC_KEY_SEMICOLON, SWFDEC_KEY_APOSTROPHE, SWFDEC_KEY_GRAVE,
   /*  50 */ SWFDEC_KEY_SHIFT, SWFDEC_KEY_BACKSLASH, SWFDEC_KEY_Z, SWFDEC_KEY_X, SWFDEC_KEY_C, 
-  /*  55 */ SWFDEC_KEY_V, SWFDEC_KEY_B, SWFDEC_KEY_N, SWFDEC_KEY_M, 0, 
-  /*  60 */ 0, SWFDEC_KEY_SLASH, SWFDEC_KEY_SHIFT, SWFDEC_KEY_NUMPAD_MULTIPLY, SWFDEC_KEY_ALT,
+  /*  55 */ SWFDEC_KEY_V, SWFDEC_KEY_B, SWFDEC_KEY_N, SWFDEC_KEY_M, SWFDEC_KEY_COMMA, 
+  /*  60 */ SWFDEC_KEY_DOT, SWFDEC_KEY_SLASH, SWFDEC_KEY_SHIFT, SWFDEC_KEY_NUMPAD_MULTIPLY, SWFDEC_KEY_ALT,
   /*  65 */ SWFDEC_KEY_SPACE, 0, SWFDEC_KEY_F1, SWFDEC_KEY_F2, SWFDEC_KEY_F3, 
   /*  70 */ SWFDEC_KEY_F4, SWFDEC_KEY_F5, SWFDEC_KEY_F6, SWFDEC_KEY_F7, SWFDEC_KEY_F8,
   /*  75 */ SWFDEC_KEY_F9, SWFDEC_KEY_F10, SWFDEC_KEY_NUM_LOCK, 0, SWFDEC_KEY_NUMPAD_7,
@@ -49,8 +49,6 @@ static const guint8 flash_keycodes[] = {
   /* 115 */ 0, 0, 0, 0, 0
 };
 /*
-SWFDEC_KEY_COMMA 59
-SWFDEC_KEY_DOT 60
 SWFDEC_KEY_SCROLL_LOCK 78
 SWFDEC_KEY_BREAK 110
 SWFDEC_KEY_META 115
diff --git a/swfdec/swfdec_keys.h b/swfdec/swfdec_keys.h
index a32e546..277508b 100644
--- a/swfdec/swfdec_keys.h
+++ b/swfdec/swfdec_keys.h
@@ -113,7 +113,9 @@ typedef enum {
   SWFDEC_KEY_NUM_LOCK = 144,
   SWFDEC_KEY_SEMICOLON = 186,
   SWFDEC_KEY_EQUAL = 187,
+  SWFDEC_KEY_COMMA = 188,
   SWFDEC_KEY_MINUS = 189,
+  SWFDEC_KEY_DOT = 190,
   SWFDEC_KEY_SLASH = 191,
   SWFDEC_KEY_GRAVE = 192,
   SWFDEC_KEY_LEFT_BRACKET = 219,
diff --git a/swfdec/swfdec_player.c b/swfdec/swfdec_player.c
index ada8aa2..5de9ec0 100644
--- a/swfdec/swfdec_player.c
+++ b/swfdec/swfdec_player.c
@@ -226,7 +226,9 @@
  * @SWFDEC_KEY_NUM_LOCK: the num lock key
  * @SWFDEC_KEY_SEMICOLON: the semicolon key (on English keyboards)
  * @SWFDEC_KEY_EQUAL: the equal key (on English keyboards)
+ * @SWFDEC_KEY_COMMA: the comma key (on English keyboards)
  * @SWFDEC_KEY_MINUS: the minus key (on English keyboards)
+ * @SWFDEC_KEY_DOT: the dot key (on English keyboards)
  * @SWFDEC_KEY_SLASH: the slash key (on English keyboards)
  * @SWFDEC_KEY_GRAVE: the grave key (on English keyboards)
  * @SWFDEC_KEY_LEFT_BRACKET: the left bracket key (on English keyboards)
commit 1a7423bd21c592a0736948b2141c8079dd249b2b
Author: Benjamin Otte <otte at gnome.org>
Date:   Mon Apr 14 14:35:04 2008 +0200

    the default background is white, so make sure we provide that

diff --git a/test/swfdec_test_plugin.c b/test/swfdec_test_plugin.c
index 3bcee26..5bf5794 100644
--- a/test/swfdec_test_plugin.c
+++ b/test/swfdec_test_plugin.c
@@ -51,6 +51,10 @@ swfdec_test_plugin_swfdec_screenshot (SwfdecTestPlugin *plugin, unsigned char *d
   surface = cairo_image_surface_create_for_data (data, CAIRO_FORMAT_ARGB32, 
       width, height, width * 4);
   cr = cairo_create (surface);
+  /* use a white background */
+  cairo_set_source_rgb (cr, 1, 1, 1);
+  cairo_paint (cr);
+
   cairo_translate (cr, -x, -y);
   swfdec_player_render (plugin->data, cr, x, y, width, height);
   cairo_destroy (cr);


More information about the Swfdec-commits mailing list