package o;

import android.content.res.Resources;
import android.graphics.Canvas;
import android.graphics.Matrix;
import android.graphics.Outline;
import android.graphics.Paint;
import android.graphics.PorterDuffXfermode;
import android.graphics.Rect;
import android.os.Build;
import android.view.View;
import android.view.ViewParent;

/* compiled from: r8-map-id-3b7cc9102578c509342fa2f0fabed2bfc72239cd258d579fc679bfcbc198b048 */
/* renamed from: o.lE, reason: case insensitive filesystem */
/* loaded from: classes.dex */
public final class C1750lE implements InterfaceC1178fE {
    public static final C1655kE w = new C1655kE();
    public final AbstractC1810lt b;
    public final C0006Ag c;
    public final C0743ak0 d;
    public final Resources e;
    public final Rect f;
    public Paint g;
    public int h;
    public int i;
    public long j;
    public boolean k;
    public boolean l;
    public boolean m;
    public int n;

    /* renamed from: o, reason: collision with root package name */
    public int f621o;
    public float p;
    public boolean q;
    public float r;
    public float s;
    public float t;
    public long u;
    public long v;

    public C1750lE(AbstractC1810lt abstractC1810lt) {
        C0006Ag c0006Ag = new C0006Ag();
        C3113zg c3113zg = new C3113zg();
        this.b = abstractC1810lt;
        this.c = c0006Ag;
        C0743ak0 c0743ak0 = new C0743ak0(abstractC1810lt, c0006Ag, c3113zg);
        this.d = c0743ak0;
        this.e = abstractC1810lt.getResources();
        this.f = new Rect();
        abstractC1810lt.addView(c0743ak0);
        c0743ak0.setClipBounds(null);
        this.j = 0L;
        View.generateViewId();
        this.n = 3;
        this.f621o = 0;
        this.p = 1.0f;
        this.r = 1.0f;
        this.s = 1.0f;
        long j = C0190Hi.b;
        this.u = j;
        this.v = j;
    }

    @Override // o.InterfaceC1178fE
    public final void A(float f) {
        this.s = f;
        this.d.setScaleY(f);
    }

    @Override // o.InterfaceC1178fE
    public final void B(InterfaceC2923xg interfaceC2923xg) {
        Rect rect;
        boolean z = this.k;
        C0743ak0 c0743ak0 = this.d;
        if (z) {
            if ((this.m || c0743ak0.getClipToOutline()) && !this.l) {
                rect = this.f;
                rect.left = 0;
                rect.top = 0;
                rect.right = c0743ak0.getWidth();
                rect.bottom = c0743ak0.getHeight();
            } else {
                rect = null;
            }
            c0743ak0.setClipBounds(rect);
        }
        Canvas canvas = U2.a;
        if (((T2) interfaceC2923xg).a.isHardwareAccelerated()) {
            this.b.a(interfaceC2923xg, c0743ak0, c0743ak0.getDrawingTime());
        }
    }

    @Override // o.InterfaceC1178fE
    public final Matrix C() {
        return this.d.getMatrix();
    }

    @Override // o.InterfaceC1178fE
    public final void D(int i, int i2, long j) {
        boolean zA = C1470iI.a(this.j, j);
        C0743ak0 c0743ak0 = this.d;
        if (zA) {
            int i3 = this.h;
            if (i3 != i) {
                c0743ak0.offsetLeftAndRight(i - i3);
            }
            int i4 = this.i;
            if (i4 != i2) {
                c0743ak0.offsetTopAndBottom(i2 - i4);
            }
        } else {
            if (this.m || c0743ak0.getClipToOutline()) {
                this.k = true;
            }
            int i5 = (int) (j >> 32);
            int i6 = (int) (4294967295L & j);
            c0743ak0.layout(i, i2, i + i5, i2 + i6);
            this.j = j;
            if (this.q) {
                c0743ak0.setPivotX(i5 / 2.0f);
                c0743ak0.setPivotY(i6 / 2.0f);
            }
        }
        this.h = i;
        this.i = i2;
    }

    @Override // o.InterfaceC1178fE
    public final float E() {
        return 0.0f;
    }

    @Override // o.InterfaceC1178fE
    public final void F(float f) {
        this.d.setCameraDistance(f * this.e.getDisplayMetrics().densityDpi);
    }

    @Override // o.InterfaceC1178fE
    public final float G() {
        return this.t;
    }

    @Override // o.InterfaceC1178fE
    public final float I() {
        return this.s;
    }

    @Override // o.InterfaceC1178fE
    public final float J() {
        return 0.0f;
    }

    @Override // o.InterfaceC1178fE
    public final int K() {
        return this.n;
    }

    @Override // o.InterfaceC1178fE
    public final void L(long j) {
        long j2 = 9223372034707292159L & j;
        C0743ak0 c0743ak0 = this.d;
        if (j2 != 9205357640488583168L) {
            this.q = false;
            c0743ak0.setPivotX(Float.intBitsToFloat((int) (j >> 32)));
            c0743ak0.setPivotY(Float.intBitsToFloat((int) (j & 4294967295L)));
        } else {
            if (Build.VERSION.SDK_INT >= 28) {
                c0743ak0.resetPivot();
                return;
            }
            this.q = true;
            c0743ak0.setPivotX(((int) (this.j >> 32)) / 2.0f);
            c0743ak0.setPivotY(((int) (this.j & 4294967295L)) / 2.0f);
        }
    }

    @Override // o.InterfaceC1178fE
    public final long M() {
        return this.u;
    }

