diff --git a/base b/base index 003e635a5..8b544c9a3 160000 --- a/base +++ b/base @@ -1 +1 @@ -Subproject commit 003e635a56c38d0530a69fa628b7395780837884 +Subproject commit 8b544c9a3b2b10aa3706a47aec5ad7429ce08030 diff --git a/frontend/apps/reader/modules/readerhinting.lua b/frontend/apps/reader/modules/readerhinting.lua index 7a2e8283c..ad995791c 100644 --- a/frontend/apps/reader/modules/readerhinting.lua +++ b/frontend/apps/reader/modules/readerhinting.lua @@ -19,8 +19,8 @@ function ReaderHinting:onHintPage() self.zoom:getZoom(self.view.state.page + i), self.view.state.rotation, self.view.state.gamma, - self.view.state.black_hex, - self.view.state.white_hex) + self.view.state.black_hex, + self.view.state.white_hex) end end return true diff --git a/frontend/apps/reader/modules/readerkoptlistener.lua b/frontend/apps/reader/modules/readerkoptlistener.lua index 2e8345de4..c0c7d4e64 100644 --- a/frontend/apps/reader/modules/readerkoptlistener.lua +++ b/frontend/apps/reader/modules/readerkoptlistener.lua @@ -22,8 +22,8 @@ function ReaderKoptListener:onReadSettings(config) self.normal_zoom_mode = normal_zoom_mode self:setZoomMode(normal_zoom_mode) self.ui:handleEvent(Event:new("GammaUpdate", self.document.configurable.contrast, true)) -- no notification - self.ui:handleEvent(Event:new("BlackLevelUpdate", self.document.configurable.black_hex, true)) -- no notification - self.ui:handleEvent(Event:new("WhiteLevelUpdate", self.document.configurable.white_hex, true)) -- no notification + self.ui:handleEvent(Event:new("BlackLevelUpdate", self.document.configurable.black_hex, true)) -- no notification + self.ui:handleEvent(Event:new("WhiteLevelUpdate", self.document.configurable.white_hex, true)) -- no notification -- since K2pdfopt v2.21 negative value of word spacing is also used, for config -- compatibility we should manually change previous -1 to a more reasonable -0.2 if self.document.configurable.word_spacing == -1 then diff --git a/frontend/document/document.lua b/frontend/document/document.lua index 0e9e80b10..867a37a85 100644 --- a/frontend/document/document.lua +++ b/frontend/document/document.lua @@ -392,9 +392,8 @@ end function Document:getFullPageHash(pageno, zoom, rotation, gamma, black_hex, white_hex) return "renderpg|"..self.file.."|"..self.mod_time.."|"..pageno.."|" - ..zoom.."|" - ..rotation.."|"..gamma.."|"..black_hex.."|"..white_hex - ..self.render_mode..(self.render_color and "|color" or "|bw") + ..zoom.."|"..rotation.."|"..gamma.."|"..black_hex.."|"..white_hex + ..self.render_mode..(self.render_color and "|color" or "|bw") ..(self.reflowable_font_size and "|"..self.reflowable_font_size or "") end @@ -402,7 +401,7 @@ function Document:getPagePartHash(pageno, zoom, rotation, gamma, black_hex, whit return "renderpgpart|"..self.file.."|"..self.mod_time.."|"..pageno.."|" ..tostring(rect).."|"..zoom.."|"..tostring(rect.scaled_rect).."|" ..rotation.."|"..gamma.."|"..black_hex.."|"..white_hex - ..self.render_mode..(self.render_color and "|color" or "|bw") + ..self.render_mode..(self.render_color and "|color" or "|bw") ..(self.reflowable_font_size and "|"..self.reflowable_font_size or "") end @@ -504,8 +503,8 @@ function Document:renderPage(pageno, rect, zoom, rotation, gamma, black_hex, whi dc:setGamma(gamma) end - dc:setBlackHex(black_hex) - dc:setWhiteHex(white_hex) + dc:setBlackHex(black_hex) + dc:setWhiteHex(white_hex) -- And finally, render the page in our BB local page = self._document:openPage(pageno) diff --git a/frontend/document/koptinterface.lua b/frontend/document/koptinterface.lua index 12520f153..75a1bfe44 100644 --- a/frontend/document/koptinterface.lua +++ b/frontend/document/koptinterface.lua @@ -99,8 +99,8 @@ function KoptInterface:setDefaultConfigurable(configurable) configurable.page_margin = G_defaults:readSetting("DKOPTREADER_CONFIG_PAGE_MARGIN") configurable.quality = G_defaults:readSetting("DKOPTREADER_CONFIG_RENDER_QUALITY") configurable.contrast = G_defaults:readSetting("DKOPTREADER_CONFIG_CONTRAST") - configurable.black_hex = G_defaults:readSetting("DKOPTREADER_CONFIG_BLACK_HEX") - configurable.white_hex = G_defaults:readSetting("DKOPTREADER_CONFIG_WHITE_HEX") + configurable.black_hex = G_defaults:readSetting("DKOPTREADER_CONFIG_BLACK_HEX") + configurable.white_hex = G_defaults:readSetting("DKOPTREADER_CONFIG_WHITE_HEX") configurable.defect_size = G_defaults:readSetting("DKOPTREADER_CONFIG_DEFECT_SIZE") configurable.line_spacing = G_defaults:readSetting("DKOPTREADER_CONFIG_LINE_SPACING") configurable.word_spacing = G_defaults:readSetting("DKOPTREADER_CONFIG_DEFAULT_WORD_SPACING") @@ -152,8 +152,8 @@ function KoptInterface:createContext(doc, pageno, bbox) kc:setQuality(doc.configurable.quality) -- k2pdfopt (for reflowing) and mupdf use different algorithms to apply gamma when rendering kc:setContrast(1 / doc.configurable.contrast) - kc:setForegroundHex(doc.configurable.black_hex) - kc:setBackgroundHex(doc.configurable.white_hex) + kc:setBlackHex(doc.configurable.black_hex) + kc:setWhiteHex(doc.configurable.white_hex) kc:setDefectSize(doc.configurable.defect_size) kc:setLineSpacing(doc.configurable.line_spacing) kc:setWordSpacing(doc.configurable.word_spacing) @@ -553,7 +553,7 @@ Draw cached tile pixels into target blitbuffer. Inherited from common document interface. --]] function KoptInterface:drawContextPage(doc, target, x, y, rect, pageno, zoom, rotation) - local tile = self:renderPage(doc, pageno, rect, zoom, rotation, 1.0) + local tile = self:renderPage(doc, pageno, rect, zoom, rotation, 1.0, 0x000000, 0xFFFFFF) target:blitFrom(tile.bb, x, y, rect.x - tile.excerpt.x, diff --git a/frontend/ui/data/koptoptions.lua b/frontend/ui/data/koptoptions.lua index d9b5b0ca8..043d80626 100644 --- a/frontend/ui/data/koptoptions.lua +++ b/frontend/ui/data/koptoptions.lua @@ -512,7 +512,7 @@ Some of the other settings are only available when reflow mode is enabled.]]), event = "BlackLevelUpdate", -- For pdf non-reflowing mode (mupdf): args = {0x808080, 0x606060, 0x404040, 0x202020, 0x000000}, - labels = { #808080, #606060, #404040, #202020, #000000}, + labels = {"#808080", "#606060", "#404040", "#202020", "#000000"}, name_text_hold_callback = optionsutil.showValues, }, { @@ -526,7 +526,7 @@ Some of the other settings are only available when reflow mode is enabled.]]), event = "WhiteLevelUpdate", -- For pdf non-reflowing mode (mupdf): args = {0xFFFFFF, 0xE0E0E0, 0xC0C0C0, 0xA0A0A0, 0x808080}, - labels = { #FFFFFF, #E0E0E0, #C0C0C0, #A0A0A0, #808080}, + labels = {"#FFFFFF", "#E0E0E0", "#C0C0C0", "#A0A0A0", "#808080"}, name_text_hold_callback = optionsutil.showValues, }, { diff --git a/spec/unit/pdf_bench.lua b/spec/unit/pdf_bench.lua index 1631dc4cc..5f787b41e 100644 --- a/spec/unit/pdf_bench.lua +++ b/spec/unit/pdf_bench.lua @@ -23,7 +23,7 @@ describe("PDF benchmark:", function() end for pageno = 1, math.min(9, doc.info.number_of_pages) do local secs, usecs = util.gettime() - assert.truthy(doc:renderPage(pageno, nil, 1, 0, 1.0, , 0x000000, 0xFFFFFF)) + assert.truthy(doc:renderPage(pageno, nil, 1, 0, 1.0, 0x000000, 0xFFFFFF)) local nsecs, nusecs = util.gettime() local dur = nsecs - secs + (nusecs - usecs) / 1000000 logDuration(logfile, pageno, dur)