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:
@@ -139,7 +139,7 @@ void TxtReaderActivity::initializeReader() {
|
||||
orientedMarginRight += cachedScreenMargin;
|
||||
orientedMarginBottom += cachedScreenMargin;
|
||||
|
||||
auto metrics = UITheme::getInstance().getMetrics();
|
||||
const auto& metrics = UITheme::getInstance().getMetrics();
|
||||
|
||||
// Add status bar margin
|
||||
if (SETTINGS.statusBar != CrossPointSettings::STATUS_BAR_MODE::NONE) {
|
||||
@@ -476,7 +476,7 @@ void TxtReaderActivity::renderStatusBar(const int orientedMarginRight, const int
|
||||
const bool showBatteryPercentage =
|
||||
SETTINGS.hideBatteryPercentage == CrossPointSettings::HIDE_BATTERY_PERCENTAGE::HIDE_NEVER;
|
||||
|
||||
auto metrics = UITheme::getInstance().getMetrics();
|
||||
const auto& metrics = UITheme::getInstance().getMetrics();
|
||||
const auto screenHeight = renderer.getScreenHeight();
|
||||
// Adjust text position upward when progress bar is shown to avoid overlap
|
||||
const auto textY = screenHeight - orientedMarginBottom - 4;
|
||||
|
||||
Reference in New Issue
Block a user