diff options
author | Carlos Garcia Campos <[email protected]> | 2014-08-15 13:04:53 +0200 |
---|---|---|
committer | raveit65 <[email protected]> | 2017-08-28 16:04:01 +0200 |
commit | c284fdd869066085c756f617ac6787abe06769c6 (patch) | |
tree | 468921bf6298c0810cd3b8a4d4bc4d3b55d87d3d | |
parent | 3ada385fead55fa8f94afa128558348d8530dee6 (diff) | |
download | atril-c284fdd869066085c756f617ac6787abe06769c6.tar.bz2 atril-c284fdd869066085c756f617ac6787abe06769c6.tar.xz |
page-cache: Add flags parameter to ev_page_cache_mark_dirty()
This allows to specify what is dirty so that it's freed before being
cached again.
origin commit:
https://git.gnome.org/browse/evince/commit/?h=gnome-3-14&id=20c6b3b
-rw-r--r-- | libview/ev-page-cache.c | 26 | ||||
-rw-r--r-- | libview/ev-page-cache.h | 3 | ||||
-rw-r--r-- | libview/ev-view.c | 4 |
3 files changed, 28 insertions, 5 deletions
diff --git a/libview/ev-page-cache.c b/libview/ev-page-cache.c index a3a2b6fd..b7c5e8aa 100644 --- a/libview/ev-page-cache.c +++ b/libview/ev-page-cache.c @@ -342,8 +342,9 @@ ev_page_cache_set_flags (EvPageCache *cache, } void -ev_page_cache_mark_dirty (EvPageCache *cache, - gint page) +ev_page_cache_mark_dirty (EvPageCache *cache, + gint page, + EvJobPageDataFlags flags) { EvPageCacheData *data; @@ -352,6 +353,27 @@ ev_page_cache_mark_dirty (EvPageCache *cache, data = &cache->page_list[page]; data->dirty = TRUE; + if (flags & EV_PAGE_DATA_INCLUDE_LINKS) + g_clear_pointer (&data->link_mapping, ev_mapping_list_unref); + + if (flags & EV_PAGE_DATA_INCLUDE_IMAGES) + g_clear_pointer (&data->image_mapping, ev_mapping_list_unref); + + if (flags & EV_PAGE_DATA_INCLUDE_FORMS) + g_clear_pointer (&data->form_field_mapping, ev_mapping_list_unref); + + if (flags & EV_PAGE_DATA_INCLUDE_ANNOTS) + g_clear_pointer (&data->annot_mapping, ev_mapping_list_unref); + + if (flags & EV_PAGE_DATA_INCLUDE_TEXT_MAPPING) + g_clear_pointer (&data->text_mapping, cairo_region_destroy); + + if (flags & EV_PAGE_DATA_INCLUDE_TEXT) + g_clear_pointer (&data->text, g_free); + + if (flags & EV_PAGE_DATA_INCLUDE_TEXT_LAYOUT) + g_clear_pointer (&data->text_layout, g_free); + /* Update the current range */ ev_page_cache_set_page_range (cache, cache->start_page, cache->end_page); } diff --git a/libview/ev-page-cache.h b/libview/ev-page-cache.h index 8306b56e..1e6bf3f6 100644 --- a/libview/ev-page-cache.h +++ b/libview/ev-page-cache.h @@ -48,7 +48,8 @@ EvJobPageDataFlags ev_page_cache_get_flags (EvPageCache *cach void ev_page_cache_set_flags (EvPageCache *cache, EvJobPageDataFlags flags); void ev_page_cache_mark_dirty (EvPageCache *cache, - gint page); + gint page, + EvJobPageDataFlags flags); EvMappingList *ev_page_cache_get_link_mapping (EvPageCache *cache, gint page); EvMappingList *ev_page_cache_get_image_mapping (EvPageCache *cache, diff --git a/libview/ev-view.c b/libview/ev-view.c index 6f7f2470..f409a2e5 100644 --- a/libview/ev-view.c +++ b/libview/ev-view.c @@ -3030,7 +3030,7 @@ ev_view_create_annotation (EvView *view, /* If the page didn't have annots, mark the cache as dirty */ if (!ev_page_cache_get_annot_mapping (view->page_cache, view->current_page)) - ev_page_cache_mark_dirty (view->page_cache, view->current_page); + ev_page_cache_mark_dirty (view->page_cache, view->current_page, EV_PAGE_DATA_INCLUDE_ANNOTS); if (EV_IS_ANNOTATION_MARKUP (annot)) { GtkWindow *parent; @@ -3121,7 +3121,7 @@ ev_view_remove_annotation (EvView *view, annot); ev_document_doc_mutex_unlock (); - ev_page_cache_mark_dirty (view->page_cache, page); + ev_page_cache_mark_dirty (view->page_cache, page, EV_PAGE_DATA_INCLUDE_ANNOTS); /* FIXME: only redraw the annot area */ ev_view_reload_page (view, page, NULL); |