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

Method _screencap

source/MaaAdbControlUnit/Manager/AdbControlUnitMgr.cpp:294–327  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

292}
293
294bool AdbControlUnitMgr::_screencap(cv::Mat& image)
295{
296 if (!screencap_) {
297 LogError << "screencap_ is null";
298 return false;
299 }
300
301 auto opt = screencap_->screencap();
302
303 if (!opt) {
304 LogError << "failed to screencap";
305 return false;
306 }
307
308 image = std::move(opt).value();
309
310 auto& [width, height] = image_resolution_;
311
312 if (width == 0 || height == 0) {
313 width = image.cols;
314 height = image.rows;
315 }
316 else if (width != image.cols || height != image.rows) {
317 LogInfo << "Image size changed" << VAR(width) << VAR(height) << VAR(image.cols) << VAR(image.rows);
318 auto pre = image_resolution_;
319
320 width = image.cols;
321 height = image.rows;
322
323 on_image_resolution_changed(pre, image_resolution_);
324 }
325
326 return true;
327}
328
329void AdbControlUnitMgr::on_image_resolution_changed(const std::pair<int, int>& pre, const std::pair<int, int>& cur)
330{

Callers

nothing calls this directly

Calls 2

moveFunction · 0.85
screencapMethod · 0.65

Tested by

no test coverage detected