Remove unnecessary thumbnail loading code

This commit is contained in:
xiota
2021-09-23 14:02:54 -07:00
parent dd01cc110b
commit 320859bf92

View File

@@ -184,7 +184,6 @@ Glib::ustring Thumbnail::xmpSidecarPath(const Glib::ustring &imagePath)
void Thumbnail::_generateThumbnailImage () void Thumbnail::_generateThumbnailImage ()
{ {
// delete everything loaded into memory // delete everything loaded into memory
delete tpp; delete tpp;
tpp = nullptr; tpp = nullptr;
@@ -205,67 +204,37 @@ void Thumbnail::_generateThumbnailImage ()
cfs.exifValid = false; cfs.exifValid = false;
cfs.timeValid = false; cfs.timeValid = false;
if (ext == "jpg" || ext == "jpeg") { // RAW works like this:
// 1. if we are here it's because we aren't in the cache so load the JPG
// image out of the RAW. Mark as "quick".
// 2. if we don't find that then just grab the real image.
bool quick = false;
rtengine::eSensorType sensorType = rtengine::ST_NONE;
if ( initial_ && options.internalThumbIfUntouched) {
quick = true;
tpp = rtengine::Thumbnail::loadQuickFromRaw (fname, sensorType, tw, th, 1, TRUE);
}
if ( tpp == nullptr ) {
quick = false;
tpp = rtengine::Thumbnail::loadFromRaw (fname, sensorType, tw, th, 1, pparams->wb.equal, pparams->wb.observer, TRUE, &(pparams->raw));
}
cfs.sensortype = sensorType;
if (tpp) {
cfs.format = FT_Raw;
cfs.thumbImgType = quick ? CacheImageData::QUICK_THUMBNAIL : CacheImageData::FULL_THUMBNAIL;
infoFromImage (fname); infoFromImage (fname);
tpp = rtengine::Thumbnail::loadFromImage (fname, tw, th, -1, pparams->wb.equal, pparams->wb.observer); if (!quick) {
cfs.width = tpp->full_width;
if (tpp) { cfs.height = tpp->full_height;
cfs.format = FT_Jpeg;
}
} else if (ext == "png") {
tpp = rtengine::Thumbnail::loadFromImage (fname, tw, th, -1, pparams->wb.equal, pparams->wb.observer);
if (tpp) {
cfs.format = FT_Png;
}
#ifdef LIBJXL
} else if (ext == "jxl") {
tpp = rtengine::Thumbnail::loadFromImage (fname, tw, th, -1, pparams->wb.equal);
if (tpp) {
cfs.format = FT_Custom;
}
#endif
} else if (ext == "tif" || ext == "tiff") {
infoFromImage (fname);
tpp = rtengine::Thumbnail::loadFromImage (fname, tw, th, -1, pparams->wb.equal, pparams->wb.observer);
if (tpp) {
cfs.format = FT_Tiff;
}
} else {
// RAW works like this:
// 1. if we are here it's because we aren't in the cache so load the JPG
// image out of the RAW. Mark as "quick".
// 2. if we don't find that then just grab the real image.
bool quick = false;
rtengine::eSensorType sensorType = rtengine::ST_NONE;
if ( initial_ && options.internalThumbIfUntouched) {
quick = true;
tpp = rtengine::Thumbnail::loadQuickFromRaw (fname, sensorType, tw, th, 1, TRUE);
}
if ( tpp == nullptr ) {
quick = false;
tpp = rtengine::Thumbnail::loadFromRaw (fname, sensorType, tw, th, 1, pparams->wb.equal, pparams->wb.observer, TRUE, &(pparams->raw));
}
cfs.sensortype = sensorType;
if (tpp) {
cfs.format = FT_Raw;
cfs.thumbImgType = quick ? CacheImageData::QUICK_THUMBNAIL : CacheImageData::FULL_THUMBNAIL;
infoFromImage (fname);
if (!quick) {
cfs.width = tpp->full_width;
cfs.height = tpp->full_height;
}
} }
} }
if (!tpp) { if (!tpp) {
// try a custom loader // this will load formats supported by imagio (jpg, png, jxl, and tiff)
tpp = rtengine::Thumbnail::loadFromImage(fname, tw, th, -1, pparams->wb.equal, true); tpp = rtengine::Thumbnail::loadFromImage (fname, tw, th, -1, pparams->wb.equal, pparams->wb.observer);
if (tpp) { if (tpp) {
cfs.format = FT_Custom; cfs.format = FT_Custom;
infoFromImage(fname); infoFromImage(fname);