From 6f91cb6af7a8b20e3e001f90406e27f4580a1ccd Mon Sep 17 00:00:00 2001 From: Alex Sakhartchouk Date: Fri, 8 Oct 2010 15:00:05 -0700 Subject: Removing fixed size arrays. Change-Id: I5c65b29a197013de2517cfb6dbe7abb9e24a688b --- libs/rs/rsScript.cpp | 38 ++++++++++++++++++++++++++++---------- 1 file changed, 28 insertions(+), 10 deletions(-) (limited to 'libs/rs/rsScript.cpp') 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[mEnviroment.mFieldCount]; + mTypes = new ObjectBaseRef[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