Apply code-cleanup patch from @Floessie
See https://github.com/Beep6581/RawTherapee/pull/5325
This commit is contained in:
@@ -69,37 +69,40 @@ FramesMetaData* FramesMetaData::fromFile (const Glib::ustring& fname, std::uniqu
|
||||
return new FramesData (fname, std::move(rml), firstFrameOnly);
|
||||
}
|
||||
|
||||
FrameData::FrameData (rtexif::TagDirectory* frameRootDir_, rtexif::TagDirectory* rootDir, rtexif::TagDirectory* firstRootDir)
|
||||
: frameRootDir(frameRootDir_), iptc(nullptr), time(), timeStamp(), iso_speed(0), aperture(0.), focal_len(0.), focal_len35mm(0.), focus_dist(0.f),
|
||||
shutter(0.), expcomp(0.), make("Unknown"), model("Unknown"), orientation("Unknown"), rating(0), lens("Unknown"),
|
||||
sampleFormat(IIOSF_UNKNOWN), isPixelShift(false), isHDR(false)
|
||||
FrameData::FrameData(rtexif::TagDirectory* frameRootDir_, rtexif::TagDirectory* rootDir, rtexif::TagDirectory* firstRootDir) :
|
||||
frameRootDir(frameRootDir_),
|
||||
iptc(nullptr),
|
||||
time{},
|
||||
timeStamp{},
|
||||
iso_speed(0),
|
||||
aperture(0.),
|
||||
focal_len(0.),
|
||||
focal_len35mm(0.),
|
||||
focus_dist(0.f),
|
||||
shutter(0.),
|
||||
expcomp(0.),
|
||||
make("Unknown"),
|
||||
model("Unknown"),
|
||||
orientation("Unknown"),
|
||||
rating(0),
|
||||
lens("Unknown"),
|
||||
sampleFormat(IIOSF_UNKNOWN),
|
||||
isPixelShift(false),
|
||||
isHDR(false)
|
||||
{
|
||||
memset (&time, 0, sizeof(time));
|
||||
|
||||
if (!frameRootDir) {
|
||||
return;
|
||||
}
|
||||
|
||||
rtexif::Tag* tag;
|
||||
rtexif::TagDirectory* newFrameRootDir = frameRootDir;
|
||||
|
||||
memset(&time, 0, sizeof(time));
|
||||
timeStamp = 0;
|
||||
iso_speed = 0;
|
||||
aperture = 0.0;
|
||||
focal_len = 0.0;
|
||||
focal_len35mm = 0.0;
|
||||
focus_dist = 0.0f;
|
||||
shutter = 0.0;
|
||||
expcomp = 0.0;
|
||||
make.clear();
|
||||
model.clear();
|
||||
serial.clear();
|
||||
orientation.clear();
|
||||
lens.clear();
|
||||
rating = 0;
|
||||
|
||||
tag = newFrameRootDir->findTag("Make");
|
||||
rtexif::TagDirectory* newFrameRootDir = frameRootDir;
|
||||
|
||||
rtexif::Tag* tag = newFrameRootDir->findTag("Make");
|
||||
if (!tag) {
|
||||
newFrameRootDir = rootDir;
|
||||
tag = newFrameRootDir->findTag("Make");
|
||||
@@ -198,17 +201,11 @@ FrameData::FrameData (rtexif::TagDirectory* frameRootDir_, rtexif::TagDirectory*
|
||||
}
|
||||
char sXMPRating[64];
|
||||
if (newFrameRootDir->getXMPTagValue("xmp:Rating", sXMPRating)) {
|
||||
rating = atoi(sXMPRating);
|
||||
}
|
||||
// guard against out-of-range values
|
||||
if (rating > 5) {
|
||||
rating = 5;
|
||||
}
|
||||
// Guard against out-of-range values (<0, >5)
|
||||
rating = rtengine::max(0, rtengine::min(5, atoi(sXMPRating)));
|
||||
// Currently, Rating=-1 is not supported. A value of -1 should mean
|
||||
// "Rejected" according to the specification. Maybe in the future, Rating=-1
|
||||
// sets InTrash=true?
|
||||
if (rating < 0) {
|
||||
rating = 0;
|
||||
}
|
||||
|
||||
tag = newFrameRootDir->findTagUpward("MakerNote");
|
||||
@@ -1197,15 +1194,21 @@ std::string FramesData::getOrientation(unsigned int frame) const
|
||||
}
|
||||
);
|
||||
}
|
||||
int FramesData::getRating (unsigned int frame) const
|
||||
|
||||
int FramesData::getRating(unsigned int frame) const
|
||||
{
|
||||
return frames.empty() || frame >= frames.size() ? 0 : frames.at(frame)->getRating ();
|
||||
return getFromFrame<int>(
|
||||
frames,
|
||||
frame,
|
||||
[](const FrameData& frame_data)
|
||||
{
|
||||
return frame_data.getRating();
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
//------inherited functions--------------//
|
||||
|
||||
|
||||
std::string FramesMetaData::apertureToString (double aperture)
|
||||
{
|
||||
|
||||
|
@@ -127,7 +127,7 @@ public:
|
||||
std::string getModel (unsigned int frame = 0) const override;
|
||||
std::string getLens (unsigned int frame = 0) const override;
|
||||
std::string getSerialNumber (unsigned int frame = 0) const;
|
||||
std::string getOrientation (unsigned int frame = 0) const;
|
||||
std::string getOrientation (unsigned int frame = 0) const override;
|
||||
int getRating (unsigned int frame = 0) const override;
|
||||
};
|
||||
|
||||
|
@@ -24,12 +24,37 @@
|
||||
|
||||
#include "../rtengine/procparams.h"
|
||||
|
||||
CacheImageData::CacheImageData ()
|
||||
: md5(""), supported(false), format(FT_Invalid), rankOld(-1), inTrashOld(false), recentlySaved(false),
|
||||
timeValid(false), year(0), month(0), day(0), hour(0), min(0), sec(0), exifValid(false), frameCount(1),
|
||||
fnumber(0.0), shutter(0.0), focalLen(0.0), focalLen35mm(0.0), focusDist(0.f), iso(0), rating(0), isHDR (false),
|
||||
isPixelShift (false), sensortype(rtengine::ST_NONE), sampleFormat(rtengine::IIOSF_UNKNOWN),
|
||||
redAWBMul(-1.0), greenAWBMul(-1.0), blueAWBMul(-1.0), rotate(0), thumbImgType(0)
|
||||
CacheImageData::CacheImageData() :
|
||||
supported(false),
|
||||
format(FT_Invalid),
|
||||
rankOld(-1),
|
||||
inTrashOld(false),
|
||||
recentlySaved(false),
|
||||
timeValid(false),
|
||||
year(0),
|
||||
month(0),
|
||||
day(0),
|
||||
hour(0),
|
||||
min(0),
|
||||
sec(0),
|
||||
exifValid(false),
|
||||
frameCount(1),
|
||||
fnumber(0.0),
|
||||
shutter(0.0),
|
||||
focalLen(0.0),
|
||||
focalLen35mm(0.0),
|
||||
focusDist(0.f),
|
||||
iso(0),
|
||||
rating(0),
|
||||
isHDR (false),
|
||||
isPixelShift (false),
|
||||
sensortype(rtengine::ST_NONE),
|
||||
sampleFormat(rtengine::IIOSF_UNKNOWN),
|
||||
redAWBMul(-1.0),
|
||||
greenAWBMul(-1.0),
|
||||
blueAWBMul(-1.0),
|
||||
rotate(0),
|
||||
thumbImgType(0)
|
||||
{
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user