Loading minui/graphics.cpp +21 −0 Original line number Diff line number Diff line Loading @@ -41,6 +41,7 @@ static uint32_t gr_current = ~0; // gr_draw is owned by backends. static GRSurface* gr_draw = nullptr; static GRRotation rotation = GRRotation::NONE; static GRRotation touch_rotation = GRRotation::NONE; static PixelFormat pixel_format = PixelFormat::UNKNOWN; // The graphics backend list that provides fallback options for the default backend selection. // For example, it will fist try DRM, then try FBDEV if DRM is unavailable. Loading Loading @@ -474,6 +475,18 @@ int gr_init(std::initializer_list<GraphicsBackend> backends) { gr_rotate(GRRotation::NONE); } std::string touch_rotation_str = android::base::GetProperty("ro.minui.default_touch_rotation", "ROTATION_NONE"); if (touch_rotation_str == "ROTATION_RIGHT") { gr_rotate_touch(GRRotation::RIGHT); } else if (touch_rotation_str == "ROTATION_DOWN") { gr_rotate_touch(GRRotation::DOWN); } else if (touch_rotation_str == "ROTATION_LEFT") { gr_rotate_touch(GRRotation::LEFT); } else { // "ROTATION_NONE" or unknown string gr_rotate_touch(GRRotation::NONE); } if (gr_draw->pixel_bytes != 4) { printf("gr_init: Only 4-byte pixel formats supported\n"); } Loading Loading @@ -519,6 +532,10 @@ int gr_overscan_offset_y() { return overscan_offset_y; } GRRotation gr_touch_rotation() { return touch_rotation; } void gr_fb_blank(bool blank) { gr_backend->Blank(blank); } Loading @@ -531,6 +548,10 @@ void gr_rotate(GRRotation rot) { rotation = rot; } void gr_rotate_touch(GRRotation rot) { touch_rotation = rot; } bool gr_has_multiple_connectors() { return gr_backend->HasMultipleConnectors(); } minui/include/minui/minui.h +4 −0 Original line number Diff line number Diff line Loading @@ -129,6 +129,7 @@ int gr_fb_width_real(); int gr_fb_height_real(); int gr_overscan_offset_x(); int gr_overscan_offset_y(); GRRotation gr_touch_rotation(); void gr_flip(); void gr_fb_blank(bool blank); Loading Loading @@ -158,6 +159,9 @@ unsigned int gr_get_height(const GRSurface* surface); // Sets rotation, flips gr_fb_width/height if 90 degree rotation difference void gr_rotate(GRRotation rotation); // Sets touch rotation void gr_rotate_touch(GRRotation rotation); // Returns the current PixelFormat being used. PixelFormat gr_pixel_format(); Loading recovery_ui/screen_ui.cpp +27 −1 Original line number Diff line number Diff line Loading @@ -1353,8 +1353,34 @@ int ScreenRecoveryUI::SelectMenu(int sel) { } int ScreenRecoveryUI::SelectMenu(const Point& p) { Point point; const auto scaleX = static_cast<double>(p.x()) / ScreenWidth(); const auto scaleY = static_cast<double>(p.y()) / ScreenHeight(); // Correct position for touch rotation switch (gr_touch_rotation()) { case GRRotation::NONE: point.x(ScreenWidth() * scaleX); point.y(ScreenHeight() * scaleY); break; case GRRotation::RIGHT: point.x(ScreenWidth() * scaleY); point.y(ScreenHeight() - (ScreenHeight() * scaleX)); break; case GRRotation::DOWN: point.x(ScreenWidth() - (ScreenWidth() * scaleX)); point.y(ScreenHeight() - (ScreenHeight() * scaleY)); break; case GRRotation::LEFT: point.x(ScreenWidth() - (ScreenWidth() * scaleY)); point.y(ScreenHeight() * scaleX); break; } // Correct position for overscan const Point point(p.x() - gr_overscan_offset_x(), p.y() - gr_overscan_offset_y()); point.x(point.x() - gr_overscan_offset_x()); point.y(point.y() - gr_overscan_offset_y()); int new_sel = Device::kNoAction; std::lock_guard<std::mutex> lg(updateMutex); Loading Loading
minui/graphics.cpp +21 −0 Original line number Diff line number Diff line Loading @@ -41,6 +41,7 @@ static uint32_t gr_current = ~0; // gr_draw is owned by backends. static GRSurface* gr_draw = nullptr; static GRRotation rotation = GRRotation::NONE; static GRRotation touch_rotation = GRRotation::NONE; static PixelFormat pixel_format = PixelFormat::UNKNOWN; // The graphics backend list that provides fallback options for the default backend selection. // For example, it will fist try DRM, then try FBDEV if DRM is unavailable. Loading Loading @@ -474,6 +475,18 @@ int gr_init(std::initializer_list<GraphicsBackend> backends) { gr_rotate(GRRotation::NONE); } std::string touch_rotation_str = android::base::GetProperty("ro.minui.default_touch_rotation", "ROTATION_NONE"); if (touch_rotation_str == "ROTATION_RIGHT") { gr_rotate_touch(GRRotation::RIGHT); } else if (touch_rotation_str == "ROTATION_DOWN") { gr_rotate_touch(GRRotation::DOWN); } else if (touch_rotation_str == "ROTATION_LEFT") { gr_rotate_touch(GRRotation::LEFT); } else { // "ROTATION_NONE" or unknown string gr_rotate_touch(GRRotation::NONE); } if (gr_draw->pixel_bytes != 4) { printf("gr_init: Only 4-byte pixel formats supported\n"); } Loading Loading @@ -519,6 +532,10 @@ int gr_overscan_offset_y() { return overscan_offset_y; } GRRotation gr_touch_rotation() { return touch_rotation; } void gr_fb_blank(bool blank) { gr_backend->Blank(blank); } Loading @@ -531,6 +548,10 @@ void gr_rotate(GRRotation rot) { rotation = rot; } void gr_rotate_touch(GRRotation rot) { touch_rotation = rot; } bool gr_has_multiple_connectors() { return gr_backend->HasMultipleConnectors(); }
minui/include/minui/minui.h +4 −0 Original line number Diff line number Diff line Loading @@ -129,6 +129,7 @@ int gr_fb_width_real(); int gr_fb_height_real(); int gr_overscan_offset_x(); int gr_overscan_offset_y(); GRRotation gr_touch_rotation(); void gr_flip(); void gr_fb_blank(bool blank); Loading Loading @@ -158,6 +159,9 @@ unsigned int gr_get_height(const GRSurface* surface); // Sets rotation, flips gr_fb_width/height if 90 degree rotation difference void gr_rotate(GRRotation rotation); // Sets touch rotation void gr_rotate_touch(GRRotation rotation); // Returns the current PixelFormat being used. PixelFormat gr_pixel_format(); Loading
recovery_ui/screen_ui.cpp +27 −1 Original line number Diff line number Diff line Loading @@ -1353,8 +1353,34 @@ int ScreenRecoveryUI::SelectMenu(int sel) { } int ScreenRecoveryUI::SelectMenu(const Point& p) { Point point; const auto scaleX = static_cast<double>(p.x()) / ScreenWidth(); const auto scaleY = static_cast<double>(p.y()) / ScreenHeight(); // Correct position for touch rotation switch (gr_touch_rotation()) { case GRRotation::NONE: point.x(ScreenWidth() * scaleX); point.y(ScreenHeight() * scaleY); break; case GRRotation::RIGHT: point.x(ScreenWidth() * scaleY); point.y(ScreenHeight() - (ScreenHeight() * scaleX)); break; case GRRotation::DOWN: point.x(ScreenWidth() - (ScreenWidth() * scaleX)); point.y(ScreenHeight() - (ScreenHeight() * scaleY)); break; case GRRotation::LEFT: point.x(ScreenWidth() - (ScreenWidth() * scaleY)); point.y(ScreenHeight() * scaleX); break; } // Correct position for overscan const Point point(p.x() - gr_overscan_offset_x(), p.y() - gr_overscan_offset_y()); point.x(point.x() - gr_overscan_offset_x()); point.y(point.y() - gr_overscan_offset_y()); int new_sel = Device::kNoAction; std::lock_guard<std::mutex> lg(updateMutex); Loading