From 3151ebda561c63a583132e1c522925235d50e487 Mon Sep 17 00:00:00 2001 From: jpirnay Date: Sat, 4 Apr 2026 18:23:32 +0200 Subject: [PATCH] Remove dead benchmark code --- lib/GfxRenderer/GfxRenderer.cpp | 89 --------------------------------- lib/GfxRenderer/GfxRenderer.h | 6 --- 2 files changed, 95 deletions(-) diff --git a/lib/GfxRenderer/GfxRenderer.cpp b/lib/GfxRenderer/GfxRenderer.cpp index 48e4732e..f0fac300 100644 --- a/lib/GfxRenderer/GfxRenderer.cpp +++ b/lib/GfxRenderer/GfxRenderer.cpp @@ -811,95 +811,6 @@ void GfxRenderer::drawText(const int fontId, const int x, const int y, const cha } } -#ifdef ENABLE_RENDERCHAR_BENCHMARK -// Legacy per-pixel rendering path — mirrors the old renderCharImpl 1-bit BW loop. -// Used only by the renderChar benchmark to establish the baseline. -void GfxRenderer::drawTextBWLegacy(const int fontId, const int x, const int y, const char* text) const { - if (text == nullptr || *text == '\0') return; - const auto fontIt = fontMap.find(fontId); - if (fontIt == fontMap.end()) return; - const auto& fontFamily = fontIt->second; - - int yPos = y + getFontAscenderSize(fontId); - int xPos = x; - uint32_t cp; - while ((cp = utf8NextCodepoint(reinterpret_cast(&text)))) { - const EpdGlyph* glyph = fontFamily.getGlyph(cp, EpdFontFamily::REGULAR); - if (!glyph) glyph = fontFamily.getGlyph(REPLACEMENT_GLYPH, EpdFontFamily::REGULAR); - if (!glyph) continue; - const EpdFontData* fontData = fontFamily.getData(EpdFontFamily::REGULAR); - if (fontData->is2Bit) { - xPos += glyph->advanceX; - continue; - } - const uint8_t* bitmap = getGlyphBitmap(fontData, glyph); - if (bitmap != nullptr) { - const int screenYBase = yPos - glyph->top; - const int screenXBase = xPos + glyph->left; - int pixelPosition = 0; - for (int glyphY = 0; glyphY < glyph->height; glyphY++) { - for (int glyphX = 0; glyphX < glyph->width; glyphX++, pixelPosition++) { - const uint8_t bit = (bitmap[pixelPosition >> 3] >> (7 - (pixelPosition & 7))) & 1; - if (!bit) continue; - // Inline drawPixel without OOB logging — mirrors the old per-pixel path but clips silently, - // matching the fast path's behaviour so the benchmark measures rendering cost only. - int phyX, phyY; - rotateCoordinates(orientation, screenXBase + glyphX, screenYBase + glyphY, &phyX, &phyY); - if (phyX < 0 || phyX >= HalDisplay::DISPLAY_WIDTH || phyY < 0 || phyY >= HalDisplay::DISPLAY_HEIGHT) continue; - const uint16_t byteIndex = phyY * HalDisplay::DISPLAY_WIDTH_BYTES + (phyX / 8); - const uint8_t bitPosition = 7 - (phyX % 8); - frameBuffer[byteIndex] &= ~(1 << bitPosition); // black pixel - } - } - } - xPos += glyph->advanceX; - } -} - -// Legacy per-pixel rendering path — mirrors the old renderCharImpl 2-bit BW loop. -// Used only by the renderChar benchmark to establish the baseline for antialiased fonts. -void GfxRenderer::drawText2BitLegacy(const int fontId, const int x, const int y, const char* text) const { - if (text == nullptr || *text == '\0') return; - const auto fontIt = fontMap.find(fontId); - if (fontIt == fontMap.end()) return; - const auto& fontFamily = fontIt->second; - - int yPos = y + getFontAscenderSize(fontId); - int xPos = x; - uint32_t cp; - while ((cp = utf8NextCodepoint(reinterpret_cast(&text)))) { - const EpdGlyph* glyph = fontFamily.getGlyph(cp, EpdFontFamily::REGULAR); - if (!glyph) glyph = fontFamily.getGlyph(REPLACEMENT_GLYPH, EpdFontFamily::REGULAR); - if (!glyph) continue; - const EpdFontData* fontData = fontFamily.getData(EpdFontFamily::REGULAR); - if (!fontData->is2Bit) { - xPos += glyph->advanceX; - continue; - } - const uint8_t* bitmap = getGlyphBitmap(fontData, glyph); - if (bitmap != nullptr) { - const int screenYBase = yPos - glyph->top; - const int screenXBase = xPos + glyph->left; - int pixelPosition = 0; - for (int glyphY = 0; glyphY < glyph->height; glyphY++) { - for (int glyphX = 0; glyphX < glyph->width; glyphX++, pixelPosition++) { - // 2-bit: each pixel occupies 2 bits; MSB first within each byte - const uint8_t raw = (bitmap[pixelPosition >> 2] >> (6 - ((pixelPosition & 3) << 1))) & 3; - if (!raw) continue; - int phyX, phyY; - rotateCoordinates(orientation, screenXBase + glyphX, screenYBase + glyphY, &phyX, &phyY); - if (phyX < 0 || phyX >= HalDisplay::DISPLAY_WIDTH || phyY < 0 || phyY >= HalDisplay::DISPLAY_HEIGHT) continue; - const uint16_t byteIndex = phyY * HalDisplay::DISPLAY_WIDTH_BYTES + (phyX / 8); - const uint8_t bitPosition = 7 - (phyX % 8); - frameBuffer[byteIndex] &= ~(1 << bitPosition); // black pixel - } - } - } - xPos += glyph->advanceX; - } -} -#endif // ENABLE_RENDERCHAR_BENCHMARK - void GfxRenderer::drawLine(int x1, int y1, int x2, int y2, const bool state) const { if (fontCacheManager_ && fontCacheManager_->isScanning()) return; if (x1 == x2) { diff --git a/lib/GfxRenderer/GfxRenderer.h b/lib/GfxRenderer/GfxRenderer.h index afe14511..704319f4 100644 --- a/lib/GfxRenderer/GfxRenderer.h +++ b/lib/GfxRenderer/GfxRenderer.h @@ -165,10 +165,4 @@ class GfxRenderer { // Low level functions uint8_t* getFrameBuffer() const; size_t getBufferSize() const; - -#ifdef ENABLE_RENDERCHAR_BENCHMARK - // Legacy per-pixel paths — used only by the renderChar benchmark to establish baselines. - void drawTextBWLegacy(int fontId, int x, int y, const char* text) const; - void drawText2BitLegacy(int fontId, int x, int y, const char* text) const; -#endif };