android_frameworks_base/libs/hwui/jni/ByteBufferStreamAdaptor.h
Derek Sollenberger 83ccff716f Move android.graphics JNI & APEX files into HWUI
The graphics JNI code is now separate from libandroid_runtime
and it along with HWUI headers are no longer visible to targets
outside the boundary of what is to become the UI mainline module

The exposed headers to targets outside the module are now restriced
to C APIs contained in the apex header directory.

Bug: 137655431
Test: CtsUiRenderingTestCases
Change-Id: I30d34055b6870dc1039f190a88f4a747cee17300
2020-02-19 21:13:34 -05:00

38 lines
1.3 KiB
C++

#ifndef _ANDROID_GRAPHICS_BYTE_BUFFER_STREAM_ADAPTOR_H_
#define _ANDROID_GRAPHICS_BYTE_BUFFER_STREAM_ADAPTOR_H_
#include <jni.h>
#include <memory>
class SkStream;
/**
* Create an adaptor for treating a java.nio.ByteBuffer as an SkStream.
*
* This will special case direct ByteBuffers, but not the case where a byte[]
* can be used directly. For that, use CreateByteArrayStreamAdaptor.
*
* @param jbyteBuffer corresponding to the java ByteBuffer. This method will
* add a global ref.
* @param initialPosition returned by ByteBuffer.position(). Decoding starts
* from here.
* @param limit returned by ByteBuffer.limit().
*
* Returns null on failure.
*/
std::unique_ptr<SkStream> CreateByteBufferStreamAdaptor(JNIEnv*, jobject jbyteBuffer,
size_t initialPosition, size_t limit);
/**
* Create an adaptor for treating a Java byte[] as an SkStream.
*
* @param offset into the byte[] of the beginning of the data to use.
* @param length of data to use, starting from offset.
*
* Returns null on failure.
*/
std::unique_ptr<SkStream> CreateByteArrayStreamAdaptor(JNIEnv*, jbyteArray array, size_t offset,
size_t length);
#endif // _ANDROID_GRAPHICS_BYTE_BUFFER_STREAM_ADAPTOR_H_