mirror of
https://github.com/koreader/koreader.git
synced 2025-08-10 00:52:38 +00:00
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
This commit is contained in:
@@ -239,10 +239,15 @@ function CreDocument:drawCurrentView(target, x, y, rect, pos)
|
||||
self.buffer:free()
|
||||
self.buffer = nil
|
||||
end
|
||||
local color = Screen:isColorEnabled()
|
||||
if not self.buffer then
|
||||
self.buffer = Blitbuffer.new(rect.w, rect.h)
|
||||
-- If we use TYPE_BBRGB32 (and LVColorDrawBuf drawBuf(..., 32) in cre.cpp),
|
||||
-- we get inverted Red and Blue in the blitbuffer (could be that
|
||||
-- crengine/src/lvdrawbuf.cpp treats our 32bits not as RGBA).
|
||||
-- But it is all fine if we use TYPE_BBRGB16.
|
||||
self.buffer = Blitbuffer.new(rect.w, rect.h, color and Blitbuffer.TYPE_BBRGB16 or nil)
|
||||
end
|
||||
self._document:drawCurrentPage(self.buffer)
|
||||
self._document:drawCurrentPage(self.buffer, color)
|
||||
target:blitFrom(self.buffer, x, y, 0, 0, rect.w, rect.h)
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user