MCPcopy Create free account
hub / github.com/crosspoint-reader/crosspoint-reader / prewarmCache

Method prewarmCache

lib/GfxRenderer/FontCacheManager.cpp:22–46  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

20}
21
22void FontCacheManager::prewarmCache(int fontId, const char* utf8Text, uint8_t styleMask) {
23 // SD card font prewarm path: prewarm all requested styles in one call
24 auto it = sdCardFonts_.find(fontId);
25 if (it != sdCardFonts_.end()) {
26 int missed = it->second->prewarm(utf8Text, styleMask);
27 if (missed > 0) {
28 LOG_DBG("FCM", "prewarmCache(SD): %d glyph(s) not found (styleMask=0x%02X)", missed, styleMask);
29 }
30 return;
31 }
32
33 // Standard compressed font prewarm path: loop over all requested styles
34 if (!fontDecompressor_ || fontMap_.count(fontId) == 0) return;
35
36 for (uint8_t i = 0; i < 4; i++) {
37 if (!(styleMask & (1 << i))) continue;
38 auto style = static_cast<EpdFontFamily::Style>(i);
39 const EpdFontData* data = fontMap_.at(fontId).getData(style);
40 if (!data || !data->groups) continue;
41 int missed = fontDecompressor_->prewarmCache(data, utf8Text);
42 if (missed > 0) {
43 LOG_DBG("FCM", "prewarmCache: %d glyph(s) not cached for style %d", missed, i);
44 }
45 }
46}
47
48void FontCacheManager::logStats(const char* label) {
49 if (fontDecompressor_) fontDecompressor_->logStats(label);

Callers 1

endScanAndPrewarmMethod · 0.45

Calls 3

endMethod · 0.80
prewarmMethod · 0.80
getDataMethod · 0.80

Tested by

no test coverage detected