Painting$1.smali

.class Lim/tpelyyftgw/ui/components/paint/Painting$1;
.super Ljava/lang/Object;
.source "Painting.java"

# interfaces
.implements Ljava/lang/Runnable;


# annotations
.annotation system Ldalvik/annotation/EnclosingMethod;
    value = Lim/tpelyyftgw/ui/components/paint/Painting;->paintStroke(Lim/tpelyyftgw/ui/components/paint/Path;ZLjava/lang/Runnable;)V
.end annotation

.annotation system Ldalvik/annotation/InnerClass;
    accessFlags = 0x0
    name = null
.end annotation


# instance fields
.field final synthetic this$0:Lim/tpelyyftgw/ui/components/paint/Painting;

.field final synthetic val$action:Ljava/lang/Runnable;

.field final synthetic val$clearBuffer:Z

.field final synthetic val$path:Lim/tpelyyftgw/ui/components/paint/Path;


# direct methods
.method static constructor <clinit>()V
    .registers 1

    return-void
.end method

.method constructor <init>(Lim/tpelyyftgw/ui/components/paint/Painting;Lim/tpelyyftgw/ui/components/paint/Path;ZLjava/lang/Runnable;)V
    .registers 5
    .param p1, "this$0"    # Lim/tpelyyftgw/ui/components/paint/Painting;

    .line 153
    iput-object p1, p0, Lim/tpelyyftgw/ui/components/paint/Painting$1;->this$0:Lim/tpelyyftgw/ui/components/paint/Painting;

    iput-object p2, p0, Lim/tpelyyftgw/ui/components/paint/Painting$1;->val$path:Lim/tpelyyftgw/ui/components/paint/Path;

    iput-boolean p3, p0, Lim/tpelyyftgw/ui/components/paint/Painting$1;->val$clearBuffer:Z

    iput-object p4, p0, Lim/tpelyyftgw/ui/components/paint/Painting$1;->val$action:Ljava/lang/Runnable;

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

    return-void
.end method


