2007-07-30 Matthew Allum <mallum@openedhand.com>

* clutter/clutter-texture.c:
        Fix re-relisation for large tiled textures.
        * tests/test-textures.c: (main):
        Add a show/hide to trigger above (see #442)
This commit is contained in:
Matthew Allum 2007-07-29 22:55:04 +00:00
parent 249ada48bc
commit 0151f842d7
3 changed files with 23 additions and 10 deletions

View File

@ -1,3 +1,10 @@
2007-07-30 Matthew Allum <mallum@openedhand.com>
* clutter/clutter-texture.c:
Fix re-relisation for large tiled textures.
* tests/test-textures.c: (main):
Add a show/hide to trigger above (see #442)
2007-07-29 Emmanuele Bassi <ebassi@openedhand.com>
* clutter/clutter-types.h: Document ClutterGravity enumeration

View File

@ -649,6 +649,8 @@ clutter_texture_realize (ClutterActor *actor)
/* Move any local image data we have from unrealization
* back into video memory.
*/
if (priv->is_tiled)
texture_init_tiles (texture);
clutter_texture_set_pixbuf (texture, priv->local_pixbuf, NULL);
g_object_unref (priv->local_pixbuf);
priv->local_pixbuf = NULL;
@ -1146,7 +1148,7 @@ clutter_texture_get_pixbuf (ClutterTexture* texture)
src_w = priv->x_tiles[x].size;
src_h = priv->y_tiles[y].size;
pixels = g_malloc (((src_w * bpp) &~ 3) * src_h);
pixels = g_malloc (((src_w * bpp + 3) &~ 3) * src_h);
glBindTexture(priv->target_type, priv->tiles[i]);
@ -1161,13 +1163,6 @@ clutter_texture_get_pixbuf (ClutterTexture* texture)
PIXEL_TYPE,
(GLvoid *) pixels);
/* Clip */
if (priv->x_tiles[x].pos + src_w > priv->width)
src_w = priv->width - priv->x_tiles[x].pos;
if (priv->y_tiles[y].pos + src_h > priv->height)
src_h = priv->height - priv->y_tiles[y].pos;
tmp_pixb =
gdk_pixbuf_new_from_data ((const guchar*)pixels,
GDK_COLORSPACE_RGB,
@ -1180,6 +1175,13 @@ clutter_texture_get_pixbuf (ClutterTexture* texture)
pixbuf_destroy_notify,
NULL);
/* Clip */
if (priv->x_tiles[x].pos + src_w > priv->width)
src_w = priv->width - priv->x_tiles[x].pos;
if (priv->y_tiles[y].pos + src_h > priv->height)
src_h = priv->height - priv->y_tiles[y].pos;
gdk_pixbuf_copy_area (tmp_pixb,
0,
0,

View File

@ -87,6 +87,10 @@ main (int argc, char *argv[])
clutter_actor_set_size (texture, 400, 400);
clutter_actor_show (texture);
/* Hide & show to unreaise then realise the texture */
clutter_actor_hide (texture);
clutter_actor_show (texture);
clutter_texture_get_n_tiles(CLUTTER_TEXTURE(texture), &cols, &rows);
printf("with tiles: %i x %i\n", cols, rows);