trusty: teeui: Add context constructor that derrives dp2px from mm2px
Bug: 260675978
Test: manual
Change-Id: Ie7d581fccac35ea0ff46fb730b7252403f72bda9
diff --git a/libteeui/include/teeui/utils.h b/libteeui/include/teeui/utils.h
index 985761a..e52c6eb 100644
--- a/libteeui/include/teeui/utils.h
+++ b/libteeui/include/teeui/utils.h
@@ -458,6 +458,11 @@
};
public:
+ explicit context(Numeric mm2px) {
+ mm2px_ = mm2px;
+ dp2px_ = (mm2px * 25.4) / 160.0; /* 1dp = 1/160th of an inch */
+ }
+
context(Numeric mm2px, Numeric dp2px) : mm2px_(mm2px), dp2px_(dp2px) {}
context(const context&) = default;