package xr;

import android.content.res.Resources;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.Path;
import android.graphics.PointF;
import android.graphics.RectF;
import android.view.View;
import vr.c;
import vr.d;
import vr.f;

/* loaded from: classes5.dex */
public class b extends c {

    /* renamed from: c, reason: collision with root package name */
    Paint f51043c;

    /* renamed from: d, reason: collision with root package name */
    int f51044d;

    /* renamed from: e, reason: collision with root package name */
    RectF f51045e;

    /* renamed from: f, reason: collision with root package name */
    RectF f51046f;

    /* renamed from: g, reason: collision with root package name */
    PointF f51047g;

    /* renamed from: h, reason: collision with root package name */
    RectF f51048h;

    /* renamed from: i, reason: collision with root package name */
    int f51049i;

    /* renamed from: j, reason: collision with root package name */
    float f51050j;

    /* renamed from: k, reason: collision with root package name */
    Path f51051k;

    /* renamed from: l, reason: collision with root package name */
    private float f51052l;

    /* renamed from: m, reason: collision with root package name */
    private float f51053m;

    /* renamed from: n, reason: collision with root package name */
    private PointF f51054n;

    public b() {
        Paint paint = new Paint();
        this.f51043c = paint;
        paint.setAntiAlias(true);
        this.f51045e = new RectF();
        this.f51046f = new RectF();
        this.f51047g = new PointF();
        this.f51048h = new RectF();
        float f10 = Resources.getSystem().getDisplayMetrics().density;
        float f11 = 2.0f * f10;
        this.f51053m = f11;
        this.f51052l = f11;
        this.f51050j = f10 * 8.0f;
    }

    @Override // vr.c
    public boolean b(float f10, float f11) {
        return this.f51045e.contains(f10, f11);
    }

    @Override // vr.c
    public void c(Canvas canvas) {
        if (this.f40485a) {
            int alpha = this.f51043c.getAlpha();
            int color = this.f51043c.getColor();
            if (color == 0) {
                this.f51043c.setColor(-1);
            }
            this.f51043c.setAlpha(this.f51044d);
            canvas.drawRoundRect(this.f51048h, this.f51052l, this.f51053m, this.f51043c);
            this.f51043c.setColor(color);
            this.f51043c.setAlpha(alpha);
        }
        canvas.drawPath(e(), this.f51043c);
    }

    @Override // vr.c
    public RectF d() {
        return this.f51046f;
    }

    @Override // vr.c
    public Path e() {
        return this.f51051k;
    }

    @Override // vr.c
    public void f(d dVar, float f10, float f11) {
        PointF pointF = this.f51054n;
        if (pointF == null) {
            throw new UnsupportedOperationException("RectanglePromptFocal size must be set using setSize(PointF)");
        }
        float f12 = pointF.x / 2.0f;
        float f13 = pointF.y / 2.0f;
        RectF rectF = this.f51046f;
        float f14 = this.f51050j;
        rectF.left = (f10 - f12) - f14;
        rectF.top = (f11 - f13) - f14;
        rectF.right = f12 + f10 + f14;
        rectF.bottom = f13 + f11 + f14;
        PointF pointF2 = this.f51047g;
        pointF2.x = f10;
        pointF2.y = f11;
    }

    @Override // vr.c
    public void g(d dVar, View view, int[] iArr) {
        int[] iArr2 = new int[2];
        view.getLocationInWindow(iArr2);
        float f10 = iArr2[0] - iArr[0];
        float f11 = iArr2[1] - iArr[1];
        int width = view.getWidth();
        int height = view.getHeight();
        if (this.f51054n != null) {
            f(dVar, f10 + (width / 2), f11 + (height / 2));
            return;
        }
        RectF rectF = this.f51046f;
        float f12 = this.f51050j;
        rectF.left = f10 - f12;
        rectF.top = f11 - f12;
        rectF.right = width + f10 + f12;
        rectF.bottom = height + f11 + f12;
        PointF pointF = this.f51047g;
        pointF.x = f10 + (width / 2);
        pointF.y = f11 + (height / 2);
    }

    @Override // vr.c
    public void h(int i10) {
        this.f51043c.setColor(i10);
        int alpha = Color.alpha(i10);
        this.f51049i = alpha;
        this.f51043c.setAlpha(alpha);
    }

    @Override // vr.c
    public void k(d dVar, float f10, float f11) {
        f.i(this.f51047g, this.f51046f, this.f51045e, f10, true);
        Path path = new Path();
        this.f51051k = path;
        path.addRoundRect(this.f51045e, this.f51052l, this.f51053m, Path.Direction.CW);
    }

    @Override // vr.c
    public void l(float f10, float f11) {
        f.i(this.f51047g, this.f51046f, this.f51048h, f10, true);
        this.f51044d = (int) (this.f40486b * f11);
    }
}
