package J2;

import android.graphics.Matrix;
import android.graphics.Path;
import android.graphics.Rect;
import android.graphics.RectF;
import android.util.Log;

/* JADX INFO: loaded from: classes.dex */
public final class y0 extends android.support.v4.media.session.b {

    /* JADX INFO: renamed from: h, reason: collision with root package name */
    public final /* synthetic */ int f3480h;

    /* JADX INFO: renamed from: i, reason: collision with root package name */
    public float f3481i;

    /* JADX INFO: renamed from: j, reason: collision with root package name */
    public final float f3482j;

    /* JADX INFO: renamed from: k, reason: collision with root package name */
    public final /* synthetic */ B0 f3483k;
    public final Object l;

    public y0(B0 b02, float f6, float f7) {
        this.f3480h = 1;
        this.f3483k = b02;
        this.l = new RectF();
        this.f3481i = f6;
        this.f3482j = f7;
    }

    @Override // android.support.v4.media.session.b
    public final void E(String str) {
        String str2;
        switch (this.f3480h) {
            case 0:
                B0 b02 = this.f3483k;
                if (b02.V()) {
                    Path path = new Path();
                    str2 = str;
                    b02.f3156c.f3491d.getTextPath(str2, 0, str.length(), this.f3481i, this.f3482j, path);
                    ((Path) this.l).addPath(path);
                } else {
                    str2 = str;
                }
                this.f3481i = b02.f3156c.f3491d.measureText(str2) + this.f3481i;
                break;
            default:
                B0 b03 = this.f3483k;
                if (b03.V()) {
                    Rect rect = new Rect();
                    b03.f3156c.f3491d.getTextBounds(str, 0, str.length(), rect);
                    RectF rectF = new RectF(rect);
                    rectF.offset(this.f3481i, this.f3482j);
                    ((RectF) this.l).union(rectF);
                }
                this.f3481i = b03.f3156c.f3491d.measureText(str) + this.f3481i;
                break;
        }
    }

    @Override // android.support.v4.media.session.b
    public final boolean l(n0 n0Var) {
        switch (this.f3480h) {
            case 0:
                if (!(n0Var instanceof o0)) {
                    return true;
                }
                Log.w("SVGAndroidRenderer", "Using <textPath> elements in a clip path is not supported.");
                return false;
            default:
                if (!(n0Var instanceof o0)) {
                    return true;
                }
                o0 o0Var = (o0) n0Var;
                AbstractC0399a0 abstractC0399a0N = n0Var.f3370a.N(o0Var.f3413n);
                if (abstractC0399a0N == null) {
                    B0.o("TextPath path reference '%s' not found", o0Var.f3413n);
                } else {
                    K k6 = (K) abstractC0399a0N;
                    Path path = new v0(k6.f3279o).f3468a;
                    Matrix matrix = k6.f3149n;
                    if (matrix != null) {
                        path.transform(matrix);
                    }
                    RectF rectF = new RectF();
                    path.computeBounds(rectF, true);
                    ((RectF) this.l).union(rectF);
                }
                return false;
        }
    }

    public y0(B0 b02, float f6, float f7, Path path) {
        this.f3480h = 0;
        this.f3483k = b02;
        this.f3481i = f6;
        this.f3482j = f7;
        this.l = path;
    }
}
