summaryrefslogtreecommitdiffstats
path: root/rs/jni
diff options
context:
space:
mode:
authorChad Jones <chadj@google.com>2015-03-05 19:34:26 +0000
committerChad Jones <chadj@google.com>2015-03-05 19:34:26 +0000
commitc02977e3bbfaaedcb1b1d67e1692becc7dddd59b (patch)
tree24564767d59138f5c039efefe4744ee35c23ac7e /rs/jni
parentb2915245b74b3b5541b123e38403f8e26426b4b7 (diff)
downloadframeworks_base-c02977e3bbfaaedcb1b1d67e1692becc7dddd59b.zip
frameworks_base-c02977e3bbfaaedcb1b1d67e1692becc7dddd59b.tar.gz
frameworks_base-c02977e3bbfaaedcb1b1d67e1692becc7dddd59b.tar.bz2
Revert "Cleanup Bitmap JNI"
This reverts commit b2915245b74b3b5541b123e38403f8e26426b4b7. Change-Id: Idd7d7f33eec4ea5024c83de6b10d3d1a6ab2b17a
Diffstat (limited to 'rs/jni')
-rw-r--r--rs/jni/Android.mk4
-rw-r--r--rs/jni/android_renderscript_RenderScript.cpp17
2 files changed, 12 insertions, 9 deletions
diff --git a/rs/jni/Android.mk b/rs/jni/Android.mk
index 94f0859..f1f0bfc 100644
--- a/rs/jni/Android.mk
+++ b/rs/jni/Android.mk
@@ -14,8 +14,7 @@ LOCAL_SHARED_LIBRARIES := \
libskia \
libutils \
libui \
- libgui \
- libjnigraphics
+ libgui
LOCAL_STATIC_LIBRARIES :=
@@ -24,7 +23,6 @@ rs_generated_include_dir := $(call intermediates-dir-for,SHARED_LIBRARIES,libRS,
LOCAL_C_INCLUDES += \
$(JNI_H_INCLUDE) \
frameworks/rs \
- frameworks/base/core/jni \
$(rs_generated_include_dir)
LOCAL_CFLAGS += -Wno-unused-parameter -std=c++11
diff --git a/rs/jni/android_renderscript_RenderScript.cpp b/rs/jni/android_renderscript_RenderScript.cpp
index d8e1464..a145166 100644
--- a/rs/jni/android_renderscript_RenderScript.cpp
+++ b/rs/jni/android_renderscript_RenderScript.cpp
@@ -24,6 +24,8 @@
#include <utils/misc.h>
#include <inttypes.h>
+#include <SkBitmap.h>
+
#include <androidfw/Asset.h>
#include <androidfw/AssetManager.h>
#include <androidfw/ResourceTypes.h>
@@ -33,7 +35,6 @@
#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>
@@ -171,10 +172,14 @@ 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");
}
// ---------------------------------------------------------------------------
@@ -929,7 +934,7 @@ nAllocationCreateFromBitmap(JNIEnv *_env, jobject _this, jlong con, jlong type,
jobject jbitmap, jint usage)
{
SkBitmap const * nativeBitmap =
- GraphicsJNI::getSkBitmap(_env, jbitmap);
+ (SkBitmap const *)_env->GetLongField(jbitmap, gNativeBitmapID);
const SkBitmap& bitmap(*nativeBitmap);
bitmap.lockPixels();
@@ -946,7 +951,7 @@ nAllocationCreateBitmapBackedAllocation(JNIEnv *_env, jobject _this, jlong con,
jint mip, jobject jbitmap, jint usage)
{
SkBitmap const * nativeBitmap =
- GraphicsJNI::getSkBitmap(_env, jbitmap);
+ (SkBitmap const *)_env->GetLongField(jbitmap, gNativeBitmapID);
const SkBitmap& bitmap(*nativeBitmap);
bitmap.lockPixels();
@@ -963,7 +968,7 @@ nAllocationCubeCreateFromBitmap(JNIEnv *_env, jobject _this, jlong con, jlong ty
jobject jbitmap, jint usage)
{
SkBitmap const * nativeBitmap =
- GraphicsJNI::getSkBitmap(_env, jbitmap);
+ (SkBitmap const *)_env->GetLongField(jbitmap, gNativeBitmapID);
const SkBitmap& bitmap(*nativeBitmap);
bitmap.lockPixels();
@@ -979,7 +984,7 @@ static void
nAllocationCopyFromBitmap(JNIEnv *_env, jobject _this, jlong con, jlong alloc, jobject jbitmap)
{
SkBitmap const * nativeBitmap =
- GraphicsJNI::getSkBitmap(_env, jbitmap);
+ (SkBitmap const *)_env->GetLongField(jbitmap, gNativeBitmapID);
const SkBitmap& bitmap(*nativeBitmap);
int w = bitmap.width();
int h = bitmap.height();
@@ -996,7 +1001,7 @@ static void
nAllocationCopyToBitmap(JNIEnv *_env, jobject _this, jlong con, jlong alloc, jobject jbitmap)
{
SkBitmap const * nativeBitmap =
- GraphicsJNI::getSkBitmap(_env, jbitmap);
+ (SkBitmap const *)_env->GetLongField(jbitmap, gNativeBitmapID);
const SkBitmap& bitmap(*nativeBitmap);
bitmap.lockPixels();