aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike McTernan <mikemcternan@google.com>2023-07-03 15:35:11 +0100
committerMike McTernan <mikemcternan@google.com>2023-07-03 15:35:11 +0100
commit86ad8579731e1376198b2a559df98e3e317a8dcb (patch)
tree482cdc2682cbb8ea1182b7f73c062b855a94b290
parent0f3d6f36fe990197c04e183aa6242691d7b02d56 (diff)
downloadconfirmationui-86ad8579731e1376198b2a559df98e3e317a8dcb.tar.gz
trusty: tui: assume device params apply rotation to dimensions
This cleans up the abstraction provided by the device parameters and layout context. Critically it avoids special handling in the confui port test. Bug: 289339705 Test: build.py Change-Id: I743b4dc10f8995a8d01f79c895ead623e5ceb2a9
-rw-r--r--src/trusty_confirmation_ui.cpp27
-rw-r--r--test/main.cpp2
2 files changed, 16 insertions, 13 deletions
diff --git a/src/trusty_confirmation_ui.cpp b/src/trusty_confirmation_ui.cpp
index 997abd7..f2c35d3 100644
--- a/src/trusty_confirmation_ui.cpp
+++ b/src/trusty_confirmation_ui.cpp
@@ -146,21 +146,24 @@ ResponseCode TrustyConfirmationUI::start(const char* prompt,
return ResponseCode::UIError;
}
- /* Check the layout context and framebuffer agree on dimensions,
- * ignoring rotation for now.
- */
- if (*ctx->getParam<RightEdgeOfScreen>() != pxs(fb_info_[i].width) ||
- *ctx->getParam<BottomOfScreen>() != pxs(fb_info_[i].height)) {
- TLOGE("Framebuffer dimensions do not match panel configuration\n");
- stop();
- return ResponseCode::UIError;
- }
+ /* Get rotated frame buffer dimensions */
+ uint32_t rwidth, rheight;
- /* Swap dimensions if rotating */
if (fb_info_[i].rotation == TTUI_DRAW_ROTATION_90 ||
fb_info_[i].rotation == TTUI_DRAW_ROTATION_270) {
- ctx->setParam<RightEdgeOfScreen>(pxs(fb_info_[i].height));
- ctx->setParam<BottomOfScreen>(pxs(fb_info_[i].width));
+ rwidth = fb_info_[i].height;
+ rheight = fb_info_[i].width;
+ } else {
+ rwidth = fb_info_[i].width;
+ rheight = fb_info_[i].height;
+ }
+
+ /* Check the layout context and framebuffer agree on dimensions */
+ if (*ctx->getParam<RightEdgeOfScreen>() != pxs(rwidth) ||
+ *ctx->getParam<BottomOfScreen>() != pxs(rheight)) {
+ TLOGE("Framebuffer dimensions do not match panel configuration\n");
+ stop();
+ return ResponseCode::UIError;
}
/* Set the colours */
diff --git a/test/main.cpp b/test/main.cpp
index 82968e2..094a8fc 100644
--- a/test/main.cpp
+++ b/test/main.cpp
@@ -133,7 +133,7 @@ TEST_P(confuip, display_params) {
"pixel coverage %" PRIu32 ".%" PRIu32 "%%",
coverage / 10, coverage % 10);
- trusty_unittest_printf("[ DATA ] %" PRIu32 "x%" PRIu32
+ trusty_unittest_printf("[ DATA ] %" PRIu32 " x %" PRIu32
", %" PRIu32
" plot calls = approx %" PRIu32
".%" PRIu32 "%% coverage\n",