summaryrefslogtreecommitdiff
path: root/graphics/java/android/renderscript/RenderScriptGL.java
diff options
context:
space:
mode:
authorJason Sams <rjsams@android.com>2011-06-20 16:58:04 -0700
committerJason Sams <rjsams@android.com>2011-06-20 16:58:04 -0700
commitfaa32b33b50ad941f631716dd0915e936bdc3ac5 (patch)
tree67bf6410bf4d030c19c0083dbbe60bf3672c80e2 /graphics/java/android/renderscript/RenderScriptGL.java
parent3106a9b7f5c5c6a62d3fa5772d8c2bb41d22c6eb (diff)
First cut at RSTextureView.
Change-Id: I920950f33079b6bb7e48bb8970201ab9737bb021
Diffstat (limited to 'graphics/java/android/renderscript/RenderScriptGL.java')
-rw-r--r--graphics/java/android/renderscript/RenderScriptGL.java28
1 files changed, 22 insertions, 6 deletions
diff --git a/graphics/java/android/renderscript/RenderScriptGL.java b/graphics/java/android/renderscript/RenderScriptGL.java
index 53b6e287ceef..8b14f99b5de6 100644
--- a/graphics/java/android/renderscript/RenderScriptGL.java
+++ b/graphics/java/android/renderscript/RenderScriptGL.java
@@ -22,6 +22,7 @@ import android.content.Context;
import android.graphics.PixelFormat;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
+import android.graphics.SurfaceTexture;
import android.util.Log;
import android.view.Surface;
import android.view.SurfaceHolder;
@@ -35,7 +36,6 @@ import android.view.SurfaceView;
* the screen.
**/
public class RenderScriptGL extends RenderScript {
- private Surface mSurface;
int mWidth;
int mHeight;
@@ -160,7 +160,6 @@ public class RenderScriptGL extends RenderScript {
super(ctx);
mSurfaceConfig = new SurfaceConfig(sc);
- mSurface = null;
mWidth = 0;
mHeight = 0;
mDev = nDeviceCreate();
@@ -189,14 +188,31 @@ public class RenderScriptGL extends RenderScript {
*/
public void setSurface(SurfaceHolder sur, int w, int h) {
validate();
+ Surface s = null;
if (sur != null) {
- mSurface = sur.getSurface();
- } else {
- mSurface = null;
+ s = sur.getSurface();
}
mWidth = w;
mHeight = h;
- nContextSetSurface(w, h, mSurface);
+ nContextSetSurface(w, h, s);
+ }
+
+ /**
+ * Bind an os surface
+ *
+ * @hide
+ *
+ * @param w
+ * @param h
+ * @param sur
+ */
+ public void setSurfaceTexture(SurfaceTexture sur, int w, int h) {
+ validate();
+ //android.util.Log.v("rs", "set surface " + sur + " w=" + w + ", h=" + h);
+
+ mWidth = w;
+ mHeight = h;
+ nContextSetSurfaceTexture(w, h, sur);
}
/**