* clutter/clutter-texture.c: (texture_get_tile_pixbuf),
(clutter_texture_get_pixbuf): Fix copying textures to pixbufs for tiled textures and correct #ifndef typo * clutter/clutter-util.c: Amend documentation
This commit is contained in:
parent
9c625d187d
commit
aa9e91e261
3 changed files with 34 additions and 11 deletions
10
ChangeLog
10
ChangeLog
|
@ -1,3 +1,13 @@
|
|||
2008-02-12 Chris Lord <chris@openedhand.com>
|
||||
|
||||
* clutter/clutter-texture.c: (texture_get_tile_pixbuf),
|
||||
(clutter_texture_get_pixbuf):
|
||||
Fix copying textures to pixbufs for tiled textures and correct #ifndef
|
||||
typo
|
||||
|
||||
* clutter/clutter-util.c:
|
||||
Amend documentation
|
||||
|
||||
2008-02-12 Matthew Allum <mallum@openedhand.com>
|
||||
|
||||
* clutter/clutter-texture.c: (texture_get_tile_pixbuf):
|
||||
|
|
|
@ -1192,9 +1192,11 @@ pixbuf_destroy_notify (guchar *pixels, gpointer data)
|
|||
static GdkPixbuf *
|
||||
texture_get_tile_pixbuf (ClutterTexture *texture,
|
||||
COGLuint texture_id,
|
||||
gint bpp)
|
||||
gint bpp,
|
||||
gint ix,
|
||||
gint iy)
|
||||
{
|
||||
#ifndef HAVE_COGL_GL
|
||||
#ifdef HAVE_COGL_GL
|
||||
ClutterTexturePrivate *priv;
|
||||
guchar *pixels = NULL;
|
||||
guint tex_width, tex_height;
|
||||
|
@ -1202,13 +1204,24 @@ texture_get_tile_pixbuf (ClutterTexture *texture,
|
|||
priv = texture->priv;
|
||||
cogl_texture_bind (priv->target_type, texture_id);
|
||||
|
||||
tex_width = priv->width;
|
||||
tex_height = priv->height;
|
||||
|
||||
if (!priv->is_tiled)
|
||||
{
|
||||
tex_width = priv->width;
|
||||
tex_height = priv->height;
|
||||
}
|
||||
else
|
||||
{
|
||||
tex_width = priv->x_tiles[ix].size;
|
||||
tex_height = priv->y_tiles[iy].size;
|
||||
}
|
||||
|
||||
/* Make sure if we aren't using rectangular textures that we increase the
|
||||
* texture size accordingly.
|
||||
*/
|
||||
if (priv->target_type == CGL_TEXTURE_2D) /* POT */
|
||||
{
|
||||
tex_width = clutter_util_next_p2 (priv->width);
|
||||
tex_height = clutter_util_next_p2 (priv->height);
|
||||
tex_width = clutter_util_next_p2 (tex_width);
|
||||
tex_height = clutter_util_next_p2 (tex_height);
|
||||
}
|
||||
|
||||
cogl_texture_set_alignment (priv->target_type, 4, tex_width);
|
||||
|
@ -1283,7 +1296,7 @@ clutter_texture_get_pixbuf (ClutterTexture *texture)
|
|||
|
||||
if (!priv->is_tiled)
|
||||
{
|
||||
pixtmp = texture_get_tile_pixbuf (texture, priv->tiles[0], bpp);
|
||||
pixtmp = texture_get_tile_pixbuf (texture, priv->tiles[0], bpp, 0, 0);
|
||||
|
||||
if (pixtmp == NULL)
|
||||
{
|
||||
|
@ -1319,7 +1332,7 @@ clutter_texture_get_pixbuf (ClutterTexture *texture)
|
|||
{
|
||||
gint src_w, src_h;
|
||||
|
||||
pixtmp = texture_get_tile_pixbuf (texture, priv->tiles[i], bpp);
|
||||
pixtmp = texture_get_tile_pixbuf (texture, priv->tiles[i], bpp, x, y);
|
||||
|
||||
if (pixtmp == NULL)
|
||||
{
|
||||
|
|
|
@ -38,9 +38,9 @@
|
|||
* clutter_util_next_p2:
|
||||
* @a: Value to get the next power
|
||||
*
|
||||
* Calculates the next power greater than @a.
|
||||
* Calculates the nearest power of two, greater than or equal to @a.
|
||||
*
|
||||
* Return value: The next power after @a.
|
||||
* Return value: The nearest power of two, greater or equal to @a.
|
||||
*/
|
||||
int
|
||||
clutter_util_next_p2 (int a)
|
||||
|
|
Loading…
Reference in a new issue