summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLeon Scroggins III <scroggo@google.com>2013-09-03 11:35:00 -0400
committerLeon Scroggins III <scroggo@google.com>2013-09-03 11:35:00 -0400
commitc7797525084ba0ea441e394aa0a2ba35d6ff3320 (patch)
treeaaaee8358d9d540b74a4738d8ad4348134c7f18f
parente2acbcc0053eb9aac4ac17e1f0e8615556003da8 (diff)
downloadframeworks_base-c7797525084ba0ea441e394aa0a2ba35d6ff3320.zip
frameworks_base-c7797525084ba0ea441e394aa0a2ba35d6ff3320.tar.gz
frameworks_base-c7797525084ba0ea441e394aa0a2ba35d6ff3320.tar.bz2
Change name back to CreateJavaInputStreamAdaptor.
In order to fix open source builds, change WrapJavaInputStream's name back to CreateJavaInputStreamAdaptor. Remove FIXME in CopyJavaInputStream, and return a more generic type, since the more specific type was only needed by a change in external/webkit, which is being reverted since it depends on unreleased code. Change-Id: I89b0431e357b509a2a0c17a624b31bd49d29070f
-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;
}