summaryrefslogtreecommitdiffstats
path: root/src/com/android/gallery3d/ui
diff options
context:
space:
mode:
authorGeorge Mount <mount@google.com>2013-01-08 10:22:16 -0800
committerAndroid (Google) Code Review <android-gerrit@google.com>2013-01-08 10:22:17 -0800
commitfd091d5c1cbb635f26823efa6295bf0563a2e2a4 (patch)
tree9bce27c430427633b9de1a924cb8e4b36b13c120 /src/com/android/gallery3d/ui
parenta4205e4eab691b402e7a6dc1e913a611b7fdc45f (diff)
parente4673b2650ffc642afa872458dbf51e1a24b00c8 (diff)
downloadandroid_packages_apps_Snap-fd091d5c1cbb635f26823efa6295bf0563a2e2a4.tar.gz
android_packages_apps_Snap-fd091d5c1cbb635f26823efa6295bf0563a2e2a4.tar.bz2
android_packages_apps_Snap-fd091d5c1cbb635f26823efa6295bf0563a2e2a4.zip
Merge "Instantiate GLCanvas rather than reinitialize current GLCanvas." into gb-ub-photos-bryce
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);