/*
 * Copyright (c) 2017-present, Facebook, Inc.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */
package com.facebook.imagepipeline.postprocessors;

import android.graphics.Bitmap;
import com.facebook.cache.common.CacheKey;
import com.facebook.cache.common.SimpleCacheKey;
import com.facebook.imagepipeline.nativecode.NativeRoundingFilter;
import com.facebook.imagepipeline.request.BasePostprocessor;
import javax.annotation.Nullable;

/** Postprocessor that rounds a given image as a circle. */
public class RoundAsCirclePostprocessor extends BasePostprocessor {

  private @Nullable CacheKey mCacheKey;

  @Override
  public void process(Bitmap bitmap) {
    NativeRoundingFilter.toCircle(bitmap);
  }

  @Nullable
  @Override
  public CacheKey getPostprocessorCacheKey() {
    if (mCacheKey == null) {
      mCacheKey = new SimpleCacheKey("RoundAsCirclePostprocessor");
    }
    return mCacheKey;
  }
}

@@ -646,48 +646,347 @@
 r %7B%0A
-%0A  private @Nullable CacheKey mCacheKey;
+  private static final boolean ENABLE_ANTI_ALIASING = true;%0A%0A  private @Nullable CacheKey mCacheKey;%0A  private final boolean mEnableAntiAliasing;%0A%0A  public RoundAsCirclePostprocessor() %7B%0A    this(ENABLE_ANTI_ALIASING);%0A  %7D%0A%0A  public RoundAsCirclePostprocessor(boolean enableAntiAliasing) %7B%0A    mEnableAntiAliasing = enableAntiAliasing;%0A  %7D
 %0A%0A  
@@ -1074,16 +1074,37 @@
 e(bitmap
+, mEnableAntiAliasing
 );%0A  %7D%0A%0A
@@ -1199,24 +1199,156 @@
  == null) %7B%0A
+      if (mEnableAntiAliasing) %7B%0A        mCacheKey = new SimpleCacheKey(%22RoundAsCirclePostprocessor#AntiAliased%22);%0A      %7D else %7B%0A  
       mCache
@@ -1399,24 +1399,32 @@
 rocessor%22);%0A
+      %7D%0A
     %7D%0A    re

Update existing native rounding post processor