# HG changeset patch # User nadvornik # Date 1243714702 0 # Node ID d4d12f872398e367bdf79a8c31b5597949a474e7 # Parent 5b36a6ff55aeccbfad242d81db8785b291662542 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 5b36a6ff55ae -r d4d12f872398 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; + } }