summaryrefslogtreecommitdiffstats
path: root/graphics/java/android
diff options
context:
space:
mode:
authorJason Sams <rjsams@android.com>2009-11-03 13:58:36 -0800
committerJason Sams <rjsams@android.com>2009-11-03 14:15:28 -0800
commitefd9b6fb2e0f31b50db089352118e5daeb268879 (patch)
tree9b1099e2c01a1d1843093dbd2db74171e39028e9 /graphics/java/android
parent83665194abceeb7681cb7ac49a4b71aa6e96b1b1 (diff)
downloadframeworks_base-efd9b6fb2e0f31b50db089352118e5daeb268879.zip
frameworks_base-efd9b6fb2e0f31b50db089352118e5daeb268879.tar.gz
frameworks_base-efd9b6fb2e0f31b50db089352118e5daeb268879.tar.bz2
Support applications changing the surface attached to the RS.
Diffstat (limited to 'graphics/java/android')
-rw-r--r--graphics/java/android/renderscript/RSSurfaceView.java6
-rw-r--r--graphics/java/android/renderscript/RenderScript.java6
2 files changed, 12 insertions, 0 deletions
diff --git a/graphics/java/android/renderscript/RSSurfaceView.java b/graphics/java/android/renderscript/RSSurfaceView.java
index 53466cc..1bc03ac 100644
--- a/graphics/java/android/renderscript/RSSurfaceView.java
+++ b/graphics/java/android/renderscript/RSSurfaceView.java
@@ -80,6 +80,9 @@ public class RSSurfaceView extends SurfaceView implements SurfaceHolder.Callback
*/
public void surfaceDestroyed(SurfaceHolder holder) {
// Surface will be destroyed when we return
+ if (mRS != null) {
+ mRS.contextSetSurface(null);
+ }
//Log.v(RenderScript.LOG_TAG, "surfaceDestroyed");
}
@@ -88,6 +91,9 @@ public class RSSurfaceView extends SurfaceView implements SurfaceHolder.Callback
* not normally called or subclassed by clients of RSSurfaceView.
*/
public void surfaceChanged(SurfaceHolder holder, int format, int w, int h) {
+ if (mRS != null) {
+ mRS.contextSetSurface(holder.getSurface());
+ }
//Log.v(RenderScript.LOG_TAG, "surfaceChanged");
}
diff --git a/graphics/java/android/renderscript/RenderScript.java b/graphics/java/android/renderscript/RenderScript.java
index 1f2ea38..f1e5af1 100644
--- a/graphics/java/android/renderscript/RenderScript.java
+++ b/graphics/java/android/renderscript/RenderScript.java
@@ -64,6 +64,7 @@ public class RenderScript {
native void nDeviceSetConfig(int dev, int param, int value);
native int nContextCreate(int dev, Surface sur, int ver, boolean useDepth);
native void nContextDestroy(int con);
+ native void nContextSetSurface(Surface sur);
native void nContextBindRootScript(int script);
native void nContextBindSampler(int sampler, int slot);
@@ -276,6 +277,11 @@ public class RenderScript {
mMessageThread.start();
}
+ public void contextSetSurface(Surface sur) {
+ mSurface = sur;
+ nContextSetSurface(mSurface);
+ }
+
public void destroy() {
nContextDeinitToClient();
mMessageThread.mRun = false;