From afe1dc9681625e5469016d05c020c5a1932fa760 Mon Sep 17 00:00:00 2001 From: NiLuJe Date: Sat, 5 Feb 2022 20:20:15 +0100 Subject: [PATCH] Don't show SW dither toggle on devices w/ HW dithering --- frontend/dispatcher.lua | 2 +- frontend/document/document.lua | 3 ++- frontend/ui/data/koptoptions.lua | 6 +++--- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/frontend/dispatcher.lua b/frontend/dispatcher.lua index 03830d2d8..0912cf7d3 100644 --- a/frontend/dispatcher.lua +++ b/frontend/dispatcher.lua @@ -190,7 +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_sw_dithering = {category="configurable", paging=true, condition=Device:hasEinkScreen() and not Device:canHWDither() 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}, diff --git a/frontend/document/document.lua b/frontend/document/document.lua index 53e7330ad..90f4de793 100644 --- a/frontend/document/document.lua +++ b/frontend/document/document.lua @@ -497,7 +497,8 @@ function Document:drawPage(target, x, y, rect, pageno, zoom, rotation, gamma, re local tile = self:renderPage(pageno, rect, zoom, rotation, gamma, render_mode) -- 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 + 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, diff --git a/frontend/ui/data/koptoptions.lua b/frontend/ui/data/koptoptions.lua index 33bbb0262..b0eacdc0d 100644 --- a/frontend/ui/data/koptoptions.lua +++ b/frontend/ui/data/koptoptions.lua @@ -497,7 +497,7 @@ This can also be used to remove some gray background or to convert a grayscale o }, { name = "hw_dithering", - name_text = _("HW Dithering"), + name_text = _("Dithering"), toggle = {_("off"), _("on")}, values = {0, 1}, default_value = 0, @@ -508,12 +508,12 @@ This can also be used to remove some gray background or to convert a grayscale o }, { name = "sw_dithering", - name_text = _("SW Dithering"), + name_text = _("Dithering"), toggle = {_("off"), _("on")}, values = {0, 1}, default_value = 0, advanced = true, - show = Device:hasEinkScreen() and Device.screen.fb_bpp == 8, + show = Device:hasEinkScreen() and not Device:canHWDither() and Device.screen.fb_bpp == 8, name_text_hold_callback = optionsutil.showValues, help_text = _([[Enable software dithering.]]), },