Review comments
This commit is contained in:
@@ -799,11 +799,21 @@ void GfxRenderer::drawText(const int fontId, const int x, const int y, const cha
|
|||||||
}
|
}
|
||||||
|
|
||||||
const EpdGlyph* glyph = font.getGlyph(cp, style);
|
const EpdGlyph* glyph = font.getGlyph(cp, style);
|
||||||
|
if (!glyph) {
|
||||||
|
lastBaseX += fp4::toPixel(prevAdvanceFP);
|
||||||
|
prevCp = 0;
|
||||||
|
prevAdvanceFP = 0;
|
||||||
|
lastBaseLeft = 0;
|
||||||
|
lastBaseWidth = 0;
|
||||||
|
lastBaseTop = 0;
|
||||||
|
lastBaseAdvanceFP = 0;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
lastBaseLeft = glyph ? glyph->left : 0;
|
lastBaseLeft = glyph->left;
|
||||||
lastBaseWidth = glyph ? glyph->width : 0;
|
lastBaseWidth = glyph->width;
|
||||||
lastBaseTop = glyph ? glyph->top : 0;
|
lastBaseTop = glyph->top;
|
||||||
lastBaseAdvanceFP = glyph ? glyph->advanceX : 0;
|
lastBaseAdvanceFP = glyph->advanceX;
|
||||||
prevAdvanceFP = lastBaseAdvanceFP;
|
prevAdvanceFP = lastBaseAdvanceFP;
|
||||||
|
|
||||||
renderCharImpl<TextRotation::None>(*this, renderMode, font, cp, lastBaseX, yPos, black, style);
|
renderCharImpl<TextRotation::None>(*this, renderMode, font, cp, lastBaseX, yPos, black, style);
|
||||||
@@ -1588,10 +1598,17 @@ void GfxRenderer::invertScreen() const {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GfxRenderer::setNextDisplayRefreshMode(const HalDisplay::RefreshMode refreshMode) const {
|
||||||
|
useNextRefreshOverride = true;
|
||||||
|
nextRefreshOverride = refreshMode;
|
||||||
|
}
|
||||||
|
|
||||||
void GfxRenderer::displayBuffer(const HalDisplay::RefreshMode refreshMode) const {
|
void GfxRenderer::displayBuffer(const HalDisplay::RefreshMode refreshMode) const {
|
||||||
|
const auto effectiveMode = useNextRefreshOverride ? nextRefreshOverride : refreshMode;
|
||||||
|
useNextRefreshOverride = false;
|
||||||
auto elapsed = millis() - start_ms;
|
auto elapsed = millis() - start_ms;
|
||||||
LOG_DBG("GFX", "Time = %lu ms from clearScreen to displayBuffer", elapsed);
|
LOG_DBG("GFX", "Time = %lu ms from clearScreen to displayBuffer", elapsed);
|
||||||
display.displayBuffer(refreshMode, fadingFix);
|
display.displayBuffer(effectiveMode, fadingFix);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string GfxRenderer::truncatedText(const int fontId, const char* text, const int maxWidth,
|
std::string GfxRenderer::truncatedText(const int fontId, const char* text, const int maxWidth,
|
||||||
@@ -1766,7 +1783,13 @@ int GfxRenderer::getTextAdvanceX(const int fontId, const char* text, EpdFontFami
|
|||||||
}
|
}
|
||||||
|
|
||||||
const EpdGlyph* glyph = font.getGlyph(cp, style);
|
const EpdGlyph* glyph = font.getGlyph(cp, style);
|
||||||
prevAdvanceFP = glyph ? glyph->advanceX : 0;
|
if (!glyph) {
|
||||||
|
widthPx += fp4::toPixel(prevAdvanceFP);
|
||||||
|
prevCp = 0;
|
||||||
|
prevAdvanceFP = 0;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
prevAdvanceFP = glyph->advanceX;
|
||||||
prevCp = cp;
|
prevCp = cp;
|
||||||
}
|
}
|
||||||
widthPx += fp4::toPixel(prevAdvanceFP); // final glyph's advance
|
widthPx += fp4::toPixel(prevAdvanceFP); // final glyph's advance
|
||||||
@@ -1848,11 +1871,21 @@ void GfxRenderer::drawTextRotated90CW(const int fontId, const int x, const int y
|
|||||||
}
|
}
|
||||||
|
|
||||||
const EpdGlyph* glyph = font.getGlyph(cp, style);
|
const EpdGlyph* glyph = font.getGlyph(cp, style);
|
||||||
|
if (!glyph) {
|
||||||
|
lastBaseY -= fp4::toPixel(prevAdvanceFP);
|
||||||
|
prevCp = 0;
|
||||||
|
prevAdvanceFP = 0;
|
||||||
|
lastBaseLeft = 0;
|
||||||
|
lastBaseWidth = 0;
|
||||||
|
lastBaseTop = 0;
|
||||||
|
lastBaseAdvanceFP = 0;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
lastBaseLeft = glyph ? glyph->left : 0;
|
lastBaseLeft = glyph->left;
|
||||||
lastBaseWidth = glyph ? glyph->width : 0;
|
lastBaseWidth = glyph->width;
|
||||||
lastBaseTop = glyph ? glyph->top : 0;
|
lastBaseTop = glyph->top;
|
||||||
lastBaseAdvanceFP = glyph ? glyph->advanceX : 0;
|
lastBaseAdvanceFP = glyph->advanceX;
|
||||||
prevAdvanceFP = lastBaseAdvanceFP;
|
prevAdvanceFP = lastBaseAdvanceFP;
|
||||||
|
|
||||||
renderCharImpl<TextRotation::Rotated90CW>(*this, renderMode, font, cp, x, lastBaseY, black, style);
|
renderCharImpl<TextRotation::Rotated90CW>(*this, renderMode, font, cp, x, lastBaseY, black, style);
|
||||||
|
|||||||
Reference in New Issue
Block a user