diff options
author | Alex Sakhartchouk <alexst@google.com> | 2010-11-09 17:00:54 -0800 |
---|---|---|
committer | Alex Sakhartchouk <alexst@google.com> | 2010-11-10 11:30:51 -0800 |
commit | ed9f210568082dd6d1d8a0c92c693d574d87d545 (patch) | |
tree | d1b9a5c7862ac078064946a122dd89f05d88f38b /libs/rs/rsScript.cpp | |
parent | c65347f239e0adae4fe9fad5248b69a5a6d3bbe8 (diff) | |
download | frameworks_base-ed9f210568082dd6d1d8a0c92c693d574d87d545.zip frameworks_base-ed9f210568082dd6d1d8a0c92c693d574d87d545.tar.gz frameworks_base-ed9f210568082dd6d1d8a0c92c693d574d87d545.tar.bz2 |
Code cleanup to make formatting consistent
across all the renderscript files.
Change-Id: Idf5fcc60877e44c8f074f7176e37f70b3b895a3c
Diffstat (limited to 'libs/rs/rsScript.cpp')
-rw-r--r-- | libs/rs/rsScript.cpp | 49 |
1 files changed, 17 insertions, 32 deletions
diff --git a/libs/rs/rsScript.cpp b/libs/rs/rsScript.cpp index ef380d2..4ffdbfd 100644 --- a/libs/rs/rsScript.cpp +++ b/libs/rs/rsScript.cpp @@ -19,35 +19,33 @@ using namespace android; using namespace android::renderscript; -Script::Script(Context *rsc) : ObjectBase(rsc) -{ +Script::Script(Context *rsc) : ObjectBase(rsc) { memset(&mEnviroment, 0, sizeof(mEnviroment)); mSlots = NULL; mTypes = NULL; } -Script::~Script() -{ - if(mSlots) { +Script::~Script() { + if (mSlots) { delete [] mSlots; mSlots = NULL; } - if(mTypes) { + if (mTypes) { delete [] mTypes; mTypes = NULL; } } void Script::initSlots() { - if(mEnviroment.mFieldCount > 0) { + 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) { + if (slot >= mEnviroment.mFieldCount) { LOGE("Script::setSlot unable to set allocation, invalid slot index"); return; } @@ -55,8 +53,7 @@ void Script::setSlot(uint32_t slot, Allocation *a) { mSlots[slot].set(a); } -void Script::setVar(uint32_t slot, const void *val, uint32_t len) -{ +void Script::setVar(uint32_t slot, const void *val, uint32_t len) { int32_t *destPtr = ((int32_t **)mEnviroment.mFieldAddress)[slot]; if (destPtr) { //LOGE("setVar f1 %f", ((const float *)destPtr)[0]); @@ -73,72 +70,60 @@ void Script::setVar(uint32_t slot, const void *val, uint32_t len) namespace android { namespace renderscript { - -void rsi_ScriptBindAllocation(Context * rsc, RsScript vs, RsAllocation va, uint32_t slot) -{ +void rsi_ScriptBindAllocation(Context * rsc, RsScript vs, RsAllocation va, uint32_t slot) { Script *s = static_cast<Script *>(vs); Allocation *a = static_cast<Allocation *>(va); s->setSlot(slot, a); //LOGE("rsi_ScriptBindAllocation %i %p %p", slot, a, a->getPtr()); } -void rsi_ScriptSetTimeZone(Context * rsc, RsScript vs, const char * timeZone, uint32_t length) -{ +void rsi_ScriptSetTimeZone(Context * rsc, RsScript vs, const char * timeZone, uint32_t length) { Script *s = static_cast<Script *>(vs); s->mEnviroment.mTimeZone = timeZone; } -void rsi_ScriptInvoke(Context *rsc, RsScript vs, uint32_t slot) -{ +void rsi_ScriptInvoke(Context *rsc, RsScript vs, uint32_t slot) { Script *s = static_cast<Script *>(vs); s->Invoke(rsc, slot, NULL, 0); } -void rsi_ScriptInvokeData(Context *rsc, RsScript vs, uint32_t slot, void *data) -{ +void rsi_ScriptInvokeData(Context *rsc, RsScript vs, uint32_t slot, void *data) { Script *s = static_cast<Script *>(vs); s->Invoke(rsc, slot, NULL, 0); } -void rsi_ScriptInvokeV(Context *rsc, RsScript vs, uint32_t slot, const void *data, uint32_t len) -{ +void rsi_ScriptInvokeV(Context *rsc, RsScript vs, uint32_t slot, const void *data, uint32_t len) { Script *s = static_cast<Script *>(vs); s->Invoke(rsc, slot, data, len); } -void rsi_ScriptSetVarI(Context *rsc, RsScript vs, uint32_t slot, int value) -{ +void rsi_ScriptSetVarI(Context *rsc, RsScript vs, uint32_t slot, int value) { Script *s = static_cast<Script *>(vs); s->setVar(slot, &value, sizeof(value)); } -void rsi_ScriptSetVarJ(Context *rsc, RsScript vs, uint32_t slot, long long value) -{ +void rsi_ScriptSetVarJ(Context *rsc, RsScript vs, uint32_t slot, long long value) { Script *s = static_cast<Script *>(vs); s->setVar(slot, &value, sizeof(value)); } -void rsi_ScriptSetVarF(Context *rsc, RsScript vs, uint32_t slot, float value) -{ +void rsi_ScriptSetVarF(Context *rsc, RsScript vs, uint32_t slot, float value) { Script *s = static_cast<Script *>(vs); s->setVar(slot, &value, sizeof(value)); } -void rsi_ScriptSetVarD(Context *rsc, RsScript vs, uint32_t slot, double value) -{ +void rsi_ScriptSetVarD(Context *rsc, RsScript vs, uint32_t slot, double value) { Script *s = static_cast<Script *>(vs); s->setVar(slot, &value, sizeof(value)); } -void rsi_ScriptSetVarV(Context *rsc, RsScript vs, uint32_t slot, const void *data, uint32_t len) -{ +void rsi_ScriptSetVarV(Context *rsc, RsScript vs, uint32_t slot, const void *data, uint32_t len) { const float *fp = (const float *)data; Script *s = static_cast<Script *>(vs); s->setVar(slot, data, len); } - } } |