From 65e7aa56f56097418d617663683544c25b3988ea Mon Sep 17 00:00:00 2001 From: Jason Sams Date: Thu, 24 Sep 2009 17:38:20 -0700 Subject: Implement pause/resume for the RS thread. --- libs/rs/rsContext.cpp | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) (limited to 'libs/rs/rsContext.cpp') diff --git a/libs/rs/rsContext.cpp b/libs/rs/rsContext.cpp index e3236c4b921d..2fe762c3df30 100644 --- a/libs/rs/rsContext.cpp +++ b/libs/rs/rsContext.cpp @@ -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); } @@ -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; @@ -328,6 +329,7 @@ Context::~Context() { LOGV("Context::~Context"); mExit = true; + mPaused = false; void *res; mIO.shutdown(); @@ -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); @@ -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(); +} + } } -- cgit v1.2.3-59-g8ed1b