| 1036 | } |
| 1037 | |
| 1038 | cv::Point ControllerAgent::preproc_touch_point(const cv::Point& p) |
| 1039 | { |
| 1040 | if (control_unit_ && control_unit_->get_features() & MaaControllerFeature_NoScalingTouchPoints) { |
| 1041 | return p; |
| 1042 | } |
| 1043 | |
| 1044 | if (image_target_width_ == 0 || image_target_height_ == 0) { |
| 1045 | LogWarn << "Invalid image target size" << VAR(image_target_width_) << VAR(image_target_height_); |
| 1046 | |
| 1047 | if (!init_scale_info()) { |
| 1048 | return { }; |
| 1049 | } |
| 1050 | } |
| 1051 | |
| 1052 | double scale_width = static_cast<double>(image_raw_width_) / image_target_width_; |
| 1053 | double scale_height = static_cast<double>(image_raw_height_) / image_target_height_; |
| 1054 | |
| 1055 | int proced_x = static_cast<int>(std::round(p.x * scale_width)); |
| 1056 | int proced_y = static_cast<int>(std::round(p.y * scale_height)); |
| 1057 | |
| 1058 | return { proced_x, proced_y }; |
| 1059 | } |
| 1060 | |
| 1061 | bool ControllerAgent::postproc_screenshot(const cv::Mat& raw) |
| 1062 | { |
nothing calls this directly
no test coverage detected