Commit Graph

76 Commits

Author SHA1 Message Date
Marwan Tanager
cb18fe8603 Replace the periodic page reclaiming code with a LRU caching algorithm.
This patch implements a page cache that is invalidated in a LRU fashion.

Pages are added to the cache as soon as they become visible. When the cache is
full and a new page that isn't in the cache becomes visible, the least recently
viewed page in the cache is evicted from memory and the new one takes it's
place.

The cache size is configurable using the page-cache-size configuration
variable, with a default value of 15 pages. Very large values for the cache
size are not recommended, though, as it will stress the system memory out.

The old periodic page reclaiming code is no longer necessary with this patch,
so I removed it.

Special thanks to Ignas Anikevičius, and Sebastian Ramacher for the
inspirations.

Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
2013-03-26 12:45:43 +01:00
Sebastian Ramacher
f2ed53aa72 Fix the off-by-one with the poppler plugin
Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
2013-02-23 17:18:02 +01:00
Sebastian Ramacher
edde1bf00f Restore compatibility with earlier versions of glib
Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
2013-02-09 15:10:00 +01:00
Moritz Lipp
de5b93dd55 Use GMutex instead of deprecated GStaticMutex 2013-01-20 16:38:36 +01:00
Moritz Lipp
89e7832047 Update style 2012-10-09 01:12:18 +02:00
Sebastian Ramacher
9c28be7c11 Coding style. 2012-08-01 16:15:56 +02:00
Abdó Roig-Maranges
c57463a053 Added option to recolor keeping hues of original color.
If option recolor-keephue is true, the recoloring algorithm
only adjusts the lightness of the original color, keeping the
rest of the properties close to the original.

