diff --git a/lib/Epub/Epub/Page.cpp b/lib/Epub/Epub/Page.cpp index 3bfb0251..15bcf10e 100644 --- a/lib/Epub/Epub/Page.cpp +++ b/lib/Epub/Epub/Page.cpp @@ -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(*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) { diff --git a/lib/Epub/Epub/Page.h b/lib/Epub/Epub/Page.h index 067f2d5a..54985193 100644 --- a/lib/Epub/Epub/Page.h +++ b/lib/Epub/Epub/Page.h @@ -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 deserialize(FsFile& file); diff --git a/src/activities/reader/EpubReaderActivity.cpp b/src/activities/reader/EpubReaderActivity.cpp index 661488d2..f01e1d1f 100644 --- a/src/activities/reader/EpubReaderActivity.cpp +++ b/src/activities/reader/EpubReaderActivity.cpp @@ -1964,8 +1964,10 @@ void EpubReaderActivity::renderContents(std::unique_ptr 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, 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; }