diff options
author | Jason Sams <rjsams@android.com> | 2009-06-05 17:35:09 -0700 |
---|---|---|
committer | Jason Sams <rjsams@android.com> | 2009-06-05 17:35:09 -0700 |
commit | 1f52633fefd1862451e6a30209d590680d02beec (patch) | |
tree | c38300ae9a92e4bfff5db0da26525410256d75c7 /rsScriptC.cpp | |
parent | 81e6fd5a9a74f453b452f03d2fad704a7b00d8aa (diff) | |
download | rs-1f52633fefd1862451e6a30209d590680d02beec.tar.gz |
Move call to compiler from jni to core library code.
Diffstat (limited to 'rsScriptC.cpp')
-rw-r--r-- | rsScriptC.cpp | 30 |
1 files changed, 29 insertions, 1 deletions
diff --git a/rsScriptC.cpp b/rsScriptC.cpp index 36019aba..be0191b0 100644 --- a/rsScriptC.cpp +++ b/rsScriptC.cpp @@ -28,6 +28,8 @@ ScriptC::ScriptC() { mAccScript = NULL; mScript = NULL; + mScriptText = NULL; + mScriptTextLength = 0; } ScriptC::~ScriptC() @@ -418,6 +420,21 @@ void ScriptCState::clear() mScript = NULL; mIsRoot = false; mIsOrtho = true; + mScriptText = NULL; + mScriptTextLength = 0; +} + +void ScriptCState::runCompiler() +{ + mAccScript = accCreateScript(); + + LOGE("Compiler 1"); + const char* scriptSource[] = {mScriptText}; + int scriptLength[] = {mScriptTextLength} ; + accScriptSource(mAccScript, 1, scriptSource, scriptLength); + accCompileScript(mAccScript); + accGetScriptLabel(mAccScript, "main", (ACCvoid**) &mScript); + LOGE("Compiler 1"); } namespace android { @@ -475,10 +492,20 @@ void rsi_ScriptCSetOrtho(Context * rsc, bool isOrtho) ss->mIsOrtho = isOrtho; } +void rsi_ScriptCSetText(Context *rsc, const char *text, uint32_t len) +{ + ScriptCState *ss = &rsc->mScriptC; + ss->mScriptText = text; + ss->mScriptTextLength = len; +} + + RsScript rsi_ScriptCCreate(Context * rsc) { ScriptCState *ss = &rsc->mScriptC; + ss->runCompiler(); + ScriptC *s = new ScriptC(); s->mAccScript = ss->mAccScript; ss->mAccScript = NULL; @@ -491,7 +518,8 @@ RsScript rsi_ScriptCCreate(Context * rsc) s->mClearStencil = ss->mClearStencil; s->mIsRoot = ss->mIsRoot; s->mIsOrtho = ss->mIsOrtho; - + s->mScriptText = ss->mScriptText; + s->mScriptTextLength = ss->mScriptTextLength; return s; } |