80 #define EV_PAGE_DATA_FLAGS_DEFAULT ( \
81 EV_PAGE_DATA_INCLUDE_LINKS | \
82 EV_PAGE_DATA_INCLUDE_TEXT_MAPPING | \
83 EV_PAGE_DATA_INCLUDE_IMAGES | \
84 EV_PAGE_DATA_INCLUDE_FORMS | \
85 EV_PAGE_DATA_INCLUDE_ANNOTS | \
86 EV_PAGE_DATA_INCLUDE_MEDIA)
88 #define PRE_CACHE_SIZE 1
101 g_object_unref (data->job);
105 if (data->link_mapping) {
107 data->link_mapping = NULL;
110 if (data->image_mapping) {
112 data->image_mapping = NULL;
115 if (data->form_field_mapping) {
117 data->form_field_mapping = NULL;
120 if (data->annot_mapping) {
122 data->annot_mapping = NULL;
125 if (data->media_mapping) {
127 data->media_mapping = NULL;
130 if (data->text_mapping) {
131 cairo_region_destroy (data->text_mapping);
132 data->text_mapping = NULL;
135 if (data->text_layout) {
136 g_free (data->text_layout);
137 data->text_layout = NULL;
138 data->text_layout_length = 0;
146 if (data->text_attrs) {
147 pango_attr_list_unref (data->text_attrs);
148 data->text_attrs = NULL;
151 if (data->text_log_attrs) {
152 g_free (data->text_log_attrs);
153 data->text_log_attrs = NULL;
154 data->text_log_attrs_length = 0;
165 for (i = 0; i < cache->
n_pages; i++) {
171 g_signal_handlers_disconnect_by_func (data->
job,
174 g_signal_handlers_disconnect_by_func (data->
job,
191 G_OBJECT_CLASS (ev_page_cache_parent_class)->finalize (
object);
202 GObjectClass *g_object_class = G_OBJECT_CLASS (klass);
207 g_signal_new (
"page-cached",
212 g_cclosure_marshal_VOID__INT,
213 G_TYPE_NONE, 1, G_TYPE_INT);
263 flags = (data->
text) ?
297 cache->
document = g_object_ref (document);
342 g_object_unref (data->
job);
352 g_object_unref (data->
job);
373 g_signal_connect (data->
job,
"finished",
376 g_signal_connect (data->
job,
"cancelled",
389 gint pages_to_pre_cache;
394 for (i = start; i <= end; i++)
402 while ((start - i > 0) || (end + i < cache->n_pages)) {
403 if (end + i < cache->n_pages) {
405 if (--pages_to_pre_cache == 0)
411 if (--pages_to_pre_cache == 0)
428 if (cache->
flags == flags)
431 cache->
flags = flags;
465 g_clear_pointer (&data->
text_mapping, cairo_region_destroy);
468 g_clear_pointer (&data->
text, g_free);
476 g_clear_pointer (&data->
text_attrs, pango_attr_list_unref);
494 g_return_val_if_fail (page >= 0 && page < cache->n_pages, NULL);
516 g_return_val_if_fail (page >= 0 && page < cache->n_pages, NULL);
538 g_return_val_if_fail (page >= 0 && page < cache->n_pages, NULL);
560 g_return_val_if_fail (page >= 0 && page < cache->n_pages, NULL);
582 g_return_val_if_fail (page >= 0 && page < cache->n_pages, NULL);
604 g_return_val_if_fail (page >= 0 && page < cache->n_pages, NULL);
626 g_return_val_if_fail (page >= 0 && page < cache->n_pages, NULL);
650 g_return_val_if_fail (page >= 0 && page < cache->n_pages,
FALSE);
689 g_return_val_if_fail (page >= 0 && page < cache->n_pages, NULL);
720 PangoLogAttr **log_attrs,
726 g_return_val_if_fail (page >= 0 && page < cache->n_pages,
FALSE);
754 g_return_if_fail (page >= 0 && page < cache->n_pages);
766 g_return_val_if_fail (page >= 0 && page < cache->n_pages,
FALSE);