aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--gyp/bench.gypi3
-rw-r--r--src/effects/SkMatrixConvolutionImageFilter.cpp13
2 files changed, 6 insertions, 10 deletions
diff --git a/gyp/bench.gypi b/gyp/bench.gypi
index 03635a8c8e..ecb533a578 100644
--- a/gyp/bench.gypi
+++ b/gyp/bench.gypi
@@ -20,8 +20,7 @@
'../bench/InterpBench.cpp',
'../bench/MathBench.cpp',
'../bench/MatrixBench.cpp',
- #Disable this benchmark until non-premul alpha problems are figured out
- #'../bench/MatrixConvolutionBench.cpp',
+ '../bench/MatrixConvolutionBench.cpp',
'../bench/MemoryBench.cpp',
'../bench/MorphologyBench.cpp',
'../bench/MutexBench.cpp',
diff --git a/src/effects/SkMatrixConvolutionImageFilter.cpp b/src/effects/SkMatrixConvolutionImageFilter.cpp
index 67104f04d9..e5acf563f3 100644
--- a/src/effects/SkMatrixConvolutionImageFilter.cpp
+++ b/src/effects/SkMatrixConvolutionImageFilter.cpp
@@ -113,14 +113,11 @@ void SkMatrixConvolutionImageFilter::filterPixels(const SkBitmap& src, SkBitmap*
sumB += SkScalarMul(SkIntToScalar(SkGetPackedB32(s)), k);
}
}
- int a = SkScalarFloorToInt(SkScalarMul(sumA, fGain) + fBias);
- int r = SkScalarFloorToInt(SkScalarMul(sumR, fGain) + fBias);
- int g = SkScalarFloorToInt(SkScalarMul(sumG, fGain) + fBias);
- int b = SkScalarFloorToInt(SkScalarMul(sumB, fGain) + fBias);
- *dptr++ = SkPackARGB32(SkClampMax(a, 255),
- SkClampMax(r, 255),
- SkClampMax(g, 255),
- SkClampMax(b, 255));
+ int a = SkClampMax(SkScalarFloorToInt(SkScalarMul(sumA, fGain) + fBias), 255);
+ int r = SkClampMax(SkScalarFloorToInt(SkScalarMul(sumR, fGain) + fBias), a);
+ int g = SkClampMax(SkScalarFloorToInt(SkScalarMul(sumG, fGain) + fBias), a);
+ int b = SkClampMax(SkScalarFloorToInt(SkScalarMul(sumB, fGain) + fBias), a);
+ *dptr++ = SkPackARGB32(a, r, g, b);
}
}
}