2
0
mirror of https://github.com/koreader/koreader synced 2024-11-16 06:12:56 +00:00

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.
This commit is contained in:
poire-z 2019-02-03 11:25:34 +01:00 committed by GitHub
parent 895589ddaa
commit f2a9ed0b79
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 14 additions and 9 deletions

2
base

@ -1 +1 @@
Subproject commit 399063859a9ca74941970e114d87fc275a854fa4
Subproject commit 52466a536689ef97ef62d7db9d5491439c3a537b

View File

@ -323,7 +323,7 @@ function CreDocument:drawCurrentView(target, x, y, rect, pos)
-- change has been made, to avoid having crengine redraw the exact
-- same buffer.
-- And it could only change when some other methods from here are called
self._document:drawCurrentPage(self.buffer, self.render_color)
self._drawn_images_count, self._drawn_images_surface_ratio = self._document:drawCurrentPage(self.buffer, self.render_color)
target:blitFrom(self.buffer, x, y, 0, 0, rect.w, rect.h)
end

View File

@ -402,6 +402,11 @@ function Document:drawPage(target, x, y, rect, pageno, zoom, rotation, gamma, re
rect.w, rect.h)
end
function Document:getDrawnImagesStatistics()
-- For now, only set by CreDocument in CreDocument:drawCurrentView()
return self._drawn_images_count, self._drawn_images_surface_ratio
end
function Document:getPageText(pageno)
-- is this worth caching? not done yet.
local page = self._document:openPage(pageno)

View File

@ -186,13 +186,13 @@ describe("Readerrolling module", function()
it("should show pages for different word gap", function()
readerui.document:setSpaceCondensing(100)
readerui:handleEvent(Event:new("ChangeScreenMode", "portrait"))
assert.are.same(266, readerui.document:getPageCount())
assert.are.same(249, readerui.document:getPageCount())
readerui.document:setSpaceCondensing(75)
readerui:handleEvent(Event:new("ChangeScreenMode", "portrait"))
assert.are.same(261, readerui.document:getPageCount())
assert.are.same(242, readerui.document:getPageCount())
readerui.document:setSpaceCondensing(50)
readerui:handleEvent(Event:new("ChangeScreenMode", "portrait"))
assert.are.same(247, readerui.document:getPageCount())
assert.are.same(233, readerui.document:getPageCount())
end)
end)

View File

@ -66,8 +66,8 @@ describe("Readersearch module", function()
end)
it("should find the last occurrence", function()
-- local logger = require("logger")
-- logger.info("nb of pages", doc:getPageCount())
-- 20181208: currently 266 pages
-- logger.warn("nb of pages", doc:getPageCount())
-- 20190202: currently 242 pages
for i = 100, 180, 10 do
rolling:onGotoPage(i)
local words = search:searchFromEnd("Verona")

View File

@ -25,7 +25,7 @@ describe("Readertoc module", function()
title = toc:getTocTitleByPage(60)
DEBUG("toc", toc.toc)
assert(title == "SCENE V. A hall in Capulet's house.")
title = toc:getTocTitleByPage(195)
title = toc:getTocTitleByPage(187)
assert(title == "SCENE I. Friar Laurence's cell.")
end)
describe("getTocTicks API", function()
@ -68,7 +68,7 @@ describe("Readertoc module", function()
end)
it("should get page left of chapter", function()
assert.truthy(toc:getChapterPagesLeft(10, 0) > 10)
assert.truthy(toc:getChapterPagesLeft(102, 0) > 10)
assert.truthy(toc:getChapterPagesLeft(97, 0) > 10)
assert.are.same(nil, toc:getChapterPagesLeft(290, 0))
end)
it("should get page done of chapter", function()