diff options
author | Android (Google) Code Review <android-gerrit@google.com> | 2009-11-17 18:53:07 -0800 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2009-11-17 18:53:07 -0800 |
commit | f5fac58f50eda336cd996b7eda240eee0e423674 (patch) | |
tree | 999130056c3f581f764d9f335d47158a8da71402 /libs/rs | |
parent | 9390931b6ec800a5c670592c9b0f196705ad1817 (diff) | |
parent | d10824dadc658e20ed85cd47fe4364b659a7fe2a (diff) | |
download | frameworks_base-f5fac58f50eda336cd996b7eda240eee0e423674.zip frameworks_base-f5fac58f50eda336cd996b7eda240eee0e423674.tar.gz frameworks_base-f5fac58f50eda336cd996b7eda240eee0e423674.tar.bz2 |
Merge change Id10824da
* changes:
Fix film init
Diffstat (limited to 'libs/rs')
-rw-r--r-- | libs/rs/java/Film/src/com/android/film/FilmView.java | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/libs/rs/java/Film/src/com/android/film/FilmView.java b/libs/rs/java/Film/src/com/android/film/FilmView.java index 1c5b2bc..e40784c 100644 --- a/libs/rs/java/Film/src/com/android/film/FilmView.java +++ b/libs/rs/java/Film/src/com/android/film/FilmView.java @@ -42,19 +42,29 @@ public class FilmView extends RSSurfaceView { public FilmView(Context context) { super(context); - //setFocusable(true); } private RenderScript mRS; private FilmRS mRender; + public void surfaceChanged(SurfaceHolder holder, int format, int w, int h) { super.surfaceChanged(holder, format, w, h); + if (mRS == null) { + mRS = createRenderScript(false); + mRS.contextSetSurface(w, h, holder.getSurface()); + mRender = new FilmRS(); + mRender.init(mRS, getResources(), w, h); + } + } - mRS = createRenderScript(true); - mRender = new FilmRS(); - mRender.init(mRS, getResources(), w, h); + @Override + protected void onDetachedFromWindow() { + if(mRS != null) { + mRS = null; + destroyRenderScript(); + } } @Override |