# virtual methods
.method public run()V
    .registers 10

    .line 156
    iget-object v0, p0, Lim/tpelyyftgw/ui/components/paint/Painting$1;->this$0:Lim/tpelyyftgw/ui/components/paint/Painting;

    iget-object v1, p0, Lim/tpelyyftgw/ui/components/paint/Painting$1;->val$path:Lim/tpelyyftgw/ui/components/paint/Path;

    # setter for: Lim/tpelyyftgw/ui/components/paint/Painting;->activePath:Lim/tpelyyftgw/ui/components/paint/Path;
    invoke-static {v0, v1}, Lim/tpelyyftgw/ui/components/paint/Painting;->access$002(Lim/tpelyyftgw/ui/components/paint/Painting;Lim/tpelyyftgw/ui/components/paint/Path;)Lim/tpelyyftgw/ui/components/paint/Path;

    .line 158
    const/4 v0, 0x0

    .line 160
    .local v0, "bounds":Landroid/graphics/RectF;
    iget-object v1, p0, Lim/tpelyyftgw/ui/components/paint/Painting$1;->this$0:Lim/tpelyyftgw/ui/components/paint/Painting;

    # invokes: Lim/tpelyyftgw/ui/components/paint/Painting;->getReusableFramebuffer()I
    invoke-static {v1}, Lim/tpelyyftgw/ui/components/paint/Painting;->access$100(Lim/tpelyyftgw/ui/components/paint/Painting;)I

    move-result v1

    const v2, 0x8d40

    invoke-static {v2, v1}, Landroid/opengl/GLES20;->glBindFramebuffer(II)V

    .line 161
    iget-object v1, p0, Lim/tpelyyftgw/ui/components/paint/Painting$1;->this$0:Lim/tpelyyftgw/ui/components/paint/Painting;

    # invokes: Lim/tpelyyftgw/ui/components/paint/Painting;->getPaintTexture()I
    invoke-static {v1}, Lim/tpelyyftgw/ui/components/paint/Painting;->access$200(Lim/tpelyyftgw/ui/components/paint/Painting;)I

    move-result v1

    const/16 v3, 0xde1

    const/4 v4, 0x0

    const v5, 0x8ce0

    invoke-static {v2, v5, v3, v1, v4}, Landroid/opengl/GLES20;->glFramebufferTexture2D(IIIII)V

    .line 163
    invoke-static {}, Lim/tpelyyftgw/ui/components/paint/Utils;->HasGLError()V

    .line 165
    invoke-static {v2}, Landroid/opengl/GLES20;->glCheckFramebufferStatus(I)I

    move-result v1

    .line 166
    .local v1, "status":I
    const v5, 0x8cd5

    if-ne v1, v5, :cond_d5

    .line 167
    iget-object v5, p0, Lim/tpelyyftgw/ui/components/paint/Painting$1;->this$0:Lim/tpelyyftgw/ui/components/paint/Painting;

    # getter for: Lim/tpelyyftgw/ui/components/paint/Painting;->size:Lim/tpelyyftgw/ui/components/Size;
    invoke-static {v5}, Lim/tpelyyftgw/ui/components/paint/Painting;->access$300(Lim/tpelyyftgw/ui/components/paint/Painting;)Lim/tpelyyftgw/ui/components/Size;

    move-result-object v5

    iget v5, v5, Lim/tpelyyftgw/ui/components/Size;->width:F

    float-to-int v5, v5

    iget-object v6, p0, Lim/tpelyyftgw/ui/components/paint/Painting$1;->this$0:Lim/tpelyyftgw/ui/components/paint/Painting;

    # getter for: Lim/tpelyyftgw/ui/components/paint/Painting;->size:Lim/tpelyyftgw/ui/components/Size;
    invoke-static {v6}, Lim/tpelyyftgw/ui/components/paint/Painting;->access$300(Lim/tpelyyftgw/ui/components/paint/Painting;)Lim/tpelyyftgw/ui/components/Size;

    move-result-object v6

    iget v6, v6, Lim/tpelyyftgw/ui/components/Size;->height:F

    float-to-int v6, v6

    invoke-static {v4, v4, v5, v6}, Landroid/opengl/GLES20;->glViewport(IIII)V

    .line 169
    iget-boolean v5, p0, Lim/tpelyyftgw/ui/components/paint/Painting$1;->val$clearBuffer:Z

    if-eqz v5, :cond_51

    .line 170
    const/4 v5, 0x0

    invoke-static {v5, v5, v5, v5}, Landroid/opengl/GLES20;->glClearColor(FFFF)V

    .line 171
    const/16 v5, 0x4000

    invoke-static {v5}, Landroid/opengl/GLES20;->glClear(I)V

    .line 174
    :cond_51
    iget-object v5, p0, Lim/tpelyyftgw/ui/components/paint/Painting$1;->this$0:Lim/tpelyyftgw/ui/components/paint/Painting;

    # getter for: Lim/tpelyyftgw/ui/components/paint/Painting;->shaders:Ljava/util/Map;
    invoke-static {v5}, Lim/tpelyyftgw/ui/components/paint/Painting;->access$400(Lim/tpelyyftgw/ui/components/paint/Painting;)Ljava/util/Map;

    move-result-object v5

    if-nez v5, :cond_5a

    .line 175
    return-void

    .line 177
    :cond_5a
    iget-object v5, p0, Lim/tpelyyftgw/ui/components/paint/Painting$1;->this$0:Lim/tpelyyftgw/ui/components/paint/Painting;

    # getter for: Lim/tpelyyftgw/ui/components/paint/Painting;->shaders:Ljava/util/Map;
    invoke-static {v5}, Lim/tpelyyftgw/ui/components/paint/Painting;->access$400(Lim/tpelyyftgw/ui/components/paint/Painting;)Ljava/util/Map;

    move-result-object v5

    iget-object v6, p0, Lim/tpelyyftgw/ui/components/paint/Painting$1;->this$0:Lim/tpelyyftgw/ui/components/paint/Painting;

    # getter for: Lim/tpelyyftgw/ui/components/paint/Painting;->brush:Lim/tpelyyftgw/ui/components/paint/Brush;
    invoke-static {v6}, Lim/tpelyyftgw/ui/components/paint/Painting;->access$500(Lim/tpelyyftgw/ui/components/paint/Painting;)Lim/tpelyyftgw/ui/components/paint/Brush;

    move-result-object v6

    invoke-interface {v6}, Lim/tpelyyftgw/ui/components/paint/Brush;->isLightSaber()Z

    move-result v6

    if-eqz v6, :cond_6f

    const-string v6, "brushLight"

    goto :goto_71

    :cond_6f
    const-string v6, "brush"

    :goto_71
    invoke-interface {v5, v6}, Ljava/util/Map;->get(Ljava/lang/Object;)Ljava/lang/Object;

    move-result-object v5

    check-cast v5, Lim/tpelyyftgw/ui/components/paint/Shader;

    .line 178
    .local v5, "shader":Lim/tpelyyftgw/ui/components/paint/Shader;
    if-nez v5, :cond_7a

    .line 179
    return-void

    .line 182
    :cond_7a
    iget v6, v5, Lim/tpelyyftgw/ui/components/paint/Shader;->program:I

    invoke-static {v6}, Landroid/opengl/GLES20;->glUseProgram(I)V

    .line 183
    iget-object v6, p0, Lim/tpelyyftgw/ui/components/paint/Painting$1;->this$0:Lim/tpelyyftgw/ui/components/paint/Painting;

    # getter for: Lim/tpelyyftgw/ui/components/paint/Painting;->brushTexture:Lim/tpelyyftgw/ui/components/paint/Texture;
    invoke-static {v6}, Lim/tpelyyftgw/ui/components/paint/Painting;->access$600(Lim/tpelyyftgw/ui/components/paint/Painting;)Lim/tpelyyftgw/ui/components/paint/Texture;

    move-result-object v6

    if-nez v6, :cond_99

    .line 184
    iget-object v6, p0, Lim/tpelyyftgw/ui/components/paint/Painting$1;->this$0:Lim/tpelyyftgw/ui/components/paint/Painting;

    new-instance v7, Lim/tpelyyftgw/ui/components/paint/Texture;

    # getter for: Lim/tpelyyftgw/ui/components/paint/Painting;->brush:Lim/tpelyyftgw/ui/components/paint/Brush;
    invoke-static {v6}, Lim/tpelyyftgw/ui/components/paint/Painting;->access$500(Lim/tpelyyftgw/ui/components/paint/Painting;)Lim/tpelyyftgw/ui/components/paint/Brush;

    move-result-object v8

    invoke-interface {v8}, Lim/tpelyyftgw/ui/components/paint/Brush;->getStamp()Landroid/graphics/Bitmap;

    move-result-object v8

    invoke-direct {v7, v8}, Lim/tpelyyftgw/ui/components/paint/Texture;-><init>(Landroid/graphics/Bitmap;)V

    # setter for: Lim/tpelyyftgw/ui/components/paint/Painting;->brushTexture:Lim/tpelyyftgw/ui/components/paint/Texture;
    invoke-static {v6, v7}, Lim/tpelyyftgw/ui/components/paint/Painting;->access$602(Lim/tpelyyftgw/ui/components/paint/Painting;Lim/tpelyyftgw/ui/components/paint/Texture;)Lim/tpelyyftgw/ui/components/paint/Texture;

    .line 186
    :cond_99
    const v6, 0x84c0

    invoke-static {v6}, Landroid/opengl/GLES20;->glActiveTexture(I)V

    .line 187
    iget-object v6, p0, Lim/tpelyyftgw/ui/components/paint/Painting$1;->this$0:Lim/tpelyyftgw/ui/components/paint/Painting;

    # getter for: Lim/tpelyyftgw/ui/components/paint/Painting;->brushTexture:Lim/tpelyyftgw/ui/components/paint/Texture;
    invoke-static {v6}, Lim/tpelyyftgw/ui/components/paint/Painting;->access$600(Lim/tpelyyftgw/ui/components/paint/Painting;)Lim/tpelyyftgw/ui/components/paint/Texture;

    move-result-object v6

    invoke-virtual {v6}, Lim/tpelyyftgw/ui/components/paint/Texture;->texture()I

    move-result v6

    invoke-static {v3, v6}, Landroid/opengl/GLES20;->glBindTexture(II)V

    .line 188
    const-string v3, "mvpMatrix"

    invoke-virtual {v5, v3}, Lim/tpelyyftgw/ui/components/paint/Shader;->getUniform(Ljava/lang/String;)I

    move-result v3

    const/4 v6, 0x1

    iget-object v7, p0, Lim/tpelyyftgw/ui/components/paint/Painting$1;->this$0:Lim/tpelyyftgw/ui/components/paint/Painting;

    # getter for: Lim/tpelyyftgw/ui/components/paint/Painting;->projection:[F
    invoke-static {v7}, Lim/tpelyyftgw/ui/components/paint/Painting;->access$700(Lim/tpelyyftgw/ui/components/paint/Painting;)[F

    move-result-object v7

    invoke-static {v7}, Ljava/nio/FloatBuffer;->wrap([F)Ljava/nio/FloatBuffer;

    move-result-object v7

    invoke-static {v3, v6, v4, v7}, Landroid/opengl/GLES20;->glUniformMatrix4fv(IIZLjava/nio/FloatBuffer;)V

    .line 189
    const-string v3, "texture"

    invoke-virtual {v5, v3}, Lim/tpelyyftgw/ui/components/paint/Shader;->getUniform(Ljava/lang/String;)I

    move-result v3

    invoke-static {v3, v4}, Landroid/opengl/GLES20;->glUniform1i(II)V

    .line 191
    iget-object v3, p0, Lim/tpelyyftgw/ui/components/paint/Painting$1;->val$path:Lim/tpelyyftgw/ui/components/paint/Path;

    iget-object v6, p0, Lim/tpelyyftgw/ui/components/paint/Painting$1;->this$0:Lim/tpelyyftgw/ui/components/paint/Painting;

    # getter for: Lim/tpelyyftgw/ui/components/paint/Painting;->renderState:Lim/tpelyyftgw/ui/components/paint/RenderState;
    invoke-static {v6}, Lim/tpelyyftgw/ui/components/paint/Painting;->access$800(Lim/tpelyyftgw/ui/components/paint/Painting;)Lim/tpelyyftgw/ui/components/paint/RenderState;

    move-result-object v6

    invoke-static {v3, v6}, Lim/tpelyyftgw/ui/components/paint/Render;->RenderPath(Lim/tpelyyftgw/ui/components/paint/Path;Lim/tpelyyftgw/ui/components/paint/RenderState;)Landroid/graphics/RectF;

    move-result-object v0

    .line 194
    .end local v5    # "shader":Lim/tpelyyftgw/ui/components/paint/Shader;
    :cond_d5
    invoke-static {v2, v4}, Landroid/opengl/GLES20;->glBindFramebuffer(II)V

    .line 196
    iget-object v2, p0, Lim/tpelyyftgw/ui/components/paint/Painting$1;->this$0:Lim/tpelyyftgw/ui/components/paint/Painting;

    # getter for: Lim/tpelyyftgw/ui/components/paint/Painting;->delegate:Lim/tpelyyftgw/ui/components/paint/Painting$PaintingDelegate;
    invoke-static {v2}, Lim/tpelyyftgw/ui/components/paint/Painting;->access$900(Lim/tpelyyftgw/ui/components/paint/Painting;)Lim/tpelyyftgw/ui/components/paint/Painting$PaintingDelegate;

    move-result-object v2

    if-eqz v2, :cond_e9

    .line 197
    iget-object v2, p0, Lim/tpelyyftgw/ui/components/paint/Painting$1;->this$0:Lim/tpelyyftgw/ui/components/paint/Painting;

    # getter for: Lim/tpelyyftgw/ui/components/paint/Painting;->delegate:Lim/tpelyyftgw/ui/components/paint/Painting$PaintingDelegate;
    invoke-static {v2}, Lim/tpelyyftgw/ui/components/paint/Painting;->access$900(Lim/tpelyyftgw/ui/components/paint/Painting;)Lim/tpelyyftgw/ui/components/paint/Painting$PaintingDelegate;

    move-result-object v2

    invoke-interface {v2, v0}, Lim/tpelyyftgw/ui/components/paint/Painting$PaintingDelegate;->contentChanged(Landroid/graphics/RectF;)V

    .line 200
    :cond_e9
    iget-object v2, p0, Lim/tpelyyftgw/ui/components/paint/Painting$1;->this$0:Lim/tpelyyftgw/ui/components/paint/Painting;

    # getter for: Lim/tpelyyftgw/ui/components/paint/Painting;->activeStrokeBounds:Landroid/graphics/RectF;
    invoke-static {v2}, Lim/tpelyyftgw/ui/components/paint/Painting;->access$1000(Lim/tpelyyftgw/ui/components/paint/Painting;)Landroid/graphics/RectF;

    move-result-object v2

    if-eqz v2, :cond_fb

    .line 201
    iget-object v2, p0, Lim/tpelyyftgw/ui/components/paint/Painting$1;->this$0:Lim/tpelyyftgw/ui/components/paint/Painting;

    # getter for: Lim/tpelyyftgw/ui/components/paint/Painting;->activeStrokeBounds:Landroid/graphics/RectF;
    invoke-static {v2}, Lim/tpelyyftgw/ui/components/paint/Painting;->access$1000(Lim/tpelyyftgw/ui/components/paint/Painting;)Landroid/graphics/RectF;

    move-result-object v2

    invoke-virtual {v2, v0}, Landroid/graphics/RectF;->union(Landroid/graphics/RectF;)V

    goto :goto_100

    .line 203
    :cond_fb
    iget-object v2, p0, Lim/tpelyyftgw/ui/components/paint/Painting$1;->this$0:Lim/tpelyyftgw/ui/components/paint/Painting;

    # setter for: Lim/tpelyyftgw/ui/components/paint/Painting;->activeStrokeBounds:Landroid/graphics/RectF;
    invoke-static {v2, v0}, Lim/tpelyyftgw/ui/components/paint/Painting;->access$1002(Lim/tpelyyftgw/ui/components/paint/Painting;Landroid/graphics/RectF;)Landroid/graphics/RectF;

    .line 206
    :goto_100
    iget-object v2, p0, Lim/tpelyyftgw/ui/components/paint/Painting$1;->val$action:Ljava/lang/Runnable;

    if-eqz v2, :cond_107

    .line 207
    invoke-interface {v2}, Ljava/lang/Runnable;->run()V

    .line 209
    :cond_107
    return-void
.end method