From 15970bba9b35efafd8340c15505c7b164e370934 Mon Sep 17 00:00:00 2001 From: Matthew Allum Date: Mon, 19 Mar 2007 17:02:48 +0000 Subject: [PATCH] 2007-03-19 Matthew Allum * clutter/clutter-label.c: Simple doc fix. * clutter/clutter-texture.c: (clutter_texture_get_pixbuf): Backport of fix to get_pixbuf on non alpha textures from 0_2 branch. --- ChangeLog | 7 +++++++ clutter/clutter-label.c | 2 +- clutter/clutter-texture.c | 14 +++++++++----- 3 files changed, 17 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index 48db82ec5..c0a534fca 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2007-03-19 Matthew Allum + + * clutter/clutter-label.c: + Simple doc fix. + * clutter/clutter-texture.c: (clutter_texture_get_pixbuf): + Backport of fix to get_pixbuf on non alpha textures from 0_2 branch. + 2007-03-19 Emmanuele Bassi * clutter/clutter-texture.c: Clean up code; add checks diff --git a/clutter/clutter-label.c b/clutter/clutter-label.c index 492514c41..44f07b2fb 100644 --- a/clutter/clutter-label.c +++ b/clutter/clutter-label.c @@ -988,7 +988,7 @@ clutter_label_get_attributes (ClutterLabel *label) * * Sets whether the text of the label contains markup in Pango's text markup - * language. See clutter_label_set_markup(). + * language. **/ void clutter_label_set_use_markup (ClutterLabel *label, diff --git a/clutter/clutter-texture.c b/clutter/clutter-texture.c index c1bf7f1f7..993597ff0 100644 --- a/clutter/clutter-texture.c +++ b/clutter/clutter-texture.c @@ -1041,15 +1041,19 @@ clutter_texture_get_pixbuf (ClutterTexture* texture) ClutterTexturePrivate *priv; GdkPixbuf *pixbuf = NULL; guchar *pixels = NULL; + int bpp = 4; priv = texture->priv; if (priv->tiles == NULL) return NULL; + if (priv->pixel_format == GL_RGB) + bpp = 3; + if (!priv->is_tiled) { - pixels = g_malloc (priv->width * priv->height * 4); + pixels = g_malloc (priv->width * priv->height * bpp); if (pixels == NULL) return NULL; @@ -1062,7 +1066,7 @@ clutter_texture_get_pixbuf (ClutterTexture* texture) /* read data from gl text and return as pixbuf */ glGetTexImage (priv->target_type, 0, - priv->pixel_format, + priv->pixel_format, priv->pixel_type, (GLvoid*)pixels); @@ -1072,7 +1076,7 @@ clutter_texture_get_pixbuf (ClutterTexture* texture) 8, priv->width, priv->height, - priv->width * 4, + priv->width * bpp, pixbuf_destroy_notify, NULL); } @@ -1097,7 +1101,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 * src_h *4); + pixels = g_malloc (src_w * src_h * bpp); glBindTexture(priv->target_type, priv->tiles[i]); @@ -1117,7 +1121,7 @@ clutter_texture_get_pixbuf (ClutterTexture* texture) 8, src_w, src_h, - src_w * 4, + src_w * bpp, pixbuf_destroy_notify, NULL);