Mercurial > hg > forks > geeqie
changeset 2079:429a86e76026
try to preserve original texture
author | Vladimir Nadvornik <nadvornik@suse.cz> |
---|---|
date | Tue, 14 Aug 2012 23:03:26 +0200 |
parents | 41ea2592dde6 |
children | b916ab9a2e4d |
files | src/renderer-clutter.c |
diffstat | 1 files changed, 20 insertions(+), 10 deletions(-) [+] |
line wrap: on
line diff
--- a/src/renderer-clutter.c Tue Aug 14 22:52:03 2012 +0200 +++ b/src/renderer-clutter.c Tue Aug 14 23:03:26 2012 +0200 @@ -244,22 +244,32 @@ 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 (width != prev_width || height != prev_height) + { + /* 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 (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); } }