43#include <GLES2/gl2ext.h>
47#define STENCIL_BUFFER_SIZE 8
68#define ATRACE_NAME(name)
75static JavaVM*
sJVM =
nullptr;
79 if (
sJVM->GetEnv((
void**) &
env, JNI_VERSION_1_4) != JNI_OK) {
80 SK_ABORT(
"Attempting to release a JNI ref on a thread without a JVM attached.");
82 jobject obj =
reinterpret_cast<jobject
>(context);
83 env->DeleteGlobalRef(obj);
86extern "C" JNIEXPORT jlong
95 options.fDisableDistanceFieldPaths =
true;
102 skottie->mDContext = std::move(dContext);
107extern "C" JNIEXPORT
void
115 skottie->mDContext->releaseResourcesAndAbandonContext();
122extern "C" JNIEXPORT
void
131 skottie->mDContext->setResourceCacheLimit(maxCacheSize);
143extern "C" JNIEXPORT jlong
155 const void*
buffer =
env->GetDirectBufferAddress(bufferObj);
156 jlong bufferSize =
env->GetDirectBufferCapacity(bufferObj);
157 if (
buffer ==
nullptr || bufferSize <= 0) {
162 jobject bufferRef =
env->NewGlobalRef(bufferObj);
163 if (bufferRef ==
nullptr) {
168 reinterpret_cast<void*
>(bufferRef)));
176 skottieAnimation->
mRunner = skottieRunner;
190 .setTextShapingFactory(sk_make_sp<SkShapers::HarfbuzzFactory>())
191 .make(skottieAnimation->
mStream.get());
197 delete skottieAnimation;
201 return (jlong) skottieAnimation;
204extern "C" JNIEXPORT
void
212 delete skottieAnimation;
215extern "C" JNIEXPORT
bool
218 jlong nativeProxy, jint
width,
220 jboolean wideColorGamut,
222 jint backgroundColor,
223 jboolean forceDraw) {
249 if (wideColorGamut) {
265 canvas->
clear(backgroundColor);
270 dContext->flushAndSubmit();
274extern "C" JNIEXPORT jlong
283 return (jlong) skottieAnimation->
mDuration;
@ kBottomLeft_GrSurfaceOrigin
#define SK_ABORT(message,...)
@ kRGBA_F16_SkColorType
pixel with half floats for red, green, blue, alpha;
SK_API sk_sp< SkFontMgr > SkFontMgr_New_Custom_Empty()
static SkColorType colorType(AImageDecoder *decoder, const AImageDecoderHeaderInfo *headerInfo)
@ kUnknown_SkPixelGeometry
void clear(SkColor color)
static sk_sp< SkData > MakeWithProc(const void *ptr, size_t length, ReleaseProc proc, void *ctx)
static std::unique_ptr< SkMemoryStream > Make(sk_sp< SkData > data)
void render(SkCanvas *canvas, const SkRect *dst=nullptr) const
void seek(SkScalar t, sksg::InvalidationController *ic=nullptr)
static sk_sp< DataURIResourceProviderProxy > Make(sk_sp< ResourceProvider > rp, ImageDecodeStrategy=ImageDecodeStrategy::kLazyDecode, sk_sp< const SkFontMgr > fontMgr=nullptr)
const SkRect & bounds() const
SK_API GrBackendRenderTarget MakeGL(int width, int height, int sampleCnt, int stencilBits, const GrGLFramebufferInfo &glInfo)
SK_API sk_sp< GrDirectContext > MakeGL(sk_sp< const GrGLInterface >, const GrContextOptions &)
SK_API sk_sp< const GrGLInterface > MakeEGL()
void SK_API Register(Decoder d)
constexpr SkCodecs::Decoder Decoder()
constexpr SkCodecs::Decoder Decoder()
constexpr SkCodecs::Decoder Decoder()
Optional< SkRect > bounds
SK_API sk_sp< SkSurface > WrapBackendRenderTarget(GrRecordingContext *context, const GrBackendRenderTarget &backendRenderTarget, GrSurfaceOrigin origin, SkColorType colorType, sk_sp< SkColorSpace > colorSpace, const SkSurfaceProps *surfaceProps, RenderTargetReleaseProc releaseProc=nullptr, ReleaseContext releaseContext=nullptr)
DlVertices::Builder Builder
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot The VM snapshot data that will be memory mapped as read only SnapshotAssetPath must be present isolate snapshot The isolate snapshot data that will be memory mapped as read only SnapshotAssetPath must be present cache dir Path to the cache directory This is different from the persistent_cache_path in embedder which is used for Skia shader cache icu native lib Path to the library file that exports the ICU data vm service The hostname IP address on which the Dart VM Service should be served If not defaults to or::depending on whether ipv6 is specified vm service A custom Dart VM Service port The default is to pick a randomly available open port disable vm Disable the Dart VM Service The Dart VM Service is never available in release mode disable vm service Disable mDNS Dart VM Service publication Bind to the IPv6 localhost address for the Dart VM Service Ignored if vm service host is set endless trace buffer
static void release_global_jni_ref(const void *, void *context)
JNIEXPORT void JNICALL Java_org_skia_skottie_SkottieAnimation_nDeleteProxy(JNIEnv *env, jclass clazz, jlong nativeProxy)
JNIEXPORT jlong JNICALL Java_org_skia_skottie_SkottieRunner_nCreateProxy(JNIEnv *env, jclass clazz)
JNIEXPORT jlong JNICALL Java_org_skia_skottie_SkottieAnimation_nGetDuration(JNIEnv *env, jclass clazz, jlong nativeProxy)
JNIEXPORT bool JNICALL Java_org_skia_skottie_SkottieAnimation_nDrawFrame(JNIEnv *env, jclass clazz, jlong nativeProxy, jint width, jint height, jboolean wideColorGamut, jfloat progress, jint backgroundColor, jboolean forceDraw)
JNIEXPORT void JNICALL Java_org_skia_skottie_SkottieRunner_nDeleteProxy(JNIEnv *env, jclass clazz, jlong nativeProxy)
#define STENCIL_BUFFER_SIZE
JNIEXPORT void JNICALL Java_org_skia_skottie_SkottieRunner_nSetMaxCacheSize(JNIEnv *env, jclass clazz, jint maxCacheSize, jlong nativeProxy)
#define ATRACE_NAME(name)
JNIEXPORT jlong JNICALL Java_org_skia_skottie_SkottieAnimation_nCreateProxy(JNIEnv *env, jobject clazz, jlong runner, jobject bufferObj)
skgpu::Protected fProtected
static constexpr SkRect MakeWH(float w, float h)
std::unique_ptr< SkStream > mStream
sk_sp< skottie::Animation > mAnimation
sk_sp< GrDirectContext > mDContext
std::shared_ptr< const fml::Mapping > data