Remove dead benchmark code

This commit is contained in:
jpirnay
2026-04-04 18:23:32 +02:00
parent b32804410c
commit 3151ebda56
2 changed files with 0 additions and 95 deletions
-89
View File
@@ -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<const uint8_t**>(&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<const uint8_t**>(&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) {