MCPcopy Create free account
hub / github.com/MaaXYZ/MaaFramework / preproc_touch_point

Method preproc_touch_point

source/MaaFramework/Controller/ControllerAgent.cpp:1038–1059  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1036}
1037
1038cv::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
1061bool ControllerAgent::postproc_screenshot(const cv::Mat& raw)
1062{

Callers

nothing calls this directly

Calls 1

get_featuresMethod · 0.65

Tested by

no test coverage detected