.class public Lcom/via/gpuimage/GPUImageView; .super Landroid/widget/FrameLayout; .source "GPUImageView.java" # annotations .annotation system Ldalvik/annotation/MemberClasses; value = { Lcom/via/gpuimage/GPUImageView$OnPictureSavedListener;, Lcom/via/gpuimage/GPUImageView$SaveTask;, Lcom/via/gpuimage/GPUImageView$LoadingView;, Lcom/via/gpuimage/GPUImageView$GPUImageGLSurfaceView;, Lcom/via/gpuimage/GPUImageView$Size; } .end annotation # instance fields .field private mFilter:Lcom/via/gpuimage/GPUImageFilter; .field public mForceSize:Lcom/via/gpuimage/GPUImageView$Size; .field private mGLSurfaceView:Landroid/opengl/GLSurfaceView; .field private mGPUImage:Lcom/via/gpuimage/GPUImage; .field private mRatio:F # direct methods .method public constructor (Landroid/content/Context;)V .locals 2 .prologue const/4 v1, 0x0 .line 34 invoke-direct {p0, p1}, Landroid/widget/FrameLayout;->(Landroid/content/Context;)V .line 30 iput-object v1, p0, Lcom/via/gpuimage/GPUImageView;->mForceSize:Lcom/via/gpuimage/GPUImageView$Size; .line 31 const/4 v0, 0x0 iput v0, p0, Lcom/via/gpuimage/GPUImageView;->mRatio:F .line 35 invoke-direct {p0, p1, v1}, Lcom/via/gpuimage/GPUImageView;->init(Landroid/content/Context;Landroid/util/AttributeSet;)V .line 36 return-void .end method .method public constructor (Landroid/content/Context;Landroid/util/AttributeSet;)V .locals 1 .prologue .line 39 invoke-direct {p0, p1, p2}, Landroid/widget/FrameLayout;->(Landroid/content/Context;Landroid/util/AttributeSet;)V .line 30 const/4 v0, 0x0 iput-object v0, p0, Lcom/via/gpuimage/GPUImageView;->mForceSize:Lcom/via/gpuimage/GPUImageView$Size; .line 31 const/4 v0, 0x0 iput v0, p0, Lcom/via/gpuimage/GPUImageView;->mRatio:F .line 40 invoke-direct {p0, p1, p2}, Lcom/via/gpuimage/GPUImageView;->init(Landroid/content/Context;Landroid/util/AttributeSet;)V .line 41 return-void .end method .method static synthetic access$000(Lcom/via/gpuimage/GPUImageView;)Landroid/opengl/GLSurfaceView; .locals 1 .prologue .line 25 iget-object v0, p0, Lcom/via/gpuimage/GPUImageView;->mGLSurfaceView:Landroid/opengl/GLSurfaceView; return-object v0 .end method .method private init(Landroid/content/Context;Landroid/util/AttributeSet;)V .locals 2 .prologue .line 44 new-instance v0, Lcom/via/gpuimage/GPUImageView$GPUImageGLSurfaceView; invoke-direct {v0, p0, p1, p2}, Lcom/via/gpuimage/GPUImageView$GPUImageGLSurfaceView;->(Lcom/via/gpuimage/GPUImageView;Landroid/content/Context;Landroid/util/AttributeSet;)V iput-object v0, p0, Lcom/via/gpuimage/GPUImageView;->mGLSurfaceView:Landroid/opengl/GLSurfaceView; .line 45 iget-object v0, p0, Lcom/via/gpuimage/GPUImageView;->mGLSurfaceView:Landroid/opengl/GLSurfaceView; invoke-virtual {p0, v0}, Lcom/via/gpuimage/GPUImageView;->addView(Landroid/view/View;)V .line 46 new-instance v0, Lcom/via/gpuimage/GPUImage; invoke-virtual {p0}, Lcom/via/gpuimage/GPUImageView;->getContext()Landroid/content/Context; move-result-object v1 invoke-direct {v0, v1}, Lcom/via/gpuimage/GPUImage;->(Landroid/content/Context;)V iput-object v0, p0, Lcom/via/gpuimage/GPUImageView;->mGPUImage:Lcom/via/gpuimage/GPUImage; .line 47 iget-object v0, p0, Lcom/via/gpuimage/GPUImageView;->mGPUImage:Lcom/via/gpuimage/GPUImage; iget-object v1, p0, Lcom/via/gpuimage/GPUImageView;->mGLSurfaceView:Landroid/opengl/GLSurfaceView; invoke-virtual {v0, v1}, Lcom/via/gpuimage/GPUImage;->setGLSurfaceView(Landroid/opengl/GLSurfaceView;)V .line 48 return-void .end method # virtual methods .method public capture()Landroid/graphics/Bitmap; .locals 7 .prologue .line 285 new-instance v5, Ljava/util/concurrent/Semaphore; const/4 v0, 0x0 invoke-direct {v5, v0}, Ljava/util/concurrent/Semaphore;->(I)V .line 287 iget-object v0, p0, Lcom/via/gpuimage/GPUImageView;->mGLSurfaceView:Landroid/opengl/GLSurfaceView; invoke-virtual {v0}, Landroid/opengl/GLSurfaceView;->getMeasuredWidth()I move-result v2 .line 288 iget-object v0, p0, Lcom/via/gpuimage/GPUImageView;->mGLSurfaceView:Landroid/opengl/GLSurfaceView; invoke-virtual {v0}, Landroid/opengl/GLSurfaceView;->getMeasuredHeight()I move-result v3 .line 291 mul-int v0, v2, v3 new-array v4, v0, [I .line 292 iget-object v6, p0, Lcom/via/gpuimage/GPUImageView;->mGPUImage:Lcom/via/gpuimage/GPUImage; new-instance v0, Lcom/via/gpuimage/GPUImageView$6; move-object v1, p0 invoke-direct/range {v0 .. v5}, Lcom/via/gpuimage/GPUImageView$6;->(Lcom/via/gpuimage/GPUImageView;II[ILjava/util/concurrent/Semaphore;)V invoke-virtual {v6, v0}, Lcom/via/gpuimage/GPUImage;->runOnGLThread(Ljava/lang/Runnable;)V .line 308 invoke-virtual {p0}, Lcom/via/gpuimage/GPUImageView;->requestRender()V .line 309 invoke-virtual {v5}, Ljava/util/concurrent/Semaphore;->acquire()V .line 311 sget-object v0, Landroid/graphics/Bitmap$Config;->ARGB_8888:Landroid/graphics/Bitmap$Config; invoke-static {v2, v3, v0}, Landroid/graphics/Bitmap;->createBitmap(IILandroid/graphics/Bitmap$Config;)Landroid/graphics/Bitmap; move-result-object v0 .line 312 invoke-static {v4}, Ljava/nio/IntBuffer;->wrap([I)Ljava/nio/IntBuffer; move-result-object v1 invoke-virtual {v0, v1}, Landroid/graphics/Bitmap;->copyPixelsFromBuffer(Ljava/nio/Buffer;)V .line 313 return-object v0 .end method .method public capture(II)Landroid/graphics/Bitmap; .locals 4 .prologue .line 216 invoke-static {}, Landroid/os/Looper;->myLooper()Landroid/os/Looper; move-result-object v0 invoke-static {}, Landroid/os/Looper;->getMainLooper()Landroid/os/Looper; move-result-object v1 if-ne v0, v1, :cond_0 .line 217 new-instance v0, Ljava/lang/IllegalStateException; const-string v1, "Do not call this method from the UI thread!" invoke-direct {v0, v1}, Ljava/lang/IllegalStateException;->(Ljava/lang/String;)V throw v0 .line 220 :cond_0 new-instance v0, Lcom/via/gpuimage/GPUImageView$Size; invoke-direct {v0, p1, p2}, Lcom/via/gpuimage/GPUImageView$Size;->(II)V iput-object v0, p0, Lcom/via/gpuimage/GPUImageView;->mForceSize:Lcom/via/gpuimage/GPUImageView$Size; .line 222 new-instance v0, Ljava/util/concurrent/Semaphore; const/4 v1, 0x0 invoke-direct {v0, v1}, Ljava/util/concurrent/Semaphore;->(I)V .line 225 invoke-virtual {p0}, Lcom/via/gpuimage/GPUImageView;->getViewTreeObserver()Landroid/view/ViewTreeObserver; move-result-object v1 new-instance v2, Lcom/via/gpuimage/GPUImageView$1; invoke-direct {v2, p0, v0}, Lcom/via/gpuimage/GPUImageView$1;->(Lcom/via/gpuimage/GPUImageView;Ljava/util/concurrent/Semaphore;)V invoke-virtual {v1, v2}, Landroid/view/ViewTreeObserver;->addOnGlobalLayoutListener(Landroid/view/ViewTreeObserver$OnGlobalLayoutListener;)V .line 236 new-instance v1, Lcom/via/gpuimage/GPUImageView$2; invoke-direct {v1, p0}, Lcom/via/gpuimage/GPUImageView$2;->(Lcom/via/gpuimage/GPUImageView;)V invoke-virtual {p0, v1}, Lcom/via/gpuimage/GPUImageView;->post(Ljava/lang/Runnable;)Z .line 245 invoke-virtual {v0}, Ljava/util/concurrent/Semaphore;->acquire()V .line 248 iget-object v1, p0, Lcom/via/gpuimage/GPUImageView;->mGPUImage:Lcom/via/gpuimage/GPUImage; new-instance v2, Lcom/via/gpuimage/GPUImageView$3; invoke-direct {v2, p0, v0}, Lcom/via/gpuimage/GPUImageView$3;->(Lcom/via/gpuimage/GPUImageView;Ljava/util/concurrent/Semaphore;)V invoke-virtual {v1, v2}, Lcom/via/gpuimage/GPUImage;->runOnGLThread(Ljava/lang/Runnable;)V .line 254 invoke-virtual {p0}, Lcom/via/gpuimage/GPUImageView;->requestRender()V .line 255 invoke-virtual {v0}, Ljava/util/concurrent/Semaphore;->acquire()V .line 256 invoke-virtual {p0}, Lcom/via/gpuimage/GPUImageView;->capture()Landroid/graphics/Bitmap; move-result-object v0 .line 259 const/4 v1, 0x0 iput-object v1, p0, Lcom/via/gpuimage/GPUImageView;->mForceSize:Lcom/via/gpuimage/GPUImageView$Size; .line 260 new-instance v1, Lcom/via/gpuimage/GPUImageView$4; invoke-direct {v1, p0}, Lcom/via/gpuimage/GPUImageView$4;->(Lcom/via/gpuimage/GPUImageView;)V invoke-virtual {p0, v1}, Lcom/via/gpuimage/GPUImageView;->post(Ljava/lang/Runnable;)Z .line 266 invoke-virtual {p0}, Lcom/via/gpuimage/GPUImageView;->requestRender()V .line 268 new-instance v1, Lcom/via/gpuimage/GPUImageView$5; invoke-direct {v1, p0}, Lcom/via/gpuimage/GPUImageView$5;->(Lcom/via/gpuimage/GPUImageView;)V const-wide/16 v2, 0x12c invoke-virtual {p0, v1, v2, v3}, Lcom/via/gpuimage/GPUImageView;->postDelayed(Ljava/lang/Runnable;J)Z .line 276 return-object v0 .end method .method public getFilter()Lcom/via/gpuimage/GPUImageFilter; .locals 1 .prologue .line 137 iget-object v0, p0, Lcom/via/gpuimage/GPUImageView;->mFilter:Lcom/via/gpuimage/GPUImageFilter; return-object v0 .end method .method public getGPUImage()Lcom/via/gpuimage/GPUImage; .locals 1 .prologue .line 80 iget-object v0, p0, Lcom/via/gpuimage/GPUImageView;->mGPUImage:Lcom/via/gpuimage/GPUImage; return-object v0 .end method .method protected onMeasure(II)V .locals 5 .prologue const/high16 v4, 0x40000000 # 2.0f .line 52 iget v0, p0, Lcom/via/gpuimage/GPUImageView;->mRatio:F const/4 v1, 0x0 cmpl-float v0, v0, v1 if-eqz v0, :cond_1 .line 53 invoke-static {p1}, Landroid/view/View$MeasureSpec;->getSize(I)I move-result v0 .line 54 invoke-static {p2}, Landroid/view/View$MeasureSpec;->getSize(I)I move-result v1 .line 58 int-to-float v2, v0 iget v3, p0, Lcom/via/gpuimage/GPUImageView;->mRatio:F div-float/2addr v2, v3 int-to-float v3, v1 cmpg-float v2, v2, v3 if-gez v2, :cond_0 .line 60 int-to-float v1, v0 iget v2, p0, Lcom/via/gpuimage/GPUImageView;->mRatio:F div-float/2addr v1, v2 invoke-static {v1}, Ljava/lang/Math;->round(F)I move-result v1 .line 66 :goto_0 invoke-static {v0, v4}, Landroid/view/View$MeasureSpec;->makeMeasureSpec(II)I move-result v0 .line 67 invoke-static {v1, v4}, Landroid/view/View$MeasureSpec;->makeMeasureSpec(II)I move-result v1 .line 68 invoke-super {p0, v0, v1}, Landroid/widget/FrameLayout;->onMeasure(II)V .line 72 :goto_1 return-void .line 63 :cond_0 int-to-float v0, v1 iget v2, p0, Lcom/via/gpuimage/GPUImageView;->mRatio:F mul-float/2addr v0, v2 invoke-static {v0}, Ljava/lang/Math;->round(F)I move-result v0 goto :goto_0 .line 70 :cond_1 invoke-super {p0, p1, p2}, Landroid/widget/FrameLayout;->onMeasure(II)V goto :goto_1 .end method .method public onPause()V .locals 1 .prologue .line 320 iget-object v0, p0, Lcom/via/gpuimage/GPUImageView;->mGLSurfaceView:Landroid/opengl/GLSurfaceView; invoke-virtual {v0}, Landroid/opengl/GLSurfaceView;->onPause()V .line 321 return-void .end method .method public onResume()V .locals 1 .prologue .line 327 iget-object v0, p0, Lcom/via/gpuimage/GPUImageView;->mGLSurfaceView:Landroid/opengl/GLSurfaceView; invoke-virtual {v0}, Landroid/opengl/GLSurfaceView;->onResume()V .line 328 return-void .end method .method public requestRender()V .locals 1 .prologue .line 168 iget-object v0, p0, Lcom/via/gpuimage/GPUImageView;->mGLSurfaceView:Landroid/opengl/GLSurfaceView; invoke-virtual {v0}, Landroid/opengl/GLSurfaceView;->requestRender()V .line 169 return-void .end method .method public saveToPictures(Ljava/lang/String;Ljava/lang/String;IILcom/via/gpuimage/GPUImageView$OnPictureSavedListener;)V .locals 7 .prologue .line 203 new-instance v0, Lcom/via/gpuimage/GPUImageView$SaveTask; move-object v1, p0 move-object v2, p1 move-object v3, p2 move v4, p3 move v5, p4 move-object v6, p5 invoke-direct/range {v0 .. v6}, Lcom/via/gpuimage/GPUImageView$SaveTask;->(Lcom/via/gpuimage/GPUImageView;Ljava/lang/String;Ljava/lang/String;IILcom/via/gpuimage/GPUImageView$OnPictureSavedListener;)V const/4 v1, 0x0 new-array v1, v1, [Ljava/lang/Void; invoke-virtual {v0, v1}, Lcom/via/gpuimage/GPUImageView$SaveTask;->execute([Ljava/lang/Object;)Landroid/os/AsyncTask; .line 204 return-void .end method .method public saveToPictures(Ljava/lang/String;Ljava/lang/String;Lcom/via/gpuimage/GPUImageView$OnPictureSavedListener;)V .locals 2 .prologue .line 184 new-instance v0, Lcom/via/gpuimage/GPUImageView$SaveTask; invoke-direct {v0, p0, p1, p2, p3}, Lcom/via/gpuimage/GPUImageView$SaveTask;->(Lcom/via/gpuimage/GPUImageView;Ljava/lang/String;Ljava/lang/String;Lcom/via/gpuimage/GPUImageView$OnPictureSavedListener;)V const/4 v1, 0x0 new-array v1, v1, [Ljava/lang/Void; invoke-virtual {v0, v1}, Lcom/via/gpuimage/GPUImageView$SaveTask;->execute([Ljava/lang/Object;)Landroid/os/AsyncTask; .line 185 return-void .end method .method public setBackgroundColor(FFF)V .locals 1 .prologue .line 91 iget-object v0, p0, Lcom/via/gpuimage/GPUImageView;->mGPUImage:Lcom/via/gpuimage/GPUImage; invoke-virtual {v0, p1, p2, p3}, Lcom/via/gpuimage/GPUImage;->setBackgroundColor(FFF)V .line 92 return-void .end method .method public setFilter(Lcom/via/gpuimage/GPUImageFilter;)V .locals 1 .prologue .line 126 iput-object p1, p0, Lcom/via/gpuimage/GPUImageView;->mFilter:Lcom/via/gpuimage/GPUImageFilter; .line 127 iget-object v0, p0, Lcom/via/gpuimage/GPUImageView;->mGPUImage:Lcom/via/gpuimage/GPUImage; invoke-virtual {v0, p1}, Lcom/via/gpuimage/GPUImage;->setFilter(Lcom/via/gpuimage/GPUImageFilter;)V .line 128 invoke-virtual {p0}, Lcom/via/gpuimage/GPUImageView;->requestRender()V .line 129 return-void .end method .method public setImage(Landroid/graphics/Bitmap;)V .locals 1 .prologue .line 146 iget-object v0, p0, Lcom/via/gpuimage/GPUImageView;->mGPUImage:Lcom/via/gpuimage/GPUImage; invoke-virtual {v0, p1}, Lcom/via/gpuimage/GPUImage;->setImage(Landroid/graphics/Bitmap;)V .line 147 return-void .end method .method public setImage(Landroid/net/Uri;)V .locals 1 .prologue .line 155 iget-object v0, p0, Lcom/via/gpuimage/GPUImageView;->mGPUImage:Lcom/via/gpuimage/GPUImage; invoke-virtual {v0, p1}, Lcom/via/gpuimage/GPUImage;->setImage(Landroid/net/Uri;)V .line 156 return-void .end method .method public setImage(Ljava/io/File;)V .locals 1 .prologue .line 164 iget-object v0, p0, Lcom/via/gpuimage/GPUImageView;->mGPUImage:Lcom/via/gpuimage/GPUImage; invoke-virtual {v0, p1}, Lcom/via/gpuimage/GPUImage;->setImage(Ljava/io/File;)V .line 165 return-void .end method .method public setRatio(F)V .locals 1 .prologue .line 96 iput p1, p0, Lcom/via/gpuimage/GPUImageView;->mRatio:F .line 97 iget-object v0, p0, Lcom/via/gpuimage/GPUImageView;->mGLSurfaceView:Landroid/opengl/GLSurfaceView; invoke-virtual {v0}, Landroid/opengl/GLSurfaceView;->requestLayout()V .line 98 iget-object v0, p0, Lcom/via/gpuimage/GPUImageView;->mGPUImage:Lcom/via/gpuimage/GPUImage; invoke-virtual {v0}, Lcom/via/gpuimage/GPUImage;->deleteImage()V .line 99 return-void .end method .method public setRotation(Lcom/via/gpuimage/Rotation;)V .locals 1 .prologue .line 116 iget-object v0, p0, Lcom/via/gpuimage/GPUImageView;->mGPUImage:Lcom/via/gpuimage/GPUImage; invoke-virtual {v0, p1}, Lcom/via/gpuimage/GPUImage;->setRotation(Lcom/via/gpuimage/Rotation;)V .line 117 invoke-virtual {p0}, Lcom/via/gpuimage/GPUImageView;->requestRender()V .line 118 return-void .end method .method public setScaleType(Lcom/via/gpuimage/GPUImage$ScaleType;)V .locals 1 .prologue .line 107 iget-object v0, p0, Lcom/via/gpuimage/GPUImageView;->mGPUImage:Lcom/via/gpuimage/GPUImage; invoke-virtual {v0, p1}, Lcom/via/gpuimage/GPUImage;->setScaleType(Lcom/via/gpuimage/GPUImage$ScaleType;)V .line 108 return-void .end method