BlockGLSurfaceView$EglHelper.smali

.class Lcom/sandboxol/clothes/BlockGLSurfaceView$EglHelper;
.super Ljava/lang/Object;
.source "BlockGLSurfaceView.java"


# annotations
.annotation system Ldalvik/annotation/EnclosingClass;
    value = Lcom/sandboxol/clothes/BlockGLSurfaceView;
.end annotation

.annotation system Ldalvik/annotation/InnerClass;
    accessFlags = 0xa
    name = "EglHelper"
.end annotation


# instance fields
.field mEgl:Ljavax/microedition/khronos/egl/EGL10;

.field mEglConfig:Ljavax/microedition/khronos/egl/EGLConfig;

.field mEglContext:Ljavax/microedition/khronos/egl/EGLContext;

.field mEglDisplay:Ljavax/microedition/khronos/egl/EGLDisplay;

.field mEglSurface:Ljavax/microedition/khronos/egl/EGLSurface;

.field private mGLSurfaceViewWeakRef:Ljava/lang/ref/WeakReference;
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "Ljava/lang/ref/WeakReference<",
            "Lcom/sandboxol/clothes/BlockGLSurfaceView;",
            ">;"
        }
    .end annotation
.end field

.field mHasCurrentContext:Z


# direct methods
.method public constructor <init>(Ljava/lang/ref/WeakReference;)V
    .registers 2
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "(",
            "Ljava/lang/ref/WeakReference<",
            "Lcom/sandboxol/clothes/BlockGLSurfaceView;",
            ">;)V"
        }
    .end annotation

    .line 1
    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    .line 2
    iput-object p1, p0, Lcom/sandboxol/clothes/BlockGLSurfaceView$EglHelper;->mGLSurfaceViewWeakRef:Ljava/lang/ref/WeakReference;

    return-void
.end method

.method private destroySurfaceImp()V
    .registers 5

    .line 1
    iget-object v0, p0, Lcom/sandboxol/clothes/BlockGLSurfaceView$EglHelper;->mEglSurface:Ljavax/microedition/khronos/egl/EGLSurface;

    if-eqz v0, :cond_2e

    sget-object v1, Ljavax/microedition/khronos/egl/EGL10;->EGL_NO_SURFACE:Ljavax/microedition/khronos/egl/EGLSurface;

    if-eq v0, v1, :cond_2e

    .line 2
    iget-object v0, p0, Lcom/sandboxol/clothes/BlockGLSurfaceView$EglHelper;->mEgl:Ljavax/microedition/khronos/egl/EGL10;

    iget-object v2, p0, Lcom/sandboxol/clothes/BlockGLSurfaceView$EglHelper;->mEglDisplay:Ljavax/microedition/khronos/egl/EGLDisplay;

    sget-object v3, Ljavax/microedition/khronos/egl/EGL10;->EGL_NO_CONTEXT:Ljavax/microedition/khronos/egl/EGLContext;

    invoke-interface {v0, v2, v1, v1, v3}, Ljavax/microedition/khronos/egl/EGL10;->eglMakeCurrent(Ljavax/microedition/khronos/egl/EGLDisplay;Ljavax/microedition/khronos/egl/EGLSurface;Ljavax/microedition/khronos/egl/EGLSurface;Ljavax/microedition/khronos/egl/EGLContext;)Z

    .line 3
    iget-object v0, p0, Lcom/sandboxol/clothes/BlockGLSurfaceView$EglHelper;->mGLSurfaceViewWeakRef:Ljava/lang/ref/WeakReference;

    invoke-virtual {v0}, Ljava/lang/ref/WeakReference;->get()Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Lcom/sandboxol/clothes/BlockGLSurfaceView;

    if-eqz v0, :cond_28

    .line 4
    # getter for: Lcom/sandboxol/clothes/BlockGLSurfaceView;->mEGLWindowSurfaceFactory:Lcom/sandboxol/clothes/BlockGLSurfaceView$EGLWindowSurfaceFactory;
    invoke-static {v0}, Lcom/sandboxol/clothes/BlockGLSurfaceView;->access$500(Lcom/sandboxol/clothes/BlockGLSurfaceView;)Lcom/sandboxol/clothes/BlockGLSurfaceView$EGLWindowSurfaceFactory;

    move-result-object v0

    iget-object v1, p0, Lcom/sandboxol/clothes/BlockGLSurfaceView$EglHelper;->mEgl:Ljavax/microedition/khronos/egl/EGL10;

    iget-object v2, p0, Lcom/sandboxol/clothes/BlockGLSurfaceView$EglHelper;->mEglDisplay:Ljavax/microedition/khronos/egl/EGLDisplay;

    iget-object v3, p0, Lcom/sandboxol/clothes/BlockGLSurfaceView$EglHelper;->mEglSurface:Ljavax/microedition/khronos/egl/EGLSurface;

    invoke-interface {v0, v1, v2, v3}, Lcom/sandboxol/clothes/BlockGLSurfaceView$EGLWindowSurfaceFactory;->destroySurface(Ljavax/microedition/khronos/egl/EGL10;Ljavax/microedition/khronos/egl/EGLDisplay;Ljavax/microedition/khronos/egl/EGLSurface;)V

    :cond_28
    const/4 v0, 0x0

    .line 5
    iput-object v0, p0, Lcom/sandboxol/clothes/BlockGLSurfaceView$EglHelper;->mEglSurface:Ljavax/microedition/khronos/egl/EGLSurface;

    const/4 v0, 0x0

    .line 6
    iput-boolean v0, p0, Lcom/sandboxol/clothes/BlockGLSurfaceView$EglHelper;->mHasCurrentContext:Z

    :cond_2e
    return-void
