summaryrefslogtreecommitdiff
path: root/libs/rs/rsScript.cpp
diff options
context:
space:
mode:
authorAlex Sakhartchouk <alexst@google.com>2010-10-08 15:00:05 -0700
committerAlex Sakhartchouk <alexst@google.com>2010-10-08 15:00:05 -0700
commit6f91cb6af7a8b20e3e001f90406e27f4580a1ccd (patch)
tree38b8d6feb2db2e9600205e5851ee69c62bcad585 /libs/rs/rsScript.cpp
parent026284745bb2f84e96fe132071f48a8cd4c1e715 (diff)
Removing fixed size arrays.
Change-Id: I5c65b29a197013de2517cfb6dbe7abb9e24a688b
Diffstat (limited to 'libs/rs/rsScript.cpp')
-rw-r--r--libs/rs/rsScript.cpp38
1 files changed, 28 insertions, 10 deletions
diff --git a/libs/rs/rsScript.cpp b/libs/rs/rsScript.cpp
index 43bb09e14204..0e76daef1c27 100644
--- a/libs/rs/rsScript.cpp
+++ b/libs/rs/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);