diff options
Diffstat (limited to 'rs/jni/android_renderscript_RenderScript.cpp')
-rw-r--r-- | rs/jni/android_renderscript_RenderScript.cpp | 17 |
1 files changed, 6 insertions, 11 deletions
diff --git a/rs/jni/android_renderscript_RenderScript.cpp b/rs/jni/android_renderscript_RenderScript.cpp index 6d6757d..59161e7 100644 --- a/rs/jni/android_renderscript_RenderScript.cpp +++ b/rs/jni/android_renderscript_RenderScript.cpp @@ -24,8 +24,6 @@ #include <utils/misc.h> #include <inttypes.h> -#include <SkBitmap.h> - #include <androidfw/Asset.h> #include <androidfw/AssetManager.h> #include <androidfw/ResourceTypes.h> @@ -35,6 +33,7 @@ #include "android_runtime/AndroidRuntime.h" #include "android_runtime/android_view_Surface.h" #include "android_runtime/android_util_AssetManager.h" +#include "android/graphics/GraphicsJNI.h" #include <rs.h> #include <rsEnv.h> @@ -282,14 +281,10 @@ private: // --------------------------------------------------------------------------- static jfieldID gContextId = 0; -static jfieldID gNativeBitmapID = 0; static void _nInit(JNIEnv *_env, jclass _this) { gContextId = _env->GetFieldID(_this, "mContext", "J"); - - jclass bitmapClass = _env->FindClass("android/graphics/Bitmap"); - gNativeBitmapID = _env->GetFieldID(bitmapClass, "mNativeBitmap", "J"); } // --------------------------------------------------------------------------- @@ -1070,7 +1065,7 @@ nAllocationCreateFromBitmap(JNIEnv *_env, jobject _this, jlong con, jlong type, jobject jbitmap, jint usage) { SkBitmap const * nativeBitmap = - (SkBitmap const *)_env->GetLongField(jbitmap, gNativeBitmapID); + GraphicsJNI::getSkBitmap(_env, jbitmap); const SkBitmap& bitmap(*nativeBitmap); bitmap.lockPixels(); @@ -1087,7 +1082,7 @@ nAllocationCreateBitmapBackedAllocation(JNIEnv *_env, jobject _this, jlong con, jint mip, jobject jbitmap, jint usage) { SkBitmap const * nativeBitmap = - (SkBitmap const *)_env->GetLongField(jbitmap, gNativeBitmapID); + GraphicsJNI::getSkBitmap(_env, jbitmap); const SkBitmap& bitmap(*nativeBitmap); bitmap.lockPixels(); @@ -1104,7 +1099,7 @@ nAllocationCubeCreateFromBitmap(JNIEnv *_env, jobject _this, jlong con, jlong ty jobject jbitmap, jint usage) { SkBitmap const * nativeBitmap = - (SkBitmap const *)_env->GetLongField(jbitmap, gNativeBitmapID); + GraphicsJNI::getSkBitmap(_env, jbitmap); const SkBitmap& bitmap(*nativeBitmap); bitmap.lockPixels(); @@ -1120,7 +1115,7 @@ static void nAllocationCopyFromBitmap(JNIEnv *_env, jobject _this, jlong con, jlong alloc, jobject jbitmap) { SkBitmap const * nativeBitmap = - (SkBitmap const *)_env->GetLongField(jbitmap, gNativeBitmapID); + GraphicsJNI::getSkBitmap(_env, jbitmap); const SkBitmap& bitmap(*nativeBitmap); int w = bitmap.width(); int h = bitmap.height(); @@ -1137,7 +1132,7 @@ static void nAllocationCopyToBitmap(JNIEnv *_env, jobject _this, jlong con, jlong alloc, jobject jbitmap) { SkBitmap const * nativeBitmap = - (SkBitmap const *)_env->GetLongField(jbitmap, gNativeBitmapID); + GraphicsJNI::getSkBitmap(_env, jbitmap); const SkBitmap& bitmap(*nativeBitmap); bitmap.lockPixels(); |