Loading graphics/java/android/renderscript/Allocation.java +16 −3 Original line number Diff line number Diff line Loading @@ -43,8 +43,11 @@ public class Allocation extends BaseObj { } public void destroy() { if(mDestroyed) { throw new IllegalStateException("Object already destroyed."); } mDestroyed = true; mRS.nAllocationDestroy(mID); mID = 0; } public void data(int[] d) { Loading Loading @@ -160,17 +163,27 @@ public class Allocation extends BaseObj { mBitmapOptions.inScaled = false; } static public Allocation createTyped(RenderScript rs, Type type) { static public Allocation createTyped(RenderScript rs, Type type) throws IllegalArgumentException { if(type.mID == 0) { throw new IllegalStateException("Bad Type"); } int id = rs.nAllocationCreateTyped(type.mID); return new Allocation(id, rs); } static public Allocation createSized(RenderScript rs, Element e, int count) { static public Allocation createSized(RenderScript rs, Element e, int count) throws IllegalArgumentException { int id; if(e.mIsPredefined) { id = rs.nAllocationCreatePredefSized(e.mPredefinedID, count); } else { id = rs.nAllocationCreateSized(e.mID, count); if(id == 0) { throw new IllegalStateException("Bad element."); } } return new Allocation(id, rs); } Loading graphics/java/android/renderscript/BaseObj.java +3 −1 Original line number Diff line number Diff line Loading @@ -27,6 +27,7 @@ class BaseObj { BaseObj(RenderScript rs) { mRS = rs; mID = 0; mDestroyed = false; } public int getID() { Loading @@ -34,6 +35,7 @@ class BaseObj { } int mID; boolean mDestroyed; String mName; RenderScript mRS; Loading @@ -57,7 +59,7 @@ class BaseObj { protected void finalize() throws Throwable { if (mID != 0) { if (!mDestroyed) { Log.v(RenderScript.LOG_TAG, "Element finalized without having released the RS reference."); } Loading graphics/java/android/renderscript/Element.java +5 −2 Original line number Diff line number Diff line Loading @@ -137,8 +137,11 @@ 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); mID = 0; } Loading Loading @@ -206,7 +209,7 @@ public class Element extends BaseObj { if (en.mIsNormalized) { norm = 1; } rs.nElementAdd(en.mType.mID, en.mKind.mID, norm, en.mBits); rs.nElementAdd(en.mKind.mID, en.mType.mID, norm, en.mBits); } } int id = rs.nElementCreate(); Loading graphics/java/android/renderscript/Primitive.java 0 → 100644 +37 −0 Original line number Diff line number Diff line /* * Copyright (C) 2008 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package android.renderscript; /** * @hide **/ public enum Primitive { POINT (0), LINE (1), LINE_STRIP (2), TRIANGLE (3), TRIANGLE_STRIP (4), TRIANGLE_FAN (5); int mID; Primitive(int id) { mID = id; } } graphics/java/android/renderscript/ProgramFragment.java +4 −1 Original line number Diff line number Diff line Loading @@ -46,8 +46,11 @@ public class ProgramFragment extends BaseObj { } public void destroy() { if(mDestroyed) { throw new IllegalStateException("Object already destroyed."); } mDestroyed = true; mRS.nProgramFragmentStoreDestroy(mID); mID = 0; } public void bindTexture(Allocation va, int slot) Loading Loading
graphics/java/android/renderscript/Allocation.java +16 −3 Original line number Diff line number Diff line Loading @@ -43,8 +43,11 @@ public class Allocation extends BaseObj { } public void destroy() { if(mDestroyed) { throw new IllegalStateException("Object already destroyed."); } mDestroyed = true; mRS.nAllocationDestroy(mID); mID = 0; } public void data(int[] d) { Loading Loading @@ -160,17 +163,27 @@ public class Allocation extends BaseObj { mBitmapOptions.inScaled = false; } static public Allocation createTyped(RenderScript rs, Type type) { static public Allocation createTyped(RenderScript rs, Type type) throws IllegalArgumentException { if(type.mID == 0) { throw new IllegalStateException("Bad Type"); } int id = rs.nAllocationCreateTyped(type.mID); return new Allocation(id, rs); } static public Allocation createSized(RenderScript rs, Element e, int count) { static public Allocation createSized(RenderScript rs, Element e, int count) throws IllegalArgumentException { int id; if(e.mIsPredefined) { id = rs.nAllocationCreatePredefSized(e.mPredefinedID, count); } else { id = rs.nAllocationCreateSized(e.mID, count); if(id == 0) { throw new IllegalStateException("Bad element."); } } return new Allocation(id, rs); } Loading
graphics/java/android/renderscript/BaseObj.java +3 −1 Original line number Diff line number Diff line Loading @@ -27,6 +27,7 @@ class BaseObj { BaseObj(RenderScript rs) { mRS = rs; mID = 0; mDestroyed = false; } public int getID() { Loading @@ -34,6 +35,7 @@ class BaseObj { } int mID; boolean mDestroyed; String mName; RenderScript mRS; Loading @@ -57,7 +59,7 @@ class BaseObj { protected void finalize() throws Throwable { if (mID != 0) { if (!mDestroyed) { Log.v(RenderScript.LOG_TAG, "Element finalized without having released the RS reference."); } Loading
graphics/java/android/renderscript/Element.java +5 −2 Original line number Diff line number Diff line Loading @@ -137,8 +137,11 @@ 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); mID = 0; } Loading Loading @@ -206,7 +209,7 @@ public class Element extends BaseObj { if (en.mIsNormalized) { norm = 1; } rs.nElementAdd(en.mType.mID, en.mKind.mID, norm, en.mBits); rs.nElementAdd(en.mKind.mID, en.mType.mID, norm, en.mBits); } } int id = rs.nElementCreate(); Loading
graphics/java/android/renderscript/Primitive.java 0 → 100644 +37 −0 Original line number Diff line number Diff line /* * Copyright (C) 2008 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package android.renderscript; /** * @hide **/ public enum Primitive { POINT (0), LINE (1), LINE_STRIP (2), TRIANGLE (3), TRIANGLE_STRIP (4), TRIANGLE_FAN (5); int mID; Primitive(int id) { mID = id; } }
graphics/java/android/renderscript/ProgramFragment.java +4 −1 Original line number Diff line number Diff line Loading @@ -46,8 +46,11 @@ public class ProgramFragment extends BaseObj { } public void destroy() { if(mDestroyed) { throw new IllegalStateException("Object already destroyed."); } mDestroyed = true; mRS.nProgramFragmentStoreDestroy(mID); mID = 0; } public void bindTexture(Allocation va, int slot) Loading