    public final void N(int i) {
        C0743ak0 c0743ak0 = this.d;
        boolean z = true;
        if (i == 1) {
            c0743ak0.setLayerType(2, this.g);
        } else if (i == 2) {
            c0743ak0.setLayerType(0, this.g);
            z = false;
        } else {
            c0743ak0.setLayerType(0, this.g);
        }
        c0743ak0.setCanUseCompositingLayer$ui_graphics_release(z);
    }

    public final void O() {
        int i = this.f621o;
        if (i != 1 && this.n == 3) {
            N(i);
        } else {
            N(1);
        }
    }

    @Override // o.InterfaceC1178fE
    public final float a() {
        return this.p;
    }

    @Override // o.InterfaceC1178fE
    public final void b() {
        this.d.setRotationX(0.0f);
    }

    @Override // o.InterfaceC1178fE
    public final void c(float f) {
        this.p = f;
        this.d.setAlpha(f);
    }

    @Override // o.InterfaceC1178fE
    public final void d(InterfaceC2281qr interfaceC2281qr, EnumC1280gK enumC1280gK, C1082eE c1082eE, C2769w c2769w) {
        C0743ak0 c0743ak0 = this.d;
        ViewParent parent = c0743ak0.getParent();
        AbstractC1810lt abstractC1810lt = this.b;
        if (parent == null) {
            abstractC1810lt.addView(c0743ak0);
        }
        c0743ak0.r = interfaceC2281qr;
        c0743ak0.s = enumC1280gK;
        c0743ak0.t = c2769w;
        c0743ak0.u = c1082eE;
        if (c0743ak0.isAttachedToWindow()) {
            c0743ak0.setVisibility(4);
            c0743ak0.setVisibility(0);
            try {
                C0006Ag c0006Ag = this.c;
                C1655kE c1655kE = w;
                T2 t2 = c0006Ag.a;
                Canvas canvas = t2.a;
                t2.a = c1655kE;
                abstractC1810lt.a(t2, c0743ak0, c0743ak0.getDrawingTime());
                c0006Ag.a.a = canvas;
            } catch (ClassCastException unused) {
            }
        }
    }

    @Override // o.InterfaceC1178fE
    public final float e() {
        return this.r;
    }

    @Override // o.InterfaceC1178fE
    public final void f(float f) {
        this.t = f;
        this.d.setElevation(f);
    }

    @Override // o.InterfaceC1178fE
    public final float g() {
        return 0.0f;
    }

    @Override // o.InterfaceC1178fE
    public final void h() {
        this.d.setTranslationY(0.0f);
    }

    @Override // o.InterfaceC1178fE
    public final void i() {
        this.d.setRotationY(0.0f);
    }

    @Override // o.InterfaceC1178fE
    public final long j() {
        return this.v;
    }

    @Override // o.InterfaceC1178fE
    public final void k(long j) {
        if (Build.VERSION.SDK_INT >= 28) {
            this.u = j;
            this.d.setOutlineAmbientShadowColor(AbstractC0752ap.g0(j));
        }
    }

    @Override // o.InterfaceC1178fE
    public final void l(Outline outline, long j) {
        C0743ak0 c0743ak0 = this.d;
        c0743ak0.p = outline;
        c0743ak0.invalidateOutline();
        if ((this.m || c0743ak0.getClipToOutline()) && outline != null) {
            c0743ak0.setClipToOutline(true);
            if (this.m) {
                this.m = false;
                this.k = true;
            }
        }
        this.l = outline != null;
    }

    @Override // o.InterfaceC1178fE
    public final void m() {
        Paint paint = this.g;
        if (paint == null) {
            paint = new Paint();
            this.g = paint;
        }
        paint.setColorFilter(null);
        O();
    }

    @Override // o.InterfaceC1178fE
    public final void n(float f) {
        this.r = f;
        this.d.setScaleX(f);
    }

    @Override // o.InterfaceC1178fE
    public final void o(int i) {
        this.n = i;
        Paint paint = this.g;
        if (paint == null) {
            paint = new Paint();
            this.g = paint;
        }
        paint.setXfermode(new PorterDuffXfermode(AbstractC1692kh0.R(i)));
        O();
    }

    @Override // o.InterfaceC1178fE
    public final float p() {
        return this.d.getCameraDistance() / this.e.getDisplayMetrics().densityDpi;
    }

    @Override // o.InterfaceC1178fE
    public final void q() {
        this.b.removeViewInLayout(this.d);
    }

    @Override // o.InterfaceC1178fE
    public final float r() {
        return 0.0f;
    }

    @Override // o.InterfaceC1178fE
    public final void s() {
        this.d.setTranslationX(0.0f);
    }

    @Override // o.InterfaceC1178fE
    public final void t(boolean z) {
        boolean z2 = false;
        this.m = z && !this.l;
        this.k = true;
        if (z && this.l) {
            z2 = true;
        }
        this.d.setClipToOutline(z2);
    }

    @Override // o.InterfaceC1178fE
    public final int u() {
        return this.f621o;
    }

    @Override // o.InterfaceC1178fE
    public final float v() {
        return 0.0f;
    }

    @Override // o.InterfaceC1178fE
    public final C0444Rd w() {
        return null;
    }

    @Override // o.InterfaceC1178fE
    public final void x(int i) {
        this.f621o = i;
        O();
    }

    @Override // o.InterfaceC1178fE
    public final void y() {
        this.d.setRotation(0.0f);
    }

    @Override // o.InterfaceC1178fE
    public final void z(long j) {
        if (Build.VERSION.SDK_INT >= 28) {
            this.v = j;
            this.d.setOutlineSpotShadowColor(AbstractC0752ap.g0(j));
        }
    }
}
