content: package androidx.cardview.widget;
  
  import android.content.res.ColorStateList;
  import android.graphics.Canvas;
  import android.graphics.ColorFilter;
  import android.graphics.Outline;
  import android.graphics.Paint;
  import android.graphics.PorterDuff;
  import android.graphics.PorterDuffColorFilter;
  import android.graphics.Rect;
  import android.graphics.RectF;
  import android.graphics.drawable.Drawable;
  
  class RoundRectDrawable extends Drawable {
      private ColorStateList mBackground;
      private final RectF mBoundsF;
      private final Rect mBoundsI;
      private boolean mInsetForPadding = false;
      private boolean mInsetForRadius = true;
      private float mPadding;
      private final Paint mPaint;
      private float mRadius;
      private ColorStateList mTint;
      private PorterDuffColorFilter mTintFilter;
      private PorterDuff.Mode mTintMode = PorterDuff.Mode.SRC_IN;
  
      RoundRectDrawable(ColorStateList backgroundColor, float radius) {
          this.mRadius = radius;
          this.mPaint = new Paint(5);
          setBackground(backgroundColor);
          this.mBoundsF = new RectF();
          this.mBoundsI = new Rect();
      }
  
      private PorterDuffColorFilter createTintFilter(ColorStateList tint, PorterDuff.Mode tintMode) {
          if (tint == null || tintMode == null) {
              return null;
          }
          return new PorterDuffColorFilter(tint.getColorForState(getState(), 0), tintMode);
      }
  
      private void setBackground(ColorStateList color) {
          ColorStateList valueOf = color == null ? ColorStateList.valueOf(0) : color;
          this.mBackground = valueOf;
          this.mPaint.setColor(valueOf.getColorForState(getState(), this.mBackground.getDefaultColor()));
      }
  
      private void updateBounds(Rect bounds) {
          if (bounds == null) {
              bounds = getBounds();
          }
          this.mBoundsF.set((float) bounds.left, (float) bounds.top, (float) bounds.right, (float) bounds.bottom);
          this.mBoundsI.set(bounds);
          if (this.mInsetForPadding) {
              float calculateVerticalPadding = RoundRectDrawableWithShadow.calculateVerticalPadding(this.mPadding, this.mRadius, this.mInsetForRadius);
              this.mBoundsI.inset((int) Math.ceil((double) RoundRectDrawableWithShadow.calculateHorizontalPadding(this.mPadding, this.mRadius, this.mInsetForRadius)), (int) Math.ceil((double) calculateVerticalPadding));
              this.mBoundsF.set(this.mBoundsI);
          }
      }
  
      public void draw(Canvas canvas) {
          boolean z;
          Paint paint = this.mPaint;
          if (this.mTintFilter == null || paint.getColorFilter() != null) {
              z = false;
          } else {
              paint.setColorFilter(this.mTintFilter);
              z = true;
          }
          RectF rectF = this.mBoundsF;
          float f = this.mRadius;
          canvas.drawRoundRect(rectF, f, f, paint);
          if (z) {
              paint.setColorFilter((ColorFilter) null);
          }
      }
  
      public ColorStateList getColor() {
          return this.mBackground;
      }
  
      public int getOpacity() {
          return -3;
      }
  
      public void getOutline(Outline outline) {
          outline.setRoundRect(this.mBoundsI, this.mRadius);
      }
  
      /* access modifiers changed from: package-private */
      public float getPadding() {
          return this.mPadding;
      }
  
      public float getRadius() {
          return this.mRadius;
      }
  
      /* JADX WARNING: Code restructure failed: missing block: B:4:0x000a, code lost:
          r0 = r1.mBackground;
       */
      /* Code decompiled incorrectly, please refer to instructions dump. */
      public boolean isStateful() {
          /*
              r1 = this;
              android.content.res.ColorStateList r0 = r1.mTint
              if (r0 == 0) goto L_0x000a
              boolean r0 = r0.isStateful()
              if (r0 != 0) goto L_0x001a
          L_0x000a:
              android.content.res.ColorStateList r0 = r1.mBackground
              if (r0 == 0) goto L_0x0014
              boolean r0 = r0.isStateful()
              if (r0 != 0) goto L_0x001a
          L_0x0014:
              boolean r0 = super.isStateful()
              if (r0 == 0) goto L_0x001c
          L_0x001a:
              r0 = 1
              goto L_0x001d
          L_0x001c:
              r0 = 0
          L_0x001d:
              return r0
          */
          throw new UnsupportedOperationException("Method not decompiled: androidx.cardview.widget.RoundRectDrawable.isStateful():boolean");
      }
  
      /* access modifiers changed from: protected */
      public void onBoundsChange(Rect bounds) {
          super.onBoundsChange(bounds);
          updateBounds(bounds);
      }
  
      /* access modifiers changed from: protected */
      public boolean onStateChange(int[] stateSet) {
          PorterDuff.Mode mode;
          ColorStateList colorStateList = this.mBackground;
          int colorForState = colorStateList.getColorForState(stateSet, colorStateList.getDefaultColor());
          boolean z = colorForState != this.mPaint.getColor();
          if (z) {
              this.mPaint.setColor(colorForState);
          }
          ColorStateList colorStateList2 = this.mTint;
          if (colorStateList2 == null || (mode = this.mTintMode) == null) {
              return z;
          }
          this.mTintFilter = createTintFilter(colorStateList2, mode);
          return true;
      }
  
      public void setAlpha(int alpha) {
          this.mPaint.setAlpha(alpha);
      }
  
      public void setColor(ColorStateList color) {
          setBackground(color);
          invalidateSelf();
      }
  
      public void setColorFilter(ColorFilter cf) {
          this.mPaint.setColorFilter(cf);
      }
  
      /* access modifiers changed from: package-private */
      public void setPadding(float padding, boolean insetForPadding, boolean insetForRadius) {
          if (padding != this.mPadding || this.mInsetForPadding != insetForPadding || this.mInsetForRadius != insetForRadius) {
              this.mPadding = padding;
              this.mInsetForPadding = insetForPadding;
              this.mInsetForRadius = insetForRadius;
              updateBounds((Rect) null);
              invalidateSelf();
          }
      }
  
      /* access modifiers changed from: package-private */
      public void setRadius(float radius) {
          if (radius != this.mRadius) {
              this.mRadius = radius;
              updateBounds((Rect) null);
              invalidateSelf();
          }
      }
  
      public void setTintList(ColorStateList tint) {
          this.mTint = tint;
          this.mTintFilter = createTintFilter(tint, this.mTintMode);
          invalidateSelf();
      }
  
      public void setTintMode(PorterDuff.Mode tintMode) {
          this.mTintMode = tintMode;
          this.mTintFilter = createTintFilter(this.mTint, tintMode);
          invalidateSelf();
      }
  }
  