From 91d0f550b9ba01f0e6bc07f465e39a8696bef5aa Mon Sep 17 00:00:00 2001 From: zzyyyl Date: Thu, 12 Oct 2023 13:30:55 +0800 Subject: [PATCH] =?UTF-8?q?perf:=20=E4=BC=98=E5=8C=96=20OperBox=20?= =?UTF-8?q?=E7=9B=B8=E5=85=B3=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Vision/Miscellaneous/OperBoxImageAnalyzer.cpp | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/src/MaaCore/Vision/Miscellaneous/OperBoxImageAnalyzer.cpp b/src/MaaCore/Vision/Miscellaneous/OperBoxImageAnalyzer.cpp index ae19164057..a841f277a1 100644 --- a/src/MaaCore/Vision/Miscellaneous/OperBoxImageAnalyzer.cpp +++ b/src/MaaCore/Vision/Miscellaneous/OperBoxImageAnalyzer.cpp @@ -69,7 +69,6 @@ bool asst::OperBoxImageAnalyzer::opers_analyze() TemplDetOCRer::ResultsVec results; - const auto& replace_task = Task.get("CharsNameOcrReplace"); const auto& all_opers = BattleData.get_all_oper_names(); Rect roi_top = Task.get("OperBoxFlagRoleTopROI")->roi; @@ -77,21 +76,16 @@ bool asst::OperBoxImageAnalyzer::opers_analyze() for (int i = 1; i < 10; ++i) { oper_name_analyzer.set_task_info("OperBoxFlagRole" + std::to_string(i), "OperBoxNameOCR"); - oper_name_analyzer.set_replace(replace_task->replace_map, replace_task->replace_full); oper_name_analyzer.set_required(std::vector(all_opers.begin(), all_opers.end())); oper_name_analyzer.set_roi(roi_top); - auto top_result_opt = oper_name_analyzer.analyze(); - if (top_result_opt) { - results.insert(results.end(), std::make_move_iterator(top_result_opt->begin()), - std::make_move_iterator(top_result_opt->end())); + if (auto top_result_opt = oper_name_analyzer.analyze()) { + ranges::move(*top_result_opt, std::back_inserter(results)); } oper_name_analyzer.set_roi(roi_bottom); - auto bottom_result_opt = oper_name_analyzer.analyze(); - if (bottom_result_opt) { - results.insert(results.end(), std::make_move_iterator(bottom_result_opt->begin()), - std::make_move_iterator(bottom_result_opt->end())); + if (auto bottom_result_opt = oper_name_analyzer.analyze()) { + ranges::move(*bottom_result_opt, std::back_inserter(results)); } }