+
+ if (!has_thumbs)
+ continue;
+
+ if (!rc) {
+ rc = ev_render_context_new (0, i, (gdouble)THUMBNAIL_WIDTH / page_width);
+ } else {
+ ev_render_context_set_page (rc, i);
+ ev_render_context_set_scale (rc, (gdouble)THUMBNAIL_WIDTH / page_width);
+ }
+
+ ev_document_thumbnails_get_dimensions (EV_DOCUMENT_THUMBNAILS (document),
+ rc, &thumb_width, &thumb_height);
+
+ if (thumb_width > page_cache->thumbs_max_width) {
+ page_cache->thumbs_max_width = thumb_width;
+ }
+
+ if (thumb_height > page_cache->thumbs_max_height) {
+ page_cache->thumbs_max_height = thumb_height;
+ }
+
+ if (i == 0) {
+ page_cache->thumbs_uniform_width = thumb_width;
+ page_cache->thumbs_uniform_height = thumb_height;
+ } else if (page_cache->thumbs_uniform &&
+ (page_cache->thumbs_uniform_width != thumb_width ||
+ page_cache->thumbs_uniform_height != thumb_height)) {
+ /* It's a different thumbnail size. Backfill the array. */
+ int j;
+
+ page_cache->thumbs_size_cache = g_new0 (EvPageThumbsInfo, page_cache->n_pages);
+
+ for (j = 0; j < i; j++) {
+ thumb_info = &(page_cache->thumbs_size_cache [j]);
+ thumb_info->width = page_cache->thumbs_uniform_width;
+ thumb_info->height = page_cache->thumbs_uniform_height;
+ }
+ page_cache->thumbs_uniform = FALSE;
+ }
+
+ if (! page_cache->thumbs_uniform) {
+ thumb_info = &(page_cache->thumbs_size_cache [i]);
+
+ thumb_info->width = thumb_width;
+ thumb_info->height = thumb_height;
+ }
+ }
+
+ if (rc) {
+ g_object_unref (rc);