summaryrefslogtreecommitdiff
path: root/rs
diff options
context:
space:
mode:
Diffstat (limited to 'rs')
-rw-r--r--rs/java/android/renderscript/RenderScript.java38
-rw-r--r--rs/jni/android_renderscript_RenderScript.cpp32
2 files changed, 39 insertions, 31 deletions
diff --git a/rs/java/android/renderscript/RenderScript.java b/rs/java/android/renderscript/RenderScript.java
index 85c82bc009a0..f4c27771c846 100644
--- a/rs/java/android/renderscript/RenderScript.java
+++ b/rs/java/android/renderscript/RenderScript.java
@@ -447,27 +447,33 @@ public class RenderScript {
validate();
return rsnAllocationCreateTyped(mContext, type, mip, usage, pointer);
}
- native long rsnAllocationCreateFromBitmap(long con, long type, int mip, Bitmap bmp, int usage);
+ native long rsnAllocationCreateFromBitmap(long con, long type, int mip, long bitmapHandle,
+ int usage);
synchronized long nAllocationCreateFromBitmap(long type, int mip, Bitmap bmp, int usage) {
validate();
- return rsnAllocationCreateFromBitmap(mContext, type, mip, bmp, usage);
+ return rsnAllocationCreateFromBitmap(mContext, type, mip, bmp.getNativeInstance(), usage);
}
- native long rsnAllocationCreateBitmapBackedAllocation(long con, long type, int mip, Bitmap bmp, int usage);
- synchronized long nAllocationCreateBitmapBackedAllocation(long type, int mip, Bitmap bmp, int usage) {
+ native long rsnAllocationCreateBitmapBackedAllocation(long con, long type, int mip, long bitmapHandle,
+ int usage);
+ synchronized long nAllocationCreateBitmapBackedAllocation(long type, int mip, Bitmap bmp,
+ int usage) {
validate();
- return rsnAllocationCreateBitmapBackedAllocation(mContext, type, mip, bmp, usage);
+ return rsnAllocationCreateBitmapBackedAllocation(mContext, type, mip, bmp.getNativeInstance(),
+ usage);
}
- native long rsnAllocationCubeCreateFromBitmap(long con, long type, int mip, Bitmap bmp, int usage);
+ native long rsnAllocationCubeCreateFromBitmap(long con, long type, int mip, long bitmapHandle,
+ int usage);
synchronized long nAllocationCubeCreateFromBitmap(long type, int mip, Bitmap bmp, int usage) {
validate();
- return rsnAllocationCubeCreateFromBitmap(mContext, type, mip, bmp, usage);
+ return rsnAllocationCubeCreateFromBitmap(mContext, type, mip, bmp.getNativeInstance(),
+ usage);
}
- native long rsnAllocationCreateBitmapRef(long con, long type, Bitmap bmp);
+ native long rsnAllocationCreateBitmapRef(long con, long type, long bitmapHandle);
synchronized long nAllocationCreateBitmapRef(long type, Bitmap bmp) {
validate();
- return rsnAllocationCreateBitmapRef(mContext, type, bmp);
+ return rsnAllocationCreateBitmapRef(mContext, type, bmp.getNativeInstance());
}
native long rsnAllocationCreateFromAssetStream(long con, int mips, int assetStream, int usage);
synchronized long nAllocationCreateFromAssetStream(int mips, int assetStream, int usage) {
@@ -475,10 +481,10 @@ public class RenderScript {
return rsnAllocationCreateFromAssetStream(mContext, mips, assetStream, usage);
}
- native void rsnAllocationCopyToBitmap(long con, long alloc, Bitmap bmp);
+ native void rsnAllocationCopyToBitmap(long con, long alloc, long bitmapHandle);
synchronized void nAllocationCopyToBitmap(long alloc, Bitmap bmp) {
validate();
- rsnAllocationCopyToBitmap(mContext, alloc, bmp);
+ rsnAllocationCopyToBitmap(mContext, alloc, bmp.getNativeInstance());
}
native void rsnAllocationSyncAll(long con, long alloc, int src);
@@ -487,8 +493,10 @@ public class RenderScript {
rsnAllocationSyncAll(mContext, alloc, src);
}
- native ByteBuffer rsnAllocationGetByteBuffer(long con, long alloc, long[] stride, int xBytesSize, int dimY, int dimZ);
- synchronized ByteBuffer nAllocationGetByteBuffer(long alloc, long[] stride, int xBytesSize, int dimY, int dimZ) {
+ native ByteBuffer rsnAllocationGetByteBuffer(long con, long alloc, long[] stride,
+ int xBytesSize, int dimY, int dimZ);
+ synchronized ByteBuffer nAllocationGetByteBuffer(long alloc, long[] stride, int xBytesSize,
+ int dimY, int dimZ) {
validate();
return rsnAllocationGetByteBuffer(mContext, alloc, stride, xBytesSize, dimY, dimZ);
}
@@ -529,10 +537,10 @@ public class RenderScript {
validate();
rsnAllocationGenerateMipmaps(mContext, alloc);
}
- native void rsnAllocationCopyFromBitmap(long con, long alloc, Bitmap bmp);
+ native void rsnAllocationCopyFromBitmap(long con, long alloc, long bitmapHandle);
synchronized void nAllocationCopyFromBitmap(long alloc, Bitmap bmp) {
validate();
- rsnAllocationCopyFromBitmap(mContext, alloc, bmp);
+ rsnAllocationCopyFromBitmap(mContext, alloc, bmp.getNativeInstance());
}
diff --git a/rs/jni/android_renderscript_RenderScript.cpp b/rs/jni/android_renderscript_RenderScript.cpp
index 52d0e08e4e7f..dfee96182a48 100644
--- a/rs/jni/android_renderscript_RenderScript.cpp
+++ b/rs/jni/android_renderscript_RenderScript.cpp
@@ -1321,10 +1321,10 @@ nAllocationGenerateMipmaps(JNIEnv *_env, jobject _this, jlong con, jlong alloc)
static jlong
nAllocationCreateFromBitmap(JNIEnv *_env, jobject _this, jlong con, jlong type, jint mip,
- jobject jbitmap, jint usage)
+ jlong bitmapPtr, jint usage)
{
SkBitmap bitmap;
- GraphicsJNI::getSkBitmap(_env, jbitmap, &bitmap);
+ bitmap::toBitmap(bitmapPtr).getSkBitmap(&bitmap);
const void* ptr = bitmap.getPixels();
jlong id = (jlong)(uintptr_t)rsAllocationCreateFromBitmap((RsContext)con,
@@ -1335,10 +1335,10 @@ nAllocationCreateFromBitmap(JNIEnv *_env, jobject _this, jlong con, jlong type,
static jlong
nAllocationCreateBitmapBackedAllocation(JNIEnv *_env, jobject _this, jlong con, jlong type,
- jint mip, jobject jbitmap, jint usage)
+ jint mip, jlong bitmapPtr, jint usage)
{
SkBitmap bitmap;
- GraphicsJNI::getSkBitmap(_env, jbitmap, &bitmap);
+ bitmap::toBitmap(bitmapPtr).getSkBitmap(&bitmap);
const void* ptr = bitmap.getPixels();
jlong id = (jlong)(uintptr_t)rsAllocationCreateTyped((RsContext)con,
@@ -1349,10 +1349,10 @@ nAllocationCreateBitmapBackedAllocation(JNIEnv *_env, jobject _this, jlong con,
static jlong
nAllocationCubeCreateFromBitmap(JNIEnv *_env, jobject _this, jlong con, jlong type, jint mip,
- jobject jbitmap, jint usage)
+ jlong bitmapPtr, jint usage)
{
SkBitmap bitmap;
- GraphicsJNI::getSkBitmap(_env, jbitmap, &bitmap);
+ bitmap::toBitmap(bitmapPtr).getSkBitmap(&bitmap);
const void* ptr = bitmap.getPixels();
jlong id = (jlong)(uintptr_t)rsAllocationCubeCreateFromBitmap((RsContext)con,
@@ -1362,10 +1362,10 @@ nAllocationCubeCreateFromBitmap(JNIEnv *_env, jobject _this, jlong con, jlong ty
}
static void
-nAllocationCopyFromBitmap(JNIEnv *_env, jobject _this, jlong con, jlong alloc, jobject jbitmap)
+nAllocationCopyFromBitmap(JNIEnv *_env, jobject _this, jlong con, jlong alloc, jlong bitmapPtr)
{
SkBitmap bitmap;
- GraphicsJNI::getSkBitmap(_env, jbitmap, &bitmap);
+ bitmap::toBitmap(bitmapPtr).getSkBitmap(&bitmap);
int w = bitmap.width();
int h = bitmap.height();
@@ -1376,10 +1376,10 @@ nAllocationCopyFromBitmap(JNIEnv *_env, jobject _this, jlong con, jlong alloc, j
}
static void
-nAllocationCopyToBitmap(JNIEnv *_env, jobject _this, jlong con, jlong alloc, jobject jbitmap)
+nAllocationCopyToBitmap(JNIEnv *_env, jobject _this, jlong con, jlong alloc, jlong bitmapPtr)
{
SkBitmap bitmap;
- GraphicsJNI::getSkBitmap(_env, jbitmap, &bitmap);
+ bitmap::toBitmap(bitmapPtr).getSkBitmap(&bitmap);
void* ptr = bitmap.getPixels();
rsAllocationCopyToBitmap((RsContext)con, (RsAllocation)alloc, ptr, bitmap.computeByteSize());
@@ -2866,13 +2866,13 @@ static const JNINativeMethod methods[] = {
{"rsnTypeCreate", "(JJIIIZZI)J", (void*)nTypeCreate },
{"rsnTypeGetNativeData", "(JJ[J)V", (void*)nTypeGetNativeData },
-{"rsnAllocationCreateTyped", "(JJIIJ)J", (void*)nAllocationCreateTyped },
-{"rsnAllocationCreateFromBitmap", "(JJILandroid/graphics/Bitmap;I)J", (void*)nAllocationCreateFromBitmap },
-{"rsnAllocationCreateBitmapBackedAllocation", "(JJILandroid/graphics/Bitmap;I)J", (void*)nAllocationCreateBitmapBackedAllocation },
-{"rsnAllocationCubeCreateFromBitmap","(JJILandroid/graphics/Bitmap;I)J", (void*)nAllocationCubeCreateFromBitmap },
+{"rsnAllocationCreateTyped", "(JJIIJ)J", (void*)nAllocationCreateTyped },
+{"rsnAllocationCreateFromBitmap", "(JJIJI)J", (void*)nAllocationCreateFromBitmap },
+{"rsnAllocationCreateBitmapBackedAllocation", "(JJIJI)J", (void*)nAllocationCreateBitmapBackedAllocation },
+{"rsnAllocationCubeCreateFromBitmap","(JJIJI)J", (void*)nAllocationCubeCreateFromBitmap },
-{"rsnAllocationCopyFromBitmap", "(JJLandroid/graphics/Bitmap;)V", (void*)nAllocationCopyFromBitmap },
-{"rsnAllocationCopyToBitmap", "(JJLandroid/graphics/Bitmap;)V", (void*)nAllocationCopyToBitmap },
+{"rsnAllocationCopyFromBitmap", "(JJJ)V", (void*)nAllocationCopyFromBitmap },
+{"rsnAllocationCopyToBitmap", "(JJJ)V", (void*)nAllocationCopyToBitmap },
{"rsnAllocationSyncAll", "(JJI)V", (void*)nAllocationSyncAll },
{"rsnAllocationSetupBufferQueue", "(JJI)V", (void*)nAllocationSetupBufferQueue },