Re-use existing buffer and write to whole screen for 'partial update'

This commit is contained in:
Dave Allie 2025-12-08 19:44:19 +11:00
parent 6f88008737
commit efe1da9526
No known key found for this signature in database
GPG Key ID: F2FDDB3AD8D0276F
4 changed files with 14 additions and 6 deletions

View File

@ -216,9 +216,12 @@ void EpdRenderer::flushDisplay(const EInkDisplay::RefreshMode refreshMode) const
}
// TODO: Support partial window update
void EpdRenderer::flushArea(const int x, const int y, const int width, const int height) const {
einkDisplay.displayBuffer();
}
// void EpdRenderer::flushArea(const int x, const int y, const int width, const int height) const {
// const int rotatedX = y;
// const int rotatedY = EInkDisplay::DISPLAY_HEIGHT - 1 - x;
//
// einkDisplay.displayBuffer(EInkDisplay::FAST_REFRESH, rotatedX, rotatedY, height, width);
// }
int EpdRenderer::getPageWidth() const { return EInkDisplay::DISPLAY_HEIGHT - marginLeft - marginRight; }
@ -230,6 +233,8 @@ int EpdRenderer::getLineHeight() const {
return regularFontRenderer->fontFamily->getData(REGULAR)->advanceY * lineCompression;
}
void EpdRenderer::swapBuffers() const { einkDisplay.swapBuffers(); }
void EpdRenderer::copyGrayscaleLsbBuffers() const { einkDisplay.copyGrayscaleLsbBuffers(einkDisplay.getFrameBuffer()); }
void EpdRenderer::copyGrayscaleMsbBuffers() const { einkDisplay.copyGrayscaleMsbBuffers(einkDisplay.getFrameBuffer()); }

View File

@ -33,6 +33,7 @@ class EpdRenderer {
void drawImage(const uint8_t bitmap[], int x, int y, int width, int height) const;
void drawImageNoMargin(const uint8_t bitmap[], int x, int y, int width, int height) const;
void swapBuffers() const;
void copyGrayscaleLsbBuffers() const;
void copyGrayscaleMsbBuffers() const;
void displayGrayBuffer() const;
@ -41,7 +42,7 @@ class EpdRenderer {
void invertScreen() const;
void flushDisplay(EInkDisplay::RefreshMode refreshMode = EInkDisplay::FAST_REFRESH) const;
void flushArea(int x, int y, int width, int height) const;
// void flushArea(int x, int y, int width, int height) const;
int getPageWidth() const;
int getPageHeight() const;

@ -1 +1 @@
Subproject commit fe963b32821dec7fb22abbfa22daa8fc67f286d1
Subproject commit a126d4b0bf66cd2895d11748774f7ec2c366cc4c

View File

@ -160,10 +160,12 @@ void EpubReaderScreen::renderScreen() {
constexpr int y = 50;
const int w = textWidth + margin * 2;
const int h = renderer.getLineHeight() + margin * 2;
renderer.swapBuffers();
renderer.fillRect(x, y, w, h, 0);
renderer.drawText(x + margin, y + margin, "Indexing...");
renderer.drawRect(x + 5, y + 5, w - 10, h - 10);
renderer.flushArea(x, y, w, h);
renderer.flushDisplay(EInkDisplay::HALF_REFRESH);
pagesUntilFullRefresh = 0;
}
section->setupCacheDir();