[Swfdec-commits] 9 commits - doc/swfdec-docs.sgml swfdec/swfdec_bitmap_data.c

Benjamin Otte company at kemper.freedesktop.org
Wed Sep 24 06:46:45 PDT 2008


 doc/swfdec-docs.sgml        |    1 
 swfdec/swfdec_bitmap_data.c |   53 +++++++++++++++++++++++---------------------
 2 files changed, 29 insertions(+), 25 deletions(-)

New commits:
commit 9e4215fcc4b9c9bcf6d8a1dbfad76219710ca682
Merge: a4c5787... d22d751...
Author: Benjamin Otte <otte at gnome.org>
Date:   Wed Sep 24 15:41:23 2008 +0200

    Merge branch '0.8'

commit d22d7510281b93e094afa621997ec7ffed35b247
Author: Benjamin Otte <otte at gnome.org>
Date:   Sat Sep 20 15:03:21 2008 +0200

    add symbol index to documentation

diff --git a/doc/swfdec-docs.sgml b/doc/swfdec-docs.sgml
index fdffb68..4b5de7e 100644
--- a/doc/swfdec-docs.sgml
+++ b/doc/swfdec-docs.sgml
@@ -42,4 +42,5 @@
     <xi:include href="xml/SwfdecAsFrame.xml"/>
     <xi:include href="xml/SwfdecAsDebugger.xml"/>
   </chapter>
+  <index />
 </book>
commit ae1369c29db95c6d60848116c4c4ebc062a33053
Author: Pekka Lampila <pekka.lampila at iki.fi>
Date:   Wed Sep 17 13:05:12 2008 +0300

    Don't require policy file for NetStream
    
    It's only required if checkPolicyFile property is true. Which is only needed to
    allow BitmapData.draw for the NetStream object

diff --git a/swfdec/swfdec_net_stream.c b/swfdec/swfdec_net_stream.c
index 77bbc21..601576d 100644
--- a/swfdec/swfdec_net_stream.c
+++ b/swfdec/swfdec_net_stream.c
@@ -586,12 +586,14 @@ swfdec_net_stream_load (SwfdecPlayer *player, gboolean allowed, gpointer streamp
   stream->requested_url = NULL;
 }
 
+// When checkPolicyFile is true the YES values in last column must be changed
+// to POLICY
 static const SwfdecAccessMatrix swfdec_net_stream_matrix = {
   { SWFDEC_ACCESS_NO,  SWFDEC_ACCESS_NO,  SWFDEC_ACCESS_NO },
-  { SWFDEC_ACCESS_NO,  SWFDEC_ACCESS_YES, SWFDEC_ACCESS_POLICY },
+  { SWFDEC_ACCESS_NO,  SWFDEC_ACCESS_YES, SWFDEC_ACCESS_YES },
   { SWFDEC_ACCESS_YES, SWFDEC_ACCESS_NO,  SWFDEC_ACCESS_NO },
-  { SWFDEC_ACCESS_NO,  SWFDEC_ACCESS_NO,  SWFDEC_ACCESS_POLICY },
-  { SWFDEC_ACCESS_YES, SWFDEC_ACCESS_NO,  SWFDEC_ACCESS_POLICY }
+  { SWFDEC_ACCESS_NO,  SWFDEC_ACCESS_NO,  SWFDEC_ACCESS_YES },
+  { SWFDEC_ACCESS_YES, SWFDEC_ACCESS_NO,  SWFDEC_ACCESS_YES }
 };
 
 void
commit 8527ea61df0bb41c8eda0dd094824274e0216f00
Author: Benjamin Otte <otte at gnome.org>
Date:   Mon Sep 15 19:13:03 2008 +0200

    SWF files seem to be loaded without requiring a policy file

diff --git a/swfdec/swfdec_resource.c b/swfdec/swfdec_resource.c
index 5fb9f01..67a5c9c 100644
--- a/swfdec/swfdec_resource.c
+++ b/swfdec/swfdec_resource.c
@@ -592,8 +592,8 @@ static const SwfdecAccessMatrix swfdec_resource_matrix = {
   { SWFDEC_ACCESS_NO,  SWFDEC_ACCESS_NO,  SWFDEC_ACCESS_NO },
   { SWFDEC_ACCESS_NO,  SWFDEC_ACCESS_YES, SWFDEC_ACCESS_YES },
   { SWFDEC_ACCESS_YES, SWFDEC_ACCESS_NO,  SWFDEC_ACCESS_NO },
-  { SWFDEC_ACCESS_YES, SWFDEC_ACCESS_NO,  SWFDEC_ACCESS_POLICY },
-  { SWFDEC_ACCESS_YES, SWFDEC_ACCESS_NO,  SWFDEC_ACCESS_POLICY }
+  { SWFDEC_ACCESS_YES, SWFDEC_ACCESS_NO,  SWFDEC_ACCESS_YES },
+  { SWFDEC_ACCESS_YES, SWFDEC_ACCESS_NO,  SWFDEC_ACCESS_YES }
 };
 
 static void
