djvu: enable color rendering (#3361)

* djvu: enable color rendering

* Bump base
This commit is contained in:
poire-z
2017-10-15 13:03:42 +02:00
committed by Frans de Jonge
parent 74242025ff
commit cfa5c8a941
3 changed files with 14 additions and 4 deletions

View File

@@ -1,3 +1,4 @@
local Blitbuffer = require("ffi/blitbuffer")
local Document = require("document/document")
local DrawContext = require("ffi/drawcontext")
local KoptOptions = require("ui/data/koptoptions")
@@ -10,7 +11,7 @@ local DjvuDocument = Document:new{
dc_null = DrawContext.new(),
options = KoptOptions,
koptinterface = nil,
is_color_capable = false,
color_bb_type = Blitbuffer.TYPE_BBRGB24,
}
-- check DjVu magic string to validate
@@ -33,7 +34,7 @@ function DjvuDocument:init()
end
local ok
ok, self._document = pcall(djvu.openDocument, self.file, self.djvulibre_cache_size)
ok, self._document = pcall(djvu.openDocument, self.file, self.render_color, self.djvulibre_cache_size)
if not ok then
error(self._document) -- will contain error message
end
@@ -43,6 +44,13 @@ function DjvuDocument:init()
self:_readMetadata()
end
function DjvuDocument:updateColorRendering()
Document.updateColorRendering(self) -- will set self.render_color
if self._document then
self._document:setColorRendering(self.render_color)
end
end
function DjvuDocument:getProps()
local _, _, docname = self.file:find(".*/(.*)")
docname = docname or self.file