diff options
| author | Riku Isokoski <riksu9000@gmail.com> | 2023-01-24 01:08:20 +0200 |
|---|---|---|
| committer | Riku Isokoski <riksu9000@gmail.com> | 2023-01-29 08:51:37 +0200 |
| commit | 8e8215d360bf2e57dbc96bb94428914f81bfa504 (patch) | |
| tree | d40618b2015ee0c937e2e726d080c42c4b7822b2 /src/displayapp/InfiniTimeTheme.cpp | |
| parent | 547c46a588a9e4f3c57e8dda34c10f0917871868 (diff) | |
theme: Replace LV_DPX with a constexpr variant
Diffstat (limited to 'src/displayapp/InfiniTimeTheme.cpp')
| -rw-r--r-- | src/displayapp/InfiniTimeTheme.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/displayapp/InfiniTimeTheme.cpp b/src/displayapp/InfiniTimeTheme.cpp index 2532f21d..6795647e 100644 --- a/src/displayapp/InfiniTimeTheme.cpp +++ b/src/displayapp/InfiniTimeTheme.cpp @@ -1,4 +1,17 @@ #include "displayapp/InfiniTimeTheme.h" +#include <algorithm> + +// Replace LV_DPX with a constexpr version using a constant LV_DPI +#undef LV_DPX + +namespace { + constexpr int LV_DPX(int n) { + if (n == 0) { + return 0; + } + return std::max(((LV_DPI * n + 80) / 160), 1); /*+80 for rounding*/ + } +} static void theme_apply(lv_obj_t* obj, lv_theme_style_t name); |
