package X6FRs_4.IFxWkV_5.Mqv2r_3;

import android.graphics.Matrix;
import android.graphics.Rect;
import android.graphics.RectF;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewParent;
/* compiled from: ViewGroupUtils.java */
/* loaded from: classes.dex */
public class QxJ9d_1 {
    public static final ThreadLocal<Matrix> KQgRr5e_0 = new ThreadLocal<>();
    public static final ThreadLocal<RectF> QxJ9d_1 = new ThreadLocal<>();

    public static void KQgRr5e_0(ViewGroup viewGroup, View view, Rect rect) {
        rect.set(0, 0, view.getWidth(), view.getHeight());
        QxJ9d_1(viewGroup, view, rect);
    }

    public static void QxJ9d_1(ViewGroup viewGroup, View view, Rect rect) {
        Matrix matrix = KQgRr5e_0.get();
        if (matrix == null) {
            matrix = new Matrix();
            KQgRr5e_0.set(matrix);
        } else {
            matrix.reset();
        }
        KQgRr5e_0(viewGroup, view, matrix);
        RectF rectF = QxJ9d_1.get();
        if (rectF == null) {
            rectF = new RectF();
            QxJ9d_1.set(rectF);
        }
        rectF.set(rect);
        matrix.mapRect(rectF);
        rect.set((int) (rectF.left + 0.5f), (int) (rectF.top + 0.5f), (int) (rectF.right + 0.5f), (int) (rectF.bottom + 0.5f));
    }

    public static void KQgRr5e_0(ViewParent viewParent, View view, Matrix matrix) {
        ViewParent parent = view.getParent();
        if ((parent instanceof View) && parent != viewParent) {
            View view2 = (View) parent;
            KQgRr5e_0(viewParent, view2, matrix);
            matrix.preTranslate(-view2.getScrollX(), -view2.getScrollY());
        }
        matrix.preTranslate(view.getLeft(), view.getTop());
        if (view.getMatrix().isIdentity()) {
            return;
        }
        matrix.preConcat(view.getMatrix());
    }
}
