From ed876a7175c54a68735e8bcacd1a22cbc84034ed Mon Sep 17 00:00:00 2001 From: Tao Bao Date: Tue, 31 Jul 2018 21:32:50 -0700 Subject: minui: Use runtime properties instead of build time vars. This CL removes the use of the following build time macros, and uses the runtime property values instead. - TARGET_RECOVERY_PIXEL_FORMAT - TARGET_RECOVERY_OVERSCAN_PERCENT - TARGET_RECOVERY_DEFAULT_ROTATION Bug: 110380063 Test: Set up taimen with `TARGET_RECOVERY_DEFAULT_ROTATION := ROTATION_LEFT`. Build and check recovery UI. Test: Set up taimen with `TARGET_RECOVERY_PIXEL_FORMAT := ABGR_8888`. Build and check recovery UI. Change-Id: I4439556a03fde4805a18011ef72eff1373f31d47 --- minui/graphics_adf.cpp | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) (limited to 'minui/graphics_adf.cpp') diff --git a/minui/graphics_adf.cpp b/minui/graphics_adf.cpp index a59df00c6..7439df9ac 100644 --- a/minui/graphics_adf.cpp +++ b/minui/graphics_adf.cpp @@ -104,15 +104,16 @@ int MinuiBackendAdf::DeviceInit(adf_device* dev) { } GRSurface* MinuiBackendAdf::Init() { -#if defined(RECOVERY_ABGR) - format = DRM_FORMAT_ABGR8888; -#elif defined(RECOVERY_BGRA) - format = DRM_FORMAT_BGRA8888; -#elif defined(RECOVERY_RGBX) - format = DRM_FORMAT_RGBX8888; -#else - format = DRM_FORMAT_RGB565; -#endif + PixelFormat pixel_format = gr_pixel_format(); + if (pixel_format == PixelFormat::ABGR) { + format = DRM_FORMAT_ABGR8888; + } else if (pixel_format == PixelFormat::BGRA) { + format = DRM_FORMAT_BGRA8888; + } else if (pixel_format == PixelFormat::RGBX) { + format = DRM_FORMAT_RGBX8888; + } else { + format = DRM_FORMAT_RGB565; + } adf_id_t* dev_ids = nullptr; ssize_t n_dev_ids = adf_devices(&dev_ids); -- cgit v1.2.3