GUIで大量の画像を入れたフォルダを入力にした際、GUIが長時間フリーズするのを修正

This commit is contained in:
lltcggie 2016-03-19 22:48:50 +09:00
parent a309c1f367
commit 52eedcc8b9

View File

@ -456,35 +456,7 @@ private:
HWND hcrop = GetDlgItem(dh, IDC_COMBO_CROP_SIZE); HWND hcrop = GetDlgItem(dh, IDC_COMBO_CROP_SIZE);
int gcd = 1; int gcd = 1;
if (boost::filesystem::is_directory(input_path)) if (!boost::filesystem::is_directory(input_path))
{
BOOST_FOREACH(const boost::filesystem::path& p, std::make_pair(boost::filesystem::recursive_directory_iterator(input_path),
boost::filesystem::recursive_directory_iterator()))
{
if (!boost::filesystem::is_directory(p))
{
tstring ext(getTString(p.extension()));
#ifdef UNICODE
std::transform(ext.begin(), ext.end(), ext.begin(), ::towlower);
#else
std::transform(ext.begin(), ext.end(), ext.begin(), ::tolower);
#endif
if (std::find(extList.begin(), extList.end(), ext) != extList.end())
{
auto mat = Waifu2x::LoadMat(p.string());
if (mat.empty())
continue;
auto size = mat.size();
mat.release();
gcd = boost::math::gcd(size.width, size.height);
}
}
}
}
else
{ {
auto mat = Waifu2x::LoadMat(input_path.string()); auto mat = Waifu2x::LoadMat(input_path.string());
if (mat.empty()) if (mat.empty())