Skip to content

Commit 8e8215d

Browse files
committed
theme: Replace LV_DPX with a constexpr variant
1 parent 547c46a commit 8e8215d

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

src/displayapp/InfiniTimeTheme.cpp

+13
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,17 @@
11
#include "displayapp/InfiniTimeTheme.h"
2+
#include <algorithm>
3+
4+
// Replace LV_DPX with a constexpr version using a constant LV_DPI
5+
#undef LV_DPX
6+
7+
namespace {
8+
constexpr int LV_DPX(int n) {
9+
if (n == 0) {
10+
return 0;
11+
}
12+
return std::max(((LV_DPI * n + 80) / 160), 1); /*+80 for rounding*/
13+
}
14+
}
215

316
static void theme_apply(lv_obj_t* obj, lv_theme_style_t name);
417

0 commit comments

Comments
 (0)