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.
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.
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>
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>
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>
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>