Bug: skbug.com/10154 Bug: 140600285 Test: BitmapRegionDecoderTest in CtsGraphicsTestCases Skia is renaming this class in https://skia-review.googlesource.com/c/skia/+/287498 Use the new name for this and android::skia::BitmapRegionDecoder. Convert CopyAssetToStream to CopyAssetToData. It was already using an SkData, held by an SkMemoryStream. Using an SkData directly will allow sharing it with other decoders for a multithreaded BitmapRegionDecoder. Remove comment about ref/reopen-ing the asset. Change-Id: Ib51a8d697ad0f5dc1f461257311b31443b5f9dfb
43 lines
1.5 KiB
C++
43 lines
1.5 KiB
C++
#ifndef _ANDROID_GRAPHICS_CREATE_JAVA_OUTPUT_STREAM_ADAPTOR_H_
|
|
#define _ANDROID_GRAPHICS_CREATE_JAVA_OUTPUT_STREAM_ADAPTOR_H_
|
|
|
|
#include "jni.h"
|
|
#include "SkData.h"
|
|
|
|
class SkMemoryStream;
|
|
class SkStream;
|
|
class SkStreamRewindable;
|
|
class SkWStream;
|
|
|
|
/**
|
|
* Return an adaptor from a Java InputStream to an SkStream.
|
|
* Does not support rewind.
|
|
* @param env JNIEnv object.
|
|
* @param stream Pointer to Java InputStream.
|
|
* @param storage Java byte array for retrieving data from the
|
|
* Java InputStream.
|
|
* @param swallowExceptions Whether to call ExceptionClear() after
|
|
* an Exception is thrown. If false, it is up to the client to
|
|
* clear or propagate the exception.
|
|
* @return SkStream Simple subclass of SkStream which supports its
|
|
* basic methods like reading. Only valid until the calling
|
|
* function returns, since the Java InputStream is not managed
|
|
* by the SkStream.
|
|
*/
|
|
SkStream* CreateJavaInputStreamAdaptor(JNIEnv* env, jobject stream, jbyteArray storage,
|
|
bool swallowExceptions = true);
|
|
|
|
/**
|
|
* Copy a Java InputStream to an SkData.
|
|
* @param env JNIEnv object.
|
|
* @param stream Pointer to Java InputStream.
|
|
* @param storage Java byte array for retrieving data from the
|
|
* Java InputStream.
|
|
* @return SkData containing the stream's data.
|
|
*/
|
|
sk_sp<SkData> CopyJavaInputStream(JNIEnv* env, jobject stream, jbyteArray storage);
|
|
|
|
SkWStream* CreateJavaOutputStreamAdaptor(JNIEnv* env, jobject stream, jbyteArray storage);
|
|
|
|
#endif // _ANDROID_GRAPHICS_CREATE_JAVA_OUTPUT_STREAM_ADAPTOR_H_
|