astyle on files edited by rec2020 branch
This commit is contained in:
@@ -41,8 +41,9 @@ void loadProfiles (const Glib::ustring& dirName,
|
|||||||
std::map<Glib::ustring, Glib::ustring>* profileNames,
|
std::map<Glib::ustring, Glib::ustring>* profileNames,
|
||||||
bool nameUpper, bool onlyRgb)
|
bool nameUpper, bool onlyRgb)
|
||||||
{
|
{
|
||||||
if (dirName.empty ())
|
if (dirName.empty ()) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
@@ -52,23 +53,27 @@ void loadProfiles (const Glib::ustring& dirName,
|
|||||||
|
|
||||||
const Glib::ustring fileName = *entry;
|
const Glib::ustring fileName = *entry;
|
||||||
|
|
||||||
if (fileName.size () < 4)
|
if (fileName.size () < 4) {
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
const Glib::ustring extension = fileName.substr (fileName.size () - 4).casefold ();
|
const Glib::ustring extension = fileName.substr (fileName.size () - 4).casefold ();
|
||||||
|
|
||||||
if (extension.compare (".icc") != 0 && extension.compare (".icm") != 0)
|
if (extension.compare (".icc") != 0 && extension.compare (".icm") != 0) {
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
const Glib::ustring filePath = Glib::build_filename (dirName, fileName);
|
const Glib::ustring filePath = Glib::build_filename (dirName, fileName);
|
||||||
|
|
||||||
if (!Glib::file_test (filePath, Glib::FILE_TEST_IS_REGULAR))
|
if (!Glib::file_test (filePath, Glib::FILE_TEST_IS_REGULAR)) {
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
Glib::ustring name = fileName.substr (0, fileName.size() - 4);
|
Glib::ustring name = fileName.substr (0, fileName.size() - 4);
|
||||||
|
|
||||||
if (nameUpper)
|
if (nameUpper) {
|
||||||
name = name.uppercase ();
|
name = name.uppercase ();
|
||||||
|
}
|
||||||
|
|
||||||
if (profiles) {
|
if (profiles) {
|
||||||
const rtengine::ProfileContent content (filePath);
|
const rtengine::ProfileContent content (filePath);
|
||||||
@@ -77,28 +82,31 @@ void loadProfiles (const Glib::ustring& dirName,
|
|||||||
if (profile && (!onlyRgb || cmsGetColorSpace (profile) == cmsSigRgbData)) {
|
if (profile && (!onlyRgb || cmsGetColorSpace (profile) == cmsSigRgbData)) {
|
||||||
profiles->insert (std::make_pair (name, profile));
|
profiles->insert (std::make_pair (name, profile));
|
||||||
|
|
||||||
if (profileContents)
|
if (profileContents) {
|
||||||
profileContents->insert (std::make_pair (name, content));
|
profileContents->insert (std::make_pair (name, content));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (profileNames)
|
if (profileNames) {
|
||||||
profileNames->insert (std::make_pair (name, filePath));
|
profileNames->insert (std::make_pair (name, filePath));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Glib::Exception&) {}
|
} catch (Glib::Exception&) {}
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void getSupportedIntent (cmsHPROFILE profile, cmsUInt32Number intent, cmsUInt32Number direction, std::uint8_t& result)
|
inline void getSupportedIntent (cmsHPROFILE profile, cmsUInt32Number intent, cmsUInt32Number direction, std::uint8_t& result)
|
||||||
{
|
{
|
||||||
if (cmsIsIntentSupported (profile, intent, direction))
|
if (cmsIsIntentSupported (profile, intent, direction)) {
|
||||||
result |= 1 << intent;
|
result |= 1 << intent;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
inline std::uint8_t getSupportedIntents (cmsHPROFILE profile, cmsUInt32Number direction)
|
inline std::uint8_t getSupportedIntents (cmsHPROFILE profile, cmsUInt32Number direction)
|
||||||
{
|
{
|
||||||
if (!profile)
|
if (!profile) {
|
||||||
return 0;
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
std::uint8_t result = 0;
|
std::uint8_t result = 0;
|
||||||
|
|
||||||
@@ -163,8 +171,9 @@ std::vector<Glib::ustring> ICCStore::getProfiles () const
|
|||||||
|
|
||||||
std::vector<Glib::ustring> res;
|
std::vector<Glib::ustring> res;
|
||||||
|
|
||||||
for (ProfileMap::const_iterator profile = fileProfiles.begin (); profile != fileProfiles.end (); ++profile)
|
for (ProfileMap::const_iterator profile = fileProfiles.begin (); profile != fileProfiles.end (); ++profile) {
|
||||||
res.push_back (profile->first);
|
res.push_back (profile->first);
|
||||||
|
}
|
||||||
|
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
@@ -181,8 +190,9 @@ std::vector<Glib::ustring> ICCStore::getProfilesFromDir (const Glib::ustring& di
|
|||||||
loadProfiles (profilesDir, &profiles, NULL, NULL, false, true);
|
loadProfiles (profilesDir, &profiles, NULL, NULL, false, true);
|
||||||
loadProfiles (dirName, &profiles, NULL, NULL, false, true);
|
loadProfiles (dirName, &profiles, NULL, NULL, false, true);
|
||||||
|
|
||||||
for (ProfileMap::const_iterator profile = profiles.begin (); profile != profiles.end (); ++profile)
|
for (ProfileMap::const_iterator profile = profiles.begin (); profile != profiles.end (); ++profile) {
|
||||||
res.push_back (profile->first);
|
res.push_back (profile->first);
|
||||||
|
}
|
||||||
|
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
@@ -388,22 +398,25 @@ cmsHPROFILE ICCStore::getStdProfile (const Glib::ustring& name) const
|
|||||||
const ProfileMap::const_iterator r = fileStdProfiles.find (nameUpper);
|
const ProfileMap::const_iterator r = fileStdProfiles.find (nameUpper);
|
||||||
|
|
||||||
// return profile from store
|
// return profile from store
|
||||||
if (r != fileStdProfiles.end ())
|
if (r != fileStdProfiles.end ()) {
|
||||||
return r->second;
|
return r->second;
|
||||||
|
}
|
||||||
|
|
||||||
// profile is not yet in store
|
// profile is not yet in store
|
||||||
const NameMap::const_iterator f = fileStdProfilesFileNames.find (nameUpper);
|
const NameMap::const_iterator f = fileStdProfilesFileNames.find (nameUpper);
|
||||||
|
|
||||||
// profile does not exist
|
// profile does not exist
|
||||||
if (f == fileStdProfilesFileNames.end ())
|
if (f == fileStdProfilesFileNames.end ()) {
|
||||||
return NULL;
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
// but there exists one => load it
|
// but there exists one => load it
|
||||||
const ProfileContent content (f->second);
|
const ProfileContent content (f->second);
|
||||||
const cmsHPROFILE profile = content.toProfile ();
|
const cmsHPROFILE profile = content.toProfile ();
|
||||||
|
|
||||||
if (profile)
|
if (profile) {
|
||||||
const_cast<ProfileMap&> (fileStdProfiles).insert (std::make_pair (f->first, profile));
|
const_cast<ProfileMap&> (fileStdProfiles).insert (std::make_pair (f->first, profile));
|
||||||
|
}
|
||||||
|
|
||||||
// profile is not valid or it is now stored => remove entry from fileStdProfilesFileNames
|
// profile is not valid or it is now stored => remove entry from fileStdProfilesFileNames
|
||||||
const_cast<NameMap&> (fileStdProfilesFileNames).erase (f);
|
const_cast<NameMap&> (fileStdProfilesFileNames).erase (f);
|
||||||
@@ -481,6 +494,7 @@ void ICCStore::findDefaultMonitorProfile ()
|
|||||||
defaultMonitorProfile = Glib::ustring (profileName);
|
defaultMonitorProfile = Glib::ustring (profileName);
|
||||||
defaultMonitorProfile = Glib::path_get_basename (defaultMonitorProfile);
|
defaultMonitorProfile = Glib::path_get_basename (defaultMonitorProfile);
|
||||||
size_t pos = defaultMonitorProfile.rfind (".");
|
size_t pos = defaultMonitorProfile.rfind (".");
|
||||||
|
|
||||||
if (pos != Glib::ustring::npos) {
|
if (pos != Glib::ustring::npos) {
|
||||||
defaultMonitorProfile = defaultMonitorProfile.substr (0, pos);
|
defaultMonitorProfile = defaultMonitorProfile.substr (0, pos);
|
||||||
}
|
}
|
||||||
|
@@ -1771,11 +1771,13 @@ int Options::readFromFile (Glib::ustring fname)
|
|||||||
if (options.rtSettings.verbose) {
|
if (options.rtSettings.verbose) {
|
||||||
printf ("Options::readFromFile / Error code %d while reading values from \"%s\":\n%s\n", err.code(), fname.c_str(), err.what().c_str());
|
printf ("Options::readFromFile / Error code %d while reading values from \"%s\":\n%s\n", err.code(), fname.c_str(), err.what().c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
setDefaults ();
|
setDefaults ();
|
||||||
} catch (...) {
|
} catch (...) {
|
||||||
if (options.rtSettings.verbose) {
|
if (options.rtSettings.verbose) {
|
||||||
printf ("Options::readFromFile / Unknown exception while trying to load \"%s\"!\n", fname.c_str());
|
printf ("Options::readFromFile / Unknown exception while trying to load \"%s\"!\n", fname.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
setDefaults ();
|
setDefaults ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user