Skip to content

Commit

Permalink
Blur and sharpen ops always convolve
Browse files Browse the repository at this point in the history
Partial revert of 36ac882
  • Loading branch information
lovell committed Aug 12, 2015
1 parent 36ac882 commit 0143597
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/pipeline.cc
Original file line number Diff line number Diff line change
Expand Up @@ -493,9 +493,10 @@ class PipelineWorker : public NanAsyncWorker {
}

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 shouldPremultiplyAlpha = HasAlpha(image) && (shouldAffineTransform || willConvolve || hasOverlay);
bool shouldPremultiplyAlpha = HasAlpha(image) && (shouldAffineTransform || shouldBlur || shouldSharpen || hasOverlay);

// Premultiply image alpha channel before all transformations to avoid
// dark fringing around bright pixels
Expand Down Expand Up @@ -679,7 +680,7 @@ class PipelineWorker : public NanAsyncWorker {
}

// Blur
if (baton->blurSigma != 0.0) {
if (shouldBlur) {
VipsImage *blurred;
if (Blur(hook, image, &blurred, baton->blurSigma)) {
return Error();
Expand All @@ -688,7 +689,7 @@ class PipelineWorker : public NanAsyncWorker {
}

// Sharpen
if (baton->sharpenRadius != 0) {
if (shouldSharpen) {
VipsImage *sharpened;
if (Sharpen(hook, image, &sharpened, baton->sharpenRadius, baton->sharpenFlat, baton->sharpenJagged)) {
return Error();
Expand Down

0 comments on commit 0143597

Please sign in to comment.