Fix ghosting on pages following images in grayscale (#2226)

This commit is contained in:
Justin Mitchell
2026-05-31 23:33:26 -04:00
committed by GitHub
parent 03f73fadc7
commit 50e4d550fb
3 changed files with 18 additions and 2 deletions
+10
View File
@@ -104,6 +104,16 @@ void ImageBlock::render(GfxRenderer& renderer, const int x, const int y) {
return;
}
// Tiled grayscale (#2190): skip the whole image when it doesn't touch the
// active band. The per-pixel writer already clips off-band pixels, but without
// this each of the ~7 bands per plane re-ran the full cache load / pixel walk
// and discarded the result — the dominant cost of AA on image pages. The check
// is orientation-aware and returns true when no strip is active, so the BW
// pass and non-tiled controllers render the image exactly as before.
if (!renderer.glyphIntersectsStrip(x, y, x + width - 1, y + height - 1)) {
return;
}
// Try to render from cache first
std::string cachePath = getCachePath(imagePath);
if (renderFromCache(renderer, cachePath, x, y, width, height)) {
+7 -1
View File
@@ -940,7 +940,13 @@ void EpubReaderActivity::renderContents(std::unique_ptr<Page> page, const int or
} else {
renderer.displayBuffer(HalDisplay::HALF_REFRESH);
}
// Double FAST_REFRESH handles ghosting for image pages; don't count toward full refresh cadence
// The image's own page is handled above and doesn't count toward the full
// refresh cadence. But the grayscale pass below leaves gray charge in the
// image region that a plain fast diff on the *next* page can't clear, so
// text there ghosts gray (#2190). Force the next ordinary page onto the
// HALF ghost-cleanup path, which drives every pixel to its target
// regardless of residue.
pagesUntilFullRefresh = 1;
} else {
ReaderUtils::displayWithRefreshCycle(renderer, pagesUntilFullRefresh);
}