Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 062292b9 authored by Android (Google) Code Review's avatar Android (Google) Code Review
Browse files

Merge change 21776 into eclair

* changes:
  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.
parents 6c317acc 7ce033d7
Loading
Loading
Loading
Loading
+1 −19
Original line number Diff line number Diff line
@@ -47,14 +47,6 @@ public class Allocation extends BaseObj {
        mRS.nAllocationUploadToTexture(mID, baseMipLevel);
    }

    public void destroy() {
        if(mDestroyed) {
            throw new IllegalStateException("Object already destroyed.");
        }
        mDestroyed = true;
        mRS.nAllocationDestroy(mID);
    }

    public void data(int[] d) {
        mRS.nAllocationData(mID, d);
    }
@@ -98,11 +90,6 @@ public class Allocation extends BaseObj {
            mID = id;
        }

        public void destroy() {
            mRS.nAdapter1DDestroy(mID);
            mID = 0;
        }

        public void setConstraint(Dimension dim, int value) {
            mRS.nAdapter1DSetConstraint(mID, dim.mID, value);
        }
@@ -139,11 +126,6 @@ public class Allocation extends BaseObj {
            mID = id;
        }

        public void destroy() {
            mRS.nAdapter2DDestroy(mID);
            mID = 0;
        }

        public void setConstraint(Dimension dim, int value) {
            mRS.nAdapter2DSetConstraint(mID, dim.mID, value);
        }
+10 −1
Original line number Diff line number Diff line
@@ -61,9 +61,18 @@ class BaseObj {
    {
        if (!mDestroyed) {
            Log.v(RenderScript.LOG_TAG,
                  "Element finalized without having released the RS reference.");
                  getClass() + " finalized without having released the RS reference.");
        }
        super.finalize();
    }

    public void destroy() {
        if(mDestroyed) {
            throw new IllegalStateException("Object already destroyed.");
        }
        mDestroyed = true;
        mRS.nObjDestroy(mID);
    }

}
+1 −5
Original line number Diff line number Diff line
@@ -138,11 +138,7 @@ public class Element extends BaseObj {
        if(mIsPredefined) {
            throw new IllegalStateException("Attempting to destroy a predefined Element.");
        }
        if(mDestroyed) {
            throw new IllegalStateException("Object already destroyed.");
        }
        mDestroyed = true;
        mRS.nElementDestroy(mID);
        super.destroy();
    }

    public static Element createFromClass(RenderScript rs, Class c) {
+0 −5
Original line number Diff line number Diff line
@@ -29,11 +29,6 @@ public class Light extends BaseObj {
        mID = id;
    }

    public void destroy() {
        mRS.nLightDestroy(mID);
        mID = 0;
    }

    public void setColor(float r, float g, float b) {
        mRS.nLightSetColor(mID, r, g, b);
    }
+0 −8
Original line number Diff line number Diff line
@@ -45,14 +45,6 @@ public class ProgramFragment extends BaseObj {
        mID = id;
    }

    public void destroy() {
        if(mDestroyed) {
            throw new IllegalStateException("Object already destroyed.");
        }
        mDestroyed = true;
        mRS.nProgramFragmentStoreDestroy(mID);
    }

    public void bindTexture(Allocation va, int slot)
        throws IllegalArgumentException {
        if((slot < 0) || (slot >= MAX_SLOT)) {
Loading