#include "ev-document-forms.h"
#include "ev-document-images.h"
#include "ev-document-annotations.h"
+#include "ev-view-private.h"
typedef struct _CacheJobInfo
{
/* These are used for iterating through the prev and next arrays */
#define FIRST_VISIBLE_PREV(pixbuf_cache) \
(MAX (0, pixbuf_cache->preload_cache_size - pixbuf_cache->start_page))
-#define VISIBLE_NEXT_LEN(pixbuf_cache, page_cache) \
- (MIN(pixbuf_cache->preload_cache_size, ev_page_cache_get_n_pages (page_cache) - (1 + pixbuf_cache->end_page)))
+#define VISIBLE_NEXT_LEN(pixbuf_cache) \
+ (MIN(pixbuf_cache->preload_cache_size, ev_document_get_n_pages (pixbuf_cache->document) - (1 + pixbuf_cache->end_page)))
#define PAGE_CACHE_LEN(pixbuf_cache) \
((pixbuf_cache->end_page - pixbuf_cache->start_page) + 1)
EvPageCache *page_cache,
gfloat scale)
{
- gint width;
- gint height;
+ gint width, height;
g_assert (job_info);
if (job_info->job == NULL)
return;
- ev_page_cache_get_size (page_cache,
- EV_JOB_RENDER (job_info->job)->page,
- EV_JOB_RENDER (job_info->job)->rotation,
- scale,
- &width, &height);
-
+ _get_page_size_for_scale_and_rotation (job_info->job->document,
+ EV_JOB_RENDER (job_info->job)->page,
+ scale,
+ EV_JOB_RENDER (job_info->job)->rotation,
+ &width, &height);
if (width == EV_JOB_RENDER (job_info->job)->target_width &&
height == EV_JOB_RENDER (job_info->job)->target_height)
return;
CacheJobInfo *new_job_list;
CacheJobInfo *new_prev_job;
CacheJobInfo *new_next_job;
- EvPageCache *page_cache;
int i, page;
if (pixbuf_cache->start_page == start_page &&
pixbuf_cache->end_page == end_page)
return;
- page_cache = ev_page_cache_get (pixbuf_cache->document);
-
new_job_list = g_new0 (CacheJobInfo, (end_page - start_page) + 1);
new_prev_job = g_new0 (CacheJobInfo, pixbuf_cache->preload_cache_size);
new_next_job = g_new0 (CacheJobInfo, pixbuf_cache->preload_cache_size);
}
for (i = 0; i < pixbuf_cache->preload_cache_size; i++) {
- if (page >= ev_page_cache_get_n_pages (page_cache)) {
+ if (page >= ev_document_get_n_pages (pixbuf_cache->document)) {
dispose_cache_job_info (pixbuf_cache->next_job + i, pixbuf_cache);
} else {
move_one_job (pixbuf_cache->next_job + i,
static void
add_job (EvPixbufCache *pixbuf_cache,
CacheJobInfo *job_info,
- EvPageCache *page_cache,
GdkRegion *region,
gint width,
gint height,
if (job_info->job)
return;
- ev_page_cache_get_size (page_cache, page, rotation,
- scale, &width, &height);
+ _get_page_size_for_scale_and_rotation (pixbuf_cache->document,
+ page, scale, rotation,
+ &width, &height);
if (job_info->surface &&
cairo_image_surface_get_width (job_info->surface) == width &&
cairo_image_surface_get_height (job_info->surface) == height)
return;
- add_job (pixbuf_cache, job_info, page_cache, NULL,
+ add_job (pixbuf_cache, job_info, NULL,
width, height, page, rotation, scale,
priority);
}
EV_JOB_PRIORITY_LOW);
}
- for (i = 0; i < VISIBLE_NEXT_LEN(pixbuf_cache, page_cache); i++) {
+ for (i = 0; i < VISIBLE_NEXT_LEN(pixbuf_cache); i++) {
job_info = (pixbuf_cache->next_job + i);
page = pixbuf_cache->end_page + 1 + i;
gfloat scale,
GList *selection_list)
{
- EvPageCache *page_cache;
-
g_return_if_fail (EV_IS_PIXBUF_CACHE (pixbuf_cache));
- page_cache = ev_page_cache_get (pixbuf_cache->document);
-
- g_return_if_fail (start_page >= 0 && start_page < ev_page_cache_get_n_pages (page_cache));
- g_return_if_fail (end_page >= 0 && end_page < ev_page_cache_get_n_pages (page_cache));
+ g_return_if_fail (start_page >= 0 && start_page < ev_document_get_n_pages (pixbuf_cache->document));
+ g_return_if_fail (end_page >= 0 && end_page < ev_document_get_n_pages (pixbuf_cache->document));
g_return_if_fail (end_page >= start_page);
/* First, resize the page_range as needed. We cull old pages
gint page,
gfloat scale)
{
- EvPageCache *page_cache;
-
if (job_info->selection && job_info->rc) {
gint width, height;
gint selection_width, selection_height;
-
- page_cache = ev_page_cache_get (pixbuf_cache->document);
- ev_page_cache_get_size (page_cache, page,
- job_info->rc->rotation,
- scale, &width, &height);
+
+ _get_page_size_for_scale_and_rotation (pixbuf_cache->document,
+ page, scale, job_info->rc->rotation,
+ &width, &height);
selection_width = cairo_image_surface_get_width (job_info->selection);
selection_height = cairo_image_surface_get_height (job_info->selection);
ev_pixbuf_cache_set_selection_list (EvPixbufCache *pixbuf_cache,
GList *selection_list)
{
- EvPageCache *page_cache;
EvViewSelection *selection;
GList *list = selection_list;
int page;
if (!EV_IS_SELECTION (pixbuf_cache->document))
return;
- page_cache = ev_page_cache_get (pixbuf_cache->document);
-
/* We check each area to see what needs updating, and what needs freeing; */
page = pixbuf_cache->start_page - pixbuf_cache->preload_cache_size;
for (i = 0; i < pixbuf_cache->preload_cache_size; i++) {
}
for (i = 0; i < pixbuf_cache->preload_cache_size; i++) {
- if (page >= ev_page_cache_get_n_pages (page_cache))
+ if (page >= ev_document_get_n_pages (pixbuf_cache->document))
break;
selection = NULL;
GList *
ev_pixbuf_cache_get_selection_list (EvPixbufCache *pixbuf_cache)
{
- EvPageCache *page_cache;
EvViewSelection *selection;
GList *retval = NULL;
int page;
g_return_val_if_fail (EV_IS_PIXBUF_CACHE (pixbuf_cache), NULL);
- page_cache = ev_page_cache_get (pixbuf_cache->document);
-
/* We check each area to see what needs updating, and what needs freeing; */
page = pixbuf_cache->start_page - pixbuf_cache->preload_cache_size;
for (i = 0; i < pixbuf_cache->preload_cache_size; i++) {
}
for (i = 0; i < pixbuf_cache->preload_cache_size; i++) {
- if (page >= ev_page_cache_get_n_pages (page_cache))
+ if (page >= ev_document_get_n_pages (pixbuf_cache->document))
break;
if (pixbuf_cache->next_job[i].selection_points.x1 != -1) {
return retval;
}
-void
+void
ev_pixbuf_cache_reload_page (EvPixbufCache *pixbuf_cache,
GdkRegion *region,
gint page,
gdouble scale)
{
CacheJobInfo *job_info;
- EvPageCache *page_cache;
gint width, height;
job_info = find_job_cache (pixbuf_cache, page);
if (job_info == NULL)
return;
-
- page_cache = ev_page_cache_get (pixbuf_cache->document);
- ev_page_cache_get_size (page_cache, page, rotation, scale,
- &width, &height);
- add_job (pixbuf_cache, job_info, page_cache, region,
+ _get_page_size_for_scale_and_rotation (pixbuf_cache->document,
+ page, scale, rotation,
+ &width, &height);
+ add_job (pixbuf_cache, job_info, region,
width, height, page, rotation, scale,
EV_JOB_PRIORITY_URGENT);
}