package eightbitlab.com.blurview;

import android.content.Context;
import android.graphics.Canvas;
import android.graphics.RenderNode;
import android.os.Build;
import android.util.AttributeSet;
import android.widget.FrameLayout;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.RequiresApi;
import p6.a;

/* JADX INFO: loaded from: classes.dex */
public class BlurTarget extends FrameLayout {

    /* JADX INFO: renamed from: b, reason: collision with root package name */
    public static final boolean f25883b;

    /* JADX INFO: renamed from: a, reason: collision with root package name */
    public final RenderNode f25884a;

    static {
        f25883b = Build.VERSION.SDK_INT >= 31;
    }

    public BlurTarget(@NonNull Context context) {
        super(context);
        if (f25883b) {
            this.f25884a = a.e();
        }
    }

    @Override // android.view.ViewGroup, android.view.View
    public final void dispatchDraw(Canvas canvas) {
        if (!f25883b || !canvas.isHardwareAccelerated()) {
            super.dispatchDraw(canvas);
            return;
        }
        int width = getWidth();
        int height = getHeight();
        RenderNode renderNode = this.f25884a;
        renderNode.setPosition(0, 0, width, height);
        super.dispatchDraw(renderNode.beginRecording());
        renderNode.endRecording();
        canvas.drawRenderNode(renderNode);
    }

    public BlurTarget(@NonNull Context context, @Nullable AttributeSet attributeSet) {
        super(context, attributeSet);
        if (f25883b) {
            this.f25884a = a.e();
        }
    }

    public BlurTarget(@NonNull Context context, @Nullable AttributeSet attributeSet, int i10) {
        super(context, attributeSet, i10);
        if (f25883b) {
            this.f25884a = a.e();
        }
    }

    @RequiresApi(api = 21)
    public BlurTarget(@NonNull Context context, @Nullable AttributeSet attributeSet, int i10, int i11) {
        super(context, attributeSet, i10, i11);
        if (f25883b) {
            this.f25884a = a.e();
        }
    }
}
