mirror of
https://github.com/daveallie/crosspoint-reader.git
synced 2025-12-18 07:07:41 +03:00
Show indexing text when indexing
This commit is contained in:
parent
12d28e2148
commit
e08bac2e10
@ -89,7 +89,7 @@ void EpdFontRenderer<Renderable>::renderChar(const uint32_t cp, int* x, const in
|
||||
if (font->data->compressed) {
|
||||
auto* tmpBitmap = static_cast<uint8_t*>(malloc(bitmapSize));
|
||||
if (tmpBitmap == nullptr && bitmapSize) {
|
||||
// ESP_LOGE("font", "malloc failed.");
|
||||
Serial.println("Failed to allocate memory for decompression buffer");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@ -120,9 +120,8 @@ void EpdRenderer::clearScreen(const bool black) const {
|
||||
|
||||
void EpdRenderer::flushDisplay(const bool partialUpdate) const { display->display(partialUpdate); }
|
||||
|
||||
void EpdRenderer::flushArea(int x, int y, int width, int height) const {
|
||||
// TODO: Fix
|
||||
display->display(true);
|
||||
void EpdRenderer::flushArea(const int x, const int y, const int width, const int height) const {
|
||||
display->displayWindow(x, y, width, height);
|
||||
}
|
||||
|
||||
int EpdRenderer::getPageWidth() const { return display->width() - marginLeft - marginRight; }
|
||||
|
||||
@ -123,6 +123,20 @@ void EpubReaderScreen::renderPage() {
|
||||
section = new Section(epub, currentSpineIndex, renderer);
|
||||
if (!section->hasCache()) {
|
||||
Serial.println("Cache not found, building...");
|
||||
|
||||
{
|
||||
const int textWidth = renderer->getTextWidth("Indexing...");
|
||||
constexpr int margin = 20;
|
||||
const int x = (renderer->getPageWidth() - textWidth - margin * 2) / 2;
|
||||
constexpr int y = 50;
|
||||
const int w = textWidth + margin * 2;
|
||||
const int h = renderer->getLineHeight() + margin * 2;
|
||||
renderer->fillRect(x, y, w, h, 0);
|
||||
renderer->drawText(x + margin, y + margin, "Indexing...");
|
||||
renderer->drawRect(x + 5, y + 5, w - 10, h - 10, 1);
|
||||
renderer->flushArea(x - 20, y - 20, w + 40, h + 40);
|
||||
}
|
||||
|
||||
section->setupCacheDir();
|
||||
if (!section->persistPageDataToSD()) {
|
||||
Serial.println("Failed to persist page data to SD");
|
||||
|
||||
Loading…
Reference in New Issue
Block a user