commit baa777e37a1d2fa71046cd7cc455b03baf9c1bb2
Author: Benjamin Otte <otte at gnome.org>
Date:   Sun Sep 14 20:20:58 2008 +0200

    improve documentation for SwfdecRenderer
    
    It seems to be unclear that SwfdecRenderer objects should be kept around.

diff --git a/swfdec/swfdec_renderer.c b/swfdec/swfdec_renderer.c
index 7e4495c..259f28a 100644
--- a/swfdec/swfdec_renderer.c
+++ b/swfdec/swfdec_renderer.c
@@ -42,18 +42,21 @@ struct _SwfdecRendererPrivate {
  * The #SwfdecRenderer object is used internally to improve rendering done by
  * Swfdec.
  *
- * The first thing #SwfdecRenderer does is provide a way to cache data relevant
- * to rendering.
+ * The first thing a #SwfdecRenderer does is provide a way to cache data relevant
+ * to rendering. This means it will cache surfaces that are expensive to create
+ * (like decoded JPEG images) in a format most suitable to quick rendering.
+ * Therefore, it's a good idea to keep renderers around as long as any drawing 
+ * to the attached surface happens.
  *
- * The second thing it does is provide access to the surface that is used for 
- * rendering, even when not in the process of rendering. This is relevant for
- * font backends, as different surfaces provide different native fonts. See
- * swfdec_player_set_default_backend() for details about this.
+ * The second thing a #SwfdecRenderer does is provide access to the surface 
+ * that is used for rendering, even when not in the process of rendering. This 
+ * is relevant for font backends, as different surfaces provide different 
+ * native fonts. See swfdec_player_set_default_backend() for details about this.
  *
- * The third thing it does is provide a list of virtual functions for critical
- * operations that you can optimize using subclasses to provide faster 
- * implementations. Note that a working default implementation is provided, so
- * you only need to override the functions you care about. 
+ * The third thing #SwfdecRenderer does is provide a list of virtual functions 
+ * for critical operations that you can optimize using subclasses to provide 
+ * faster implementations. Note that a working default implementation is 
+ * provided, so you only need to override the functions you care about. 
  * See #SwfdecRendererClass for details about these functions.
  */
 
commit 1cad56ce3fe0a6c7988285b9a595ea6a4710c6a1
Author: Benjamin Otte <otte at gnome.org>
Date:   Sun Sep 14 19:52:55 2008 +0200

    We require glib 2.16

diff --git a/README b/README
index f9e0632..09955b8 100644
--- a/README
+++ b/README
@@ -64,7 +64,7 @@ Limitations:
 Dependencies:
 
   cairo (>= 1.2.0 - >= 1.8.0 recommended) with png support enabled
-  glib (>= 2.14.0)
+  glib (>= 2.16.0)
   liboil (>= 0.3.6)
   Pangocairo (>= 1.16.0) - this is provided by Pango
   zlib (>= 1.1.4)
commit a4c5787b017072026f185cb5a891729c44e49cd5
Author: Benjamin Otte <otte at gnome.org>
Date:   Sun Sep 21 11:28:28 2008 +0200

    rewrite BitmapData.copyPixels to be cleaner

diff --git a/swfdec/swfdec_bitmap_data.c b/swfdec/swfdec_bitmap_data.c
index 62c0551..4ed1964 100644
--- a/swfdec/swfdec_bitmap_data.c
+++ b/swfdec/swfdec_bitmap_data.c
@@ -386,6 +386,8 @@ swfdec_bitmap_data_copyPixels (SwfdecAsContext *cx, SwfdecAsObject *object,
   SwfdecAsObject *recto, *pt, *apt = NULL;
   SwfdecRectangle rect;
   gboolean copy_alpha = FALSE;
+  SwfdecColorTransform ctrans;
+  cairo_pattern_t *pattern;
   cairo_t *cr;
   int x, y;
 
@@ -405,18 +407,19 @@ swfdec_bitmap_data_copyPixels (SwfdecAsContext *cx, SwfdecAsObject *object,
   cr = cairo_create (bitmap->surface);
   cairo_rectangle (cr, rect.x, rect.y, rect.width, rect.height);
   cairo_clip (cr);
+  cairo_translate (cr, rect.x - x, rect.y - y);
+  swfdec_color_transform_init_identity (&ctrans);
+  pattern = swfdec_bitmap_data_get_pattern (source,
+	SWFDEC_PLAYER (cx)->priv->renderer,
+	&ctrans);
+  cairo_set_source (cr, pattern);
+  cairo_pattern_destroy (pattern);
   if (bitmap == source) {
-    cairo_surface_t *copy = cairo_surface_create_similar (source->surface,
-	cairo_surface_get_content (source->surface),
-	rect.width, rect.height);
-    cairo_t *cr2 = cairo_create (copy);
-    cairo_set_source_surface (cr2, source->surface, x, y);
-    cairo_paint (cr2);
-    cairo_destroy (cr2);
-    cairo_set_source_surface (cr, copy, rect.x, rect.y);
-    cairo_surface_destroy (copy);
-  } else {
-    cairo_set_source_surface (cr, source->surface, rect.x - x, rect.y - y);
+    /* FIXME Is this necessary or does Cairo handle source == target? */
+    cairo_push_group_with_content (cr, cairo_surface_get_content (source->surface));
+    cairo_set_operator (cr, CAIRO_OPERATOR_SOURCE);
+    cairo_paint (cr);
+    cairo_pop_group_to_source (cr);
   }
 
   if (swfdec_surface_has_alpha (bitmap->surface) && !copy_alpha) {
@@ -424,21 +427,20 @@ swfdec_bitmap_data_copyPixels (SwfdecAsContext *cx, SwfdecAsObject *object,
   }
 
   if (alpha) {
-    cairo_surface_t *mask = cairo_surface_create_similar (alpha->surface,
-	CAIRO_CONTENT_COLOR_ALPHA, rect.width, rect.height);
-    cairo_t *cr2 = cairo_create (mask);
-
-    cairo_surface_set_device_offset (mask, -rect.x, -rect.y);
-    cairo_set_source (cr2, cairo_get_source (cr));
+    cairo_push_group_with_content (cr, cairo_surface_get_content (source->surface));
+    pattern = swfdec_bitmap_data_get_pattern (alpha,
+	  SWFDEC_PLAYER (cx)->priv->renderer,
+	  &ctrans);
     if (apt) {
-      swfdec_point_from_as_object (&x, &y, apt);
+      int mask_x, mask_y;
+      swfdec_point_from_as_object (&mask_x, &mask_y, apt);
+      cairo_translate (cr, x - mask_x, y - mask_y);
     } else {
-      x = y = 0;
+      cairo_translate (cr, x, y);
     }
-    cairo_mask_surface (cr2, alpha->surface, rect.x - x, rect.y - y);
-    cairo_destroy (cr2);
-    cairo_set_source_surface (cr, mask, 0, 0);
-    cairo_surface_destroy (mask);
+    cairo_mask (cr, pattern);
+    cairo_pattern_destroy (pattern);
+    cairo_pop_group_to_source (cr);
   }
   cairo_paint (cr);
   cairo_destroy (cr);
commit c35507fc680a16466b3354d773b79d1ca78104b0
Author: Benjamin Otte <otte at gnome.org>
Date:   Sun Sep 21 10:54:55 2008 +0200

    change copyPixels implementation slightly

diff --git a/swfdec/swfdec_bitmap_data.c b/swfdec/swfdec_bitmap_data.c
index 4e97ee6..62c0551 100644
--- a/swfdec/swfdec_bitmap_data.c
+++ b/swfdec/swfdec_bitmap_data.c
@@ -403,6 +403,8 @@ swfdec_bitmap_data_copyPixels (SwfdecAsContext *cx, SwfdecAsObject *object,
   y = rect.y;
   swfdec_point_from_as_object (&rect.x, &rect.y, pt);
   cr = cairo_create (bitmap->surface);
+  cairo_rectangle (cr, rect.x, rect.y, rect.width, rect.height);
+  cairo_clip (cr);
   if (bitmap == source) {
     cairo_surface_t *copy = cairo_surface_create_similar (source->surface,
 	cairo_surface_get_content (source->surface),
@@ -421,7 +423,6 @@ swfdec_bitmap_data_copyPixels (SwfdecAsContext *cx, SwfdecAsObject *object,
     cairo_set_operator (cr, CAIRO_OPERATOR_SOURCE);
   }
 
-  cairo_rectangle (cr, rect.x, rect.y, rect.width, rect.height);
   if (alpha) {
     cairo_surface_t *mask = cairo_surface_create_similar (alpha->surface,
 	CAIRO_CONTENT_COLOR_ALPHA, rect.width, rect.height);
@@ -439,7 +440,7 @@ swfdec_bitmap_data_copyPixels (SwfdecAsContext *cx, SwfdecAsObject *object,
     cairo_set_source_surface (cr, mask, 0, 0);
     cairo_surface_destroy (mask);
   }
-  cairo_fill (cr);
+  cairo_paint (cr);
   cairo_destroy (cr);
   swfdec_bitmap_data_invalidate (bitmap, rect.x, rect.y, rect.width, rect.height);
 }
commit 38b030b0eb2298dd3f1dc48767215a6e4a6eb232
Author: Benjamin Otte <otte at gnome.org>
Date:   Sat Sep 20 15:03:21 2008 +0200

    add symbol index

diff --git a/doc/swfdec-docs.sgml b/doc/swfdec-docs.sgml
index fdffb68..4b5de7e 100644
--- a/doc/swfdec-docs.sgml
+++ b/doc/swfdec-docs.sgml
@@ -42,4 +42,5 @@
     <xi:include href="xml/SwfdecAsFrame.xml"/>
     <xi:include href="xml/SwfdecAsDebugger.xml"/>
   </chapter>
+  <index />
 </book>


More information about the Swfdec-commits mailing list