diff options
| author | 2009-05-28 15:53:04 -0700 | |
|---|---|---|
| committer | 2009-05-28 15:53:04 -0700 | |
| commit | ec5a20bf2b9f563f9f6a4bde4d8cbbe13598fd25 (patch) | |
| tree | 7a49a0bb4499496085cae228d92e4725e4f93143 /libs/rs/rsScriptC.cpp | |
| parent | 63975dde40e4ee8fd08225741b31d54eff115104 (diff) | |
Delete the acc script when deleting the Renderscript rsScriptC object.
Previously we had been leaking the ACCscript object.
Diffstat (limited to 'libs/rs/rsScriptC.cpp')
| -rw-r--r-- | libs/rs/rsScriptC.cpp | 15 | 
1 files changed, 14 insertions, 1 deletions
diff --git a/libs/rs/rsScriptC.cpp b/libs/rs/rsScriptC.cpp index 60339ecdc2d8..2c7d88415f5c 100644 --- a/libs/rs/rsScriptC.cpp +++ b/libs/rs/rsScriptC.cpp @@ -18,17 +18,23 @@  #include "rsScriptC.h"  #include "rsMatrix.h" +#include "acc/acc.h" +  using namespace android;  using namespace android::renderscript;  ScriptC::ScriptC()  { +    mAccScript = NULL;      mScript = NULL;  }  ScriptC::~ScriptC()  { +    if (mAccScript) { +        accDeleteScript(mAccScript); +    }  }  extern "C" void matrixLoadIdentity(void *con, rsc_Matrix *mat) @@ -394,6 +400,9 @@ ScriptCState::ScriptCState()  ScriptCState::~ScriptCState()  { +    if (mAccScript) { +        accDeleteScript(mAccScript); +    }  }  void ScriptCState::clear() @@ -405,6 +414,7 @@ void ScriptCState::clear()      mClearColor[3] = 1;      mClearDepth = 1;      mClearStencil = 0; +    mAccScript = NULL;      mScript = NULL;      mIsRoot = false;      mIsOrtho = true; @@ -446,9 +456,10 @@ void rsi_ScriptCAddType(Context * rsc, RsType vt)      ss->mConstantBufferTypes.add(static_cast<const Type *>(vt));  } -void rsi_ScriptCSetScript(Context * rsc, void *vp) +void rsi_ScriptCSetScript(Context * rsc, void* accScript, void *vp)  {      ScriptCState *ss = &rsc->mScriptC; +    ss->mAccScript = reinterpret_cast<ACCscript*>(accScript);      ss->mScript = reinterpret_cast<rsc_RunScript>(vp);  } @@ -469,6 +480,8 @@ RsScript rsi_ScriptCCreate(Context * rsc)      ScriptCState *ss = &rsc->mScriptC;      ScriptC *s = new ScriptC(); +    s->mAccScript = ss->mAccScript; +    ss->mAccScript = NULL;      s->mScript = ss->mScript;      s->mClearColor[0] = ss->mClearColor[0];      s->mClearColor[1] = ss->mClearColor[1];  |