.end method

.method public static formatEglError(Ljava/lang/String;I)Ljava/lang/String;
    .registers 2

    .line 1
    new-instance p1, Ljava/lang/StringBuilder;

    invoke-direct {p1}, Ljava/lang/StringBuilder;-><init>()V

    invoke-virtual {p1, p0}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    const-string p0, " failed: "

    invoke-virtual {p1, p0}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    invoke-virtual {p1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object p0

    return-object p0
.end method

.method public static logEglErrorAsWarning(Ljava/lang/String;Ljava/lang/String;I)V
    .registers 3

    .line 1
    invoke-static {p1, p2}, Lcom/sandboxol/clothes/BlockGLSurfaceView$EglHelper;->formatEglError(Ljava/lang/String;I)Ljava/lang/String;

    move-result-object p1

    invoke-static {p0, p1}, Landroid/util/Log;->w(Ljava/lang/String;Ljava/lang/String;)I

    return-void
.end method

.method private throwEglException(Ljava/lang/String;)V
    .registers 3

    .line 1
    iget-object v0, p0, Lcom/sandboxol/clothes/BlockGLSurfaceView$EglHelper;->mEgl:Ljavax/microedition/khronos/egl/EGL10;

    invoke-interface {v0}, Ljavax/microedition/khronos/egl/EGL10;->eglGetError()I

    move-result v0

    invoke-static {p1, v0}, Lcom/sandboxol/clothes/BlockGLSurfaceView$EglHelper;->throwEglException(Ljava/lang/String;I)V

    const/4 p1, 0x0

    throw p1
.end method

.method public static throwEglException(Ljava/lang/String;I)V
    .registers 2

    .line 2
    invoke-static {p0, p1}, Lcom/sandboxol/clothes/BlockGLSurfaceView$EglHelper;->formatEglError(Ljava/lang/String;I)Ljava/lang/String;

    move-result-object p0

    .line 3
    new-instance p1, Ljava/lang/RuntimeException;

    invoke-direct {p1, p0}, Ljava/lang/RuntimeException;-><init>(Ljava/lang/String;)V

    throw p1
.end method


# virtual methods
.method createGL()Ljavax/microedition/khronos/opengles/GL;
    .registers 7

    .line 1
    iget-object v0, p0, Lcom/sandboxol/clothes/BlockGLSurfaceView$EglHelper;->mEglContext:Ljavax/microedition/khronos/egl/EGLContext;

    invoke-virtual {v0}, Ljavax/microedition/khronos/egl/EGLContext;->getGL()Ljavax/microedition/khronos/opengles/GL;

    move-result-object v0

    .line 2
    iget-object v1, p0, Lcom/sandboxol/clothes/BlockGLSurfaceView$EglHelper;->mGLSurfaceViewWeakRef:Ljava/lang/ref/WeakReference;

    invoke-virtual {v1}, Ljava/lang/ref/WeakReference;->get()Ljava/lang/Object;

    move-result-object v1

    check-cast v1, Lcom/sandboxol/clothes/BlockGLSurfaceView;

    if-eqz v1, :cond_42

    .line 3
    # getter for: Lcom/sandboxol/clothes/BlockGLSurfaceView;->mGLWrapper:Lcom/sandboxol/clothes/BlockGLSurfaceView$GLWrapper;
    invoke-static {v1}, Lcom/sandboxol/clothes/BlockGLSurfaceView;->access$600(Lcom/sandboxol/clothes/BlockGLSurfaceView;)Lcom/sandboxol/clothes/BlockGLSurfaceView$GLWrapper;

    move-result-object v2

    if-eqz v2, :cond_1e

    .line 4
    # getter for: Lcom/sandboxol/clothes/BlockGLSurfaceView;->mGLWrapper:Lcom/sandboxol/clothes/BlockGLSurfaceView$GLWrapper;
    invoke-static {v1}, Lcom/sandboxol/clothes/BlockGLSurfaceView;->access$600(Lcom/sandboxol/clothes/BlockGLSurfaceView;)Lcom/sandboxol/clothes/BlockGLSurfaceView$GLWrapper;

    move-result-object v2

    invoke-interface {v2, v0}, Lcom/sandboxol/clothes/BlockGLSurfaceView$GLWrapper;->wrap(Ljavax/microedition/khronos/opengles/GL;)Ljavax/microedition/khronos/opengles/GL;

    move-result-object v0

    .line 5
    :cond_1e
    # getter for: Lcom/sandboxol/clothes/BlockGLSurfaceView;->mDebugFlags:I
    invoke-static {v1}, Lcom/sandboxol/clothes/BlockGLSurfaceView;->access$700(Lcom/sandboxol/clothes/BlockGLSurfaceView;)I

    move-result v2

    and-int/lit8 v2, v2, 0x3

    if-eqz v2, :cond_42

    const/4 v2, 0x0

    const/4 v3, 0x0

    .line 6
    # getter for: Lcom/sandboxol/clothes/BlockGLSurfaceView;->mDebugFlags:I
    invoke-static {v1}, Lcom/sandboxol/clothes/BlockGLSurfaceView;->access$700(Lcom/sandboxol/clothes/BlockGLSurfaceView;)I

    move-result v4

    const/4 v5, 0x1

    and-int/2addr v4, v5

    if-eqz v4, :cond_31

    const/4 v2, 0x1

    .line 7
    :cond_31
    # getter for: Lcom/sandboxol/clothes/BlockGLSurfaceView;->mDebugFlags:I
    invoke-static {v1}, Lcom/sandboxol/clothes/BlockGLSurfaceView;->access$700(Lcom/sandboxol/clothes/BlockGLSurfaceView;)I

    move-result v1

    and-int/lit8 v1, v1, 0x2

    if-eqz v1, :cond_3e

    .line 8
    new-instance v3, Lcom/sandboxol/clothes/BlockGLSurfaceView$LogWriter;

    invoke-direct {v3}, Lcom/sandboxol/clothes/BlockGLSurfaceView$LogWriter;-><init>()V

    .line 9
    :cond_3e
    invoke-static {v0, v2, v3}, Landroid/opengl/GLDebugHelper;->wrap(Ljavax/microedition/khronos/opengles/GL;ILjava/io/Writer;)Ljavax/microedition/khronos/opengles/GL;

    move-result-object v0

    :cond_42
    return-object v0
.end method

.method public createSurface()Z
    .registers 6

    .line 1
    iget-object v0, p0, Lcom/sandboxol/clothes/BlockGLSurfaceView$EglHelper;->mEgl:Ljavax/microedition/khronos/egl/EGL10;

    if-eqz v0, :cond_81

    .line 2
    iget-object v0, p0, Lcom/sandboxol/clothes/BlockGLSurfaceView$EglHelper;->mEglDisplay:Ljavax/microedition/khronos/egl/EGLDisplay;

    if-eqz v0, :cond_79

    .line 3
    iget-object v0, p0, Lcom/sandboxol/clothes/BlockGLSurfaceView$EglHelper;->mEglConfig:Ljavax/microedition/khronos/egl/EGLConfig;

    if-eqz v0, :cond_71

    .line 4
    invoke-direct {p0}, Lcom/sandboxol/clothes/BlockGLSurfaceView$EglHelper;->destroySurfaceImp()V

    .line 5
    iget-object v0, p0, Lcom/sandboxol/clothes/BlockGLSurfaceView$EglHelper;->mGLSurfaceViewWeakRef:Ljava/lang/ref/WeakReference;

    invoke-virtual {v0}, Ljava/lang/ref/WeakReference;->get()Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Lcom/sandboxol/clothes/BlockGLSurfaceView;

    if-eqz v0, :cond_2e

    .line 6
    # getter for: Lcom/sandboxol/clothes/BlockGLSurfaceView;->mEGLWindowSurfaceFactory:Lcom/sandboxol/clothes/BlockGLSurfaceView$EGLWindowSurfaceFactory;
    invoke-static {v0}, Lcom/sandboxol/clothes/BlockGLSurfaceView;->access$500(Lcom/sandboxol/clothes/BlockGLSurfaceView;)Lcom/sandboxol/clothes/BlockGLSurfaceView$EGLWindowSurfaceFactory;

    move-result-object v1

    iget-object v2, p0, Lcom/sandboxol/clothes/BlockGLSurfaceView$EglHelper;->mEgl:Ljavax/microedition/khronos/egl/EGL10;

    iget-object v3, p0, Lcom/sandboxol/clothes/BlockGLSurfaceView$EglHelper;->mEglDisplay:Ljavax/microedition/khronos/egl/EGLDisplay;

    iget-object v4, p0, Lcom/sandboxol/clothes/BlockGLSurfaceView$EglHelper;->mEglConfig:Ljavax/microedition/khronos/egl/EGLConfig;

    .line 7
    invoke-virtual {v0}, Landroid/view/SurfaceView;->getHolder()Landroid/view/SurfaceHolder;

    move-result-object v0

    .line 8
    invoke-interface {v1, v2, v3, v4, v0}, Lcom/sandboxol/clothes/BlockGLSurfaceView$EGLWindowSurfaceFactory;->createWindowSurface(Ljavax/microedition/khronos/egl/EGL10;Ljavax/microedition/khronos/egl/EGLDisplay;Ljavax/microedition/khronos/egl/EGLConfig;Ljava/lang/Object;)Ljavax/microedition/khronos/egl/EGLSurface;

    move-result-object v0

    iput-object v0, p0, Lcom/sandboxol/clothes/BlockGLSurfaceView$EglHelper;->mEglSurface:Ljavax/microedition/khronos/egl/EGLSurface;

    goto :goto_31

    :cond_2e
    const/4 v0, 0x0

    .line 9
    iput-object v0, p0, Lcom/sandboxol/clothes/BlockGLSurfaceView$EglHelper;->mEglSurface:Ljavax/microedition/khronos/egl/EGLSurface;

    .line 10
    :goto_31
    iget-object v0, p0, Lcom/sandboxol/clothes/BlockGLSurfaceView$EglHelper;->mEglSurface:Ljavax/microedition/khronos/egl/EGLSurface;

    const/4 v1, 0x0

    if-eqz v0, :cond_5f

    sget-object v2, Ljavax/microedition/khronos/egl/EGL10;->EGL_NO_SURFACE:Ljavax/microedition/khronos/egl/EGLSurface;

    if-ne v0, v2, :cond_3b

    goto :goto_5f

    .line 11
    :cond_3b
    iget-object v2, p0, Lcom/sandboxol/clothes/BlockGLSurfaceView$EglHelper;->mEgl:Ljavax/microedition/khronos/egl/EGL10;

    iget-object v3, p0, Lcom/sandboxol/clothes/BlockGLSurfaceView$EglHelper;->mEglDisplay:Ljavax/microedition/khronos/egl/EGLDisplay;

    iget-object v4, p0, Lcom/sandboxol/clothes/BlockGLSurfaceView$EglHelper;->mEglContext:Ljavax/microedition/khronos/egl/EGLContext;

    invoke-interface {v2, v3, v0, v0, v4}, Ljavax/microedition/khronos/egl/EGL10;->eglMakeCurrent(Ljavax/microedition/khronos/egl/EGLDisplay;Ljavax/microedition/khronos/egl/EGLSurface;Ljavax/microedition/khronos/egl/EGLSurface;Ljavax/microedition/khronos/egl/EGLContext;)Z

    move-result v0

    if-nez v0, :cond_55

    .line 12
    iget-object v0, p0, Lcom/sandboxol/clothes/BlockGLSurfaceView$EglHelper;->mEgl:Ljavax/microedition/khronos/egl/EGL10;

    invoke-interface {v0}, Ljavax/microedition/khronos/egl/EGL10;->eglGetError()I

    move-result v0

    const-string v2, "EGLHelper"

    const-string v3, "eglMakeCurrent"

    invoke-static {v2, v3, v0}, Lcom/sandboxol/clothes/BlockGLSurfaceView$EglHelper;->logEglErrorAsWarning(Ljava/lang/String;Ljava/lang/String;I)V

    return v1

    .line 13
    :cond_55
    iget-object v0, p0, Lcom/sandboxol/clothes/BlockGLSurfaceView$EglHelper;->mEglContext:Ljavax/microedition/khronos/egl/EGLContext;

    sget-object v1, Ljavax/microedition/khronos/egl/EGL10;->EGL_NO_CONTEXT:Ljavax/microedition/khronos/egl/EGLContext;

    const/4 v2, 0x1

    if-eq v0, v1, :cond_5e

    .line 14
    iput-boolean v2, p0, Lcom/sandboxol/clothes/BlockGLSurfaceView$EglHelper;->mHasCurrentContext:Z

    :cond_5e
    return v2

    .line 15
    :cond_5f
    :goto_5f
    iget-object v0, p0, Lcom/sandboxol/clothes/BlockGLSurfaceView$EglHelper;->mEgl:Ljavax/microedition/khronos/egl/EGL10;

    invoke-interface {v0}, Ljavax/microedition/khronos/egl/EGL10;->eglGetError()I

    move-result v0

    const/16 v2, 0x300b

    if-ne v0, v2, :cond_70

    const-string v0, "EglHelper"

    const-string v2, "createWindowSurface returned EGL_BAD_NATIVE_WINDOW."

    .line 16
    invoke-static {v0, v2}, Landroid/util/Log;->e(Ljava/lang/String;Ljava/lang/String;)I

    :cond_70
    return v1

    .line 17
    :cond_71
    new-instance v0, Ljava/lang/RuntimeException;

    const-string v1, "mEglConfig not initialized"

    invoke-direct {v0, v1}, Ljava/lang/RuntimeException;-><init>(Ljava/lang/String;)V

    throw v0

    .line 18
    :cond_79
    new-instance v0, Ljava/lang/RuntimeException;

    const-string v1, "eglDisplay not initialized"

    invoke-direct {v0, v1}, Ljava/lang/RuntimeException;-><init>(Ljava/lang/String;)V

    throw v0

    .line 19
    :cond_81
    new-instance v0, Ljava/lang/RuntimeException;

    const-string v1, "egl not initialized"

    invoke-direct {v0, v1}, Ljava/lang/RuntimeException;-><init>(Ljava/lang/String;)V

    throw v0
.end method

.method public destroySurface()V
    .registers 1

    .line 1
    invoke-direct {p0}, Lcom/sandboxol/clothes/BlockGLSurfaceView$EglHelper;->destroySurfaceImp()V

    return-void
.end method

.method public finish()V
    .registers 6

    .line 1
    iget-object v0, p0, Lcom/sandboxol/clothes/BlockGLSurfaceView$EglHelper;->mEglContext:Ljavax/microedition/khronos/egl/EGLContext;

    const/4 v1, 0x0

    if-eqz v0, :cond_1e

    .line 2
    iget-object v0, p0, Lcom/sandboxol/clothes/BlockGLSurfaceView$EglHelper;->mGLSurfaceViewWeakRef:Ljava/lang/ref/WeakReference;

    invoke-virtual {v0}, Ljava/lang/ref/WeakReference;->get()Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Lcom/sandboxol/clothes/BlockGLSurfaceView;

    if-eqz v0, :cond_1c

    .line 3
    # getter for: Lcom/sandboxol/clothes/BlockGLSurfaceView;->mEGLContextFactory:Lcom/sandboxol/clothes/BlockGLSurfaceView$EGLContextFactory;
    invoke-static {v0}, Lcom/sandboxol/clothes/BlockGLSurfaceView;->access$400(Lcom/sandboxol/clothes/BlockGLSurfaceView;)Lcom/sandboxol/clothes/BlockGLSurfaceView$EGLContextFactory;

    move-result-object v0

    iget-object v2, p0, Lcom/sandboxol/clothes/BlockGLSurfaceView$EglHelper;->mEgl:Ljavax/microedition/khronos/egl/EGL10;

    iget-object v3, p0, Lcom/sandboxol/clothes/BlockGLSurfaceView$EglHelper;->mEglDisplay:Ljavax/microedition/khronos/egl/EGLDisplay;

    iget-object v4, p0, Lcom/sandboxol/clothes/BlockGLSurfaceView$EglHelper;->mEglContext:Ljavax/microedition/khronos/egl/EGLContext;

    invoke-interface {v0, v2, v3, v4}, Lcom/sandboxol/clothes/BlockGLSurfaceView$EGLContextFactory;->destroyContext(Ljavax/microedition/khronos/egl/EGL10;Ljavax/microedition/khronos/egl/EGLDisplay;Ljavax/microedition/khronos/egl/EGLContext;)V

    .line 4
    :cond_1c
    iput-object v1, p0, Lcom/sandboxol/clothes/BlockGLSurfaceView$EglHelper;->mEglContext:Ljavax/microedition/khronos/egl/EGLContext;

    .line 5
    :cond_1e
    iget-object v0, p0, Lcom/sandboxol/clothes/BlockGLSurfaceView$EglHelper;->mEglDisplay:Ljavax/microedition/khronos/egl/EGLDisplay;

    if-eqz v0, :cond_29

    .line 6
    iget-object v2, p0, Lcom/sandboxol/clothes/BlockGLSurfaceView$EglHelper;->mEgl:Ljavax/microedition/khronos/egl/EGL10;

    invoke-interface {v2, v0}, Ljavax/microedition/khronos/egl/EGL10;->eglTerminate(Ljavax/microedition/khronos/egl/EGLDisplay;)Z

    .line 7
    iput-object v1, p0, Lcom/sandboxol/clothes/BlockGLSurfaceView$EglHelper;->mEglDisplay:Ljavax/microedition/khronos/egl/EGLDisplay;

    :cond_29
    return-void
.end method

.method public hasCurrentContext()Z
    .registers 2

    .line 1
    iget-boolean v0, p0, Lcom/sandboxol/clothes/BlockGLSurfaceView$EglHelper;->mHasCurrentContext:Z

    return v0
.end method

.method public start()V
    .registers 6

    .line 1
    invoke-static {}, Ljavax/microedition/khronos/egl/EGLContext;->getEGL()Ljavax/microedition/khronos/egl/EGL;

    move-result-object v0

    check-cast v0, Ljavax/microedition/khronos/egl/EGL10;

    iput-object v0, p0, Lcom/sandboxol/clothes/BlockGLSurfaceView$EglHelper;->mEgl:Ljavax/microedition/khronos/egl/EGL10;

    .line 2
    iget-object v0, p0, Lcom/sandboxol/clothes/BlockGLSurfaceView$EglHelper;->mEgl:Ljavax/microedition/khronos/egl/EGL10;

    sget-object v1, Ljavax/microedition/khronos/egl/EGL10;->EGL_DEFAULT_DISPLAY:Ljava/lang/Object;

    invoke-interface {v0, v1}, Ljavax/microedition/khronos/egl/EGL10;->eglGetDisplay(Ljava/lang/Object;)Ljavax/microedition/khronos/egl/EGLDisplay;

    move-result-object v0

    iput-object v0, p0, Lcom/sandboxol/clothes/BlockGLSurfaceView$EglHelper;->mEglDisplay:Ljavax/microedition/khronos/egl/EGLDisplay;

    .line 3
    iget-object v0, p0, Lcom/sandboxol/clothes/BlockGLSurfaceView$EglHelper;->mEglDisplay:Ljavax/microedition/khronos/egl/EGLDisplay;

    sget-object v1, Ljavax/microedition/khronos/egl/EGL10;->EGL_NO_DISPLAY:Ljavax/microedition/khronos/egl/EGLDisplay;

    if-eq v0, v1, :cond_6c

    const/4 v1, 0x2

    .line 4
    new-array v1, v1, [I

    .line 5
    iget-object v2, p0, Lcom/sandboxol/clothes/BlockGLSurfaceView$EglHelper;->mEgl:Ljavax/microedition/khronos/egl/EGL10;

    invoke-interface {v2, v0, v1}, Ljavax/microedition/khronos/egl/EGL10;->eglInitialize(Ljavax/microedition/khronos/egl/EGLDisplay;[I)Z

    move-result v0

    if-eqz v0, :cond_64

    .line 6
    iget-object v0, p0, Lcom/sandboxol/clothes/BlockGLSurfaceView$EglHelper;->mGLSurfaceViewWeakRef:Ljava/lang/ref/WeakReference;

    invoke-virtual {v0}, Ljava/lang/ref/WeakReference;->get()Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Lcom/sandboxol/clothes/BlockGLSurfaceView;

    const/4 v1, 0x0

    if-nez v0, :cond_33

    .line 7
    iput-object v1, p0, Lcom/sandboxol/clothes/BlockGLSurfaceView$EglHelper;->mEglConfig:Ljavax/microedition/khronos/egl/EGLConfig;

    .line 8
    iput-object v1, p0, Lcom/sandboxol/clothes/BlockGLSurfaceView$EglHelper;->mEglContext:Ljavax/microedition/khronos/egl/EGLContext;

    goto :goto_51

    .line 9
    :cond_33
    # getter for: Lcom/sandboxol/clothes/BlockGLSurfaceView;->mEGLConfigChooser:Lcom/sandboxol/clothes/BlockGLSurfaceView$EGLConfigChooser;
    invoke-static {v0}, Lcom/sandboxol/clothes/BlockGLSurfaceView;->access$300(Lcom/sandboxol/clothes/BlockGLSurfaceView;)Lcom/sandboxol/clothes/BlockGLSurfaceView$EGLConfigChooser;

    move-result-object v2

    iget-object v3, p0, Lcom/sandboxol/clothes/BlockGLSurfaceView$EglHelper;->mEgl:Ljavax/microedition/khronos/egl/EGL10;

    iget-object v4, p0, Lcom/sandboxol/clothes/BlockGLSurfaceView$EglHelper;->mEglDisplay:Ljavax/microedition/khronos/egl/EGLDisplay;

    invoke-interface {v2, v3, v4}, Lcom/sandboxol/clothes/BlockGLSurfaceView$EGLConfigChooser;->chooseConfig(Ljavax/microedition/khronos/egl/EGL10;Ljavax/microedition/khronos/egl/EGLDisplay;)Ljavax/microedition/khronos/egl/EGLConfig;

    move-result-object v2

    iput-object v2, p0, Lcom/sandboxol/clothes/BlockGLSurfaceView$EglHelper;->mEglConfig:Ljavax/microedition/khronos/egl/EGLConfig;

    .line 10
    # getter for: Lcom/sandboxol/clothes/BlockGLSurfaceView;->mEGLContextFactory:Lcom/sandboxol/clothes/BlockGLSurfaceView$EGLContextFactory;
    invoke-static {v0}, Lcom/sandboxol/clothes/BlockGLSurfaceView;->access$400(Lcom/sandboxol/clothes/BlockGLSurfaceView;)Lcom/sandboxol/clothes/BlockGLSurfaceView$EGLContextFactory;

    move-result-object v0

    iget-object v2, p0, Lcom/sandboxol/clothes/BlockGLSurfaceView$EglHelper;->mEgl:Ljavax/microedition/khronos/egl/EGL10;

    iget-object v3, p0, Lcom/sandboxol/clothes/BlockGLSurfaceView$EglHelper;->mEglDisplay:Ljavax/microedition/khronos/egl/EGLDisplay;

    iget-object v4, p0, Lcom/sandboxol/clothes/BlockGLSurfaceView$EglHelper;->mEglConfig:Ljavax/microedition/khronos/egl/EGLConfig;

    invoke-interface {v0, v2, v3, v4}, Lcom/sandboxol/clothes/BlockGLSurfaceView$EGLContextFactory;->createContext(Ljavax/microedition/khronos/egl/EGL10;Ljavax/microedition/khronos/egl/EGLDisplay;Ljavax/microedition/khronos/egl/EGLConfig;)Ljavax/microedition/khronos/egl/EGLContext;

    move-result-object v0

    iput-object v0, p0, Lcom/sandboxol/clothes/BlockGLSurfaceView$EglHelper;->mEglContext:Ljavax/microedition/khronos/egl/EGLContext;

    .line 11
    :goto_51
    iget-object v0, p0, Lcom/sandboxol/clothes/BlockGLSurfaceView$EglHelper;->mEglContext:Ljavax/microedition/khronos/egl/EGLContext;

    if-eqz v0, :cond_5c

    sget-object v2, Ljavax/microedition/khronos/egl/EGL10;->EGL_NO_CONTEXT:Ljavax/microedition/khronos/egl/EGLContext;

    if-eq v0, v2, :cond_5c

    .line 12
    iput-object v1, p0, Lcom/sandboxol/clothes/BlockGLSurfaceView$EglHelper;->mEglSurface:Ljavax/microedition/khronos/egl/EGLSurface;

    return-void

    .line 13
    :cond_5c
    iput-object v1, p0, Lcom/sandboxol/clothes/BlockGLSurfaceView$EglHelper;->mEglContext:Ljavax/microedition/khronos/egl/EGLContext;

    const-string v0, "createContext"

    .line 14
    invoke-direct {p0, v0}, Lcom/sandboxol/clothes/BlockGLSurfaceView$EglHelper;->throwEglException(Ljava/lang/String;)V

    throw v1

    .line 15
    :cond_64
    new-instance v0, Ljava/lang/RuntimeException;

    const-string v1, "eglInitialize failed"

    invoke-direct {v0, v1}, Ljava/lang/RuntimeException;-><init>(Ljava/lang/String;)V

    throw v0

    .line 16
    :cond_6c
    new-instance v0, Ljava/lang/RuntimeException;

    const-string v1, "eglGetDisplay failed"

    invoke-direct {v0, v1}, Ljava/lang/RuntimeException;-><init>(Ljava/lang/String;)V

    throw v0
.end method

.method public swap()I
    .registers 4

    .line 1
    iget-object v0, p0, Lcom/sandboxol/clothes/BlockGLSurfaceView$EglHelper;->mGLSurfaceViewWeakRef:Ljava/lang/ref/WeakReference;

    invoke-virtual {v0}, Ljava/lang/ref/WeakReference;->get()Ljava/lang/Object;

    move-result-object v0

    if-eqz v0, :cond_2d

    iget-object v0, p0, Lcom/sandboxol/clothes/BlockGLSurfaceView$EglHelper;->mGLSurfaceViewWeakRef:Ljava/lang/ref/WeakReference;

    invoke-virtual {v0}, Ljava/lang/ref/WeakReference;->get()Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Lcom/sandboxol/clothes/BlockGLSurfaceView;

    # getter for: Lcom/sandboxol/clothes/BlockGLSurfaceView;->mDetached:Z
    invoke-static {v0}, Lcom/sandboxol/clothes/BlockGLSurfaceView;->access$800(Lcom/sandboxol/clothes/BlockGLSurfaceView;)Z

    move-result v0

    if-eqz v0, :cond_17

    goto :goto_2d

    .line 2
    :cond_17
    iget-object v0, p0, Lcom/sandboxol/clothes/BlockGLSurfaceView$EglHelper;->mEgl:Ljavax/microedition/khronos/egl/EGL10;

    iget-object v1, p0, Lcom/sandboxol/clothes/BlockGLSurfaceView$EglHelper;->mEglDisplay:Ljavax/microedition/khronos/egl/EGLDisplay;

    iget-object v2, p0, Lcom/sandboxol/clothes/BlockGLSurfaceView$EglHelper;->mEglSurface:Ljavax/microedition/khronos/egl/EGLSurface;

    invoke-interface {v0, v1, v2}, Ljavax/microedition/khronos/egl/EGL10;->eglSwapBuffers(Ljavax/microedition/khronos/egl/EGLDisplay;Ljavax/microedition/khronos/egl/EGLSurface;)Z

    move-result v0

    if-nez v0, :cond_2a

    .line 3
    iget-object v0, p0, Lcom/sandboxol/clothes/BlockGLSurfaceView$EglHelper;->mEgl:Ljavax/microedition/khronos/egl/EGL10;

    invoke-interface {v0}, Ljavax/microedition/khronos/egl/EGL10;->eglGetError()I

    move-result v0

    return v0

    :cond_2a
    const/16 v0, 0x3000

    return v0

    :cond_2d
    :goto_2d
    const/16 v0, 0x3002

    return v0
.end method