diff options
author | Alex Sakhartchouk <alexst@google.com> | 2010-07-15 11:33:03 -0700 |
---|---|---|
committer | Alex Sakhartchouk <alexst@google.com> | 2010-07-15 14:02:54 -0700 |
commit | dfac814c18f73dd7289f9927edca3e3b6ec6bc00 (patch) | |
tree | 386ca04866a3e7be79ae621582222a8f2b09ceda /graphics/java/android/renderscript/FileA3D.java | |
parent | 506821b406181ff9b9a10c2fc078d16b79a8cf92 (diff) | |
download | frameworks_base-dfac814c18f73dd7289f9927edca3e3b6ec6bc00.zip frameworks_base-dfac814c18f73dd7289f9927edca3e3b6ec6bc00.tar.gz frameworks_base-dfac814c18f73dd7289f9927edca3e3b6ec6bc00.tar.bz2 |
Populate java objects with native data from a3d file.
Remove legacy constructor from programraster
Make a3d object creation synchronous
Change-Id: Ic7d7547cf6eee6f9a7c6e3ee12cd104e80056a7b
Diffstat (limited to 'graphics/java/android/renderscript/FileA3D.java')
-rw-r--r-- | graphics/java/android/renderscript/FileA3D.java | 32 |
1 files changed, 20 insertions, 12 deletions
diff --git a/graphics/java/android/renderscript/FileA3D.java b/graphics/java/android/renderscript/FileA3D.java index 3b3711b..302a5f4 100644 --- a/graphics/java/android/renderscript/FileA3D.java +++ b/graphics/java/android/renderscript/FileA3D.java @@ -56,7 +56,7 @@ public class FileA3D extends BaseObj { } // Read only class with index entries - public class IndexEntry { + public static class IndexEntry { RenderScript mRS; int mIndex; int mID; @@ -73,34 +73,40 @@ public class FileA3D extends BaseObj { } public BaseObj getObject() { - if(mLoadedObj != null) { - return mLoadedObj; + mRS.validate(); + BaseObj obj = internalCreate(mRS, this); + return obj; + } + + static synchronized BaseObj internalCreate(RenderScript rs, IndexEntry entry) { + if(entry.mLoadedObj != null) { + return entry.mLoadedObj; } - if(mClassID == ClassID.UNKNOWN) { + if(entry.mClassID == ClassID.UNKNOWN) { return null; } - int objectID = mRS.nFileA3DGetEntryByIndex(mID, mIndex); + int objectID = rs.nFileA3DGetEntryByIndex(entry.mID, entry.mIndex); if(objectID == 0) { return null; } - switch (mClassID) { + switch (entry.mClassID) { case MESH: - mLoadedObj = new Mesh(objectID, mRS); + entry.mLoadedObj = new Mesh(objectID, rs); break; case TYPE: - mLoadedObj = new Type(objectID, mRS); + entry.mLoadedObj = new Type(objectID, rs); break; case ELEMENT: - mLoadedObj = null; + entry.mLoadedObj = null; break; case ALLOCATION: - mLoadedObj = null; + entry.mLoadedObj = null; break; case PROGRAM_VERTEX: - mLoadedObj = new ProgramVertex(objectID, mRS); + entry.mLoadedObj = new ProgramVertex(objectID, rs); break; case PROGRAM_RASTER: break; @@ -122,7 +128,9 @@ public class FileA3D extends BaseObj { break; } - return mLoadedObj; + entry.mLoadedObj.updateFromNative(); + + return entry.mLoadedObj; } IndexEntry(RenderScript rs, int index, int id, String name, ClassID classID) { |