summaryrefslogtreecommitdiffstats
path: root/src/com/android/gallery3d/ui
diff options
context:
space:
mode:
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);