what-the-bank/sources/o/sSl.java

81 lines
2.8 KiB
Java
Raw Normal View History

2024-07-27 18:17:47 +07:00
package o;
import android.opengl.EGL14;
import android.opengl.EGLConfig;
import android.opengl.EGLContext;
import android.opengl.EGLDisplay;
import android.opengl.EGLSurface;
import android.view.Surface;
import java.util.Objects;
/* loaded from: classes.dex */
public final class sSl {
public EGLDisplay a;
private EGLConfig[] b = new EGLConfig[1];
EGLSurface c;
EGLContext d;
Surface e;
private int g;
private int i;
public sSl(Surface surface) {
this.a = EGL14.EGL_NO_DISPLAY;
this.d = EGL14.EGL_NO_CONTEXT;
this.c = EGL14.EGL_NO_SURFACE;
this.e = surface;
EGLDisplay eglGetDisplay = EGL14.eglGetDisplay(0);
this.a = eglGetDisplay;
if (Objects.equals(eglGetDisplay, EGL14.EGL_NO_DISPLAY)) {
throw new RuntimeException("unable to get EGL14 display");
}
int[] iArr = new int[2];
if (!EGL14.eglInitialize(this.a, iArr, 0, iArr, 1)) {
this.a = null;
throw new RuntimeException("unable to initialize EGL14");
}
EGLDisplay eGLDisplay = this.a;
EGLConfig[] eGLConfigArr = this.b;
if (!EGL14.eglChooseConfig(eGLDisplay, new int[]{12324, 8, 12323, 8, 12322, 8, 12352, 4, 12610, 1, 12344}, 0, eGLConfigArr, 0, eGLConfigArr.length, new int[1], 0)) {
throw new RuntimeException("unable to find RGB888+recordable ES2 EGL config");
}
this.d = EGL14.eglCreateContext(this.a, this.b[0], EGL14.EGL_NO_CONTEXT, new int[]{12440, 2, 12344}, 0);
c("eglCreateContext");
if (this.d == null) {
throw new RuntimeException("null context");
}
this.c = EGL14.eglCreateWindowSurface(this.a, this.b[0], this.e, new int[]{12344}, 0);
c("eglCreateWindowSurface");
EGLSurface eGLSurface = this.c;
if (eGLSurface != null) {
int[] iArr2 = new int[1];
EGL14.eglQuerySurface(this.a, eGLSurface, 12375, iArr2, 0);
this.g = iArr2[0];
int[] iArr3 = new int[1];
EGL14.eglQuerySurface(this.a, this.c, 12374, iArr3, 0);
this.i = iArr3[0];
return;
}
throw new RuntimeException("surface was null");
}
public final void c() {
EGLDisplay eGLDisplay = this.a;
EGLSurface eGLSurface = this.c;
if (!EGL14.eglMakeCurrent(eGLDisplay, eGLSurface, eGLSurface, this.d)) {
throw new RuntimeException("eglMakeCurrent failed");
}
}
private static void c(String str) {
int eglGetError = EGL14.eglGetError();
if (eglGetError == 12288) {
return;
}
StringBuilder sb = new StringBuilder();
sb.append(str);
sb.append(": EGL error: 0x");
sb.append(Integer.toHexString(eglGetError));
throw new RuntimeException(sb.toString());
}
}