2008-02-12 Tomas Frydrych <tf@openedhand.com>

* clutter/clutter-texture.c (texture_update_data):
	Fixed incorrect calculation of offset into texture data (needs to
	use width of the texture, not of the updated area).
This commit is contained in:
Tomas Frydrych 2008-02-12 13:41:44 +00:00
parent 161163cf14
commit 14de7190d2
2 changed files with 35 additions and 29 deletions

View File

@ -1,3 +1,9 @@
2008-02-12 Tomas Frydrych <tf@openedhand.com>
* clutter/clutter-texture.c (texture_update_data):
Fixed incorrect calculation of offset into texture data (needs to
use width of the texture, not of the updated area).
2008-02-12 Tomas Frydrych <tf@openedhand.com> 2008-02-12 Tomas Frydrych <tf@openedhand.com>
* clutter/clutter-texture.c (texture_update_data): * clutter/clutter-texture.c (texture_update_data):

View File

@ -812,7 +812,7 @@ clutter_texture_paint (ClutterActor *self)
if (shader) if (shader)
clutter_shader_set_is_enabled (shader, FALSE); clutter_shader_set_is_enabled (shader, FALSE);
cogl_offscreen_redirect_start (priv->fbo_handle, cogl_offscreen_redirect_start (priv->fbo_handle,
priv->width, priv->height); priv->width, priv->height);
/* Render out actor scene to fbo */ /* Render out actor scene to fbo */
@ -1191,7 +1191,7 @@ pixbuf_destroy_notify (guchar *pixels, gpointer data)
static GdkPixbuf * static GdkPixbuf *
texture_get_tile_pixbuf (ClutterTexture *texture, texture_get_tile_pixbuf (ClutterTexture *texture,
COGLuint texture_id, COGLuint texture_id,
gint bpp) gint bpp)
{ {
ClutterTexturePrivate *priv; ClutterTexturePrivate *priv;
@ -1245,7 +1245,7 @@ texture_get_tile_pixbuf (ClutterTexture *texture,
* Gets a #GdkPixbuf representation of the #ClutterTexture data. * Gets a #GdkPixbuf representation of the #ClutterTexture data.
* The created #GdkPixbuf is not owned by the texture but the caller. * The created #GdkPixbuf is not owned by the texture but the caller.
* *
* Note: NULL is always returned with OpenGL ES. * Note: NULL is always returned with OpenGL ES.
* *
* Return value: A #GdkPixbuf or NULL on fail. * Return value: A #GdkPixbuf or NULL on fail.
**/ **/
@ -1469,8 +1469,8 @@ clutter_texture_set_from_rgb_data (ClutterTexture *texture,
if (priv->fbo_source) if (priv->fbo_source)
texture_fbo_free_resources (texture); texture_fbo_free_resources (texture);
if (!texture_prepare_upload (TRUE, texture, data, has_alpha, if (!texture_prepare_upload (TRUE, texture, data, has_alpha,
width, height, rowstride, bpp, flags, width, height, rowstride, bpp, flags,
&copy_data, &texture_dirty, &size_change)) &copy_data, &texture_dirty, &size_change))
{ {
return FALSE; return FALSE;
@ -2035,20 +2035,20 @@ texture_update_data (ClutterTexture *texture,
* |-------| <- master_offset = -8 * |-------| <- master_offset = -8
* |-------| <- effective_x = 8 * |-------| <- effective_x = 8
* |---| <- effective_width * |---| <- effective_width
* *
* -- second tile --- * -- second tile ---
* *
* |--------------------- priv->width ------------------------------| * |--------------------- priv->width ------------------------------|
* |-----------| <- priv->x_tiles[x].pos * |-----------| <- priv->x_tiles[x].pos
* |-----------| <- priv->x_tiles[x].size (src_w) * |-----------| <- priv->x_tiles[x].size (src_w)
* |-------| <- x_0 * |-------| <- x_0
* |------------| <- width * |------------| <- width
* |--------------------| <- x_0 + width * |--------------------| <- x_0 + width
* |---| <- master_offset = 4 * |---| <- master_offset = 4
* | <- effective_x (0 in between) * | <- effective_x (0 in between)
* |--------| <- effective_width * |--------| <- effective_width
* *
* XXXXXXXXXXXXXX <- master * XXXXXXXXXXXXXX <- master
* |___________|___________|___________|___________|___________|_____%%%%%%| * |___________|___________|___________|___________|___________|_____%%%%%%|
*/ */
@ -2119,7 +2119,7 @@ texture_update_data (ClutterTexture *texture,
effective_height, effective_height,
priv->pixel_format, priv->pixel_format,
priv->pixel_type, priv->pixel_type,
data + (master_offset_y * width + master_offset_x) * 4); data + (master_offset_y * priv->width + master_offset_x) * 4);
i++; i++;
} }
@ -2143,7 +2143,7 @@ texture_update_data (ClutterTexture *texture,
* *
* Return value: %TRUE on success, %FALSE on failure. * Return value: %TRUE on success, %FALSE on failure.
* *
* Since 0.6. * Since 0.6.
*/ */
gboolean gboolean
clutter_texture_set_area_from_rgb_data (ClutterTexture *texture, clutter_texture_set_area_from_rgb_data (ClutterTexture *texture,
@ -2163,7 +2163,7 @@ clutter_texture_set_area_from_rgb_data (ClutterTexture *texture,
priv = texture->priv; priv = texture->priv;
if (!texture_prepare_upload (FALSE, texture, data, has_alpha, if (!texture_prepare_upload (FALSE, texture, data, has_alpha,
width, height, rowstride, width, height, rowstride,
bpp, flags, &copy_data, NULL, NULL)) bpp, flags, &copy_data, NULL, NULL))
{ {
@ -2201,7 +2201,7 @@ on_fbo_source_size_change (GObject *object,
guint w, h; guint w, h;
clutter_actor_get_abs_size (priv->fbo_source, &w, &h); clutter_actor_get_abs_size (priv->fbo_source, &w, &h);
if (w != priv->width || h != priv->height) if (w != priv->width || h != priv->height)
{ {
if (!cogl_texture_can_size (CGL_TEXTURE_RECTANGLE_ARB, if (!cogl_texture_can_size (CGL_TEXTURE_RECTANGLE_ARB,
@ -2232,7 +2232,7 @@ on_fbo_source_size_change (GObject *object,
priv->pixel_format, priv->pixel_format,
priv->pixel_type, priv->pixel_type,
NULL); NULL);
priv->fbo_handle = cogl_offscreen_create (priv->tiles[0]); priv->fbo_handle = cogl_offscreen_create (priv->tiles[0]);
clutter_actor_set_size (CLUTTER_ACTOR(texture), w, h); clutter_actor_set_size (CLUTTER_ACTOR(texture), w, h);
@ -2258,11 +2258,11 @@ on_fbo_parent_change (ClutterActor *actor,
/** /**
* clutter_texture_new_from_actor: * clutter_texture_new_from_actor:
* @actor: A source #ClutterActor * @actor: A source #ClutterActor
* *
* Creates a new #ClutterTexture object with its source a prexisting * Creates a new #ClutterTexture object with its source a prexisting
* actor (and associated children). The textures content will contain * actor (and associated children). The textures content will contain
* 'live' redirected output of the actors scene. * 'live' redirected output of the actors scene.
* *
* Note this function is intented as a utility call for uniformly applying * Note this function is intented as a utility call for uniformly applying
* shaders to groups and other potentail visual effects. It requires that * shaders to groups and other potentail visual effects. It requires that
@ -2273,20 +2273,20 @@ on_fbo_parent_change (ClutterActor *actor,
* *
* <itemizedlist> * <itemizedlist>
* <listitem> * <listitem>
* <para>The source actor must be made visible (i.e by calling * <para>The source actor must be made visible (i.e by calling
* #clutter_actor_show). The source actor does not however have to * #clutter_actor_show). The source actor does not however have to
* have a parent.</para> * have a parent.</para>
* </listitem> * </listitem>
* <listitem> * <listitem>
* <para>Avoid reparenting the source with the created texture.</para> * <para>Avoid reparenting the source with the created texture.</para>
* </listitem> * </listitem>
* <listitem> * <listitem>
* <para>A group can be padded with a transparent rectangle as to * <para>A group can be padded with a transparent rectangle as to
* provide a border to contents for shader output (blurring text * provide a border to contents for shader output (blurring text
* for example).</para> * for example).</para>
* </listitem> * </listitem>
* <listitem> * <listitem>
* <para>The texture will automatically resize to contain a further * <para>The texture will automatically resize to contain a further
* transformed source. The however involves overhead and can be * transformed source. The however involves overhead and can be
* avoided by placing the source actor in a bounding group * avoided by placing the source actor in a bounding group
* sized large enough to contain any child tranformations.</para> * sized large enough to contain any child tranformations.</para>
@ -2404,14 +2404,14 @@ texture_fbo_free_resources (ClutterTexture *texture)
if (priv->fbo_source != NULL) if (priv->fbo_source != NULL)
{ {
g_signal_handlers_disconnect_by_func g_signal_handlers_disconnect_by_func
(priv->fbo_source, (priv->fbo_source,
G_CALLBACK(on_fbo_parent_change), G_CALLBACK(on_fbo_parent_change),
texture); texture);
g_signal_handlers_disconnect_by_func g_signal_handlers_disconnect_by_func
(priv->fbo_source, (priv->fbo_source,
G_CALLBACK(on_fbo_source_size_change), G_CALLBACK(on_fbo_source_size_change),
texture); texture);
g_object_unref (priv->fbo_source); g_object_unref (priv->fbo_source);