diff --git a/ChangeLog b/ChangeLog index 692d3bfe2..19b7c10c4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,15 @@ +2008-01-21 Matthew Allum + + * 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 * tests/test-shader.c: fix incompatible types in shader programs diff --git a/clutter/clutter-group.c b/clutter/clutter-group.c index 719c56636..1505c2386 100644 --- a/clutter/clutter-group.c +++ b/clutter/clutter-group.c @@ -108,6 +108,14 @@ clutter_group_paint (ClutterActor *actor) CLUTTER_NOTE (PAINT, "ClutterGroup paint leave"); } +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: diff --git a/clutter/clutter-texture.c b/clutter/clutter-texture.c index fb771c016..8366c53af 100644 --- a/clutter/clutter-texture.c +++ b/clutter/clutter-texture.c @@ -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, ©_data, &texture_dirty, &size_change)) + if (!texture_prepare_upload (TRUE, texture, data, has_alpha, + width, height, rowstride, bpp, flags, + ©_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; diff --git a/clutter/glx/clutter-stage-glx.c b/clutter/glx/clutter-stage-glx.c index 31d2fbe71..545dc4f7b 100644 --- a/clutter/glx/clutter-stage-glx.c +++ b/clutter/glx/clutter-stage-glx.c @@ -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 */