Merge pull request #5321 from Beep6581/clut_scan_speedup
Clut scan speedup
This commit is contained in:
@@ -270,7 +270,8 @@ void rtengine::HaldCLUT::splitClutFilename(
|
||||
const Glib::ustring& filename,
|
||||
Glib::ustring& name,
|
||||
Glib::ustring& extension,
|
||||
Glib::ustring& profile_name
|
||||
Glib::ustring& profile_name,
|
||||
bool checkProfile
|
||||
)
|
||||
{
|
||||
Glib::ustring basename = Glib::path_get_basename(filename);
|
||||
@@ -284,17 +285,19 @@ void rtengine::HaldCLUT::splitClutFilename(
|
||||
name = basename;
|
||||
}
|
||||
|
||||
profile_name = "sRGB";
|
||||
if (checkProfile) {
|
||||
profile_name = "sRGB";
|
||||
|
||||
if (!name.empty()) {
|
||||
for (const auto& working_profile : rtengine::ICCStore::getInstance()->getWorkingProfiles()) {
|
||||
if (
|
||||
!working_profile.empty() // This isn't strictly needed, but an empty wp name should be skipped anyway
|
||||
&& std::search(name.rbegin(), name.rend(), working_profile.rbegin(), working_profile.rend()) == name.rbegin()
|
||||
) {
|
||||
profile_name = working_profile;
|
||||
name.erase(name.size() - working_profile.size());
|
||||
break;
|
||||
if (!name.empty()) {
|
||||
for (const auto& working_profile : rtengine::ICCStore::getInstance()->getWorkingProfiles()) {
|
||||
if (
|
||||
!working_profile.empty() // This isn't strictly needed, but an empty wp name should be skipped anyway
|
||||
&& std::search(name.rbegin(), name.rend(), working_profile.rbegin(), working_profile.rend()) == name.rbegin()
|
||||
) {
|
||||
profile_name = working_profile;
|
||||
name.erase(name.size() - working_profile.size());
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -39,7 +39,8 @@ public:
|
||||
const Glib::ustring& filename,
|
||||
Glib::ustring& name,
|
||||
Glib::ustring& extension,
|
||||
Glib::ustring& profile_name
|
||||
Glib::ustring& profile_name,
|
||||
bool checkProfile = true
|
||||
);
|
||||
|
||||
private:
|
||||
|
@@ -8,6 +8,8 @@
|
||||
|
||||
#include "../rtengine/clutstore.h"
|
||||
#include "../rtengine/procparams.h"
|
||||
#define BENCHMARK
|
||||
#include "../rtengine/StopWatch.h"
|
||||
|
||||
using namespace rtengine;
|
||||
using namespace rtengine::procparams;
|
||||
@@ -305,6 +307,7 @@ ClutComboBox::ClutModel::ClutModel(const Glib::ustring &path)
|
||||
|
||||
int ClutComboBox::ClutModel::parseDir(const Glib::ustring& path)
|
||||
{
|
||||
BENCHFUNMICRO
|
||||
if (path.empty() || !Glib::file_test(path, Glib::FILE_TEST_IS_DIR)) {
|
||||
return 0;
|
||||
}
|
||||
@@ -364,7 +367,7 @@ int ClutComboBox::ClutModel::parseDir(const Glib::ustring& path)
|
||||
}
|
||||
|
||||
// Fill menu structure with CLUT files
|
||||
std::set<Glib::ustring> entries;
|
||||
std::set<std::string> entries;
|
||||
|
||||
unsigned long fileCount = 0;
|
||||
|
||||
@@ -390,10 +393,10 @@ int ClutComboBox::ClutModel::parseDir(const Glib::ustring& path)
|
||||
Glib::ustring name;
|
||||
Glib::ustring extension;
|
||||
Glib::ustring profileName;
|
||||
HaldCLUT::splitClutFilename (entry, name, extension, profileName);
|
||||
HaldCLUT::splitClutFilename (entry, name, extension, profileName, false);
|
||||
|
||||
extension = extension.casefold();
|
||||
if (extension.compare("tif") != 0 && extension.compare("png") != 0) {
|
||||
if (extension != "png" && extension != "tif") {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user