diff options
author | George Mount <mount@google.com> | 2012-11-30 15:08:05 -0800 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2012-11-30 15:08:05 -0800 |
commit | 8d26578f8db895dadb7e0e1d7a56c00fa18183ec (patch) | |
tree | 83b8b09301a0ac89aded3951337364d11ec9e81e /src/com/android/gallery3d/ui/RawTexture.java | |
parent | 85ea4b74e2c18576e2d0191eef804c6e2d2e65a7 (diff) | |
parent | 0db6ec1a2d602a48437a48ae47fbca01299fdcea (diff) | |
download | android_packages_apps_Snap-8d26578f8db895dadb7e0e1d7a56c00fa18183ec.tar.gz android_packages_apps_Snap-8d26578f8db895dadb7e0e1d7a56c00fa18183ec.tar.bz2 android_packages_apps_Snap-8d26578f8db895dadb7e0e1d7a56c00fa18183ec.zip |
Merge "Separate GL calls into GLCanvas in preparation for adding GLES2." into gb-ub-photos-bryce
Diffstat (limited to 'src/com/android/gallery3d/ui/RawTexture.java')
-rw-r--r-- | src/com/android/gallery3d/ui/RawTexture.java | 38 |
1 files changed, 4 insertions, 34 deletions
diff --git a/src/com/android/gallery3d/ui/RawTexture.java b/src/com/android/gallery3d/ui/RawTexture.java index 4c0d9d365..e67848f41 100644 --- a/src/com/android/gallery3d/ui/RawTexture.java +++ b/src/com/android/gallery3d/ui/RawTexture.java @@ -17,19 +17,17 @@ package com.android.gallery3d.ui; import javax.microedition.khronos.opengles.GL11; -import javax.microedition.khronos.opengles.GL11Ext; public class RawTexture extends BasicTexture { private static final String TAG = "RawTexture"; - private final static int[] sTextureId = new int[1]; - private final static float[] sCropRect = new float[4]; - private final boolean mOpaque; public RawTexture(int width, int height, boolean opaque) { mOpaque = opaque; setSize(width, height); + GLId glId = GLCanvas.getGLId(); + mId = glId.generateTexture(); } @Override @@ -38,36 +36,8 @@ public class RawTexture extends BasicTexture { } protected void prepare(GLCanvas canvas) { - GL11 gl = canvas.getGLInstance(); - - // Define a vertically flipped crop rectangle for - // OES_draw_texture. - // The four values in sCropRect are: left, bottom, width, and - // height. Negative value of width or height means flip. - sCropRect[0] = 0; - sCropRect[1] = mHeight; - sCropRect[2] = mWidth; - sCropRect[3] = -mHeight; - - // Upload the bitmap to a new texture. - GLId.glGenTextures(1, sTextureId, 0); - gl.glBindTexture(GL11.GL_TEXTURE_2D, sTextureId[0]); - gl.glTexParameterfv(GL11.GL_TEXTURE_2D, - GL11Ext.GL_TEXTURE_CROP_RECT_OES, sCropRect, 0); - gl.glTexParameteri(GL11.GL_TEXTURE_2D, - GL11.GL_TEXTURE_WRAP_S, GL11.GL_CLAMP_TO_EDGE); - gl.glTexParameteri(GL11.GL_TEXTURE_2D, - GL11.GL_TEXTURE_WRAP_T, GL11.GL_CLAMP_TO_EDGE); - gl.glTexParameterf(GL11.GL_TEXTURE_2D, - GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_LINEAR); - gl.glTexParameterf(GL11.GL_TEXTURE_2D, - GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_LINEAR); - - gl.glTexImage2D(GL11.GL_TEXTURE_2D, 0, GL11.GL_RGBA, - getTextureWidth(), getTextureHeight(), - 0, GL11.GL_RGBA, GL11.GL_UNSIGNED_BYTE, null); - - mId = sTextureId[0]; + canvas.setTextureParameters(this); + canvas.initializeTextureSize(this, GL11.GL_RGBA, GL11.GL_UNSIGNED_BYTE); mState = STATE_LOADED; setAssociatedCanvas(canvas); } |