refactor(home): Address PR review feedback for Continue Reading cover

- Invert bookmark icon logic: show bookmark only when no cover image
  (as visual decoration), hide when cover is displayed to show more art
- Replace GfxRenderer::storeBwBuffer usage with HomeActivity's own
  buffer management (storeCoverBuffer/restoreCoverBuffer/freeCoverBuffer)
- Remove copyStoredBwBuffer() and freeStoredBwBuffer() from GfxRenderer
  as they enabled misuse of the grayscale buffer storage mechanism
This commit is contained in:
Eunchurn Park
2026-01-09 23:51:24 +09:00
parent 8fc51668d0
commit f0fa90da0c
4 changed files with 80 additions and 96 deletions

View File

@@ -577,38 +577,6 @@ void GfxRenderer::restoreBwBuffer() {
Serial.printf("[%lu] [GFX] Restored and freed BW buffer chunks\n", millis());
}
/**
* Copy stored BW buffer to framebuffer without freeing the stored chunks.
* Use this when you want to restore the buffer but keep it for later reuse.
* Returns true if buffer was copied successfully.
*/
bool GfxRenderer::copyStoredBwBuffer() {
// Check if all chunks are allocated
for (const auto& bwBufferChunk : bwBufferChunks) {
if (!bwBufferChunk) {
return false;
}
}
uint8_t* frameBuffer = einkDisplay.getFrameBuffer();
if (!frameBuffer) {
return false;
}
for (size_t i = 0; i < BW_BUFFER_NUM_CHUNKS; i++) {
const size_t offset = i * BW_BUFFER_CHUNK_SIZE;
memcpy(frameBuffer + offset, bwBufferChunks[i], BW_BUFFER_CHUNK_SIZE);
}
return true;
}
/**
* Free the stored BW buffer chunks manually.
* Use this when you no longer need the stored buffer.
*/
void GfxRenderer::freeStoredBwBuffer() { freeBwBufferChunks(); }
/**
* Cleanup grayscale buffers using the current frame buffer.
* Use this when BW buffer was re-rendered instead of stored/restored.

View File

@@ -90,10 +90,8 @@ class GfxRenderer {
void copyGrayscaleLsbBuffers() const;
void copyGrayscaleMsbBuffers() const;
void displayGrayBuffer() const;
bool storeBwBuffer(); // Returns true if buffer was stored successfully
void restoreBwBuffer(); // Restore and free the stored buffer
bool copyStoredBwBuffer(); // Copy stored buffer to framebuffer without freeing
void freeStoredBwBuffer(); // Free the stored buffer manually
bool storeBwBuffer(); // Returns true if buffer was stored successfully
void restoreBwBuffer(); // Restore and free the stored buffer
void cleanupGrayscaleWithFrameBuffer() const;
// Low level functions