When recolor-keephue is set to false, the recoloring is performed
as it was before, interpolating linearly between recolor-lightcolor
and recolor-darkcolor except for a different weighting for the
lightness which is closer to perception.

Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
2012-08-01 16:05:31 +02:00
Sebastian Ramacher
aa2abd0bc4 more debug output 2012-06-20 16:41:01 +02:00
Sebastian Ramacher
c25f892385 Fix check. 2012-06-20 16:10:34 +02:00
Sebastian Ramacher
a759c008cd Don't send surfaces to widgets if we're about to close the document. 2012-06-20 15:55:32 +02:00
Moritz Lipp
dd99eca7c5 Fix render_thread_sort 2012-06-16 09:29:15 +02:00
Sebastian Ramacher
517acbd576 Remove \n in debug output. 2012-06-03 22:09:27 +02:00
Sebastian Ramacher
290eefde5c Use a lock to lock the render thread for printing. 2012-06-03 22:06:57 +02:00
Sebastian Ramacher
f28decccc1 Revert "Render pages for printing in render thread."
This reverts commit 8271419222.
2012-06-03 21:54:10 +02:00
Sebastian Ramacher
8271419222 Render pages for printing in render thread.
This needs some looking in the render thread.
2012-06-01 20:56:55 +02:00
Moritz Lipp
122ea70e16 Render last-viewed pages with a higher priority 2012-05-15 07:52:23 +02:00
Moritz Lipp
97247f41ca Unhitch zathura_t from document_t/page_t/plugin_manager_t 2012-04-03 09:02:45 +02:00
Moritz Lipp
ab4c364e56 Update document information plugin api 2012-03-30 18:24:00 +02:00
Moritz Lipp
334b4fbb95 Introduce and use zathura_document wrapper functions 2012-03-27 21:59:35 +02:00
Moritz Lipp
4ade2c1472 Introduced plugin.h and plugin-api.h 2012-03-27 13:30:04 +02:00
Moritz Lipp
5bf32f33a5 Rename page_get_id to page_get_index 2012-03-26 15:30:58 +02:00
Moritz Lipp
efc108fbe2 Introduced page.h 2012-03-26 14:44:56 +02:00
Sebastian Ramacher
07d02d934a We only need to lock the widget update. 2012-03-20 01:30:02 +01:00
Sebastian Ramacher
66bc63f5a7 Rename page_widget to page-widget. 2012-03-16 14:37:54 +01:00
Moritz Lipp
9265c9473a Add 'recolor' setting 2012-03-14 17:33:35 +01:00
Sebastian Ramacher
2a0422b5e1 Reimplement render thread using GThreadPool 2012-03-02 17:51:48 +01:00
Sebastian Ramacher
7f6ad25e02 Fix memory leak in render_free 2012-03-02 17:34:13 +01:00
Sebastian Ramacher
8c10161acf fix invalid read in render thread 2012-02-14 16:01:50 +01:00
Sebastian Ramacher
e513cb5579 store rotation in history 2012-02-08 22:23:45 +01:00
Moritz Lipp
5b54bebc1b Check zathura_page_render return value correctly 2012-02-08 01:08:23 +01:00
Moritz Lipp
21a65cbe34 Rename PageViewWidget to PageWidget 2012-02-07 18:30:46 +01:00
Sebastian Ramacher
aea5024ce3 add argument printing to zathura_page_render 2012-02-07 15:10:58 +01:00
Sebastian Ramacher
12fd8450fa some documentation 2012-02-05 11:32:32 +01:00
Sebastian Ramacher
a1cdb48921 Create a page view widget (Closes: #90).
Add a widget derived from GtkDrawingArea that handles the drawing. It
automaticaly requests rerendering of the page if necessary (i.e on a scroll and
rotate).

This should solve all the rendering issues.
2012-02-05 11:24:34 +01:00
Sebastian Ramacher
3df59895cd CS 2012-02-03 22:32:11 +01:00
Sebastian Ramacher
083a40f447 adopt to changes from girara 2012-02-03 22:15:29 +01:00
Sebastian Ramacher
3b5d29d52b Add option to disable rendering of 'Loading ...' 2012-02-01 17:30:43 +01:00
Moritz Lipp
3311038681 Begin to draw sc_follow results 2012-01-19 00:49:08 +01:00
Moritz Lipp
97cad5a7a4 Round values up when calculating width/height 2011-12-11 01:45:27 +01:00
Sebastian Ramacher
864dc5bd1d rotate in expose-event, not in render 2011-12-10 11:44:27 +01:00
Sebastian Ramacher
6c0a63943f fix the zooming issue 2011-12-10 10:19:14 +01:00
Sebastian Ramacher
911d84c908 update includes due to girara restructuring 2011-10-23 17:01:15 +02:00
Pavel Borzenkov
9dd8067873 Make sure we don't pass garbage to g_mutex_free()
Signed-off-by: Pavel Borzenkov <pavel.borzenkov@gmail.com>
Signed-off-by: Sebastian Ramacher <s.ramacher@gmx.at>
2011-10-20 18:28:22 +02:00
Sebastian Ramacher
0848c39cde no need to check for < 0 2011-10-09 00:35:52 +02:00
Moritz Lipp
bd458048c3 Include math.h in render.c 2011-09-29 18:51:24 +02:00
Sebastian Ramacher
f78b79ec17 scale cairo surface 2011-09-29 18:49:43 +02:00
Moritz Lipp
c3ad7faf1a Use cairo to render page 2011-09-29 12:35:52 +02:00
Moritz Lipp
a6268788c0 Resolve warnings caused by -Wextra 2011-09-21 00:46:03 +02:00
Sebastian Ramacher
30dd00937b rotate in render 2011-09-01 19:18:29 +02:00
Pavel Borzenkov
caccb94c69 Fix ':close' command
Currently, zathura crashes while performing ':close' command with the
following error:

GThread-ERROR **: file gthread-posix.c: line 226
(g_cond_free_posix_impl): error 'Device or resource busy' during
'pthread_cond_destroy ((pthread_cond_t *) cond)'

The error is because 'render' thread holds condition variable while
waiting for new pages to render. This patch modifies zathura's code to
correctly kill render thread and free allocated resources when the
document is being closed.

NOTE: should be applied on top of "Allow changing of "pages-per-row"
variable at runtime" commit to avoid conflicts in the
'page_view_set_mode()' function.

Signed-off-by: Pavel Borzenkov <pavel.borzenkov@gmail.com>
2011-08-25 00:49:26 +02:00