mirror of
https://github.com/koreader/koreader.git
synced 2025-08-10 00:52:38 +00:00
[CRe] Tweak nightmode and CRe call cache interaction (#6859)
Simplify 4caf8f28 (#6854), allowing us not to track
nightmode in two places.
This commit is contained in:
@@ -25,7 +25,6 @@ local CreDocument = Document:new{
|
||||
_view_mode = nil,
|
||||
_smooth_scaling = false,
|
||||
_nightmode_images = true,
|
||||
_nightmode = false,
|
||||
|
||||
line_space_percent = 100,
|
||||
default_font = "Noto Serif",
|
||||
@@ -424,7 +423,7 @@ function CreDocument:drawCurrentView(target, x, y, rect, pos)
|
||||
|
||||
--local start_ts = FFIUtil.getTimestamp()
|
||||
self._drawn_images_count, self._drawn_images_surface_ratio =
|
||||
self._document:drawCurrentPage(self.buffer, self.render_color, self._nightmode and self._nightmode_images, self._smooth_scaling, Screen.sw_dithering)
|
||||
self._document:drawCurrentPage(self.buffer, self.render_color, Screen.night_mode and self._nightmode_images, self._smooth_scaling, Screen.sw_dithering)
|
||||
--local end_ts = FFIUtil.getTimestamp()
|
||||
--print(string.format("CreDocument:drawCurrentView: Rendering took %9.3f ms", (end_ts - start_ts) * 1000))
|
||||
|
||||
@@ -878,11 +877,6 @@ function CreDocument:setNightmodeImages(toggle)
|
||||
self._nightmode_images = toggle
|
||||
end
|
||||
|
||||
function CreDocument:setNightMode(toggle)
|
||||
logger.dbg("CreDocument: set nightmode", toggle)
|
||||
self._nightmode = toggle
|
||||
end
|
||||
|
||||
function CreDocument:setFloatingPunctuation(enabled)
|
||||
--- @fixme occasional segmentation fault when toggling floating punctuation
|
||||
logger.dbg("CreDocument: set floating punctuation", enabled)
|
||||
@@ -1055,6 +1049,9 @@ function CreDocument:register(registry)
|
||||
registry:addProvider("py", "text/x-python", self, 90)
|
||||
end
|
||||
|
||||
-- no-op that will be wrapped by setupCallCache
|
||||
function CreDocument:resetCallCache() end
|
||||
|
||||
-- Optimise usage of some of the above methods by caching their results,
|
||||
-- either globally, or per page/pos for those whose result may depend on
|
||||
-- current page number or y-position.
|
||||
@@ -1274,6 +1271,7 @@ function CreDocument:setupCallCache()
|
||||
elseif name:sub(1,6) == "update" then add_reset = true
|
||||
elseif name:sub(1,6) == "enable" then add_reset = true
|
||||
elseif name == "zoomFont" then add_reset = true -- not used by koreader
|
||||
elseif name == "resetCallCache" then add_reset = true
|
||||
|
||||
-- These may have crengine do native highlight or unhighlight
|
||||
-- (we could keep the original buffer and use a scratch buffer while
|
||||
|
||||
Reference in New Issue
Block a user