InfiniTime.git

commit 8e8215d360bf2e57dbc96bb94428914f81bfa504

Author: Riku Isokoski <riksu9000@gmail.com>

theme: Replace LV_DPX with a constexpr variant

 src/displayapp/InfiniTimeTheme.cpp | 13 +++++++++++++


diff --git a/src/displayapp/InfiniTimeTheme.cpp b/src/displayapp/InfiniTimeTheme.cpp
index 2532f21d8dca1b3d0f262322960b7d1c48742114..6795647e1bf20b3b3cba0f6023a35945c1acb198 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);