perf: UITheme::getMetrics const and const-ref usage (#1094)
## Summary **What is the goal of this PR?** Small cleanup to make getTheme and getMetrics methods on UITheme const. They return const refs, so updated call sites to use `const auto&`. Realistically this won't make much performance difference, but it better conveys the nature of theme metrics being shared const state. --- ### AI Usage While CrossPoint doesn't have restrictions on AI tools in contributing, please be transparent about their usage as it helps set the right context for reviewers. Did you use AI tools to help write this code? _**NO**_
This commit is contained in:
1 parent
a6aead660a
commit
410c70ab89
19 files changed
+25
-25
No files matched your search
@@ -736,7 +736,7 @@ void BaseTheme::drawReadingProgressBar(const GfxRenderer& renderer, const size_t
|
||||
}
|
||||
|
||||
void BaseTheme::drawHelpText(const GfxRenderer& renderer, Rect rect, const char* label) const {
|
||||
auto metrics = UITheme::getInstance().getMetrics();
|
||||
const auto& metrics = UITheme::getInstance().getMetrics();
|
||||
auto truncatedLabel =
|
||||
renderer.truncatedText(SMALL_FONT_ID, label, rect.width - metrics.contentSidePadding * 2, EpdFontFamily::REGULAR);
|
||||
renderer.drawCenteredText(SMALL_FONT_ID, rect.y, truncatedLabel.c_str());
|
||||
|
||||
Reference in new issue
Block a user