Review comment

This commit is contained in:
jpirnay
2026-05-19 13:05:42 +02:00
parent ee0a2556ac
commit 98bc29f41a
3 changed files with 20 additions and 4 deletions
+13
View File
@@ -226,6 +226,19 @@ bool Page::hasPlaceholderImages(const bool forceLoadLargeImages) const {
return false;
}
bool Page::allImagesArePlaceholders(const bool forceLoadLargeImages) const {
bool anyImage = false;
for (const auto& el : elements) {
if (el->getTag() == TAG_PageImage) {
anyImage = true;
if (!static_cast<const PageImage&>(*el).getImageBlock().wouldShowPlaceholder(forceLoadLargeImages)) {
return false;
}
}
}
return anyImage;
}
void Page::renderTextOnly(GfxRenderer& renderer, const int fontId, const int xOffset, const int yOffset) const {
for (auto& element : elements) {
if (element->getTag() == TAG_PageLine) {
+1
View File
@@ -132,6 +132,7 @@ class Page {
void render(GfxRenderer& renderer, int fontId, int xOffset, int yOffset, bool forceLoadLargeImages = true) const;
void renderTextOnly(GfxRenderer& renderer, int fontId, int xOffset, int yOffset) const;
bool hasPlaceholderImages(bool forceLoadLargeImages) const;
bool allImagesArePlaceholders(bool forceLoadLargeImages) const;
bool serialize(FsFile& file) const;
static std::unique_ptr<Page> deserialize(FsFile& file);
+6 -4
View File
@@ -1964,8 +1964,10 @@ void EpubReaderActivity::renderContents(std::unique_ptr<Page> page, const int or
const bool effectiveForceLoad = forceLoadLargeImages || !SETTINGS.largeImagePlaceholder;
pageHasPlaceholders = page->hasPlaceholderImages(effectiveForceLoad);
// Force special handling for pages with real (non-placeholder) images when anti-aliasing is on
bool imagePageWithAA = page->hasImages() && !pageHasPlaceholders && aaEnabledForThisRender;
// Force special handling for pages with at least one real (decoded) image when anti-aliasing is on.
// Mixed pages (some decoded, some placeholder) still need the AA codepath.
bool imagePageWithAA =
page->hasImages() && !page->allImagesArePlaceholders(effectiveForceLoad) && aaEnabledForThisRender;
bool forceHalfRefreshThisPage = pendingHalfRefreshAfterImagePage && SETTINGS.halfRefreshAfterImagePage;
pendingHalfRefreshAfterImagePage = false;
lastRenderStats.imagePageWithAA = imagePageWithAA;
@@ -2066,9 +2068,9 @@ void EpubReaderActivity::renderContents(std::unique_ptr<Page> page, const int or
LOG_INF("ERS", "Skipping grayscale/BW-restore for this page (insufficient heap for BW snapshot)");
}
// Only schedule the half-refresh if real images were decoded on this page.
// Only schedule the half-refresh if at least one real image was decoded on this page.
// Placeholder-only pages don't deposit grayscale data that needs settling.
if (page->hasImages() && !pageHasPlaceholders &&
if (page->hasImages() && !page->allImagesArePlaceholders(effectiveForceLoad) &&
getEffectiveImageRendering() != CrossPointSettings::IMAGES_SUPPRESS) {
pendingHalfRefreshAfterImagePage = true;
}