summaryrefslogtreecommitdiffstats
path: root/core/jni
diff options
context:
space:
mode:
authorLeon Scroggins III <scroggo@google.com>2013-09-03 17:37:10 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2013-09-03 17:37:10 +0000
commit3f8da09136087bd4f97c1e13e2fb7f8cfb81941c (patch)
tree2cfd26c5c586b11b2d424b3b2b490bb65fe7ee62 /core/jni
parentf2455df4f85a2b02dee0da1a711e3b1292126c97 (diff)
parentc7797525084ba0ea441e394aa0a2ba35d6ff3320 (diff)
downloadframeworks_base-3f8da09136087bd4f97c1e13e2fb7f8cfb81941c.zip
frameworks_base-3f8da09136087bd4f97c1e13e2fb7f8cfb81941c.tar.gz
frameworks_base-3f8da09136087bd4f97c1e13e2fb7f8cfb81941c.tar.bz2
Merge "Change name back to CreateJavaInputStreamAdaptor." into klp-dev
Diffstat (limited to 'core/jni')
-rw-r--r--core/jni/android/graphics/BitmapRegionDecoder.cpp2
-rw-r--r--core/jni/android/graphics/CreateJavaOutputStreamAdaptor.cpp13
-rw-r--r--core/jni/android/graphics/CreateJavaOutputStreamAdaptor.h17
-rw-r--r--core/jni/android/graphics/Picture.cpp7
4 files changed, 19 insertions, 20 deletions
diff --git a/core/jni/android/graphics/BitmapRegionDecoder.cpp b/core/jni/android/graphics/BitmapRegionDecoder.cpp
index 6646579..ee47ac4 100644
--- a/core/jni/android/graphics/BitmapRegionDecoder.cpp
+++ b/core/jni/android/graphics/BitmapRegionDecoder.cpp
@@ -141,7 +141,7 @@ static jobject nativeNewInstanceFromStream(JNIEnv* env, jobject clazz,
jboolean isShareable) {
jobject brd = NULL;
// for now we don't allow shareable with java inputstreams
- SkStream* stream = CopyJavaInputStream(env, is, storage);
+ SkStreamRewindable* stream = CopyJavaInputStream(env, is, storage);
if (stream) {
brd = createBitmapRegionDecoder(env, stream);
diff --git a/core/jni/android/graphics/CreateJavaOutputStreamAdaptor.cpp b/core/jni/android/graphics/CreateJavaOutputStreamAdaptor.cpp
index 797d155..d264392 100644
--- a/core/jni/android/graphics/CreateJavaOutputStreamAdaptor.cpp
+++ b/core/jni/android/graphics/CreateJavaOutputStreamAdaptor.cpp
@@ -159,8 +159,8 @@ private:
friend class RewindableJavaStream;
};
-SkStream* WrapJavaInputStream(JNIEnv* env, jobject stream,
- jbyteArray storage) {
+SkStream* CreateJavaInputStreamAdaptor(JNIEnv* env, jobject stream,
+ jbyteArray storage) {
static bool gInited;
if (!gInited) {
@@ -190,6 +190,7 @@ SkStream* WrapJavaInputStream(JNIEnv* env, jobject stream,
return new JavaInputStreamAdaptor(env, stream, storage);
}
+
static SkMemoryStream* adaptor_to_mem_stream(SkStream* adaptor) {
SkASSERT(adaptor != NULL);
SkDynamicMemoryWStream wStream;
@@ -203,9 +204,9 @@ static SkMemoryStream* adaptor_to_mem_stream(SkStream* adaptor) {
return new SkMemoryStream(data.get());
}
-SkMemoryStream* CopyJavaInputStream(JNIEnv* env, jobject stream,
- jbyteArray storage) {
- SkAutoTUnref<SkStream> adaptor(WrapJavaInputStream(env, stream, storage));
+SkStreamRewindable* CopyJavaInputStream(JNIEnv* env, jobject stream,
+ jbyteArray storage) {
+ SkAutoTUnref<SkStream> adaptor(CreateJavaInputStreamAdaptor(env, stream, storage));
if (NULL == adaptor.get()) {
return NULL;
}
@@ -302,7 +303,7 @@ static size_t get_length_if_supported(JNIEnv* env, jobject jstream) {
SkStreamRewindable* GetRewindableStream(JNIEnv* env, jobject stream,
jbyteArray storage) {
- SkAutoTUnref<SkStream> adaptor(WrapJavaInputStream(env, stream, storage));
+ SkAutoTUnref<SkStream> adaptor(CreateJavaInputStreamAdaptor(env, stream, storage));
if (NULL == adaptor.get()) {
return NULL;
}
diff --git a/core/jni/android/graphics/CreateJavaOutputStreamAdaptor.h b/core/jni/android/graphics/CreateJavaOutputStreamAdaptor.h
index 5218dc5..fcc0c9a 100644
--- a/core/jni/android/graphics/CreateJavaOutputStreamAdaptor.h
+++ b/core/jni/android/graphics/CreateJavaOutputStreamAdaptor.h
@@ -24,8 +24,8 @@ class SkWStream;
* function returns, since the Java InputStream is not managed
* by the SkStream.
*/
-SkStream* WrapJavaInputStream(JNIEnv* env, jobject stream,
- jbyteArray storage);
+SkStream* CreateJavaInputStreamAdaptor(JNIEnv* env, jobject stream,
+ jbyteArray storage);
/**
* Copy a Java InputStream.
@@ -33,13 +33,11 @@ SkStream* WrapJavaInputStream(JNIEnv* env, jobject stream,
* @param stream Pointer to Java InputStream.
* @param storage Java byte array for retrieving data from the
* Java InputStream.
- * @return SkMemoryStream The data in stream will be copied to a new
- * SkMemoryStream.
- * FIXME: Could return a more generic return type if ViewStateSerializer
- * did not require an SkMemoryStream.
+ * @return SkStreamRewindable The data in stream will be copied
+ * to a new SkStreamRewindable.
*/
-SkMemoryStream* CopyJavaInputStream(JNIEnv* env, jobject stream,
- jbyteArray storage);
+SkStreamRewindable* CopyJavaInputStream(JNIEnv* env, jobject stream,
+ jbyteArray storage);
/**
* Get a rewindable stream from a Java InputStream.
@@ -50,7 +48,7 @@ SkMemoryStream* CopyJavaInputStream(JNIEnv* env, jobject stream,
* @return SkStreamRewindable Either a wrapper around the Java
* InputStream, if possible, or a copy which is rewindable.
* Since it may be a wrapper, must not be used after the
- * caller returns, like the result of WrapJavaInputStream.
+ * caller returns, like the result of CreateJavaInputStreamAdaptor.
*/
SkStreamRewindable* GetRewindableStream(JNIEnv* env, jobject stream,
jbyteArray storage);
@@ -69,5 +67,4 @@ android::AssetStreamAdaptor* CheckForAssetStream(JNIEnv* env, jobject stream);
SkWStream* CreateJavaOutputStreamAdaptor(JNIEnv* env, jobject stream,
jbyteArray storage);
-
#endif
diff --git a/core/jni/android/graphics/Picture.cpp b/core/jni/android/graphics/Picture.cpp
index dff2b18..fcf22b8 100644
--- a/core/jni/android/graphics/Picture.cpp
+++ b/core/jni/android/graphics/Picture.cpp
@@ -39,9 +39,10 @@ public:
static SkPicture* deserialize(JNIEnv* env, jobject, jobject jstream,
jbyteArray jstorage) {
SkPicture* picture = NULL;
- SkAutoTUnref<SkStream> strm(WrapJavaInputStream(env, jstream, jstorage));
- if (strm.get()) {
- picture = SkPicture::CreateFromStream(strm.get());
+ SkStream* strm = CreateJavaInputStreamAdaptor(env, jstream, jstorage);
+ if (strm) {
+ picture = SkPicture::CreateFromStream(strm);
+ delete strm;
}
return picture;
}