summaryrefslogtreecommitdiffstats
path: root/src/com/android/gallery3d/ui
diff options
context:
space:
mode:
authorGeorge Mount <mount@google.com>2013-01-07 14:15:10 -0800
committerGeorge Mount <mount@google.com>2013-01-08 07:54:55 -0800
commite4673b2650ffc642afa872458dbf51e1a24b00c8 (patch)
tree5f4fa356b46935a41c9c9008fa0ef599642625ff /src/com/android/gallery3d/ui
parent44333ecb8ebb4ea172a7847731837a88719cea3f (diff)
downloadandroid_packages_apps_Snap-e4673b2650ffc642afa872458dbf51e1a24b00c8.tar.gz
android_packages_apps_Snap-e4673b2650ffc642afa872458dbf51e1a24b00c8.tar.bz2
android_packages_apps_Snap-e4673b2650ffc642afa872458dbf51e1a24b00c8.zip
Instantiate GLCanvas rather than reinitialize current GLCanvas.
GLCanvas was being used as a singleton when it really should allow separate instances for correctness. Change-Id: I650884e843a4a78997b70826f6012ae19b8df549
Diffstat (limited to 'src/com/android/gallery3d/ui')
-rw-r--r--src/com/android/gallery3d/ui/GLRootView.java7
-rw-r--r--src/com/android/gallery3d/ui/GalleryEGLConfigChooser.java3
-rw-r--r--src/com/android/gallery3d/ui/SurfaceTextureScreenNail.java4
3 files changed, 7 insertions, 7 deletions
diff --git a/src/com/android/gallery3d/ui/GLRootView.java b/src/com/android/gallery3d/ui/GLRootView.java
index 755e10733..775e4a518 100644
--- a/src/com/android/gallery3d/ui/GLRootView.java
+++ b/src/com/android/gallery3d/ui/GLRootView.java
@@ -35,6 +35,8 @@ import com.android.gallery3d.common.ApiHelper;
import com.android.gallery3d.common.Utils;
import com.android.gallery3d.glrenderer.BasicTexture;
import com.android.gallery3d.glrenderer.GLCanvas;
+import com.android.gallery3d.glrenderer.GLES11Canvas;
+import com.android.gallery3d.glrenderer.GLES20Canvas;
import com.android.gallery3d.glrenderer.UploadedTexture;
import com.android.gallery3d.util.GalleryUtils;
import com.android.gallery3d.util.MotionEventHelper;
@@ -120,7 +122,7 @@ public class GLRootView extends GLSurfaceView
super(context, attrs);
mFlags |= FLAG_INITIALIZED;
setBackgroundDrawable(null);
- setEGLContextClientVersion(GLCanvas.getEGLContextClientVersion());
+ setEGLContextClientVersion(ApiHelper.HAS_GLES20_REQUIRED ? 2 : 1);
setEGLConfigChooser(mEglConfigChooser);
setRenderer(this);
if (ApiHelper.USE_888_PIXEL_FORMAT) {
@@ -287,8 +289,7 @@ public class GLRootView extends GLSurfaceView
mRenderLock.lock();
try {
mGL = gl;
- mCanvas = GLCanvas.getInstance();
- mCanvas.initialize(gl);
+ mCanvas = ApiHelper.HAS_GLES20_REQUIRED ? new GLES20Canvas() : new GLES11Canvas(gl);
BasicTexture.invalidateAllTextures();
} finally {
mRenderLock.unlock();
diff --git a/src/com/android/gallery3d/ui/GalleryEGLConfigChooser.java b/src/com/android/gallery3d/ui/GalleryEGLConfigChooser.java
index 4cf3edb34..f7673bce5 100644
--- a/src/com/android/gallery3d/ui/GalleryEGLConfigChooser.java
+++ b/src/com/android/gallery3d/ui/GalleryEGLConfigChooser.java
@@ -18,7 +18,6 @@ package com.android.gallery3d.ui;
import android.opengl.GLSurfaceView.EGLConfigChooser;
import com.android.gallery3d.common.ApiHelper;
-import com.android.gallery3d.glrenderer.GLCanvas;
import javax.microedition.khronos.egl.EGL10;
import javax.microedition.khronos.egl.EGLConfig;
@@ -73,7 +72,7 @@ class GalleryEGLConfigChooser implements EGLConfigChooser {
int[] numConfig = new int[1];
int configSpec[];
- if (GLCanvas.getEGLContextClientVersion() == 2) {
+ if (ApiHelper.HAS_GLES20_REQUIRED) {
configSpec = ApiHelper.USE_888_PIXEL_FORMAT ? mConfig2Spec888 : mConfig2Spec565;
} else {
configSpec = ApiHelper.USE_888_PIXEL_FORMAT ? mConfigSpec888 : mConfigSpec565;
diff --git a/src/com/android/gallery3d/ui/SurfaceTextureScreenNail.java b/src/com/android/gallery3d/ui/SurfaceTextureScreenNail.java
index ef8959c9d..18121e63b 100644
--- a/src/com/android/gallery3d/ui/SurfaceTextureScreenNail.java
+++ b/src/com/android/gallery3d/ui/SurfaceTextureScreenNail.java
@@ -42,8 +42,8 @@ public abstract class SurfaceTextureScreenNail implements ScreenNail,
public SurfaceTextureScreenNail() {
}
- public void acquireSurfaceTexture() {
- mExtTexture = new ExtTexture(GL_TEXTURE_EXTERNAL_OES);
+ public void acquireSurfaceTexture(GLCanvas canvas) {
+ mExtTexture = new ExtTexture(canvas, GL_TEXTURE_EXTERNAL_OES);
mExtTexture.setSize(mWidth, mHeight);
mSurfaceTexture = new SurfaceTexture(mExtTexture.getId());
setDefaultBufferSize(mSurfaceTexture, mWidth, mHeight);