diff options
Diffstat (limited to 'rs/java/android/renderscript/RenderScript.java')
-rw-r--r-- | rs/java/android/renderscript/RenderScript.java | 49 |
1 files changed, 35 insertions, 14 deletions
diff --git a/rs/java/android/renderscript/RenderScript.java b/rs/java/android/renderscript/RenderScript.java index 6b1939c679b0..8b1a0324956a 100644 --- a/rs/java/android/renderscript/RenderScript.java +++ b/rs/java/android/renderscript/RenderScript.java @@ -24,7 +24,6 @@ import android.content.Context; import android.content.res.AssetManager; import android.graphics.Bitmap; import android.graphics.SurfaceTexture; -import android.os.Process; import android.util.Log; import android.view.Surface; import android.os.SystemProperties; @@ -132,16 +131,31 @@ public class RenderScript { // this should be a monotonically increasing ID // used in conjunction with the API version of a device - static final long sMinorID = 1; + static final long sMinorVersion = 1; + + /** + * @hide + * + * Only exist to be compatible with old version RenderScript Support lib. + * Will eventually be removed. + * + * @return Always return 1 + * + */ + public static long getMinorID() { + return 1; + } + /** * Returns an identifier that can be used to identify a particular * minor version of RS. * - * @hide + * @return The minor RenderScript version number + * */ - public static long getMinorID() { - return sMinorID; + public static long getMinorVersion() { + return sMinorVersion; } /** @@ -302,8 +316,12 @@ public class RenderScript { long[] fieldIDs, long[] values, int[] sizes, long[] depClosures, long[] depFieldIDs) { validate(); - return rsnClosureCreate(mContext, kernelID, returnValue, fieldIDs, values, + long c = rsnClosureCreate(mContext, kernelID, returnValue, fieldIDs, values, sizes, depClosures, depFieldIDs); + if (c == 0) { + throw new RSRuntimeException("Failed creating closure."); + } + return c; } native long rsnInvokeClosureCreate(long con, long invokeID, byte[] params, @@ -311,8 +329,12 @@ public class RenderScript { synchronized long nInvokeClosureCreate(long invokeID, byte[] params, long[] fieldIDs, long[] values, int[] sizes) { validate(); - return rsnInvokeClosureCreate(mContext, invokeID, params, fieldIDs, + long c = rsnInvokeClosureCreate(mContext, invokeID, params, fieldIDs, values, sizes); + if (c == 0) { + throw new RSRuntimeException("Failed creating closure."); + } + return c; } native void rsnClosureSetArg(long con, long closureID, int index, @@ -337,7 +359,11 @@ public class RenderScript { synchronized long nScriptGroup2Create(String name, String cachePath, long[] closures) { validate(); - return rsnScriptGroup2Create(mContext, name, cachePath, closures); + long g = rsnScriptGroup2Create(mContext, name, cachePath, closures); + if (g == 0) { + throw new RSRuntimeException("Failed creating script group."); + } + return g; } native void rsnScriptGroup2Execute(long con, long groupID); @@ -1321,7 +1347,6 @@ public class RenderScript { /** * Create a RenderScript context. * - * @hide * @param ctx The context. * @return RenderScript */ @@ -1426,14 +1451,13 @@ public class RenderScript { /** * Gets or creates a RenderScript context of the specified type. * - * @hide * @param ctx The context. * @param ct The type of context to be created. * @param sdkVersion The target SDK Version. * @param flags The OR of the CREATE_FLAG_* options desired * @return RenderScript */ - public static RenderScript create(Context ctx, int sdkVersion, ContextType ct, int flags) { + private static RenderScript create(Context ctx, int sdkVersion, ContextType ct, int flags) { if (sdkVersion < 23) { return internalCreate(ctx, sdkVersion, ct, flags); } @@ -1456,8 +1480,6 @@ public class RenderScript { } /** - * @hide - * * Releases all the process contexts. This is the same as * calling .destroy() on each unique context retreived with * create(...). If no contexts have been created this @@ -1494,7 +1516,6 @@ public class RenderScript { * * If you need a single context please use create() * - * @hide * @param ctx The context. * @return RenderScript */ |