summaryrefslogtreecommitdiffstats
path: root/libs/rs
diff options
context:
space:
mode:
authorJason Sams <rjsams@android.com>2009-08-18 14:14:24 -0700
committerJason Sams <rjsams@android.com>2009-08-18 14:20:07 -0700
commit7ce033d797e5df5e2131e2ed459fba181eaf4658 (patch)
treec4bf9fd7d74260b800b75786a2adbca04d2f71be /libs/rs
parent48134b78d53eca2a0a71799b0901aba5997f2eba (diff)
downloadframeworks_base-7ce033d797e5df5e2131e2ed459fba181eaf4658.zip
frameworks_base-7ce033d797e5df5e2131e2ed459fba181eaf4658.tar.gz
frameworks_base-7ce033d797e5df5e2131e2ed459fba181eaf4658.tar.bz2
Cleanup of object destruction. No need to have a per-class destruction function. This was a legacy of the distant past when the classes did not have a common base.
Diffstat (limited to 'libs/rs')
-rw-r--r--libs/rs/rs.spec46
-rw-r--r--libs/rs/rsAdapter.cpp12
-rw-r--r--libs/rs/rsAllocation.cpp4
-rw-r--r--libs/rs/rsContext.cpp7
-rw-r--r--libs/rs/rsElement.cpp6
-rw-r--r--libs/rs/rsLight.cpp8
-rw-r--r--libs/rs/rsProgramFragment.cpp9
-rw-r--r--libs/rs/rsProgramFragmentStore.cpp11
-rw-r--r--libs/rs/rsSampler.cpp13
-rw-r--r--libs/rs/rsScript.cpp6
-rw-r--r--libs/rs/rsSimpleMesh.cpp6
-rw-r--r--libs/rs/rsType.cpp18
12 files changed, 25 insertions, 121 deletions
diff --git a/libs/rs/rs.spec b/libs/rs/rs.spec
index 0df237f..1a81021 100644
--- a/libs/rs/rs.spec
+++ b/libs/rs/rs.spec
@@ -32,6 +32,10 @@ AssignName {
param size_t len
}
+ObjDestroy {
+ param void *obj
+ }
+
ElementBegin {
}
@@ -56,10 +60,6 @@ ElementGetPredefined {
ret RsElement
}
-ElementDestroy {
- param RsElement ve
- }
-
TypeBegin {
param RsElement type
}
@@ -73,10 +73,6 @@ TypeCreate {
ret RsType
}
-TypeDestroy {
- param RsType p
- }
-
AllocationCreateTyped {
param RsType type
ret RsAllocation
@@ -130,10 +126,6 @@ AllocationUploadToBufferObject {
param RsAllocation alloc
}
-AllocationDestroy {
- param RsAllocation alloc
- }
-
AllocationData {
param RsAllocation va
@@ -170,10 +162,6 @@ Adapter1DBindAllocation {
param RsAllocation alloc
}
-Adapter1DDestroy {
- param RsAdapter1D adapter
- }
-
Adapter1DSetConstraint {
param RsAdapter1D adapter
param RsDimension dim
@@ -201,10 +189,6 @@ Adapter2DBindAllocation {
param RsAllocation alloc
}
-Adapter2DDestroy {
- param RsAdapter2D adapter
- }
-
Adapter2DSetConstraint {
param RsAdapter2D adapter
param RsDimension dim
@@ -237,9 +221,6 @@ SamplerCreate {
ret RsSampler
}
-SamplerDestroy {
- param RsSampler s
- }
TriangleMeshBegin {
param RsElement vertex
@@ -260,9 +241,6 @@ TriangleMeshCreate {
ret RsTriangleMesh
}
-TriangleMeshDestroy {
- param RsTriangleMesh mesh
- }
TriangleMeshRender {
param RsTriangleMesh vtm
@@ -274,9 +252,6 @@ TriangleMeshRenderRange {
param uint32_t count
}
-ScriptDestroy {
- param RsScript script
- }
ScriptBindAllocation {
param RsScript vtm
@@ -381,9 +356,6 @@ ProgramFragmentStoreCreate {
ret RsProgramFragmentStore
}
-ProgramFragmentStoreDestroy {
- param RsProgramFragmentStore pfs
- }
ProgramFragmentBegin {
@@ -422,10 +394,6 @@ ProgramFragmentCreate {
ret RsProgramFragment
}
-ProgramFragmentDestroy {
- param RsProgramFragment pf
- }
-
ProgramVertexBegin {
param RsElement in
@@ -464,9 +432,6 @@ LightCreate {
ret RsLight light
}
-LightDestroy {
- param RsLight light
- }
LightSetPosition {
param RsLight light
@@ -498,9 +463,6 @@ SimpleMeshCreate {
param uint32_t primType
}
-SimpleMeshDestroy {
- param RsSimpleMesh mesh
- }
SimpleMeshBindIndex {
param RsSimpleMesh mesh
diff --git a/libs/rs/rsAdapter.cpp b/libs/rs/rsAdapter.cpp
index 25f3340..3242e11 100644
--- a/libs/rs/rsAdapter.cpp
+++ b/libs/rs/rsAdapter.cpp
@@ -76,12 +76,6 @@ RsAdapter1D rsi_Adapter1DCreate(Context *rsc)
return a;
}
-void rsi_Adapter1DDestroy(Context *rsc, RsAdapter1D va)
-{
- Adapter1D * a = static_cast<Adapter1D *>(va);
- a->decRef();
-}
-
void rsi_Adapter1DBindAllocation(Context *rsc, RsAdapter1D va, RsAllocation valloc)
{
Adapter1D * a = static_cast<Adapter1D *>(va);
@@ -195,12 +189,6 @@ RsAdapter2D rsi_Adapter2DCreate(Context *rsc)
return a;
}
-void rsi_Adapter2DDestroy(Context *rsc, RsAdapter2D va)
-{
- Adapter2D * a = static_cast<Adapter2D *>(va);
- a->decRef();
-}
-
void rsi_Adapter2DBindAllocation(Context *rsc, RsAdapter2D va, RsAllocation valloc)
{
Adapter2D * a = static_cast<Adapter2D *>(va);
diff --git a/libs/rs/rsAllocation.cpp b/libs/rs/rsAllocation.cpp
index ad9c739..3cb76bc 100644
--- a/libs/rs/rsAllocation.cpp
+++ b/libs/rs/rsAllocation.cpp
@@ -201,10 +201,6 @@ void rsi_AllocationUploadToBufferObject(Context *rsc, RsAllocation va)
alloc->uploadToBufferObject();
}
-void rsi_AllocationDestroy(Context *rsc, RsAllocation)
-{
-}
-
static void mip565(const Adapter2D &out, const Adapter2D &in)
{
uint32_t w = out.getDimX();
diff --git a/libs/rs/rsContext.cpp b/libs/rs/rsContext.cpp
index 52389ea..bc0cf12 100644
--- a/libs/rs/rsContext.cpp
+++ b/libs/rs/rsContext.cpp
@@ -395,6 +395,13 @@ void rsi_AssignName(Context *rsc, void * obj, const char *name, uint32_t len)
rsc->assignName(ob, name, len);
}
+void rsi_ObjDestroy(Context *rsc, void *obj)
+{
+ ObjectBase *ob = static_cast<ObjectBase *>(obj);
+ rsc->removeName(ob);
+ ob->decRef();
+}
+
void rsi_ContextSetDefineF(Context *rsc, const char* name, float value)
{
rsc->addInt32Define(name, value);
diff --git a/libs/rs/rsElement.cpp b/libs/rs/rsElement.cpp
index 97b18c0..389b2c0 100644
--- a/libs/rs/rsElement.cpp
+++ b/libs/rs/rsElement.cpp
@@ -416,12 +416,6 @@ RsElement rsi_ElementCreate(Context *rsc)
return se;
}
-void rsi_ElementDestroy(Context *rsc, RsElement vse)
-{
- Element * se = static_cast<Element *>(vse);
- se->decRef();
-}
-
}
}
diff --git a/libs/rs/rsLight.cpp b/libs/rs/rsLight.cpp
index 24b58b6..f780e52 100644
--- a/libs/rs/rsLight.cpp
+++ b/libs/rs/rsLight.cpp
@@ -82,7 +82,7 @@ void LightState::clear()
////////////////////////////////////////////////////
-//
+//
namespace android {
namespace renderscript {
@@ -110,12 +110,6 @@ RsLight rsi_LightCreate(Context *rsc)
return l;
}
-void rsi_LightDestroy(Context *rsc, RsLight vl)
-{
- Light *l = static_cast<Light *>(vl);
- l->decRef();
-}
-
void rsi_LightSetColor(Context *rsc, RsLight vl, float r, float g, float b)
{
Light *l = static_cast<Light *>(vl);
diff --git a/libs/rs/rsProgramFragment.cpp b/libs/rs/rsProgramFragment.cpp
index a315658..9df07bf 100644
--- a/libs/rs/rsProgramFragment.cpp
+++ b/libs/rs/rsProgramFragment.cpp
@@ -236,15 +236,6 @@ RsProgramFragment rsi_ProgramFragmentCreate(Context *rsc)
return pf;
}
-void rsi_ProgramFragmentDestroy(Context *rsc, RsProgramFragment vpf)
-{
- ProgramFragment *pf = (ProgramFragment *)vpf;
- if (pf->getName()) {
- rsc->removeName(pf);
- }
- pf->decRef();
-}
-
}
}
diff --git a/libs/rs/rsProgramFragmentStore.cpp b/libs/rs/rsProgramFragmentStore.cpp
index 27f4015..99eed16 100644
--- a/libs/rs/rsProgramFragmentStore.cpp
+++ b/libs/rs/rsProgramFragmentStore.cpp
@@ -261,17 +261,6 @@ void rsi_ProgramFragmentStoreDither(Context *rsc, bool enable)
rsc->mStateFragmentStore.mPFS->setDitherEnable(enable);
}
-void rsi_ProgramFragmentStoreDestroy(Context *rsc, RsProgramFragmentStore vpfs)
-{
- ProgramFragmentStore *pfs = (ProgramFragmentStore *)vpfs;
- if (pfs->getName()) {
- rsc->removeName(pfs);
- }
- pfs->decRef();
-}
-
-
-
}
}
diff --git a/libs/rs/rsSampler.cpp b/libs/rs/rsSampler.cpp
index 418f127..c14c371 100644
--- a/libs/rs/rsSampler.cpp
+++ b/libs/rs/rsSampler.cpp
@@ -138,20 +138,13 @@ RsSampler rsi_SamplerCreate(Context *rsc)
SamplerState * ss = &rsc->mStateSampler;
- Sampler * s = new Sampler(ss->mMagFilter,
- ss->mMinFilter,
- ss->mWrapS,
+ Sampler * s = new Sampler(ss->mMagFilter,
+ ss->mMinFilter,
+ ss->mWrapS,
ss->mWrapT,
ss->mWrapR);
return s;
}
-void rsi_SamplerDestroy(Context *rsc, RsSampler vs)
-{
- Sampler * s = static_cast<Sampler *>(vs);
- s->decRef();
-
-}
-
}}
diff --git a/libs/rs/rsScript.cpp b/libs/rs/rsScript.cpp
index 6bcb8f2..fde31a1 100644
--- a/libs/rs/rsScript.cpp
+++ b/libs/rs/rsScript.cpp
@@ -37,12 +37,6 @@ namespace android {
namespace renderscript {
-void rsi_ScriptDestroy(Context * rsc, RsScript vs)
-{
- Script *s = static_cast<Script *>(vs);
- s->decRef();
-}
-
void rsi_ScriptBindAllocation(Context * rsc, RsScript vs, RsAllocation va, uint32_t slot)
{
Script *s = static_cast<Script *>(vs);
diff --git a/libs/rs/rsSimpleMesh.cpp b/libs/rs/rsSimpleMesh.cpp
index 08e36ac..0b745eb 100644
--- a/libs/rs/rsSimpleMesh.cpp
+++ b/libs/rs/rsSimpleMesh.cpp
@@ -135,12 +135,6 @@ void rsi_SimpleMeshBindPrimitive(Context *rsc, RsSimpleMesh mv, RsAllocation va)
sm->mPrimitiveBuffer.set((Allocation *)va);
}
-void rsi_SimpleMeshDestroy(Context *rsc, RsSimpleMesh vtm)
-{
- SimpleMesh * tm = static_cast<SimpleMesh *>(vtm);
- tm->decRef();
-}
-
diff --git a/libs/rs/rsType.cpp b/libs/rs/rsType.cpp
index 43c3bda..a40a152 100644
--- a/libs/rs/rsType.cpp
+++ b/libs/rs/rsType.cpp
@@ -177,9 +177,16 @@ void Type::makeGLComponents()
mGL.mColor.size = 3;
break;
case Component::ALPHA:
- rsAssert(mGL.mColor.size == 3);
- rsAssert(mGL.mColor.type == c->getGLType());
- mGL.mColor.size = 4;
+ // Can be RGBA or A at this point
+ if (mGL.mColor.size > 0) {
+ rsAssert(mGL.mColor.size == 3);
+ rsAssert(mGL.mColor.type == c->getGLType());
+ mGL.mColor.size = 4;
+ } else {
+ mGL.mColor.size = 1;
+ mGL.mColor.offset = mElement->getComponentOffsetBytes(ct);
+ mGL.mColor.type = c->getGLType();
+ }
break;
case Component::NX:
@@ -352,11 +359,6 @@ RsType rsi_TypeCreate(Context *rsc)
return st;
}
-void rsi_TypeDestroy(Context *rsc, RsType vst)
-{
- Type * st = static_cast<Type *>(vst);
- st->decRef();
-}
}
}