@Override
  public void draw(Canvas canvas) {
    mBounds.set(getBounds());
    switch (mType) {
      case CLIPPING:
        int saveCount = canvas.save();
        canvas.clipPath(mPath);
        super.draw(canvas);
        canvas.restoreToCount(saveCount);
        break;
      case OVERLAY_COLOR:
        if (mScaleDownInsideBorders) {
          if (mInsideBorderBounds == null) {
            mInsideBorderBounds = new RectF(mBounds);
            mInsideBorderTransform = new Matrix();
          } else {
            mInsideBorderBounds.set(mBounds);
          }
          mInsideBorderBounds.inset(mBorderWidth, mBorderWidth);
          if (mInsideBorderTransform != null) {
            mInsideBorderTransform.setRectToRect(
                mBounds, mInsideBorderBounds, Matrix.ScaleToFit.FILL);
          }

          saveCount = canvas.save();
          canvas.clipRect(mBounds);
          canvas.concat(mInsideBorderTransform);
          super.draw(canvas);
          canvas.restoreToCount(saveCount);
        } else {
          super.draw(canvas);
        }

        mPaint.setStyle(Paint.Style.FILL);
        mPaint.setColor(mOverlayColor);
        mPaint.setStrokeWidth(0f);
        mPaint.setFilterBitmap(getPaintFilterBitmap());
        mPath.setFillType(Path.FillType.EVEN_ODD);
        canvas.drawPath(mPath, mPaint);

        if (mIsCircle) {
          // INVERSE_EVEN_ODD will only draw inverse circle within its bounding box, so we need to
          // fill the rest manually if the bounds are not square.
          float paddingH = (mBounds.width() - mBounds.height() + mBorderWidth) / 2f;
          float paddingV = (mBounds.height() - mBounds.width() + mBorderWidth) / 2f;
          if (paddingH > 0) {
            canvas.drawRect(
                mBounds.left, mBounds.top, mBounds.left + paddingH, mBounds.bottom, mPaint);
            canvas.drawRect(
                mBounds.right - paddingH, mBounds.top, mBounds.right, mBounds.bottom, mPaint);
          }
          if (paddingV > 0) {
            canvas.drawRect(
                mBounds.left, mBounds.top, mBounds.right, mBounds.top + paddingV, mPaint);
            canvas.drawRect(
                mBounds.left, mBounds.bottom - paddingV, mBounds.right, mBounds.bottom, mPaint);
          }
        }
        break;
    }

    if (mBorderColor != Color.TRANSPARENT) {
      mPaint.setStyle(Paint.Style.STROKE);
      mPaint.setColor(mBorderColor);
      mPaint.setStrokeWidth(mBorderWidth);
      mPath.setFillType(Path.FillType.EVEN_ODD);
      canvas.drawPath(mBorderPath, mPaint);
    }
  }
Gets whether to set FILTER_BITMAP_FLAG flag to Paint.
drawee/src/main/java/com/facebook/drawee/drawable/RoundedCornersDrawable.java