Commit Graph

107 Commits (48da545e324efd1ba0cb67e4a5fb129e06fa622b)

Author SHA1 Message Date
NiLuJe 48da545e32 Kobo/Elipsa: More fine-grained control over the amount of online CPU
cores

* Only keep a single core online most of the time.
* Device: Add an enableCPUCores method to allow controlling the amount of
  online CPU cores.
* Move the initial core onlining setup to Kobo:init, instead of the startup script.
* Enable two CPU cores while hinting new (e.g., cache miss) pages in PDF land.
* Enable two CPU cores while processing book metadata.
* Drive-by fix to isolate the DocCache pressure check to KoptInterface
  and actually apply it when it matters most (e.g., k2pdfopt stuff).
3 years ago
NiLuJe acbf4b7a8c
Document: Round dimensions properly in getPageDimensions (#8170)
* Geom:transformByScale:
  * Apply the right scaling factor to the y axis
  * Round in a more sensible fashion (àla fz_round_rect, since we pretty much exclusively use it in a similar fashion).
* Bump base (https://github.com/koreader/koreader-base/pull/1407)
3 years ago
poire-z e3bac94db1 PDF written highlights: fix boxes, trash cached tiles
TileCacheItem: add created_ts property.
Document: manage a tile_cache_validity_ts and ignore
older cached tiles.
This timestamps is updated when highlights are written
as annotations in, or deleted from, the PDF, so we can
get the most current rendered bitmap from MuPDF and
avoid highlight ghosts on old tiles.
Save this timestamp in doc settings so older cached to
disk tiles will also be ignored across re-openings.
Bump base for: mupdf.lua: update frontend pboxes with
MuPDF adjusted ones.
3 years ago
NiLuJe 2c4cbd12a2 DocumentRegistry: Downgrade refcount warnings to debug logging.
It can happen in perfectly sane contexts.

CReDocument: Don't destroy internal engine data when Document just
decreased the refcount (as opposed to actually tore down the document
userdata if it were the last ref).

PdfDocument: Only write edited documents if the Doc instance was torn
down.

PicDocument: Silence some DocumentRegistry related warnings
3 years ago
NiLuJe 94f708b53b BookInfoManager: Actually close the document after extraction
DocumentRegistry just decreases a ref, it doesn't close anything.

Plug the same Document leak in a few other places, and document this.
3 years ago
NiLuJe 21b067792d Cache: Rewrite based on lua-lru
Ought to be faster than our naive array-based approach.
Especially for the glyph cache, which has a solid amount of elements,
and is mostly cache hits.
(There are few things worse for performance in Lua than
table.remove @ !tail and table.insert @ !tail, which this was full of :/).

DocCache: New module that's now an actual Cache instance instead of a
weird hack. Replaces "Cache" (the instance) as used across Document &
co.
Only Cache instance with on-disk persistence.

ImageCache: Update to new Cache.

GlyphCache: Update to new Cache.
Also, actually free glyph bbs on eviction.
3 years ago
NiLuJe ce624be8b8 Cache: Fix a whole lot of things.
* Minor updates to the min & max cache sizes (16 & 64MB). Mostly to satisfy my power-of-two OCD.
  * Purge broken on-disk cache files
  * Optimize free RAM computations
  * Start dropping LRU items when running low on memory before pre-rendring (hinting) pages in non-reflowable documents.
  * Make serialize dump the most recently *displayed* page, as the actual MRU item is the most recently *hinted* page, not the current one.
  * Use more accurate item size estimations across the whole codebase.

TileCacheItem:

  * Drop lua-serialize in favor of Persist.

KoptInterface:

  * Drop lua-serialize in favor of Persist.
  * Make KOPTContext caching actually work by ensuring its hash is stable.
3 years ago
Toromtomtom 3706196bfe
Update PDF annotations when changing bookmark text (#7411) 3 years ago
jperon 8eeb010dc9
Paged documents: rework zoom options (#6885)
- Move zoom options from top menu to bottom config
- Add option to manually define zoom (relative to
  page width) and overlap (in percent)
- Add options to zoom to columns or rows, possibly
  with overlap. Add panning direction options when
  page forward in these modes
3 years ago
Jellby 5e3c554dd7 Hide non-linear fragments
Add option to hide (skip) non-linear fragments, only working
in 1-page mode. Tweaks mostly to footer, toc and skim code
to make it clear(er) which pages belong to linear or non-linear
fragments.
4 years ago
Galunid b297fb7cf6
Panel zoom - improve output image resolution (#6709) 4 years ago
Galunid 15455b594d
[feat] Comics: zoom to panel (#6511)
This pull requests aims to provide convenient way to zoom in comics. The idea is when user holds/double taps (not decided yet) on a manga/comic panel, it gets cut out from the rest of the image and zoomed. More details in koreader/koreader-base#1148. Depends on koreader/koreader-base#1159
4 years ago
Frans de Jonge da507f8607
[chore] Update MD5 calls with new sha2 library (#6411)
Depends on <https://github.com/koreader/koreader-base/pull/1149>.
4 years ago
poire-z 2e947e6ffe PicDocuments: fix crash on hold + pan (#5742) 4 years ago
Frans de Jonge f1f6eebce0
[feat] Add MuPDF EPUB/FB2 dynamic font size (#5282)
Closes #4368.
5 years ago
Frans de Jonge a2dcfe9aec
[doc] Tag @todo, @fixme and @warning (#5244)
This commit standardizes the various todos around the code a bit in a manner recognized by LDoc.

Besides drawing more attention by being displayed in the developer docs, they're also extractable with LDoc on the command line:

```sh
ldoc --tags todo,fixme *.lua
```

However, whether that particular usage offers any advantage over other search tools is questionable at best.

* and some random beautification
5 years ago
NiLuJe 7210fb478d
Faster blitting @ BB8/BBRGB32 when no processing is needed (#4847)
* Pickup the eponymous blitting performance tweaks from koreader/koreader-base#878
* Cleanup BitOpts usage (require & cache)
* Unify oddness checks (MOD -> AND)
* Enforce the native Portrait orientation on Kobo (except @ 16bpp, i.e., KSM w/ 8bpp swap disabled), to allow for faster blitting when unrotted.
* Switch CRe BB to 32BPP on color screens
* Minor cleanups
5 years ago
Qingping Hou 1605409c60 rename runtimectl to document/canvascontext 5 years ago
Qingping Hou b1f94f9afa decouple device from credocument 5 years ago
Qingping Hou 02eca23649 decouple device from document modules 5 years ago
poire-z f2a9ed0b79
bump crengine: count nb of images drawn & others (#4542)
Includes:
- Update french hyphenation pattern
- epub.css: update style for 'blockquote'
- DrawBuf: count nb of images and surface drawn

Adds Document:getDrawnImagesStatistics() to help deciding
if refresh with (possibly costly) dithering should be used
(on devices with HW dithering capabilities) with CreDocument:
when a page contains enough images to benefit from it.
5 years ago
poire-z c3a938aad6
bump crengine: alternative TOC, no page break on borders (#4011)
Includes:
- Avoid page break between a node and its borders
- Allow building an alternative TOC from document headings

On CRE documents, allows toggling between original TOC and an
alternative TOC with long-press on the "Table of content" menu
item.

Also update the Wikipedia stylesheet to further avoid
page-breaks between images and their caption, so a full
bordered wikipedia thumbnail is always full on a single page.
6 years ago
poire-z cfa5c8a941 djvu: enable color rendering (#3361)
* djvu: enable color rendering

* Bump base
7 years ago
poire-z 561caadc5c Avoid recalculation of partial_md5_checksum at each opening (#3352)
This is done by/for kosync plugin at each opening, because
the docsettings was re-opened and saved for this, but later
overwritten by the current koreader docsettings - so it was
redone each time. This correctly adds this partial_md5_checksum
to the current koreader docsettings, which will be saved on
document closing - so it will not be redone next time.
Note: this partial_md5_checksum is not (yet) used by anything.
7 years ago
poire-z 53f083f516 Allow for toggling color rendering
New menu item in Screen submenu.
hasColorScreen enabled for SDL device.
7 years ago
poire-z 180f5755f4 Allow for colored rendering (#3276)
* Allow for colored rendering

Available with all engines (CRE, PDF, Images).
Needs to manually add setting: "color_rendering" = true

* Disable color for djvudocument

* Use Screen:isColorEnabled()

* Bump base
7 years ago
poire-z d648d2b66c Added getImageFromPosition() and isXPointerInDocument()
Bump base (depends on koreader-base PR #470)
7 years ago
Qingping Hou f95ad00b9e feat: add logger module & rewrite kobo suspend script in lua 7 years ago
chrox 166aa52a24 move painting and drawing debug log to verbose 8 years ago
Zijie He 820a39c8f7 Update KOSyncClient 8 years ago
chrox 1d887f4fe1 book reading statistics for djvu documents 8 years ago
Qingping Hou c22a3747d8 fix all the tests 8 years ago
Frans de Jonge 5638819f25 Removed a bunch of "successfully", replaced an ellipsis, and some deviant spellings of KOReader. 8 years ago
Qingping Hou 69f9ebd528 build: fix doc generation
also moved MD5 to koreader-base/ffi
8 years ago
Qingping Hou 59c17ef420 minor: more luacheck fixes 8 years ago
chrox 5c9a9198fb add Document:fastDigest method to calculate document hash without performance overhead 9 years ago
Hans-Werner Hilse acf6641009 fix memory calculation for cache insert decision, simplify drawing/rendering 10 years ago
chrox bd0975896d add fulltext search for EPUB documents 10 years ago
chrox 8c9751744e fix #1064 by adding timestamp of document in cache key
so that when document is modified the persistent cache will
be invalidated automatically because the cache key will not
be matched. There is no perfermance overhead here at all. We
even don't need to check the modification time of the cache item
on disk, because the name of the on disk cache is a md5sum of the
cacheitem key, now the filename of the cache files contains the
modification time information.
If the document is modified since one rendered page is cached to disk,
the cache key won't match the cache file. And the cache file will
be discarded without the need to open the cache file or to check
the modification time of the cache file itself.
10 years ago
chrox c2726a8f62 save two blitbuffer memory allocations for crengine on each page turn
One for drawbuffer at CreDocument:drawCurrentView and another for
resizing of drawBuf at cre.drawCurrentPage.
10 years ago
chrox 2f2d9f1bf7 issue error directly when doc is malformated
This should popup a message saying "No reader engine for this file"
instead of a crash when document file is malformated.

This should fix #868.
10 years ago
chrox 132adf8e1b register opened document in documentregistry
so that when calling getCoverPageImage in screensaver mode
the document won't be opened again. This should avoid a lot of
problem such as messing up style and options described in #863.
10 years ago
chrox b912200951 don't share info field in document
We may have multiple documents opened simultaneously, such as in
screensaver mode the current document is opened twice, it's better
to keep seperate info table for each document.

This should fix #858. When a credocument is opened for screensaver to
get the cover page, the total pages info is set to 1(strangely enough),
before this fix this total pages is shared with the reading document
so the progress bar will get a progress percentage well beyond 100% and
rendering the progress bar out of the boundering box as shown in #858.
10 years ago
chrox 0bc3eadcae refactoring: use Document API getCoverPageImage to get cover image 10 years ago
chrox 092522b89d promote user to save PDF document after highlighting
This is a wordaround for #791.
10 years ago
Paulo Matias f04951e5dc Consider as corrupt a null-area bbox
Fixes crash with empty page_states
10 years ago
chrox 5aa8eb52da add missing Blitbuffer since it's removed from global space 10 years ago
chrox a8b7b2cdbd add base document init method to create new configurable for each document
this should fix configurables pollution when opening multiple documents
at the same time, e.g. when clipping page images in Evernote plugin.
10 years ago
chrox 17741e292b serialize cache when closing ReaderUI other than closing document 10 years ago
chrox 775e5ea3b4 serialize the most recently used blitbuffer/koptcontext
to speedup koreader startup for PDF/DJVU documents
especially when reflowing
10 years ago