1
0
Fork 0

2008-02-05 Matthew Allum <mallum@openedhand.com>

* clutter/clutter-actor.c: (clutter_actor_get_vertices):
        Make sure GL related Matrices are initialised. Fixes #756

        * clutter/clutter-texture.c:
        Fix up code from Norways answer to Jean-Michel Basquiat.
        (warning on tile_get_pixbuf)
This commit is contained in:
Matthew Allum 2008-02-05 16:40:46 +00:00
parent 19e64c65d5
commit 49b189ecbb
3 changed files with 40 additions and 3 deletions

View file

@ -1,3 +1,12 @@
2008-02-05 Matthew Allum <mallum@openedhand.com>
* clutter/clutter-actor.c: (clutter_actor_get_vertices):
Make sure GL related Matrices are initialised. Fixes #756
* clutter/clutter-texture.c:
Fix up code from Norways answer to Jean-Michel Basquiat.
(warning on tile_get_pixbuf)
2008-02-05 Øyvind Kolås <pippin@o-hand.com>
* clutter/clutter-texture.c: removed spurious left over debug printf.

View file

@ -738,13 +738,38 @@ clutter_actor_get_vertices (ClutterActor *self,
ClutterFixed v[4];
ClutterFixed w[4];
ClutterActorPrivate *priv;
ClutterActor *stage;
g_return_if_fail (CLUTTER_IS_ACTOR (self));
priv = self->priv;
clutter_actor_transform_vertices (self, verts, w);
/* We essentially have to dupe some code from clutter_redraw() here
* to make sure GL Matrices etc are initialised if we're called and we
* havn't yet rendered anything.
*
* Simply duping code for now in wait for Cogl cleanup that can hopefully
* address this in a nicer way.
*/
stage = clutter_stage_get_default ();
if (CLUTTER_PRIVATE_FLAGS (stage) & CLUTTER_ACTOR_SYNC_MATRICES)
{
ClutterPerspective perspective;
clutter_stage_get_perspectivex (CLUTTER_STAGE (stage), &perspective);
cogl_setup_viewport (clutter_actor_get_width (stage),
clutter_actor_get_height (stage),
perspective.fovy,
perspective.aspect,
perspective.z_near,
perspective.z_far);
CLUTTER_UNSET_PRIVATE_FLAGS (stage, CLUTTER_ACTOR_SYNC_MATRICES);
}
clutter_actor_transform_vertices (self, verts, w);
cogl_get_projection_matrix (mtx_p);
cogl_get_viewport (v);

View file

@ -1154,7 +1154,9 @@ pixbuf_destroy_notify (guchar *pixels, gpointer data)
}
static GdkPixbuf *
texture_get_tile_pixbuf (ClutterTexture *texture, COGLuint texture_id, int bpp)
texture_get_tile_pixbuf (ClutterTexture *texture,
COGLuint texture_id,
gint bpp)
{
ClutterTexturePrivate *priv;
guchar *pixels = NULL;
@ -1162,7 +1164,6 @@ texture_get_tile_pixbuf (ClutterTexture *texture, COGLuint texture_id, int bpp)
priv = texture->priv;
cogl_texture_bind (priv->target_type, texture_id);
cogl_texture_set_alignment (priv->target_type, 4, tex_width);
tex_width = priv->width;
tex_height = priv->height;
@ -1173,6 +1174,8 @@ texture_get_tile_pixbuf (ClutterTexture *texture, COGLuint texture_id, int bpp)
tex_height = clutter_util_next_p2 (priv->height);
}
cogl_texture_set_alignment (priv->target_type, 4, tex_width);
if ((pixels = g_malloc (((tex_width * bpp + 3) &~ 3) * tex_height)) == NULL)
return NULL;