summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--tests/RenderScriptTests/Fountain/src/com/example/android/rs/fountain/FountainView.java13
-rw-r--r--tests/RenderScriptTests/FountainFbo/src/com/example/android/rs/fountainfbo/FountainFboView.java12
2 files changed, 11 insertions, 14 deletions
diff --git a/tests/RenderScriptTests/Fountain/src/com/example/android/rs/fountain/FountainView.java b/tests/RenderScriptTests/Fountain/src/com/example/android/rs/fountain/FountainView.java
index ba09421..98cec55 100644
--- a/tests/RenderScriptTests/Fountain/src/com/example/android/rs/fountain/FountainView.java
+++ b/tests/RenderScriptTests/Fountain/src/com/example/android/rs/fountain/FountainView.java
@@ -20,7 +20,7 @@ import java.io.Writer;
import java.util.ArrayList;
import java.util.concurrent.Semaphore;
-import android.renderscript.RSTextureView;
+import android.renderscript.RSSurfaceView;
import android.renderscript.RenderScript;
import android.renderscript.RenderScriptGL;
@@ -39,7 +39,7 @@ import android.view.SurfaceView;
import android.view.KeyEvent;
import android.view.MotionEvent;
-public class FountainView extends RSTextureView {
+public class FountainView extends RSSurfaceView {
public FountainView(Context context) {
super(context);
@@ -49,13 +49,12 @@ public class FountainView extends RSTextureView {
private RenderScriptGL mRS;
private FountainRS mRender;
- @Override
- protected void onAttachedToWindow() {
- super.onAttachedToWindow();
- android.util.Log.e("rs", "onAttachedToWindow");
+ public void surfaceChanged(SurfaceHolder holder, int format, int w, int h) {
+ super.surfaceChanged(holder, format, w, h);
if (mRS == null) {
RenderScriptGL.SurfaceConfig sc = new RenderScriptGL.SurfaceConfig();
mRS = createRenderScriptGL(sc);
+ mRS.setSurface(holder, w, h);
mRender = new FountainRS();
mRender.init(mRS, getResources());
}
@@ -63,8 +62,6 @@ public class FountainView extends RSTextureView {
@Override
protected void onDetachedFromWindow() {
- super.onDetachedFromWindow();
- android.util.Log.e("rs", "onDetachedFromWindow");
if (mRS != null) {
mRS = null;
destroyRenderScriptGL();
diff --git a/tests/RenderScriptTests/FountainFbo/src/com/example/android/rs/fountainfbo/FountainFboView.java b/tests/RenderScriptTests/FountainFbo/src/com/example/android/rs/fountainfbo/FountainFboView.java
index 6e40da3..8636717 100644
--- a/tests/RenderScriptTests/FountainFbo/src/com/example/android/rs/fountainfbo/FountainFboView.java
+++ b/tests/RenderScriptTests/FountainFbo/src/com/example/android/rs/fountainfbo/FountainFboView.java
@@ -17,12 +17,13 @@
package com.example.android.rs.fountainfbo;
-import android.renderscript.RSTextureView;
+import android.renderscript.RSSurfaceView;
import android.renderscript.RenderScriptGL;
import android.content.Context;
+import android.view.SurfaceHolder;
import android.view.MotionEvent;
-public class FountainFboView extends RSTextureView {
+public class FountainFboView extends RSSurfaceView {
public FountainFboView(Context context) {
super(context);
@@ -31,13 +32,12 @@ public class FountainFboView extends RSTextureView {
private RenderScriptGL mRS;
private FountainFboRS mRender;
- @Override
- protected void onAttachedToWindow() {
- super.onAttachedToWindow();
- android.util.Log.e("rs", "onAttachedToWindow");
+ public void surfaceChanged(SurfaceHolder holder, int format, int w, int h) {
+ super.surfaceChanged(holder, format, w, h);
if (mRS == null) {
RenderScriptGL.SurfaceConfig sc = new RenderScriptGL.SurfaceConfig();
mRS = createRenderScriptGL(sc);
+ mRS.setSurface(holder, w, h);
mRender = new FountainFboRS();
mRender.init(mRS, getResources());
}