Commit graph

99 commits

Author SHA1 Message Date
Sebastian Ramacher
e900c59a9b Fix check for unfinished render jobs
Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
2013-11-22 06:41:33 +01:00
Sebastian Ramacher
63a4152f93 Be more explicit about render jobs
Manage render jobs explicitly. This will help with situations where still have
an aborted request in the queue but a new render job has been requested.

Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
2013-11-07 12:36:21 +01:00
Sebastian Ramacher
11de9b606b Fix a type and add some consts
Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
2013-11-07 03:56:29 +01:00
Sebastian Ramacher
1a34fb0257 Add some debug output for signals
Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
2013-11-07 03:29:38 +01:00
Sebastian Ramacher
3abf46a164 request and aborted need to be volatile
Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
2013-11-07 03:18:44 +01:00
Sebastian Ramacher
f093046d9c Reduce the amount of code a bit
Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
2013-11-07 03:00:10 +01:00
Abdo Roig-Maranges
030a8c65c1 add functions to compute page positions
The plan is to put in adjustment.c every piece of code that has to do
with document positioning, either computing it from data on the document
side, or talking to GTK.

We want to have at our disposal functions to compute sizes and positions
without having to ask for it to a GTK widget. The new functions are:

 - move page_calc_height_width to adjustment.c

 - add page_calc_position that rotates a position relative to a page
   according to the rotation settings.

 - add position_to_page_number that computes the number of a page
   sitting at a given position (given in document-relative coordinates)

 - add page_number_to_position that computes the position (in document
   relative coordinates) that will be placed at the center of the viewport.

 - add page_is_visible that checks whether the given page intersects the
   viewport.
2013-10-26 17:13:55 +02:00
Abdo Roig-Maranges
7329209d84 change arguments to page_calc_height_width
now accepts a document object and explicit width and height. This will
make it easier to reuse this function for computing the document page
cell width and height.
2013-10-26 15:58:26 +02:00
Sebastian Ramacher
c918c590ee Rename zathura_page_cache_add
Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
2013-10-20 16:06:15 +02:00
Sebastian Ramacher
5df5357fb0 Finish moving of the page cache
Add two more signals to ZathuraRenderRequest to notify pages if they are cached
or not. This allows us to move some logic away from
cb_view_vadjutment_value_changed to more appropriate places.

ZathuraPageWidget will now release the surface if
* it gets the signal that the page is no longer cached and the page is
  invisible,
* the page is not cached and the render request is aborted.

Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
2013-10-19 17:45:12 +02:00
Sebastian Ramacher
e7cd4e5f8c Move page cache to ZathuraRenderer
Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
2013-10-18 20:00:04 +02:00
Sebastian Ramacher
16fbefa5cf Abort requests if the page becomes invisible
Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
2013-08-30 18:59:47 +02:00
Sebastian Ramacher
07005886f8 Sort requests based on last view time again
Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
2013-08-30 17:50:34 +02:00
Sebastian Ramacher
8d53833d81 Move recolor code into separate function
Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
2013-08-30 16:10:44 +02:00
Sebastian Ramacher
8a9bd7f512 We don't need zathura
Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
2013-08-30 15:43:43 +02:00
Sebastian Ramacher
7d5863ae1d Clean up includes
Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
2013-08-30 15:05:00 +02:00
Sebastian Ramacher
08a87f679e Mark the request as done in the signal emitter
Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
2013-08-30 13:52:58 +02:00
Sebastian Ramacher
9e77b26a3d Don't loop
Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
2013-08-30 13:25:59 +02:00
Sebastian Ramacher
35bd419e49 Emit signal from main context
Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
2013-08-30 13:25:22 +02:00
Sebastian Ramacher
b02d3d4b8f Move recolor state to the renderer
Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
2013-08-24 00:07:32 +02:00
Sebastian Ramacher
10115db62f Rewrite render thread as request based system
ZathuraRenderer is a thread pool rendering the pages. Every page widget holds a
ZathuraRenderRequest instance to request its page to be rendered. This object
can also be used to abort the request in case the page is not visible anymore.

Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
2013-08-21 18:32:18 +02:00
Sebastian Ramacher
f98514d5ed Increase reference in zathura_page_widget_update_surface
and always destroy in render.

Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
2013-07-27 01:34:42 +02:00
Sebastian Ramacher
71680394a7 Fix some types
Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
2013-04-02 11:39:06 +02:00
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