Loading graphics/java/android/renderscript/RSSurfaceView.java +9 −2 Original line number Diff line number Diff line Loading @@ -36,6 +36,7 @@ import android.view.SurfaceView; **/ public class RSSurfaceView extends SurfaceView implements SurfaceHolder.Callback { private SurfaceHolder mSurfaceHolder; private RenderScript mRS; /** * Standard View constructor. In order to render something, you Loading Loading @@ -97,6 +98,9 @@ public class RSSurfaceView extends SurfaceView implements SurfaceHolder.Callback * Must not be called before a renderer has been set. */ public void onPause() { if(mRS != null) { mRS.pause(); } Log.v(RenderScript.LOG_TAG, "onPause"); } Loading @@ -108,6 +112,9 @@ public class RSSurfaceView extends SurfaceView implements SurfaceHolder.Callback * Must not be called before a renderer has been set. */ public void onResume() { if(mRS != null) { mRS.resume(); } Log.v(RenderScript.LOG_TAG, "onResume"); } Loading Loading @@ -138,8 +145,8 @@ public class RSSurfaceView extends SurfaceView implements SurfaceHolder.Callback while ((sur == null) || (mSurfaceHolder == null)) { sur = getHolder().getSurface(); } RenderScript rs = new RenderScript(sur, useDepth, forceSW); return rs; mRS = new RenderScript(sur, useDepth, forceSW); return mRS; } public RenderScript createRenderScript(boolean useDepth) { Loading graphics/java/android/renderscript/RenderScript.java +10 −0 Original line number Diff line number Diff line Loading @@ -73,6 +73,8 @@ public class RenderScript { native void nContextBindProgramRaster(int pr); native void nContextAddDefineI32(String name, int value); native void nContextAddDefineF(String name, float value); native void nContextPause(); native void nContextResume(); native void nAssignName(int obj, byte[] name); native void nObjDestroy(int id); Loading Loading @@ -217,6 +219,14 @@ public class RenderScript { mDev = 0; } void pause() { nContextPause(); } void resume() { nContextResume(); } ////////////////////////////////////////////////////////////////////////////////// // File Loading graphics/jni/android_renderscript_RenderScript.cpp +18 −0 Original line number Diff line number Diff line Loading @@ -178,6 +178,22 @@ nContextDestroy(JNIEnv *_env, jobject _this, jint con) } static void nContextPause(JNIEnv *_env, jobject _this) { RsContext con = (RsContext)(_env->GetIntField(_this, gContextId)); LOG_API("nContextPause, con(%p)", con); rsContextPause(con); } static void nContextResume(JNIEnv *_env, jobject _this) { RsContext con = (RsContext)(_env->GetIntField(_this, gContextId)); LOG_API("nContextResume, con(%p)", con); rsContextResume(con); } static void nElementBegin(JNIEnv *_env, jobject _this) { Loading Loading @@ -1282,6 +1298,8 @@ static JNINativeMethod methods[] = { {"nDeviceSetConfig", "(III)V", (void*)nDeviceSetConfig }, {"nContextCreate", "(ILandroid/view/Surface;IZ)I", (void*)nContextCreate }, {"nContextDestroy", "(I)V", (void*)nContextDestroy }, {"nContextPause", "()V", (void*)nContextPause }, {"nContextResume", "()V", (void*)nContextResume }, {"nAssignName", "(I[B)V", (void*)nAssignName }, {"nObjDestroy", "(I)V", (void*)nObjDestroy }, {"nObjDestroyOOB", "(I)V", (void*)nObjDestroyOOB }, Loading libs/rs/rs.spec +6 −0 Original line number Diff line number Diff line Loading @@ -30,6 +30,12 @@ ContextSetDefineI32 { param int32_t value } ContextPause { } ContextResume { } AssignName { param void *obj param const char *name Loading libs/rs/rsContext.cpp +23 −1 Original line number Diff line number Diff line Loading @@ -251,7 +251,7 @@ void * Context::threadProc(void *vrsc) mDraw &= (rsc->mRootScript.get() != NULL); if (mDraw) { mDraw = rsc->runRootScript(); mDraw = rsc->runRootScript() && !rsc->mPaused; if (rsc->logTimes) { rsc->timerSet(RS_TIMER_CLEAR_SWAP); } Loading Loading @@ -285,6 +285,7 @@ Context::Context(Device *dev, Surface *sur, bool useDepth) mRunning = false; mExit = false; mUseDepth = useDepth; mPaused = false; int status; pthread_attr_t threadAttr; Loading Loading @@ -328,6 +329,7 @@ Context::~Context() { LOGV("Context::~Context"); mExit = true; mPaused = false; void *res; mIO.shutdown(); Loading @@ -342,6 +344,16 @@ Context::~Context() objDestroyOOBDestroy(); } void Context::pause() { mPaused = true; } void Context::resume() { mPaused = false; } void Context::setRootScript(Script *s) { mRootScript.set(s); Loading Loading @@ -578,6 +590,16 @@ void rsi_ContextSetDefineI32(Context *rsc, const char* name, int32_t value) rsc->addFloatDefine(name, value); } void rsi_ContextPause(Context *rsc) { rsc->pause(); } void rsi_ContextResume(Context *rsc) { rsc->resume(); } } } Loading Loading
graphics/java/android/renderscript/RSSurfaceView.java +9 −2 Original line number Diff line number Diff line Loading @@ -36,6 +36,7 @@ import android.view.SurfaceView; **/ public class RSSurfaceView extends SurfaceView implements SurfaceHolder.Callback { private SurfaceHolder mSurfaceHolder; private RenderScript mRS; /** * Standard View constructor. In order to render something, you Loading Loading @@ -97,6 +98,9 @@ public class RSSurfaceView extends SurfaceView implements SurfaceHolder.Callback * Must not be called before a renderer has been set. */ public void onPause() { if(mRS != null) { mRS.pause(); } Log.v(RenderScript.LOG_TAG, "onPause"); } Loading @@ -108,6 +112,9 @@ public class RSSurfaceView extends SurfaceView implements SurfaceHolder.Callback * Must not be called before a renderer has been set. */ public void onResume() { if(mRS != null) { mRS.resume(); } Log.v(RenderScript.LOG_TAG, "onResume"); } Loading Loading @@ -138,8 +145,8 @@ public class RSSurfaceView extends SurfaceView implements SurfaceHolder.Callback while ((sur == null) || (mSurfaceHolder == null)) { sur = getHolder().getSurface(); } RenderScript rs = new RenderScript(sur, useDepth, forceSW); return rs; mRS = new RenderScript(sur, useDepth, forceSW); return mRS; } public RenderScript createRenderScript(boolean useDepth) { Loading
graphics/java/android/renderscript/RenderScript.java +10 −0 Original line number Diff line number Diff line Loading @@ -73,6 +73,8 @@ public class RenderScript { native void nContextBindProgramRaster(int pr); native void nContextAddDefineI32(String name, int value); native void nContextAddDefineF(String name, float value); native void nContextPause(); native void nContextResume(); native void nAssignName(int obj, byte[] name); native void nObjDestroy(int id); Loading Loading @@ -217,6 +219,14 @@ public class RenderScript { mDev = 0; } void pause() { nContextPause(); } void resume() { nContextResume(); } ////////////////////////////////////////////////////////////////////////////////// // File Loading
graphics/jni/android_renderscript_RenderScript.cpp +18 −0 Original line number Diff line number Diff line Loading @@ -178,6 +178,22 @@ nContextDestroy(JNIEnv *_env, jobject _this, jint con) } static void nContextPause(JNIEnv *_env, jobject _this) { RsContext con = (RsContext)(_env->GetIntField(_this, gContextId)); LOG_API("nContextPause, con(%p)", con); rsContextPause(con); } static void nContextResume(JNIEnv *_env, jobject _this) { RsContext con = (RsContext)(_env->GetIntField(_this, gContextId)); LOG_API("nContextResume, con(%p)", con); rsContextResume(con); } static void nElementBegin(JNIEnv *_env, jobject _this) { Loading Loading @@ -1282,6 +1298,8 @@ static JNINativeMethod methods[] = { {"nDeviceSetConfig", "(III)V", (void*)nDeviceSetConfig }, {"nContextCreate", "(ILandroid/view/Surface;IZ)I", (void*)nContextCreate }, {"nContextDestroy", "(I)V", (void*)nContextDestroy }, {"nContextPause", "()V", (void*)nContextPause }, {"nContextResume", "()V", (void*)nContextResume }, {"nAssignName", "(I[B)V", (void*)nAssignName }, {"nObjDestroy", "(I)V", (void*)nObjDestroy }, {"nObjDestroyOOB", "(I)V", (void*)nObjDestroyOOB }, Loading
libs/rs/rs.spec +6 −0 Original line number Diff line number Diff line Loading @@ -30,6 +30,12 @@ ContextSetDefineI32 { param int32_t value } ContextPause { } ContextResume { } AssignName { param void *obj param const char *name Loading
libs/rs/rsContext.cpp +23 −1 Original line number Diff line number Diff line Loading @@ -251,7 +251,7 @@ void * Context::threadProc(void *vrsc) mDraw &= (rsc->mRootScript.get() != NULL); if (mDraw) { mDraw = rsc->runRootScript(); mDraw = rsc->runRootScript() && !rsc->mPaused; if (rsc->logTimes) { rsc->timerSet(RS_TIMER_CLEAR_SWAP); } Loading Loading @@ -285,6 +285,7 @@ Context::Context(Device *dev, Surface *sur, bool useDepth) mRunning = false; mExit = false; mUseDepth = useDepth; mPaused = false; int status; pthread_attr_t threadAttr; Loading Loading @@ -328,6 +329,7 @@ Context::~Context() { LOGV("Context::~Context"); mExit = true; mPaused = false; void *res; mIO.shutdown(); Loading @@ -342,6 +344,16 @@ Context::~Context() objDestroyOOBDestroy(); } void Context::pause() { mPaused = true; } void Context::resume() { mPaused = false; } void Context::setRootScript(Script *s) { mRootScript.set(s); Loading Loading @@ -578,6 +590,16 @@ void rsi_ContextSetDefineI32(Context *rsc, const char* name, int32_t value) rsc->addFloatDefine(name, value); } void rsi_ContextPause(Context *rsc) { rsc->pause(); } void rsi_ContextResume(Context *rsc) { rsc->resume(); } } } Loading