New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Page browser: show nightmode thumbnails when in nightmode #11091
Conversation
Just prevent page thumbnails ImageWidgets to be nightmode inverted, unlike all other ones which are expected to be double inverted to get their original colors shown. The same thumbnail can be used and cached in both day and night modes, unless "nightmode_images" is enabled and have crengine itself invert images, making thumbnails different.
@@ -250,6 +250,10 @@ end | |||
function ReaderThumbnail:getPageThumbnail(page, width, height, batch_id, when_generated_callback) | |||
self:setupCache() | |||
self.current_target_size_tag = string.format("w%d_h%d", width, height) | |||
if self.ui.rolling and Screen.night_mode and self.ui.document.configurable.nightmode_images == 1 then | |||
-- We'll get a different bb in this case: it needs it own cache hash |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
über nit: final it
should be an its
;).
@@ -250,6 +250,10 @@ end | |||
function ReaderThumbnail:getPageThumbnail(page, width, height, batch_id, when_generated_callback) | |||
self:setupCache() | |||
self.current_target_size_tag = string.format("w%d_h%d", width, height) | |||
if self.ui.rolling and Screen.night_mode and self.ui.document.configurable.nightmode_images == 1 then | |||
-- We'll get a different bb in this case: it needs it own cache hash | |||
self.current_target_size_tag = self.current_target_size_tag .. "_ni" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: I usually abbreviate to nm
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(ni
meant "nightmode images", but ok :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Besides the cosmetics nits, sounds good.
Might want to check whether it behaves both with soft (emu or disabled in dev settings) & hard (kobo) inversion, as I don't recall how this may all affect this ;).
My emulator and device are old, and so soft. I don't have a Kobo with hardware nightmode. |
Every Kobo (except for the Aura, unless it's on a recent FW; and except for the sunxi ones) supports hardware inversion, so yours should be using HW inversion ;). |
Well, ok :) (I thought there was a toggle in the menu to switch between hard/soft, but looks like there isn't). |
Oh, yeah, I also mistakenly thought I added a switch for that in dev settings, but, nope, that's dithering only. (It indeed makes no sense to disable HW inversion: either it works and it's free performance, or it doesn't and we just kill it by default). |
Just prevent page thumbnails ImageWidgets to be nightmode inverted, unlike all other ones which are expected to be double inverted to get their original colors shown.
The same thumbnail can be used and cached in both day and night modes, unless "nightmode_images" is enabled and have crengine itself invert images, making thumbnails different.
(Had a hard time writing that commit message :) was initially mentionning "triple inverting"... hard to put into words what's happening in nightmode and the simple tweaks there).
See #10811 (comment)
Pinging @NiLuJe for your OK the the ImageWidget
original_in_nightmode = true
idea/wording.This change is