Fix a few logic holes in dithering mode selection (#6419)

* Allow switching to SW dithering on a HW-capable device without that being lost on boot (and, worse, left in an undithered state).
* Make sure the automagic toggles between HW/SW in the Dev menu are properly saved.
reviewable/pr6423/r1
NiLuJe 4 years ago committed by GitHub
parent fa55152465
commit b4d5cfccb7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -1 +1 @@
Subproject commit fac6e7c85250b138a5603f54fc3427d62c141420
Subproject commit ac608dec4033f3eef8bcdd8c4861dc4efc0abaab

@ -356,11 +356,12 @@ function FileManagerMenu:setUpdateItemTable()
return not Device.screen.hw_dithering
end,
callback = function()
G_reader_settings:flipNilOrFalse("dev_no_hw_dither")
Device.screen:toggleHWDithering()
G_reader_settings:saveSetting("dev_no_hw_dither", not Device.screen.hw_dithering)
-- Make sure SW dithering gets disabled when we enable HW dithering
if Device.screen.hw_dithering and Device.screen.sw_dithering then
Device.screen:toggleSWDithering()
G_reader_settings:saveSetting("dev_no_sw_dither", true)
Device.screen:toggleSWDithering(false)
end
UIManager:setDirty("all", "full")
end,
@ -376,11 +377,12 @@ function FileManagerMenu:setUpdateItemTable()
return not Device.screen.sw_dithering
end,
callback = function()
G_reader_settings:flipNilOrFalse("dev_no_sw_dither")
Device.screen:toggleSWDithering()
G_reader_settings:saveSetting("dev_no_sw_dither", not Device.screen.sw_dithering)
-- Make sure HW dithering gets disabled when we enable SW dithering
if Device.screen.hw_dithering and Device.screen.sw_dithering then
Device.screen:toggleHWDithering()
G_reader_settings:saveSetting("dev_no_hw_dither", true)
Device.screen:toggleHWDithering(false)
end
UIManager:setDirty("all", "full")
end,

@ -130,10 +130,15 @@ end
if Device:hasEinkScreen() then
Device.screen:setupDithering()
if Device.screen.hw_dithering and G_reader_settings:isTrue("dev_no_hw_dither") then
Device.screen:toggleHWDithering()
Device.screen:toggleHWDithering(false)
end
if Device.screen.sw_dithering and G_reader_settings:isTrue("dev_no_sw_dither") then
Device.screen:toggleSWDithering()
Device.screen:toggleSWDithering(false)
end
-- NOTE: If device can HW dither (i.e., after setupDithering(), hw_dithering is true, but sw_dithering is false),
-- but HW dither is explicitly disabled, and SW dither enabled, don't leave SW dither disabled (i.e., re-enable sw_dithering)!
if Device:canHWDither() and G_reader_settings:isTrue("dev_no_hw_dither") and G_reader_settings:nilOrFalse("dev_no_sw_dither") then
Device.screen:toggleSWDithering(true)
end
end

Loading…
Cancel
Save