package s1;

import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Matrix;
import android.graphics.Rect;
import android.graphics.Region;

/* loaded from: classes.dex */
public final class b implements a0 {

    /* renamed from: a, reason: collision with root package name */
    private Canvas f35229a;

    /* renamed from: b, reason: collision with root package name */
    private Rect f35230b;

    /* renamed from: c, reason: collision with root package name */
    private Rect f35231c;

    public b() {
        Canvas canvas;
        canvas = c.f35237a;
        this.f35229a = canvas;
    }

    public final Region.Op A(int i10) {
        return f0.d(i10, f0.f35249a.a()) ? Region.Op.DIFFERENCE : Region.Op.INTERSECT;
    }

    @Override // s1.a0
    public void a(f1 f1Var, int i10) {
        Canvas canvas = this.f35229a;
        if (!(f1Var instanceof m)) {
            throw new UnsupportedOperationException("Unable to obtain android.graphics.Path");
        }
        canvas.clipPath(((m) f1Var).t(), A(i10));
    }

    public final Canvas b() {
        return this.f35229a;
    }

    @Override // s1.a0
    public void c(float f10, float f11, float f12, float f13, int i10) {
        this.f35229a.clipRect(f10, f11, f12, f13, A(i10));
    }

    @Override // s1.a0
    public void d(float f10, float f11) {
        this.f35229a.translate(f10, f11);
    }

    @Override // s1.a0
    public void e(float f10, float f11, float f12, float f13, float f14, float f15, d1 d1Var) {
        this.f35229a.drawRoundRect(f10, f11, f12, f13, f14, f15, d1Var.v());
    }

    @Override // s1.a0
    public void f(float f10, float f11) {
        this.f35229a.scale(f10, f11);
    }

    @Override // s1.a0
    public void g(long j10, long j11, d1 d1Var) {
        this.f35229a.drawLine(r1.g.m(j10), r1.g.n(j10), r1.g.m(j11), r1.g.n(j11), d1Var.v());
    }

    @Override // s1.a0
    public void h(float f10) {
        this.f35229a.rotate(f10);
    }

    @Override // s1.a0
    public void i(float f10, float f11, float f12, float f13, d1 d1Var) {
        this.f35229a.drawRect(f10, f11, f12, f13, d1Var.v());
    }

    @Override // s1.a0
    public void j(u0 u0Var, long j10, long j11, long j12, long j13, d1 d1Var) {
        if (this.f35230b == null) {
            this.f35230b = new Rect();
            this.f35231c = new Rect();
        }
        Canvas canvas = this.f35229a;
        Bitmap b10 = i.b(u0Var);
        Rect rect = this.f35230b;
        kotlin.jvm.internal.t.d(rect);
        rect.left = c3.n.h(j10);
        rect.top = c3.n.i(j10);
        rect.right = c3.n.h(j10) + c3.r.g(j11);
        rect.bottom = c3.n.i(j10) + c3.r.f(j11);
        rm.n0 n0Var = rm.n0.f34904a;
        Rect rect2 = this.f35231c;
        kotlin.jvm.internal.t.d(rect2);
        rect2.left = c3.n.h(j12);
        rect2.top = c3.n.i(j12);
        rect2.right = c3.n.h(j12) + c3.r.g(j13);
        rect2.bottom = c3.n.i(j12) + c3.r.f(j13);
        canvas.drawBitmap(b10, rect, rect2, d1Var.v());
    }

    @Override // s1.a0
    public void k(f1 f1Var, d1 d1Var) {
        Canvas canvas = this.f35229a;
        if (!(f1Var instanceof m)) {
            throw new UnsupportedOperationException("Unable to obtain android.graphics.Path");
        }
        canvas.drawPath(((m) f1Var).t(), d1Var.v());
    }

    @Override // s1.a0
    public void l(r1.i iVar, d1 d1Var) {
        this.f35229a.saveLayer(iVar.i(), iVar.l(), iVar.j(), iVar.e(), d1Var.v(), 31);
    }

    @Override // s1.a0
    public void n() {
        this.f35229a.save();
    }

    @Override // s1.a0
    public void o() {
        d0.f35238a.a(this.f35229a, false);
    }

    @Override // s1.a0
    public void p(float f10, float f11, float f12, float f13, float f14, float f15, boolean z10, d1 d1Var) {
        this.f35229a.drawArc(f10, f11, f12, f13, f14, f15, z10, d1Var.v());
    }

    @Override // s1.a0
    public void q(float[] fArr) {
        if (a1.c(fArr)) {
            return;
        }
        Matrix matrix = new Matrix();
        j.a(matrix, fArr);
        this.f35229a.concat(matrix);
    }

    @Override // s1.a0
    public void s(u0 u0Var, long j10, d1 d1Var) {
        this.f35229a.drawBitmap(i.b(u0Var), r1.g.m(j10), r1.g.n(j10), d1Var.v());
    }

    @Override // s1.a0
    public void v(long j10, float f10, d1 d1Var) {
        this.f35229a.drawCircle(r1.g.m(j10), r1.g.n(j10), f10, d1Var.v());
    }

    @Override // s1.a0
    public void x() {
        this.f35229a.restore();
    }

    @Override // s1.a0
    public void y() {
        d0.f35238a.a(this.f35229a, true);
    }

    public final void z(Canvas canvas) {
        this.f35229a = canvas;
    }
}
