A fork of https://github.com/crosspoint-reader/crosspoint-reader
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Use reference passing for EpdRenderer

+109 -114
+2 -2
lib/Epub/Epub/EpubHtmlParser.cpp
··· 146 146 currentPage = new Page(); 147 147 } 148 148 149 - const int lineHeight = renderer->getLineHeight(); 150 - const int pageHeight = renderer->getPageHeight(); 149 + const int lineHeight = renderer.getLineHeight(); 150 + const int pageHeight = renderer.getPageHeight(); 151 151 152 152 // Long running task, make sure to let other things happen 153 153 vTaskDelay(1);
+2 -2
lib/Epub/Epub/EpubHtmlParser.h
··· 10 10 11 11 class EpubHtmlParser final : public tinyxml2::XMLVisitor { 12 12 const char* filepath; 13 - EpdRenderer* renderer; 13 + EpdRenderer& renderer; 14 14 std::function<void(Page*)> completePageFn; 15 15 16 16 bool insideBoldTag = false; ··· 27 27 bool VisitExit(const tinyxml2::XMLElement& element) override; 28 28 // xml parser callbacks 29 29 public: 30 - explicit EpubHtmlParser(const char* filepath, EpdRenderer* renderer, const std::function<void(Page*)>& completePageFn) 30 + explicit EpubHtmlParser(const char* filepath, EpdRenderer& renderer, const std::function<void(Page*)>& completePageFn) 31 31 : filepath(filepath), renderer(renderer), completePageFn(completePageFn) {} 32 32 ~EpubHtmlParser() override = default; 33 33 bool parseAndBuildPages();
+2 -2
lib/Epub/Epub/Page.cpp
··· 3 3 #include <HardwareSerial.h> 4 4 #include <Serialization.h> 5 5 6 - void PageLine::render(EpdRenderer* renderer) { block->render(renderer, 0, yPos); } 6 + void PageLine::render(EpdRenderer& renderer) { block->render(renderer, 0, yPos); } 7 7 8 8 void PageLine::serialize(std::ostream& os) { 9 9 serialization::writePod(os, yPos); ··· 20 20 return new PageLine(tb, yPos); 21 21 } 22 22 23 - void Page::render(EpdRenderer* renderer) const { 23 + void Page::render(EpdRenderer& renderer) const { 24 24 const auto start = millis(); 25 25 for (const auto element : elements) { 26 26 element->render(renderer);
+3 -3
lib/Epub/Epub/Page.h
··· 11 11 int yPos; 12 12 explicit PageElement(const int yPos) : yPos(yPos) {} 13 13 virtual ~PageElement() = default; 14 - virtual void render(EpdRenderer* renderer) = 0; 14 + virtual void render(EpdRenderer& renderer) = 0; 15 15 virtual void serialize(std::ostream& os) = 0; 16 16 }; 17 17 ··· 22 22 public: 23 23 PageLine(const TextBlock* block, const int yPos) : PageElement(yPos), block(block) {} 24 24 ~PageLine() override { delete block; } 25 - void render(EpdRenderer* renderer) override; 25 + void render(EpdRenderer& renderer) override; 26 26 void serialize(std::ostream& os) override; 27 27 static PageLine* deserialize(std::istream& is); 28 28 }; ··· 32 32 int nextY = 0; 33 33 // the list of block index and line numbers on this page 34 34 std::vector<PageElement*> elements; 35 - void render(EpdRenderer* renderer) const; 35 + void render(EpdRenderer& renderer) const; 36 36 ~Page() { 37 37 for (const auto element : elements) { 38 38 delete element;
+4 -4
lib/Epub/Epub/Section.cpp
··· 107 107 delete p; 108 108 } else if (pageCount == 0) { 109 109 Serial.println("No pages to render"); 110 - const int width = renderer->getTextWidth("Empty chapter", BOLD); 111 - renderer->drawText((renderer->getPageWidth() - width) / 2, 300, "Empty chapter", 1, BOLD); 110 + const int width = renderer.getTextWidth("Empty chapter", BOLD); 111 + renderer.drawText((renderer.getPageWidth() - width) / 2, 300, "Empty chapter", 1, BOLD); 112 112 } else { 113 113 Serial.printf("Page out of bounds: %d (max %d)\n", currentPage, pageCount); 114 - const int width = renderer->getTextWidth("Out of bounds", BOLD); 115 - renderer->drawText((renderer->getPageWidth() - width) / 2, 300, "Out of bounds", 1, BOLD); 114 + const int width = renderer.getTextWidth("Out of bounds", BOLD); 115 + renderer.drawText((renderer.getPageWidth() - width) / 2, 300, "Out of bounds", 1, BOLD); 116 116 } 117 117 }
+2 -2
lib/Epub/Epub/Section.h
··· 7 7 class Section { 8 8 Epub* epub; 9 9 const int spineIndex; 10 - EpdRenderer* renderer; 10 + EpdRenderer& renderer; 11 11 std::string cachePath; 12 12 13 13 void onPageComplete(const Page* page); ··· 16 16 int pageCount = 0; 17 17 int currentPage = 0; 18 18 19 - explicit Section(Epub* epub, const int spineIndex, EpdRenderer* renderer) 19 + explicit Section(Epub* epub, const int spineIndex, EpdRenderer& renderer) 20 20 : epub(epub), spineIndex(spineIndex), renderer(renderer) { 21 21 cachePath = epub->getCachePath() + "/" + std::to_string(spineIndex); 22 22 }
+1 -1
lib/Epub/Epub/blocks/Block.h
··· 8 8 class Block { 9 9 public: 10 10 virtual ~Block() = default; 11 - virtual void layout(EpdRenderer* renderer) = 0; 11 + virtual void layout(EpdRenderer& renderer) = 0; 12 12 virtual BlockType getType() = 0; 13 13 virtual bool isEmpty() = 0; 14 14 virtual void finish() {}
+6 -6
lib/Epub/Epub/blocks/TextBlock.cpp
··· 43 43 } 44 44 } 45 45 46 - std::list<TextBlock*> TextBlock::splitIntoLines(const EpdRenderer* renderer) { 46 + std::list<TextBlock*> TextBlock::splitIntoLines(const EpdRenderer& renderer) { 47 47 const int totalWordCount = words.size(); 48 - const int pageWidth = renderer->getPageWidth(); 49 - const int spaceWidth = renderer->getSpaceWidth(); 48 + const int pageWidth = renderer.getPageWidth(); 49 + const int spaceWidth = renderer.getSpaceWidth(); 50 50 51 51 words.shrink_to_fit(); 52 52 wordStyles.shrink_to_fit(); ··· 66 66 } else if (wordStyles[i] & ITALIC_SPAN) { 67 67 fontStyle = ITALIC; 68 68 } 69 - const int width = renderer->getTextWidth(words[i].c_str(), fontStyle); 69 + const int width = renderer.getTextWidth(words[i].c_str(), fontStyle); 70 70 wordWidths[i] = width; 71 71 } 72 72 ··· 187 187 return lines; 188 188 } 189 189 190 - void TextBlock::render(const EpdRenderer* renderer, const int x, const int y) const { 190 + void TextBlock::render(const EpdRenderer& renderer, const int x, const int y) const { 191 191 for (int i = 0; i < words.size(); i++) { 192 192 // get the style 193 193 const uint8_t wordStyle = wordStyles[i]; ··· 203 203 } else if (wordStyles[i] & ITALIC_SPAN) { 204 204 fontStyle = ITALIC; 205 205 } 206 - renderer->drawText(x + wordXpos[i], y, words[i].c_str(), 1, fontStyle); 206 + renderer.drawText(x + wordXpos[i], y, words[i].c_str(), 1, fontStyle); 207 207 } 208 208 } 209 209
+3 -3
lib/Epub/Epub/blocks/TextBlock.h
··· 40 40 void set_style(const BLOCK_STYLE style) { this->style = style; } 41 41 BLOCK_STYLE get_style() const { return style; } 42 42 bool isEmpty() override { return words.empty(); } 43 - void layout(EpdRenderer* renderer) override {}; 43 + void layout(EpdRenderer& renderer) override {}; 44 44 // given a renderer works out where to break the words into lines 45 - std::list<TextBlock*> splitIntoLines(const EpdRenderer* renderer); 46 - void render(const EpdRenderer* renderer, int x, int y) const; 45 + std::list<TextBlock*> splitIntoLines(const EpdRenderer& renderer); 46 + void render(const EpdRenderer& renderer, int x, int y) const; 47 47 BlockType getType() override { return TEXT_BLOCK; } 48 48 void serialize(std::ostream& os) const; 49 49 static TextBlock* deserialize(std::istream& is);
+13 -24
src/CrossPointState.cpp
··· 9 9 constexpr uint8_t STATE_VERSION = 1; 10 10 constexpr char STATE_FILE[] = "/sd/.crosspoint/state.bin"; 11 11 12 - void CrossPointState::serialize(std::ostream& os) const { 13 - serialization::writePod(os, STATE_VERSION); 14 - serialization::writeString(os, openEpubPath); 12 + bool CrossPointState::saveToFile() const { 13 + std::ofstream outputFile(STATE_FILE); 14 + serialization::writePod(outputFile, STATE_VERSION); 15 + serialization::writeString(outputFile, openEpubPath); 16 + outputFile.close(); 17 + return true; 15 18 } 16 19 17 - CrossPointState* CrossPointState::deserialize(std::istream& is) { 18 - const auto state = new CrossPointState(); 20 + bool CrossPointState::loadFromFile() { 21 + std::ifstream inputFile(STATE_FILE); 19 22 20 23 uint8_t version; 21 - serialization::readPod(is, version); 24 + serialization::readPod(inputFile, version); 22 25 if (version != STATE_VERSION) { 23 26 Serial.printf("CrossPointState: Unknown version %u\n", version); 24 - return state; 27 + inputFile.close(); 28 + return false; 25 29 } 26 30 27 - serialization::readString(is, state->openEpubPath); 28 - return state; 29 - } 30 - 31 - void CrossPointState::saveToFile() const { 32 - std::ofstream outputFile(STATE_FILE); 33 - serialize(outputFile); 34 - outputFile.close(); 35 - } 31 + serialization::readString(inputFile, openEpubPath); 36 32 37 - CrossPointState* CrossPointState::loadFromFile() { 38 - if (!SD.exists(&STATE_FILE[3])) { 39 - return new CrossPointState(); 40 - } 41 - 42 - std::ifstream inputFile(STATE_FILE); 43 - CrossPointState* state = deserialize(inputFile); 44 33 inputFile.close(); 45 - return state; 34 + return true; 46 35 }
+4 -5
src/CrossPointState.h
··· 3 3 #include <string> 4 4 5 5 class CrossPointState { 6 - void serialize(std::ostream& os) const; 7 - static CrossPointState* deserialize(std::istream& is); 8 - 9 6 public: 10 7 std::string openEpubPath; 11 8 ~CrossPointState() = default; 12 - void saveToFile() const; 13 - static CrossPointState* loadFromFile(); 9 + 10 + bool saveToFile() const; 11 + 12 + bool loadFromFile(); 14 13 };
+14 -7
src/main.cpp
··· 31 31 GxEPD2_BW<GxEPD2_426_GDEQ0426T82, GxEPD2_426_GDEQ0426T82::HEIGHT> display(GxEPD2_426_GDEQ0426T82(EPD_CS, EPD_DC, 32 32 EPD_RST, EPD_BUSY)); 33 33 InputManager inputManager; 34 - auto renderer = new EpdRenderer(&display); 34 + EpdRenderer renderer(&display); 35 35 Screen* currentScreen; 36 - CrossPointState* appState; 36 + CrossPointState appState; 37 37 38 38 // Power button timing 39 39 // Time required to confirm boot from sleep ··· 136 136 137 137 Epub* epub = loadEpub(path); 138 138 if (epub) { 139 - appState->openEpubPath = path; 140 - appState->saveToFile(); 139 + appState.openEpubPath = path; 140 + appState.saveToFile(); 141 141 exitScreen(); 142 142 enterNewScreen(new EpubReaderScreen(renderer, inputManager, epub, onGoHome)); 143 143 } else { ··· 182 182 // SD Card Initialization 183 183 SD.begin(SD_SPI_CS, SPI, SPI_FQ); 184 184 185 - appState = CrossPointState::loadFromFile(); 186 - if (!appState->openEpubPath.empty()) { 187 - Epub* epub = loadEpub(appState->openEpubPath); 185 + appState.loadFromFile(); 186 + if (!appState.openEpubPath.empty()) { 187 + Epub* epub = loadEpub(appState.openEpubPath); 188 188 if (epub) { 189 189 exitScreen(); 190 190 enterNewScreen(new EpubReaderScreen(renderer, inputManager, epub, onGoHome)); ··· 203 203 204 204 void loop() { 205 205 delay(10); 206 + 207 + static unsigned long lastMemPrint = 0; 208 + if (Serial && millis() - lastMemPrint >= 2000) { 209 + Serial.printf("[%lu] Memory - Free: %d bytes, Total: %d bytes, Min Free: %d bytes\n", millis(), ESP.getFreeHeap(), 210 + ESP.getHeapSize(), ESP.getMinFreeHeap()); 211 + lastMemPrint = millis(); 212 + } 206 213 207 214 inputManager.update(); 208 215 if (inputManager.wasReleased(InputManager::BTN_POWER) && inputManager.getHeldTime() > POWER_BUTTON_WAKEUP_MS) {
+4 -4
src/screens/BootLogoScreen.cpp
··· 5 5 #include "images/CrossLarge.h" 6 6 7 7 void BootLogoScreen::onEnter() { 8 - const auto pageWidth = renderer->getPageWidth(); 9 - const auto pageHeight = renderer->getPageHeight(); 8 + const auto pageWidth = renderer.getPageWidth(); 9 + const auto pageHeight = renderer.getPageHeight(); 10 10 11 - renderer->clearScreen(); 11 + renderer.clearScreen(); 12 12 // Location for images is from top right in landscape orientation 13 - renderer->drawImage(CrossLarge, (pageHeight - 128) / 2, (pageWidth - 128) / 2, 128, 128); 13 + renderer.drawImage(CrossLarge, (pageHeight - 128) / 2, (pageWidth - 128) / 2, 128, 128); 14 14 }
+1 -1
src/screens/BootLogoScreen.h
··· 3 3 4 4 class BootLogoScreen final : public Screen { 5 5 public: 6 - explicit BootLogoScreen(EpdRenderer* renderer, InputManager& inputManager) : Screen(renderer, inputManager) {} 6 + explicit BootLogoScreen(EpdRenderer& renderer, InputManager& inputManager) : Screen(renderer, inputManager) {} 7 7 void onEnter() override; 8 8 };
+26 -26
src/screens/EpubReaderScreen.cpp
··· 154 154 Serial.println("Cache not found, building..."); 155 155 156 156 { 157 - const int textWidth = renderer->getTextWidth("Indexing..."); 157 + const int textWidth = renderer.getTextWidth("Indexing..."); 158 158 constexpr int margin = 20; 159 - const int x = (renderer->getPageWidth() - textWidth - margin * 2) / 2; 159 + const int x = (renderer.getPageWidth() - textWidth - margin * 2) / 2; 160 160 constexpr int y = 50; 161 161 const int w = textWidth + margin * 2; 162 - const int h = renderer->getLineHeight() + margin * 2; 163 - renderer->fillRect(x, y, w, h, 0); 164 - renderer->drawText(x + margin, y + margin, "Indexing..."); 165 - renderer->drawRect(x + 5, y + 5, w - 10, h - 10); 166 - renderer->flushArea(x, y, w, h); 162 + const int h = renderer.getLineHeight() + margin * 2; 163 + renderer.fillRect(x, y, w, h, 0); 164 + renderer.drawText(x + margin, y + margin, "Indexing..."); 165 + renderer.drawRect(x + 5, y + 5, w - 10, h - 10); 166 + renderer.flushArea(x, y, w, h); 167 167 } 168 168 169 169 section->setupCacheDir(); ··· 184 184 } 185 185 } 186 186 187 - renderer->clearScreen(); 187 + renderer.clearScreen(); 188 188 section->renderPage(); 189 189 renderStatusBar(); 190 190 if (pagesUntilFullRefresh <= 1) { 191 - renderer->flushDisplay(false); 191 + renderer.flushDisplay(false); 192 192 pagesUntilFullRefresh = PAGES_PER_REFRESH; 193 193 } else { 194 - renderer->flushDisplay(); 194 + renderer.flushDisplay(); 195 195 pagesUntilFullRefresh--; 196 196 } 197 197 ··· 206 206 } 207 207 208 208 void EpubReaderScreen::renderStatusBar() const { 209 - const auto pageWidth = renderer->getPageWidth(); 209 + const auto pageWidth = renderer.getPageWidth(); 210 210 211 211 const std::string progress = std::to_string(section->currentPage + 1) + " / " + std::to_string(section->pageCount); 212 - const auto progressTextWidth = renderer->getSmallTextWidth(progress.c_str()); 213 - renderer->drawSmallText(pageWidth - progressTextWidth, 765, progress.c_str()); 212 + const auto progressTextWidth = renderer.getSmallTextWidth(progress.c_str()); 213 + renderer.drawSmallText(pageWidth - progressTextWidth, 765, progress.c_str()); 214 214 215 215 const uint16_t percentage = battery.readPercentage(); 216 216 const auto percentageText = std::to_string(percentage) + "%"; 217 - const auto percentageTextWidth = renderer->getSmallTextWidth(percentageText.c_str()); 218 - renderer->drawSmallText(20, 765, percentageText.c_str()); 217 + const auto percentageTextWidth = renderer.getSmallTextWidth(percentageText.c_str()); 218 + renderer.drawSmallText(20, 765, percentageText.c_str()); 219 219 220 220 // 1 column on left, 2 columns on right, 5 columns of battery body 221 221 constexpr int batteryWidth = 15; ··· 224 224 constexpr int y = 772; 225 225 226 226 // Top line 227 - renderer->drawLine(x, y, x + batteryWidth - 4, y); 227 + renderer.drawLine(x, y, x + batteryWidth - 4, y); 228 228 // Bottom line 229 - renderer->drawLine(x, y + batteryHeight - 1, x + batteryWidth - 4, y + batteryHeight - 1); 229 + renderer.drawLine(x, y + batteryHeight - 1, x + batteryWidth - 4, y + batteryHeight - 1); 230 230 // Left line 231 - renderer->drawLine(x, y, x, y + batteryHeight - 1); 231 + renderer.drawLine(x, y, x, y + batteryHeight - 1); 232 232 // Battery end 233 - renderer->drawLine(x + batteryWidth - 4, y, x + batteryWidth - 4, y + batteryHeight - 1); 234 - renderer->drawLine(x + batteryWidth - 3, y + 2, x + batteryWidth - 3, y + batteryHeight - 3); 235 - renderer->drawLine(x + batteryWidth - 2, y + 2, x + batteryWidth - 2, y + batteryHeight - 3); 236 - renderer->drawLine(x + batteryWidth - 1, y + 2, x + batteryWidth - 1, y + batteryHeight - 3); 233 + renderer.drawLine(x + batteryWidth - 4, y, x + batteryWidth - 4, y + batteryHeight - 1); 234 + renderer.drawLine(x + batteryWidth - 3, y + 2, x + batteryWidth - 3, y + batteryHeight - 3); 235 + renderer.drawLine(x + batteryWidth - 2, y + 2, x + batteryWidth - 2, y + batteryHeight - 3); 236 + renderer.drawLine(x + batteryWidth - 1, y + 2, x + batteryWidth - 1, y + batteryHeight - 3); 237 237 238 238 // The +1 is to round up, so that we always fill at least one pixel 239 239 int filledWidth = percentage * (batteryWidth - 5) / 100 + 1; 240 240 if (filledWidth > batteryWidth - 5) { 241 241 filledWidth = batteryWidth - 5; // Ensure we don't overflow 242 242 } 243 - renderer->fillRect(x + 1, y + 1, filledWidth, batteryHeight - 2); 243 + renderer.fillRect(x + 1, y + 1, filledWidth, batteryHeight - 2); 244 244 245 245 // Page width minus existing content with 30px padding on each side 246 246 const int leftMargin = 20 + percentageTextWidth + 30; ··· 248 248 const int availableTextWidth = pageWidth - leftMargin - rightMargin; 249 249 const auto tocItem = epub->getTocItem(epub->getTocIndexForSpineIndex(currentSpineIndex)); 250 250 auto title = tocItem.title; 251 - int titleWidth = renderer->getSmallTextWidth(title.c_str()); 251 + int titleWidth = renderer.getSmallTextWidth(title.c_str()); 252 252 while (titleWidth > availableTextWidth) { 253 253 title = title.substr(0, title.length() - 8) + "..."; 254 - titleWidth = renderer->getSmallTextWidth(title.c_str()); 254 + titleWidth = renderer.getSmallTextWidth(title.c_str()); 255 255 } 256 256 257 - renderer->drawSmallText(leftMargin + (availableTextWidth - titleWidth) / 2, 765, title.c_str()); 257 + renderer.drawSmallText(leftMargin + (availableTextWidth - titleWidth) / 2, 765, title.c_str()); 258 258 }
+1 -1
src/screens/EpubReaderScreen.h
··· 24 24 void renderStatusBar() const; 25 25 26 26 public: 27 - explicit EpubReaderScreen(EpdRenderer* renderer, InputManager& inputManager, Epub* epub, 27 + explicit EpubReaderScreen(EpdRenderer& renderer, InputManager& inputManager, Epub* epub, 28 28 const std::function<void()>& onGoHome) 29 29 : Screen(renderer, inputManager), epub(epub), onGoHome(onGoHome) {} 30 30 void onEnter() override;
+8 -8
src/screens/FileSelectionScreen.cpp
··· 105 105 } 106 106 107 107 void FileSelectionScreen::render() const { 108 - renderer->clearScreen(); 108 + renderer.clearScreen(); 109 109 110 - const auto pageWidth = renderer->getPageWidth(); 111 - const auto titleWidth = renderer->getTextWidth("CrossPoint Reader", BOLD); 112 - renderer->drawText((pageWidth - titleWidth) / 2, 0, "CrossPoint Reader", 1, BOLD); 110 + const auto pageWidth = renderer.getPageWidth(); 111 + const auto titleWidth = renderer.getTextWidth("CrossPoint Reader", BOLD); 112 + renderer.drawText((pageWidth - titleWidth) / 2, 0, "CrossPoint Reader", 1, BOLD); 113 113 114 114 if (files.empty()) { 115 - renderer->drawUiText(10, 50, "No EPUBs found"); 115 + renderer.drawUiText(10, 50, "No EPUBs found"); 116 116 } else { 117 117 // Draw selection 118 - renderer->fillRect(0, 50 + selectorIndex * 30 + 2, pageWidth - 1, 30); 118 + renderer.fillRect(0, 50 + selectorIndex * 30 + 2, pageWidth - 1, 30); 119 119 120 120 for (size_t i = 0; i < files.size(); i++) { 121 121 const auto file = files[i]; 122 - renderer->drawUiText(10, 50 + i * 30, file.c_str(), i == selectorIndex ? 0 : 1); 122 + renderer.drawUiText(10, 50 + i * 30, file.c_str(), i == selectorIndex ? 0 : 1); 123 123 } 124 124 } 125 125 126 - renderer->flushDisplay(); 126 + renderer.flushDisplay(); 127 127 }
+1 -1
src/screens/FileSelectionScreen.h
··· 24 24 void loadFiles(); 25 25 26 26 public: 27 - explicit FileSelectionScreen(EpdRenderer* renderer, InputManager& inputManager, 27 + explicit FileSelectionScreen(EpdRenderer& renderer, InputManager& inputManager, 28 28 const std::function<void(const std::string&)>& onSelect) 29 29 : Screen(renderer, inputManager), onSelect(onSelect) {} 30 30 void onEnter() override;
+7 -7
src/screens/FullScreenMessageScreen.cpp
··· 3 3 #include <EpdRenderer.h> 4 4 5 5 void FullScreenMessageScreen::onEnter() { 6 - const auto width = renderer->getUiTextWidth(text.c_str(), style); 7 - const auto height = renderer->getLineHeight(); 8 - const auto left = (renderer->getPageWidth() - width) / 2; 9 - const auto top = (renderer->getPageHeight() - height) / 2; 6 + const auto width = renderer.getUiTextWidth(text.c_str(), style); 7 + const auto height = renderer.getLineHeight(); 8 + const auto left = (renderer.getPageWidth() - width) / 2; 9 + const auto top = (renderer.getPageHeight() - height) / 2; 10 10 11 - renderer->clearScreen(invert); 12 - renderer->drawUiText(left, top, text.c_str(), invert ? 0 : 1, style); 13 - renderer->flushDisplay(partialUpdate); 11 + renderer.clearScreen(invert); 12 + renderer.drawUiText(left, top, text.c_str(), invert ? 0 : 1, style); 13 + renderer.flushDisplay(partialUpdate); 14 14 }
+1 -1
src/screens/FullScreenMessageScreen.h
··· 12 12 bool partialUpdate; 13 13 14 14 public: 15 - explicit FullScreenMessageScreen(EpdRenderer* renderer, InputManager& inputManager, std::string text, 15 + explicit FullScreenMessageScreen(EpdRenderer& renderer, InputManager& inputManager, std::string text, 16 16 const EpdFontStyle style = REGULAR, const bool invert = false, 17 17 const bool partialUpdate = true) 18 18 : Screen(renderer, inputManager),
+2 -2
src/screens/Screen.h
··· 5 5 6 6 class Screen { 7 7 protected: 8 - EpdRenderer* renderer; 8 + EpdRenderer& renderer; 9 9 InputManager& inputManager; 10 10 11 11 public: 12 - explicit Screen(EpdRenderer* renderer, InputManager& inputManager) : renderer(renderer), inputManager(inputManager) {} 12 + explicit Screen(EpdRenderer& renderer, InputManager& inputManager) : renderer(renderer), inputManager(inputManager) {} 13 13 virtual ~Screen() = default; 14 14 virtual void onEnter() {} 15 15 virtual void onExit() {}
+1 -1
src/screens/SleepScreen.cpp
··· 4 4 5 5 #include "images/SleepScreenImg.h" 6 6 7 - void SleepScreen::onEnter() { renderer->drawImageNoMargin(SleepScreenImg, 0, 0, 800, 480, false, true); } 7 + void SleepScreen::onEnter() { renderer.drawImageNoMargin(SleepScreenImg, 0, 0, 800, 480, false, true); }
+1 -1
src/screens/SleepScreen.h
··· 3 3 4 4 class SleepScreen final : public Screen { 5 5 public: 6 - explicit SleepScreen(EpdRenderer* renderer, InputManager& inputManager) : Screen(renderer, inputManager) {} 6 + explicit SleepScreen(EpdRenderer& renderer, InputManager& inputManager) : Screen(renderer, inputManager) {} 7 7 void onEnter() override; 8 8 };