diff options
author | Alex Sakhartchouk <alexst@google.com> | 2010-10-08 15:00:05 -0700 |
---|---|---|
committer | Alex Sakhartchouk <alexst@google.com> | 2010-10-08 15:00:05 -0700 |
commit | 700ba38f022208686523ab4280c4fc9f102aa273 (patch) | |
tree | 0eade1705f416137ad6b62ebe3957be5d646e7bf /rsScript.cpp | |
parent | 9bb32e1fd75e864071f18ef10976e8ba9fc0e252 (diff) | |
download | rs-700ba38f022208686523ab4280c4fc9f102aa273.tar.gz |
Removing fixed size arrays.
Change-Id: I5c65b29a197013de2517cfb6dbe7abb9e24a688b
Diffstat (limited to 'rsScript.cpp')
-rw-r--r-- | rsScript.cpp | 38 |
1 files changed, 28 insertions, 10 deletions
diff --git a/rsScript.cpp b/rsScript.cpp index 43bb09e1..0e76daef 100644 --- a/rsScript.cpp +++ b/rsScript.cpp @@ -24,10 +24,37 @@ Script::Script(Context *rsc) : ObjectBase(rsc) mAllocFile = __FILE__; mAllocLine = __LINE__; memset(&mEnviroment, 0, sizeof(mEnviroment)); + + mSlots = NULL; + mTypes = NULL; } Script::~Script() { + if(mSlots) { + delete [] mSlots; + mSlots = NULL; + } + if(mTypes) { + delete [] mTypes; + mTypes = NULL; + } +} + +void Script::initSlots() { + if(mEnviroment.mFieldCount > 0) { + mSlots = new ObjectBaseRef<Allocation>[mEnviroment.mFieldCount]; + mTypes = new ObjectBaseRef<const Type>[mEnviroment.mFieldCount]; + } +} + +void Script::setSlot(uint32_t slot, Allocation *a) { + if(slot >= mEnviroment.mFieldCount) { + LOGE("Script::setSlot unable to set allocation, invalid slot index"); + return; + } + + mSlots[slot].set(a); } void Script::setVar(uint32_t slot, const void *val, uint32_t len) @@ -51,7 +78,7 @@ void rsi_ScriptBindAllocation(Context * rsc, RsScript vs, RsAllocation va, uint3 { Script *s = static_cast<Script *>(vs); Allocation *a = static_cast<Allocation *>(va); - s->mSlots[slot].set(a); + s->setSlot(slot, a); //LOGE("rsi_ScriptBindAllocation %i %p %p", slot, a, a->getPtr()); } @@ -61,15 +88,6 @@ void rsi_ScriptSetTimeZone(Context * rsc, RsScript vs, const char * timeZone, ui s->mEnviroment.mTimeZone = timeZone; } -void rsi_ScriptSetType(Context * rsc, RsType vt, uint32_t slot, bool writable, const char *name) -{ - ScriptCState *ss = &rsc->mScriptC; - const Type *t = static_cast<const Type *>(vt); - ss->mConstantBufferTypes[slot].set(t); - ss->mSlotWritable[slot] = writable; - LOGE("rsi_ScriptSetType"); -} - void rsi_ScriptInvoke(Context *rsc, RsScript vs, uint32_t slot) { Script *s = static_cast<Script *>(vs); |