package o;

import android.graphics.Path;
import android.graphics.RectF;

/* compiled from: r8-map-id-3b7cc9102578c509342fa2f0fabed2bfc72239cd258d579fc679bfcbc198b048 */
/* loaded from: classes.dex */
public final class O4 {
    public final Path a;
    public RectF b;
    public float[] c;

    public O4(Path path) {
        this.a = path;
    }

    public static void a(O4 o4, T00 t00) {
        Path.Direction direction;
        float f = t00.a;
        float f2 = t00.d;
        float f3 = t00.c;
        float f4 = t00.b;
        if (Float.isNaN(f) || Float.isNaN(f4) || Float.isNaN(f3) || Float.isNaN(f2)) {
            Q4.b("Invalid rectangle, make sure no value is NaN");
        }
        if (o4.b == null) {
            o4.b = new RectF();
        }
        o4.b.set(f, f4, f3, f2);
        Path path = o4.a;
        RectF rectF = o4.b;
        int iW = AbstractC2462sn.w(1);
        if (iW == 0) {
            direction = Path.Direction.CCW;
        } else {
            if (iW != 1) {
                throw new C2170pj();
            }
            direction = Path.Direction.CW;
        }
        path.addRect(rectF, direction);
    }

    public static void b(O4 o4, C2018o30 c2018o30) {
        Path.Direction direction;
        if (o4.b == null) {
            o4.b = new RectF();
        }
        RectF rectF = o4.b;
        float f = c2018o30.a;
        long j = c2018o30.h;
        long j2 = c2018o30.g;
        long j3 = c2018o30.f;
        long j4 = c2018o30.e;
        rectF.set(f, c2018o30.b, c2018o30.c, c2018o30.d);
        if (o4.c == null) {
            o4.c = new float[8];
        }
        float[] fArr = o4.c;
        fArr[0] = Float.intBitsToFloat((int) (j4 >> 32));
        fArr[1] = Float.intBitsToFloat((int) (j4 & 4294967295L));
        fArr[2] = Float.intBitsToFloat((int) (j3 >> 32));
        fArr[3] = Float.intBitsToFloat((int) (j3 & 4294967295L));
        fArr[4] = Float.intBitsToFloat((int) (j2 >> 32));
        fArr[5] = Float.intBitsToFloat((int) (j2 & 4294967295L));
        fArr[6] = Float.intBitsToFloat((int) (j >> 32));
        fArr[7] = Float.intBitsToFloat((int) (j & 4294967295L));
        Path path = o4.a;
        RectF rectF2 = o4.b;
        float[] fArr2 = o4.c;
        int iW = AbstractC2462sn.w(1);
        if (iW == 0) {
            direction = Path.Direction.CCW;
        } else {
            if (iW != 1) {
                throw new C2170pj();
            }
            direction = Path.Direction.CW;
        }
        path.addRoundRect(rectF2, fArr2, direction);
    }

    public final T00 c() {
        if (this.b == null) {
            this.b = new RectF();
        }
        RectF rectF = this.b;
        this.a.computeBounds(rectF, true);
        return new T00(rectF.left, rectF.top, rectF.right, rectF.bottom);
    }

    public final boolean d(O4 o4, O4 o42, int i) {
        Path.Op op = i == 0 ? Path.Op.DIFFERENCE : i == 1 ? Path.Op.INTERSECT : i == 4 ? Path.Op.REVERSE_DIFFERENCE : i == 2 ? Path.Op.UNION : Path.Op.XOR;
        if (!(o4 instanceof O4)) {
            throw new UnsupportedOperationException("Unable to obtain android.graphics.Path");
        }
        Path path = o4.a;
        if (o42 instanceof O4) {
            return this.a.op(path, o42.a, op);
        }
        throw new UnsupportedOperationException("Unable to obtain android.graphics.Path");
    }

    public final void e() {
        this.a.reset();
    }
}
