Blur and sharpen ops always convolve

Partial revert of 36ac882
This commit is contained in:
Lovell Fuller 2015-08-12 07:25:14 +01:00
parent 36ac8828f2
commit 01435977de

View File

@ -493,9 +493,10 @@ class PipelineWorker : public NanAsyncWorker {
} }
bool shouldAffineTransform = xresidual != 0.0 || yresidual != 0.0; bool shouldAffineTransform = xresidual != 0.0 || yresidual != 0.0;
bool willConvolve = baton->blurSigma > 0.0 || baton->sharpenRadius > 0; bool shouldBlur = baton->blurSigma != 0.0;
bool shouldSharpen = baton->sharpenRadius != 0;
bool hasOverlay = !baton->overlayPath.empty(); bool hasOverlay = !baton->overlayPath.empty();
bool shouldPremultiplyAlpha = HasAlpha(image) && (shouldAffineTransform || willConvolve || hasOverlay); bool shouldPremultiplyAlpha = HasAlpha(image) && (shouldAffineTransform || shouldBlur || shouldSharpen || hasOverlay);
// Premultiply image alpha channel before all transformations to avoid // Premultiply image alpha channel before all transformations to avoid
// dark fringing around bright pixels // dark fringing around bright pixels
@ -679,7 +680,7 @@ class PipelineWorker : public NanAsyncWorker {
} }
// Blur // Blur
if (baton->blurSigma != 0.0) { if (shouldBlur) {
VipsImage *blurred; VipsImage *blurred;
if (Blur(hook, image, &blurred, baton->blurSigma)) { if (Blur(hook, image, &blurred, baton->blurSigma)) {
return Error(); return Error();
@ -688,7 +689,7 @@ class PipelineWorker : public NanAsyncWorker {
} }
// Sharpen // Sharpen
if (baton->sharpenRadius != 0) { if (shouldSharpen) {
VipsImage *sharpened; VipsImage *sharpened;
if (Sharpen(hook, image, &sharpened, baton->sharpenRadius, baton->sharpenFlat, baton->sharpenJagged)) { if (Sharpen(hook, image, &sharpened, baton->sharpenRadius, baton->sharpenFlat, baton->sharpenJagged)) {
return Error(); return Error();