# HG changeset patch # User nadvornik # Date 1243714702 0 # Node ID d960b1743ad8493d65c597153b7022c38b35d91a # Parent f6c8b76d41ca18f4701ac9a51ff110218ec0d2d8 preserve image center over short periods when the "broken image" icon is displayed http://sourceforge.net/tracker/?func=detail&aid=2793057&group_id=222125&atid=1054680 diff -r f6c8b76d41ca -r d960b1743ad8 src/pixbuf-renderer.c --- a/src/pixbuf-renderer.c Tue May 26 19:41:22 2009 +0000 +++ b/src/pixbuf-renderer.c Sat May 30 20:18:22 2009 +0000 @@ -3172,11 +3172,23 @@ gint src_x, src_y; if (!pr->width || !pr->height) return; - src_x = pr->x_scroll + pr->vis_width / 2; - src_y = pr->y_scroll + pr->vis_height / 2; - - pr->norm_center_x = (gdouble)src_x / pr->width; - pr->norm_center_y = (gdouble)src_y / pr->height; + /* + * Update norm_center only if the image is bigger than the window. + * With this condition the stored center survives also a temporary display + * of the "broken image" icon. + */ + + if (pr->width > pr->window_width) + { + src_x = pr->x_scroll + pr->vis_width / 2; + pr->norm_center_x = (gdouble)src_x / pr->width; + } + + if (pr->height > pr->window_height) + { + src_y = pr->y_scroll + pr->vis_height / 2; + pr->norm_center_y = (gdouble)src_y / pr->height; + } }