Add function needsScale() to make sure scale is applied if defish is not active

This commit is contained in:
Alexander Brock 2024-07-27 15:30:24 +02:00
parent 159ebd45e8
commit c491a405a4
2 changed files with 9 additions and 3 deletions

View File

@ -127,6 +127,7 @@ class ImProcFunctions
bool needsDistortion() const;
bool needsRotation() const;
bool needsPerspective() const;
bool needsScale() const;
bool needsGradient() const;
bool needsVignetting() const;
bool needsLCP() const;

View File

@ -431,7 +431,7 @@ bool ImProcFunctions::transCoord (int W, int H, const std::vector<Coord2D> &src,
green.clear ();
blue.clear ();
if (!needsCA() && !needsDistortion() && !needsRotation() && !needsPerspective() && (!params->lensProf.useDist || pLCPMap == nullptr)) {
if (!needsCA() && !needsDistortion() && !needsRotation() && !needsPerspective() && !needsScale() && (!params->lensProf.useDist || pLCPMap == nullptr)) {
for (size_t i = 0; i < src.size(); i++) {
red.push_back (Coord2D (src[i].x, src[i].y));
green.push_back (Coord2D (src[i].x, src[i].y));
@ -700,7 +700,7 @@ void ImProcFunctions::transform (Imagefloat* original, Imagefloat* transformed,
}
}
if (! (needsCA() || needsDistortion() || needsRotation() || needsPerspective() || needsLCP() || needsMetadata() || needsLensfun()) && (needsVignetting() || needsPCVignetting() || needsGradient())) {
if (! (needsCA() || needsDistortion() || needsRotation() || needsPerspective() || needsScale() || needsLCP() || needsMetadata() || needsLensfun()) && (needsVignetting() || needsPCVignetting() || needsGradient())) {
transformLuminanceOnly (original, transformed, cx, cy, oW, oH, fW, fH);
} else {
bool highQuality;
@ -1451,6 +1451,11 @@ bool ImProcFunctions::needsPerspective () const
params->perspective.projection_yaw));
}
bool ImProcFunctions::needsScale () const
{
return std::abs(1.0 - params->commonTrans.getScale()) > 1e-6;
}
bool ImProcFunctions::needsGradient () const
{
return params->gradient.enabled && fabs (params->gradient.strength) > 1e-15;
@ -1488,7 +1493,7 @@ bool ImProcFunctions::needsTransform (int oW, int oH, int rawRotationDeg, const
std::unique_ptr<const LensCorrection> pLCPMap = LFDatabase::getInstance()->findModifier(params->lensProf, metadata, oW, oH, params->coarse, rawRotationDeg);
needsLf = pLCPMap.get();
}
return needsCA () || needsDistortion () || needsRotation () || needsPerspective () || needsGradient () || needsPCVignetting () || needsVignetting () || needsLCP() || needsMetadata() || needsLf;
return needsCA () || needsDistortion () || needsRotation () || needsPerspective () || needsScale () || needsGradient () || needsPCVignetting () || needsVignetting () || needsLCP() || needsMetadata() || needsLf;
}