| 1347 | }; |
| 1348 | |
| 1349 | inline std::vector<DumpDisplayInfo> ParseDumpDisplayInfo(const std::string_view &dumpDisplayInfo) |
| 1350 | { |
| 1351 | constexpr auto SubStringView = [](const std::string_view &str, std::string_view start, std::string_view end, int startOffset = 0) -> std::string_view |
| 1352 | { |
| 1353 | auto startIt = str.find(start, startOffset); |
| 1354 | if (std::string::npos == startIt) |
| 1355 | return {}; |
| 1356 | |
| 1357 | auto endIt = str.find(end, startIt + start.size()); |
| 1358 | if (std::string::npos == endIt) |
| 1359 | return {}; |
| 1360 | |
| 1361 | return str.substr(startIt + start.size(), endIt - startIt - start.size()); |
| 1362 | }; |
| 1363 | |
| 1364 | std::vector<DumpDisplayInfo> result; |
| 1365 | |
| 1366 | // DisplayDeviceInfo |
| 1367 | auto dumpDisplayInfoIt = std::string_view::npos; |
| 1368 | while (std::string_view::npos != (dumpDisplayInfoIt = dumpDisplayInfo.find("DisplayDeviceInfo", dumpDisplayInfoIt + 1))) |
| 1369 | { |
| 1370 | auto uniqueId = SubStringView(dumpDisplayInfo, "mUniqueId=", "\n", dumpDisplayInfoIt); |
| 1371 | auto currentLayerStack = SubStringView(dumpDisplayInfo, "mCurrentLayerStack=", "\n", dumpDisplayInfoIt); |
| 1372 | auto currentLayerStackRect = SubStringView(dumpDisplayInfo, "mCurrentLayerStackRect=", "\n", dumpDisplayInfoIt); |
| 1373 | |
| 1374 | if ("-1" == currentLayerStack) |
| 1375 | { |
| 1376 | LogError("[-] %s -> Current layer stack is -1, skipping", std::string{uniqueId.begin(), uniqueId.end()}.data()); |
| 1377 | |
| 1378 | continue; |
| 1379 | } |
| 1380 | |
| 1381 | result.push_back(DumpDisplayInfo::MakeFromRawDumpInfo(uniqueId, currentLayerStack, currentLayerStackRect)); |
| 1382 | } |
| 1383 | |
| 1384 | return result; |
| 1385 | } |
| 1386 | |
| 1387 | inline MirrorLayerTransform CalcMirrorLayerTransform(float targetWidth, float targetHeight, float sourceWidth, float sourceHeight, float epsilon = 0.002) |
| 1388 | { |
no outgoing calls
no test coverage detected