From a6cc4ab3fe5223eb6d39be85f868291cc2ea795b Mon Sep 17 00:00:00 2001 From: Jason P Date: Tue, 24 Jun 2025 22:57:27 -0500 Subject: [PATCH] Trunk runs --- src/graphics/draw/MessageRenderer.cpp | 27 ++++++--------------------- src/graphics/draw/MessageRenderer.h | 20 ++++---------------- 2 files changed, 10 insertions(+), 37 deletions(-) diff --git a/src/graphics/draw/MessageRenderer.cpp b/src/graphics/draw/MessageRenderer.cpp index ca14b1556..8bf990639 100644 --- a/src/graphics/draw/MessageRenderer.cpp +++ b/src/graphics/draw/MessageRenderer.cpp @@ -277,8 +277,7 @@ void drawTextMessageFrame(OLEDDisplay *display, OLEDDisplayUiState *state, int16 // Cache miss - regenerate lines and heights cachedLines = generateLines(display, headerStr, messageBuf, textWidth); - cachedHeights = - calculateLineHeights(cachedLines, emotes); + cachedHeights = calculateLineHeights(cachedLines, emotes); cachedKey = currentKey; } @@ -335,18 +334,13 @@ void drawTextMessageFrame(OLEDDisplay *display, OLEDDisplayUiState *state, int16 } // === Render visible lines === - renderMessageContent(display, cachedLines, cachedHeights, x, yOffset, - scrollBottom, emotes, numEmotes, - isInverted, isBold); + renderMessageContent(display, cachedLines, cachedHeights, x, yOffset, scrollBottom, emotes, numEmotes, isInverted, isBold); // Draw header at the end to sort out overlapping elements graphics::drawCommonHeader(display, x, y, titleStr); } -std::vector generateLines(OLEDDisplay *display, - const char *headerStr, - const char *messageBuf, - int textWidth) +std::vector generateLines(OLEDDisplay *display, const char *headerStr, const char *messageBuf, int textWidth) { std::vector lines; lines.push_back(std::string(headerStr)); // Header line is always first @@ -392,8 +386,7 @@ std::vector generateLines(OLEDDisplay *display, return lines; } -std::vector calculateLineHeights(const std::vector& lines, - const Emote *emotes) +std::vector calculateLineHeights(const std::vector &lines, const Emote *emotes) { std::vector rowHeights; @@ -422,16 +415,8 @@ std::vector calculateLineHeights(const std::vector& lines, return rowHeights; } -void renderMessageContent(OLEDDisplay *display, - const std::vector& lines, - const std::vector& rowHeights, - int x, - int yOffset, - int scrollBottom, - const Emote *emotes, - int numEmotes, - bool isInverted, - bool isBold) +void renderMessageContent(OLEDDisplay *display, const std::vector &lines, const std::vector &rowHeights, int x, + int yOffset, int scrollBottom, const Emote *emotes, int numEmotes, bool isInverted, bool isBold) { for (size_t i = 0; i < lines.size(); ++i) { int lineY = yOffset; diff --git a/src/graphics/draw/MessageRenderer.h b/src/graphics/draw/MessageRenderer.h index 2809254d3..c15a699f7 100644 --- a/src/graphics/draw/MessageRenderer.h +++ b/src/graphics/draw/MessageRenderer.h @@ -17,26 +17,14 @@ void drawStringWithEmotes(OLEDDisplay *display, int x, int y, const std::string void drawTextMessageFrame(OLEDDisplay *display, OLEDDisplayUiState *state, int16_t x, int16_t y); // Function to generate lines with word wrapping -std::vector generateLines(OLEDDisplay *display, - const char *headerStr, - const char *messageBuf, - int textWidth); +std::vector generateLines(OLEDDisplay *display, const char *headerStr, const char *messageBuf, int textWidth); // Function to calculate heights for each line -std::vector calculateLineHeights(const std::vector& lines, - const Emote *emotes); +std::vector calculateLineHeights(const std::vector &lines, const Emote *emotes); // Function to render the message content -void renderMessageContent(OLEDDisplay *display, - const std::vector& lines, - const std::vector& rowHeights, - int x, - int yOffset, - int scrollBottom, - const Emote *emotes, - int numEmotes, - bool isInverted, - bool isBold); +void renderMessageContent(OLEDDisplay *display, const std::vector &lines, const std::vector &rowHeights, int x, + int yOffset, int scrollBottom, const Emote *emotes, int numEmotes, bool isInverted, bool isBold); } // namespace MessageRenderer } // namespace graphics