Update existing native rounding post processor
@@ -15,20 +15,34 @@ import javax.annotation.Nullable;
/** Postprocessor that rounds a given image as a circle. */
public class RoundAsCirclePostprocessor extends BasePostprocessor {
+ private static final boolean ENABLE_ANTI_ALIASING = true;
private @Nullable CacheKey mCacheKey;
+ private final boolean mEnableAntiAliasing;
+
+ public RoundAsCirclePostprocessor() {
+ this(ENABLE_ANTI_ALIASING);
+ }
+
+ public RoundAsCirclePostprocessor(boolean enableAntiAliasing) {
+ mEnableAntiAliasing = enableAntiAliasing;
+ }
@Override
public void process(Bitmap bitmap) {
- NativeRoundingFilter.toCircle(bitmap);
+ NativeRoundingFilter.toCircle(bitmap, mEnableAntiAliasing);
}
@Nullable
@Override
public CacheKey getPostprocessorCacheKey() {
if (mCacheKey == null) {
+ if (mEnableAntiAliasing) {
+ mCacheKey = new SimpleCacheKey("RoundAsCirclePostprocessor#AntiAliased");
+ } else {
mCacheKey = new SimpleCacheKey("RoundAsCirclePostprocessor");
}
+ }
return mCacheKey;
}
}
