Fix css mismatch after koreader sync
This commit is contained in:
@@ -60,7 +60,7 @@ constexpr uint32_t FNV_OFFSET_BASIS = 0x811C9DC5; // 2166136261
|
||||
#endif
|
||||
|
||||
#ifndef SCT_EMBEDDED_STYLE_MIN_CONTIG_HEAP_BYTES
|
||||
#define SCT_EMBEDDED_STYLE_MIN_CONTIG_HEAP_BYTES (56 * 1024)
|
||||
#define SCT_EMBEDDED_STYLE_MIN_CONTIG_HEAP_BYTES (36 * 1024)
|
||||
#endif
|
||||
|
||||
constexpr uint32_t EMBEDDED_STYLE_MIN_FREE_HEAP_BYTES = SCT_EMBEDDED_STYLE_MIN_FREE_HEAP_BYTES;
|
||||
@@ -244,6 +244,7 @@ bool Section::loadSectionFile(const int fontId, const float lineCompression, con
|
||||
const uint16_t viewportHeight, const bool hyphenationEnabled, const bool embeddedStyle,
|
||||
const bool bionicReadingEnabled, const uint8_t imageRendering) {
|
||||
truncatedCache = false;
|
||||
embeddedStyleFallback = false;
|
||||
uint32_t propertyHash =
|
||||
calculatePropertyHash(fontId, lineCompression, extraParagraphSpacing, paragraphAlignment, viewportWidth,
|
||||
viewportHeight, hyphenationEnabled, embeddedStyle, bionicReadingEnabled, imageRendering);
|
||||
@@ -260,6 +261,7 @@ bool Section::loadSectionFile(const int fontId, const float lineCompression, con
|
||||
if (Storage.openFileForRead("SCT", fallbackPath, file)) {
|
||||
filePath = fallbackPath;
|
||||
usingEmbeddedStyleFallback = true;
|
||||
embeddedStyleFallback = true;
|
||||
LOG_INF("SCT", "Using no-CSS section cache fallback: %s", filePath.c_str());
|
||||
} else {
|
||||
return false;
|
||||
@@ -419,6 +421,13 @@ bool Section::createSectionFile(const int fontId, const float lineCompression, c
|
||||
return false;
|
||||
}
|
||||
|
||||
// Reset build state — createSectionFile may be called on a Section that previously
|
||||
// loaded a cache (e.g. fallback no-CSS file). pageCount must start at 0 so that
|
||||
// onPageComplete() numbering and paragraphLutPerPage stay in lockstep.
|
||||
file.close();
|
||||
pageCount = 0;
|
||||
this->lut.clear();
|
||||
|
||||
if (!Storage.openFileForWrite("SCT", filePath, file)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user