diff options
Diffstat (limited to 'rs')
-rw-r--r-- | rs/OWNERS | 5 | ||||
-rw-r--r-- | rs/java/android/renderscript/ScriptIntrinsic.java | 6 | ||||
-rw-r--r-- | rs/jni/Android.mk | 6 | ||||
-rw-r--r-- | rs/jni/android_renderscript_RenderScript.cpp | 38 |
4 files changed, 33 insertions, 22 deletions
diff --git a/rs/OWNERS b/rs/OWNERS new file mode 100644 index 000000000000..61853d3d40cf --- /dev/null +++ b/rs/OWNERS @@ -0,0 +1,5 @@ +butlermichael@google.com +dgross@google.com +jeanluc@google.com +miaowang@google.com +yangni@google.com diff --git a/rs/java/android/renderscript/ScriptIntrinsic.java b/rs/java/android/renderscript/ScriptIntrinsic.java index 4edce84ea3e3..61211a25f8af 100644 --- a/rs/java/android/renderscript/ScriptIntrinsic.java +++ b/rs/java/android/renderscript/ScriptIntrinsic.java @@ -17,9 +17,9 @@ package android.renderscript; /** - * Base class for all Intrinsic scripts. An intrinsic a script - * which implements a pre-defined function. Intrinsics are - * provided to provide effecient implemtations of common + * Base class for all Intrinsic scripts. An intrinsic is a script + * that implements a pre-defined function. Intrinsics are + * provided to provide efficient implementations of common * operations. * * Not intended for direct use. diff --git a/rs/jni/Android.mk b/rs/jni/Android.mk index 21438e04f38c..0854b9582187 100644 --- a/rs/jni/Android.mk +++ b/rs/jni/Android.mk @@ -12,7 +12,7 @@ LOCAL_SHARED_LIBRARIES := \ libRS \ libcutils \ liblog \ - libskia \ + libhwui \ libutils \ libui \ libgui \ @@ -23,9 +23,7 @@ LOCAL_HEADER_LIBRARIES := \ LOCAL_C_INCLUDES += \ $(JNI_H_INCLUDE) \ - frameworks/rs \ - frameworks/base/core/jni \ - frameworks/base/libs/hwui + frameworks/rs LOCAL_CFLAGS += -Wno-unused-parameter LOCAL_CFLAGS += -Wall -Werror -Wunused -Wunreachable-code diff --git a/rs/jni/android_renderscript_RenderScript.cpp b/rs/jni/android_renderscript_RenderScript.cpp index f9f6bf7dbcab..52d0e08e4e7f 100644 --- a/rs/jni/android_renderscript_RenderScript.cpp +++ b/rs/jni/android_renderscript_RenderScript.cpp @@ -24,8 +24,9 @@ #include <utils/misc.h> #include <inttypes.h> +#include <android-base/macros.h> #include <androidfw/Asset.h> -#include <androidfw/AssetManager.h> +#include <androidfw/AssetManager2.h> #include <androidfw/ResourceTypes.h> #include <android-base/macros.h> @@ -1328,7 +1329,7 @@ nAllocationCreateFromBitmap(JNIEnv *_env, jobject _this, jlong con, jlong type, const void* ptr = bitmap.getPixels(); jlong id = (jlong)(uintptr_t)rsAllocationCreateFromBitmap((RsContext)con, (RsType)type, (RsAllocationMipmapControl)mip, - ptr, bitmap.getSize(), usage); + ptr, bitmap.computeByteSize(), usage); return id; } @@ -1356,7 +1357,7 @@ nAllocationCubeCreateFromBitmap(JNIEnv *_env, jobject _this, jlong con, jlong ty const void* ptr = bitmap.getPixels(); jlong id = (jlong)(uintptr_t)rsAllocationCubeCreateFromBitmap((RsContext)con, (RsType)type, (RsAllocationMipmapControl)mip, - ptr, bitmap.getSize(), usage); + ptr, bitmap.computeByteSize(), usage); return id; } @@ -1371,7 +1372,7 @@ nAllocationCopyFromBitmap(JNIEnv *_env, jobject _this, jlong con, jlong alloc, j const void* ptr = bitmap.getPixels(); rsAllocation2DData((RsContext)con, (RsAllocation)alloc, 0, 0, 0, RS_ALLOCATION_CUBEMAP_FACE_POSITIVE_X, - w, h, ptr, bitmap.getSize(), 0); + w, h, ptr, bitmap.computeByteSize(), 0); } static void @@ -1381,7 +1382,7 @@ nAllocationCopyToBitmap(JNIEnv *_env, jobject _this, jlong con, jlong alloc, job GraphicsJNI::getSkBitmap(_env, jbitmap, &bitmap); void* ptr = bitmap.getPixels(); - rsAllocationCopyToBitmap((RsContext)con, (RsAllocation)alloc, ptr, bitmap.getSize()); + rsAllocationCopyToBitmap((RsContext)con, (RsAllocation)alloc, ptr, bitmap.computeByteSize()); bitmap.notifyPixelsChanged(); } @@ -1664,18 +1665,22 @@ nFileA3DCreateFromAssetStream(JNIEnv *_env, jobject _this, jlong con, jlong nati static jlong nFileA3DCreateFromAsset(JNIEnv *_env, jobject _this, jlong con, jobject _assetMgr, jstring _path) { - AssetManager* mgr = assetManagerForJavaObject(_env, _assetMgr); + Guarded<AssetManager2>* mgr = AssetManagerForJavaObject(_env, _assetMgr); if (mgr == nullptr) { return 0; } AutoJavaStringToUTF8 str(_env, _path); - Asset* asset = mgr->open(str.c_str(), Asset::ACCESS_BUFFER); - if (asset == nullptr) { - return 0; + std::unique_ptr<Asset> asset; + { + ScopedLock<AssetManager2> locked_mgr(*mgr); + asset = locked_mgr->Open(str.c_str(), Asset::ACCESS_BUFFER); + if (asset == nullptr) { + return 0; + } } - jlong id = (jlong)(uintptr_t)rsaFileA3DCreateFromAsset((RsContext)con, asset); + jlong id = (jlong)(uintptr_t)rsaFileA3DCreateFromAsset((RsContext)con, asset.release()); return id; } @@ -1752,22 +1757,25 @@ static jlong nFontCreateFromAsset(JNIEnv *_env, jobject _this, jlong con, jobject _assetMgr, jstring _path, jfloat fontSize, jint dpi) { - AssetManager* mgr = assetManagerForJavaObject(_env, _assetMgr); + Guarded<AssetManager2>* mgr = AssetManagerForJavaObject(_env, _assetMgr); if (mgr == nullptr) { return 0; } AutoJavaStringToUTF8 str(_env, _path); - Asset* asset = mgr->open(str.c_str(), Asset::ACCESS_BUFFER); - if (asset == nullptr) { - return 0; + std::unique_ptr<Asset> asset; + { + ScopedLock<AssetManager2> locked_mgr(*mgr); + asset = locked_mgr->Open(str.c_str(), Asset::ACCESS_BUFFER); + if (asset == nullptr) { + return 0; + } } jlong id = (jlong)(uintptr_t)rsFontCreateFromMemory((RsContext)con, str.c_str(), str.length(), fontSize, dpi, asset->getBuffer(false), asset->getLength()); - delete asset; return id; } |