diff options
author | Narayan Kamath <narayan@google.com> | 2014-02-10 13:33:26 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2014-02-10 13:33:26 +0000 |
commit | 56062983f1e07295c812fba0e22ce579a35b6f76 (patch) | |
tree | fdaf7a671ac38603bd2c4817be9e52b2d68fa832 /rs/java | |
parent | ff27e6bc44097485abfde24f396399e5eec9ff6d (diff) | |
parent | 0e0c0885aed99a119052a792becb5a0c5a93632d (diff) | |
download | frameworks_base-56062983f1e07295c812fba0e22ce579a35b6f76.zip frameworks_base-56062983f1e07295c812fba0e22ce579a35b6f76.tar.gz frameworks_base-56062983f1e07295c812fba0e22ce579a35b6f76.tar.bz2 |
Merge "AArch64: Use long for pointers in RS Java/JNI code"
Diffstat (limited to 'rs/java')
-rw-r--r-- | rs/java/android/renderscript/BaseObj.java | 2 | ||||
-rw-r--r-- | rs/java/android/renderscript/FileA3D.java | 4 | ||||
-rw-r--r-- | rs/java/android/renderscript/Font.java | 10 | ||||
-rw-r--r-- | rs/java/android/renderscript/ProgramStore.java | 4 | ||||
-rw-r--r-- | rs/java/android/renderscript/RenderScript.java | 36 | ||||
-rw-r--r-- | rs/java/android/renderscript/Sampler.java | 4 | ||||
-rw-r--r-- | rs/java/android/renderscript/ScriptC.java | 16 |
7 files changed, 43 insertions, 33 deletions
diff --git a/rs/java/android/renderscript/BaseObj.java b/rs/java/android/renderscript/BaseObj.java index eee4936..842aa23 100644 --- a/rs/java/android/renderscript/BaseObj.java +++ b/rs/java/android/renderscript/BaseObj.java @@ -32,7 +32,7 @@ public class BaseObj { mDestroyed = false; } - void setID(int id) { + void setID(long id) { if (mID != 0) { throw new RSRuntimeException("Internal Error, reset of object ID."); } diff --git a/rs/java/android/renderscript/FileA3D.java b/rs/java/android/renderscript/FileA3D.java index cdcaff7..04bc7c6 100644 --- a/rs/java/android/renderscript/FileA3D.java +++ b/rs/java/android/renderscript/FileA3D.java @@ -141,7 +141,7 @@ public class FileA3D extends BaseObj { return null; } - int objectID = rs.nFileA3DGetEntryByIndex(entry.mID, entry.mIndex); + long objectID = rs.nFileA3DGetEntryByIndex(entry.mID, entry.mIndex); if(objectID == 0) { return null; } @@ -297,7 +297,7 @@ public class FileA3D extends BaseObj { long fileId = 0; if (is instanceof AssetManager.AssetInputStream) { - int asset = ((AssetManager.AssetInputStream) is).getAssetInt(); + long asset = ((AssetManager.AssetInputStream) is).getNativeAsset(); fileId = rs.nFileA3DCreateFromAssetStream(asset); } else { throw new RSRuntimeException("Unsupported asset stream"); diff --git a/rs/java/android/renderscript/Font.java b/rs/java/android/renderscript/Font.java index 0375d2b..cfd11c0 100644 --- a/rs/java/android/renderscript/Font.java +++ b/rs/java/android/renderscript/Font.java @@ -151,7 +151,7 @@ public class Font extends BaseObj { return "DroidSans.ttf"; } - Font(int id, RenderScript rs) { + Font(long id, RenderScript rs) { super(id, rs); } @@ -162,7 +162,7 @@ public class Font extends BaseObj { static public Font createFromFile(RenderScript rs, Resources res, String path, float pointSize) { rs.validate(); int dpi = res.getDisplayMetrics().densityDpi; - int fontId = rs.nFontCreateFromFile(path, pointSize, dpi); + long fontId = rs.nFontCreateFromFile(path, pointSize, dpi); if(fontId == 0) { throw new RSRuntimeException("Unable to create font from file " + path); @@ -187,7 +187,7 @@ public class Font extends BaseObj { AssetManager mgr = res.getAssets(); int dpi = res.getDisplayMetrics().densityDpi; - int fontId = rs.nFontCreateFromAsset(mgr, path, pointSize, dpi); + long fontId = rs.nFontCreateFromAsset(mgr, path, pointSize, dpi); if(fontId == 0) { throw new RSRuntimeException("Unable to create font from asset " + path); } @@ -211,9 +211,9 @@ public class Font extends BaseObj { int dpi = res.getDisplayMetrics().densityDpi; - int fontId = 0; + long fontId = 0; if (is instanceof AssetManager.AssetInputStream) { - int asset = ((AssetManager.AssetInputStream) is).getAssetInt(); + long asset = ((AssetManager.AssetInputStream) is).getNativeAsset(); fontId = rs.nFontCreateFromAssetStream(name, pointSize, dpi, asset); } else { throw new RSRuntimeException("Unsupported asset stream created"); diff --git a/rs/java/android/renderscript/ProgramStore.java b/rs/java/android/renderscript/ProgramStore.java index dac9e76..969cc25 100644 --- a/rs/java/android/renderscript/ProgramStore.java +++ b/rs/java/android/renderscript/ProgramStore.java @@ -146,7 +146,7 @@ public class ProgramStore extends BaseObj { BlendDstFunc mBlendDst; boolean mDither; - ProgramStore(int id, RenderScript rs) { + ProgramStore(long id, RenderScript rs) { super(id, rs); } @@ -421,7 +421,7 @@ public class ProgramStore extends BaseObj { */ public ProgramStore create() { mRS.validate(); - int id = mRS.nProgramStoreCreate(mColorMaskR, mColorMaskG, mColorMaskB, mColorMaskA, + long id = mRS.nProgramStoreCreate(mColorMaskR, mColorMaskG, mColorMaskB, mColorMaskA, mDepthMask, mDither, mBlendSrc.mID, mBlendDst.mID, mDepthFunc.mID); ProgramStore programStore = new ProgramStore(id, mRS); diff --git a/rs/java/android/renderscript/RenderScript.java b/rs/java/android/renderscript/RenderScript.java index 9c8775a..8618764 100644 --- a/rs/java/android/renderscript/RenderScript.java +++ b/rs/java/android/renderscript/RenderScript.java @@ -506,8 +506,8 @@ public class RenderScript { rsnAllocationResize1D(mContext, id, dimX); } - native long rsnFileA3DCreateFromAssetStream(long con, int assetStream); - synchronized long nFileA3DCreateFromAssetStream(int assetStream) { + native long rsnFileA3DCreateFromAssetStream(long con, long assetStream); + synchronized long nFileA3DCreateFromAssetStream(long assetStream) { validate(); return rsnFileA3DCreateFromAssetStream(mContext, assetStream); } @@ -531,24 +531,24 @@ public class RenderScript { validate(); rsnFileA3DGetIndexEntries(mContext, fileA3D, numEntries, IDs, names); } - native int rsnFileA3DGetEntryByIndex(long con, long fileA3D, int index); - synchronized int nFileA3DGetEntryByIndex(long fileA3D, int index) { + native long rsnFileA3DGetEntryByIndex(long con, long fileA3D, int index); + synchronized long nFileA3DGetEntryByIndex(long fileA3D, int index) { validate(); return rsnFileA3DGetEntryByIndex(mContext, fileA3D, index); } - native int rsnFontCreateFromFile(long con, String fileName, float size, int dpi); - synchronized int nFontCreateFromFile(String fileName, float size, int dpi) { + native long rsnFontCreateFromFile(long con, String fileName, float size, int dpi); + synchronized long nFontCreateFromFile(String fileName, float size, int dpi) { validate(); return rsnFontCreateFromFile(mContext, fileName, size, dpi); } - native int rsnFontCreateFromAssetStream(long con, String name, float size, int dpi, int assetStream); - synchronized int nFontCreateFromAssetStream(String name, float size, int dpi, int assetStream) { + native long rsnFontCreateFromAssetStream(long con, String name, float size, int dpi, long assetStream); + synchronized long nFontCreateFromAssetStream(String name, float size, int dpi, long assetStream) { validate(); return rsnFontCreateFromAssetStream(mContext, name, size, dpi, assetStream); } - native int rsnFontCreateFromAsset(long con, AssetManager mgr, String path, float size, int dpi); - synchronized int nFontCreateFromAsset(AssetManager mgr, String path, float size, int dpi) { + native long rsnFontCreateFromAsset(long con, AssetManager mgr, String path, float size, int dpi); + synchronized long nFontCreateFromAsset(AssetManager mgr, String path, float size, int dpi) { validate(); return rsnFontCreateFromAsset(mContext, mgr, path, size, dpi); } @@ -665,9 +665,9 @@ public class RenderScript { rsnScriptSetVarObj(mContext, id, slot, val); } - native int rsnScriptCCreate(long con, String resName, String cacheDir, + native long rsnScriptCCreate(long con, String resName, String cacheDir, byte[] script, int length); - synchronized int nScriptCCreate(String resName, String cacheDir, byte[] script, int length) { + synchronized long nScriptCCreate(String resName, String cacheDir, byte[] script, int length) { validate(); return rsnScriptCCreate(mContext, resName, cacheDir, script, length); } @@ -714,18 +714,18 @@ public class RenderScript { rsnScriptGroupExecute(mContext, group); } - native int rsnSamplerCreate(long con, int magFilter, int minFilter, + native long rsnSamplerCreate(long con, int magFilter, int minFilter, int wrapS, int wrapT, int wrapR, float aniso); - synchronized int nSamplerCreate(int magFilter, int minFilter, + synchronized long nSamplerCreate(int magFilter, int minFilter, int wrapS, int wrapT, int wrapR, float aniso) { validate(); return rsnSamplerCreate(mContext, magFilter, minFilter, wrapS, wrapT, wrapR, aniso); } - native int rsnProgramStoreCreate(long con, boolean r, boolean g, boolean b, boolean a, + native long rsnProgramStoreCreate(long con, boolean r, boolean g, boolean b, boolean a, boolean depthMask, boolean dither, int srcMode, int dstMode, int depthFunc); - synchronized int nProgramStoreCreate(boolean r, boolean g, boolean b, boolean a, + synchronized long nProgramStoreCreate(boolean r, boolean g, boolean b, boolean a, boolean depthMask, boolean dither, int srcMode, int dstMode, int depthFunc) { validate(); @@ -791,8 +791,8 @@ public class RenderScript { rsnMeshGetIndices(mContext, id, idxIds, primitives, vtxIdCount); } - native long rsnPathCreate(long con, int prim, boolean isStatic, long vtx, int loop, float q); - synchronized long nPathCreate(int prim, boolean isStatic, long vtx, int loop, float q) { + native long rsnPathCreate(long con, int prim, boolean isStatic, long vtx, long loop, float q); + synchronized long nPathCreate(int prim, boolean isStatic, long vtx, long loop, float q) { validate(); return rsnPathCreate(mContext, prim, isStatic, vtx, loop, q); } diff --git a/rs/java/android/renderscript/Sampler.java b/rs/java/android/renderscript/Sampler.java index 623055f..8d0e29e 100644 --- a/rs/java/android/renderscript/Sampler.java +++ b/rs/java/android/renderscript/Sampler.java @@ -60,7 +60,7 @@ public class Sampler extends BaseObj { Value mWrapR; float mAniso; - Sampler(int id, RenderScript rs) { + Sampler(long id, RenderScript rs) { super(id, rs); } @@ -347,7 +347,7 @@ public class Sampler extends BaseObj { public Sampler create() { mRS.validate(); - int id = mRS.nSamplerCreate(mMag.mID, mMin.mID, + long id = mRS.nSamplerCreate(mMag.mID, mMin.mID, mWrapS.mID, mWrapT.mID, mWrapR.mID, mAniso); Sampler sampler = new Sampler(id, mRS); sampler.mMin = mMin; diff --git a/rs/java/android/renderscript/ScriptC.java b/rs/java/android/renderscript/ScriptC.java index b0a5759..cdb2b08 100644 --- a/rs/java/android/renderscript/ScriptC.java +++ b/rs/java/android/renderscript/ScriptC.java @@ -45,7 +45,17 @@ public class ScriptC extends Script { protected ScriptC(int id, RenderScript rs) { super(id, rs); } - + /** + * Only intended for use by the generated derived classes. + * + * @param id + * @param rs + * + * @hide + */ + protected ScriptC(long id, RenderScript rs) { + super(id, rs); + } /** * Only intended for use by the generated derived classes. * @@ -56,7 +66,7 @@ public class ScriptC extends Script { */ protected ScriptC(RenderScript rs, Resources resources, int resourceID) { super(0, rs); - int id = internalCreate(rs, resources, resourceID); + long id = internalCreate(rs, resources, resourceID); if (id == 0) { throw new RSRuntimeException("Loading of ScriptC script failed."); } @@ -70,7 +80,7 @@ public class ScriptC extends Script { static String mCachePath; - private static synchronized int internalCreate(RenderScript rs, Resources resources, int resourceID) { + private static synchronized long internalCreate(RenderScript rs, Resources resources, int resourceID) { byte[] pgm; int pgmLength; InputStream is = resources.openRawResource(resourceID); |