Skip to content

Commit

Permalink
try to preserve original texture
Browse files Browse the repository at this point in the history
  • Loading branch information
nadvornik committed Aug 18, 2012
1 parent 5f36bf5 commit 11bdc43
Showing 1 changed file with 20 additions and 10 deletions.
30 changes: 20 additions & 10 deletions src/renderer-clutter.c
Original file line number Diff line number Diff line change
Expand Up @@ -244,22 +244,32 @@ static void renderer_update_pixbuf(void *renderer, gboolean lazy)

if (pr->pixbuf)
{
gint width = gdk_pixbuf_get_width(pr->pixbuf);
gint height = gdk_pixbuf_get_height(pr->pixbuf);

gint prev_width, prev_height;

printf("renderer_update_pixbuf\n");
clutter_texture_get_base_size(CLUTTER_TEXTURE(rc->texture), &prev_width, &prev_height);
printf("change from %d %d to %d %d\n", prev_width, prev_height, width, height);

/* FIXME use CoglMaterial with multiple textures for background, color management, anaglyph, ... */
CoglHandle texture = cogl_texture_new_with_size(gdk_pixbuf_get_width(pr->pixbuf),
gdk_pixbuf_get_height(pr->pixbuf),
COGL_TEXTURE_NONE,
gdk_pixbuf_get_has_alpha(pr->pixbuf) ? COGL_PIXEL_FORMAT_RGBA_8888 : COGL_PIXEL_FORMAT_RGB_888);

if (texture != COGL_INVALID_HANDLE)
if (width != prev_width || height != prev_height)
{
clutter_texture_set_cogl_texture(CLUTTER_TEXTURE(rc->texture), texture);
cogl_handle_unref(texture);
/* FIXME use CoglMaterial with multiple textures for background, color management, anaglyph, ... */
CoglHandle texture = cogl_texture_new_with_size(width,
height,
COGL_TEXTURE_NONE,
gdk_pixbuf_get_has_alpha(pr->pixbuf) ? COGL_PIXEL_FORMAT_RGBA_8888 : COGL_PIXEL_FORMAT_RGB_888);

if (texture != COGL_INVALID_HANDLE)
{
clutter_texture_set_cogl_texture(CLUTTER_TEXTURE(rc->texture), texture);
cogl_handle_unref(texture);
}
}
if (!lazy)
{
renderer_area_changed(renderer, 0, 0, gdk_pixbuf_get_width(pr->pixbuf), gdk_pixbuf_get_height(pr->pixbuf));
renderer_area_changed(renderer, 0, 0, width, height);
}
}

Expand Down

0 comments on commit 11bdc43

Please sign in to comment.