2008-01-21 Matthew Allum <mallum@openedhand.com>
authorMatthew Allum <mallum@openedhand.com>
Mon, 21 Jan 2008 11:39:23 +0000 (11:39 +0000)
committerMatthew Allum <mallum@openedhand.com>
Mon, 21 Jan 2008 11:39:23 +0000 (11:39 +0000)
        * clutter/clutter-group.c:
        Make sure unrealizing a group also unrealizes children.

        * clutter/glx/clutter-stage-glx.c:
        Chain up to group unrealize to make sure textures get unrealized
        when changing context (see #718)

        * clutter/clutter-texture.c:
        Formatting cleanups

ChangeLog
clutter/clutter-group.c
clutter/clutter-texture.c
clutter/glx/clutter-stage-glx.c

index 692d3bf..19b7c10 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2008-01-21  Matthew Allum  <mallum@openedhand.com>
+
+       * clutter/clutter-group.c:
+       Make sure unrealizing a group also unrealizes children.
+
+       * clutter/glx/clutter-stage-glx.c:
+       Chain up to group unrealize to make sure textures get unrealized
+       when changing context (see #718)
+
+       * clutter/clutter-texture.c:
+       Formatting cleanups
+
 2008-01-21  Øyvind Kolås  <pippin@gimp.org>
 
        * tests/test-shader.c: fix incompatible types in shader programs
index 719c566..1505c23 100644 (file)
@@ -109,6 +109,14 @@ clutter_group_paint (ClutterActor *actor)
 }
 
 static void
+clutter_group_unrealize (ClutterActor *actor)
+{
+  clutter_container_foreach (CLUTTER_CONTAINER (actor),
+                             CLUTTER_CALLBACK (clutter_actor_unrealize),
+                             NULL);
+}
+
+static void
 clutter_group_pick (ClutterActor       *actor,
                    const ClutterColor *color)
 {
@@ -428,6 +436,7 @@ clutter_group_class_init (ClutterGroupClass *klass)
   actor_class->hide_all        = clutter_group_real_hide_all;
   actor_class->request_coords  = clutter_group_request_coords;
   actor_class->query_coords    = clutter_group_query_coords;
+  actor_class->unrealize       = clutter_group_unrealize;
 
   /**
    * ClutterGroup::add:
index fb771c0..8366c53 100644 (file)
@@ -1117,7 +1117,9 @@ pixbuf_destroy_notify (guchar  *pixels, gpointer data)
  * Gets a #GdkPixbuf representation of the #ClutterTexture data.
  * The created #GdkPixbuf is not owned by the texture but the caller.
  *
- * Return value: A #GdkPixbuf
+ * Note: NULL is always returned with OpenGL ES. 
+ *
+ * Return value: A #GdkPixbuf or NULL on fail.
  **/
 GdkPixbuf*
 clutter_texture_get_pixbuf (ClutterTexture* texture)
@@ -1363,8 +1365,9 @@ clutter_texture_set_from_rgb_data   (ClutterTexture     *texture,
   gboolean               texture_dirty = TRUE, size_change = FALSE;
 
   priv = texture->priv;
-  if (!texture_prepare_upload (TRUE, texture, data, has_alpha, width, height, rowstride,
-                               bpp, flags, &copy_data, &texture_dirty, &size_change))
+  if (!texture_prepare_upload (TRUE, texture, data, has_alpha, 
+                              width, height, rowstride, bpp, flags, 
+                              &copy_data, &texture_dirty, &size_change))
     {
       return FALSE;
     }
@@ -1914,35 +1917,33 @@ texture_update_data (ClutterTexture *texture,
         gint effective_y;
         gint effective_height;
 
-
 /*
--- first tile --
-|--------------------- priv->width ------------------------------|
-| <- priv->x_tiles[x].pos
-|-----------| <- priv->x_tiles[x].size
-|-------| <- x_0
-        |------------| <- width
-|--------------------| <- x_0 + width
-|-------| <- master_offset = -8
-|-------| <- effective_x = 8
-        |---| <- effective_width
-
--- second tile ---
-
-|--------------------- priv->width ------------------------------|
-|-----------|  <- priv->x_tiles[x].pos
-            |-----------| <- priv->x_tiles[x].size (src_w)
-|-------| <- x_0
-        |------------| <- width
-|--------------------| <- x_0 + width
-        |---| <- master_offset = 4 
-            | <- effective_x (0 in between)
-            |--------| <- effective_width
-
-
-        XXXXXXXXXXXXXX    <- master       
-|___________|___________|___________|___________|___________|_____%%%%%%|
-*/
+ *  -- first tile --
+ *  |--------------------- priv->width ------------------------------|
+ *  | <- priv->x_tiles[x].pos
+ *  |-----------| <- priv->x_tiles[x].size
+ *  |-------| <- x_0
+ *          |------------| <- width
+ *  |--------------------| <- x_0 + width
+ *  |-------| <- master_offset = -8
+ *  |-------| <- effective_x = 8
+ *          |---| <- effective_width
+ *  
+ *  -- second tile ---
+ *  
+ *  |--------------------- priv->width ------------------------------|
+ *  |-----------|  <- priv->x_tiles[x].pos
+ *              |-----------| <- priv->x_tiles[x].size (src_w)
+ *  |-------| <- x_0
+ *          |------------| <- width
+ *  |--------------------| <- x_0 + width
+ *          |---| <- master_offset = 4 
+ *              | <- effective_x (0 in between)
+ *              |--------| <- effective_width
+ *  
+ *         XXXXXXXXXXXXXX    <- master       
+ *  |___________|___________|___________|___________|___________|_____%%%%%%|
+ */
 
         gint src_w, src_h;
 
index 31d2fbe..545dc4f 100644 (file)
@@ -37,6 +37,8 @@
 #include "../clutter-debug.h"
 #include "../clutter-units.h"
 #include "../clutter-shader.h"
+#include "../clutter-group.h"
+#include "../clutter-container.h"
 
 #include "cogl.h"
 
@@ -59,6 +61,11 @@ clutter_stage_glx_unrealize (ClutterActor *actor)
 
   g_object_get (actor, "offscreen", &was_offscreen, NULL);
 
+  /* Chain up so all children get unrealized, needed to move texture data
+   * across contexts
+  */
+  CLUTTER_ACTOR_CLASS (clutter_stage_glx_parent_class)->unrealize (actor);
+
   clutter_x11_trap_x_errors ();
 
   /* Unrealize all shaders, since the GL context is going away */