From 39ddc950c9064129ead5de04b200106c0659f937 Mon Sep 17 00:00:00 2001 From: Jason Sams Date: Fri, 5 Jun 2009 17:35:09 -0700 Subject: Move call to compiler from jni to core library code. --- libs/rs/rsScriptC.cpp | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) (limited to 'libs/rs/rsScriptC.cpp') diff --git a/libs/rs/rsScriptC.cpp b/libs/rs/rsScriptC.cpp index 36019abac21e..be0191b05558 100644 --- a/libs/rs/rsScriptC.cpp +++ b/libs/rs/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; } -- cgit v1.2.3-59-g8ed1b