mirror of
https://github.com/koreader/koreader.git
synced 2025-08-10 00:52:38 +00:00
@@ -221,7 +221,7 @@ function ReaderView:paintTo(bb, x, y)
|
||||
self.dialog.dithered = nil
|
||||
-- For KOpt, let the user choose.
|
||||
if self.ui.document.info.has_pages then
|
||||
-- Also enforce dithering in PicDocument
|
||||
-- Also enforce HW dithering in PicDocument
|
||||
if self.ui.document.is_pic or self.document.configurable.hw_dithering == 1 then
|
||||
self.dialog.dithered = true
|
||||
end
|
||||
|
||||
@@ -190,6 +190,7 @@ local settingsList = {
|
||||
kopt_contrast = {category="absolutenumber", paging=true},
|
||||
kopt_page_opt = {category="configurable", paging=true},
|
||||
kopt_hw_dithering = {category="configurable", paging=true, condition=Device:hasEinkScreen() and Device:canHWDither()},
|
||||
kopt_sw_dithering = {category="configurable", paging=true, condition=Device:hasEinkScreen() and Device.screen.fb_bpp == 8},
|
||||
kopt_quality = {category="configurable", paging=true},
|
||||
kopt_doc_language = {category="string", paging=true},
|
||||
kopt_forced_ocr = {category="configurable", paging=true},
|
||||
@@ -355,6 +356,7 @@ local dispatcher_menu_order = {
|
||||
"kopt_contrast",
|
||||
"kopt_page_opt",
|
||||
"kopt_hw_dithering",
|
||||
"kopt_sw_dithering",
|
||||
"kopt_quality",
|
||||
|
||||
"kopt_doc_language",
|
||||
|
||||
@@ -51,6 +51,10 @@ function CanvasContext:init(device)
|
||||
self.is_bgr = true
|
||||
Mupdf.bgr = true
|
||||
end
|
||||
|
||||
self.hasEinkScreen = device.hasEinkScreen
|
||||
self.canHWDither = device.canHWDither
|
||||
self.fb_bpp = device.screen.fb_bpp
|
||||
end
|
||||
|
||||
|
||||
|
||||
@@ -495,11 +495,21 @@ Draw page content to blitbuffer.
|
||||
--]]
|
||||
function Document:drawPage(target, x, y, rect, pageno, zoom, rotation, gamma, render_mode)
|
||||
local tile = self:renderPage(pageno, rect, zoom, rotation, gamma, render_mode)
|
||||
target:blitFrom(tile.bb,
|
||||
x, y,
|
||||
rect.x - tile.excerpt.x,
|
||||
rect.y - tile.excerpt.y,
|
||||
rect.w, rect.h)
|
||||
-- Enable SW dithering if requested (only available in koptoptions)
|
||||
-- Much Like ReaderView, also enforce SW dithering in PicDocument if the device can't do HW dithering...
|
||||
if (self.is_pic and CanvasContext:hasEinkScreen() and not CanvasContext:canHWDither() and CanvasContext.fb_bpp == 8) or (self.configurable.sw_dithering and self.configurable.sw_dithering == 1) then
|
||||
target:ditherblitFrom(tile.bb,
|
||||
x, y,
|
||||
rect.x - tile.excerpt.x,
|
||||
rect.y - tile.excerpt.y,
|
||||
rect.w, rect.h)
|
||||
else
|
||||
target:blitFrom(tile.bb,
|
||||
x, y,
|
||||
rect.x - tile.excerpt.x,
|
||||
rect.y - tile.excerpt.y,
|
||||
rect.w, rect.h)
|
||||
end
|
||||
end
|
||||
|
||||
function Document:getDrawnImagesStatistics()
|
||||
|
||||
@@ -497,14 +497,25 @@ This can also be used to remove some gray background or to convert a grayscale o
|
||||
},
|
||||
{
|
||||
name = "hw_dithering",
|
||||
name_text = _("Dithering"),
|
||||
name_text = _("HW Dithering"),
|
||||
toggle = {_("off"), _("on")},
|
||||
values = {0, 1},
|
||||
default_value = 0,
|
||||
advanced = true,
|
||||
show = Device:hasEinkScreen() and Device:canHWDither(),
|
||||
name_text_hold_callback = optionsutil.showValues,
|
||||
help_text = _([[Enable Hardware dithering.]]),
|
||||
help_text = _([[Enable hardware dithering.]]),
|
||||
},
|
||||
{
|
||||
name = "sw_dithering",
|
||||
name_text = _("SW Dithering"),
|
||||
toggle = {_("off"), _("on")},
|
||||
values = {0, 1},
|
||||
default_value = 0,
|
||||
advanced = true,
|
||||
show = Device:hasEinkScreen() and Device.screen.fb_bpp == 8,
|
||||
name_text_hold_callback = optionsutil.showValues,
|
||||
help_text = _([[Enable software dithering.]]),
|
||||
},
|
||||
{
|
||||
name = "quality",
|
||||
|
||||
Reference in New Issue
Block a user