package com.google.android.material.textfield;

import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.PorterDuff;
import android.graphics.PorterDuffXfermode;
import android.graphics.RectF;
import com.google.android.gms.maps.model.BitmapDescriptorFactory;
import lj.k;

/* loaded from: classes3.dex */
class c extends lj.g {
    private final Paint O;
    private final RectF P;

    /* JADX INFO: Access modifiers changed from: package-private */
    public c(k kVar) {
        super(kVar == null ? new k() : kVar);
        this.O = new Paint(1);
        l0();
        this.P = new RectF();
    }

    private void l0() {
        this.O.setStyle(Paint.Style.FILL_AND_STROKE);
        this.O.setColor(-1);
        this.O.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.DST_OUT));
    }

    /* JADX INFO: Access modifiers changed from: package-private */
    public boolean h0() {
        return !this.P.isEmpty();
    }

    /* JADX INFO: Access modifiers changed from: package-private */
    public void i0() {
        j0(BitmapDescriptorFactory.HUE_RED, BitmapDescriptorFactory.HUE_RED, BitmapDescriptorFactory.HUE_RED, BitmapDescriptorFactory.HUE_RED);
    }

    void j0(float f10, float f11, float f12, float f13) {
        RectF rectF = this.P;
        if (f10 == rectF.left && f11 == rectF.top && f12 == rectF.right && f13 == rectF.bottom) {
            return;
        }
        rectF.set(f10, f11, f12, f13);
        invalidateSelf();
    }

    /* JADX INFO: Access modifiers changed from: package-private */
    public void k0(RectF rectF) {
        j0(rectF.left, rectF.top, rectF.right, rectF.bottom);
    }

    /* JADX INFO: Access modifiers changed from: protected */
    @Override // lj.g
    public void r(Canvas canvas) {
        if (this.P.isEmpty()) {
            super.r(canvas);
            return;
        }
        canvas.save();
        canvas.clipOutRect(this.P);
        super.r(canvas);
        canvas.restore();
    }
}
