114 lines
2.6 KiB
Java
114 lines
2.6 KiB
Java
package com.facebook.animated.webp;
|
|
|
|
import c.f.d.d.c;
|
|
import c.f.j.a.a.d;
|
|
import c.f.j.d.b;
|
|
import com.airbnb.lottie.parser.AnimatableValueParser;
|
|
import java.nio.ByteBuffer;
|
|
@c
|
|
public class WebPImage implements c.f.j.a.a.c, c.f.j.a.b.c {
|
|
@c
|
|
private long mNativeContext;
|
|
|
|
@c
|
|
public WebPImage() {
|
|
}
|
|
|
|
@c
|
|
public WebPImage(long j) {
|
|
this.mNativeContext = j;
|
|
}
|
|
|
|
private static native WebPImage nativeCreateFromDirectByteBuffer(ByteBuffer byteBuffer);
|
|
|
|
private static native WebPImage nativeCreateFromNativeMemory(long j, int i);
|
|
|
|
private native void nativeDispose();
|
|
|
|
private native void nativeFinalize();
|
|
|
|
private native int nativeGetDuration();
|
|
|
|
private native WebPFrame nativeGetFrame(int i);
|
|
|
|
private native int nativeGetFrameCount();
|
|
|
|
private native int[] nativeGetFrameDurations();
|
|
|
|
private native int nativeGetHeight();
|
|
|
|
private native int nativeGetLoopCount();
|
|
|
|
private native int nativeGetSizeInBytes();
|
|
|
|
private native int nativeGetWidth();
|
|
|
|
@Override // c.f.j.a.a.c
|
|
public int a() {
|
|
return nativeGetFrameCount();
|
|
}
|
|
|
|
@Override // c.f.j.a.a.c
|
|
public int b() {
|
|
return nativeGetLoopCount();
|
|
}
|
|
|
|
@Override // c.f.j.a.b.c
|
|
public c.f.j.a.a.c c(ByteBuffer byteBuffer, b bVar) {
|
|
c.f.j.m.b.a();
|
|
byteBuffer.rewind();
|
|
return nativeCreateFromDirectByteBuffer(byteBuffer);
|
|
}
|
|
|
|
@Override // c.f.j.a.a.c
|
|
public d d(int i) {
|
|
return nativeGetFrame(i);
|
|
}
|
|
|
|
@Override // c.f.j.a.a.c
|
|
public boolean e() {
|
|
return true;
|
|
}
|
|
|
|
@Override // c.f.j.a.a.c
|
|
public c.f.j.a.a.b f(int i) {
|
|
WebPFrame nativeGetFrame = nativeGetFrame(i);
|
|
try {
|
|
return new c.f.j.a.a.b(i, nativeGetFrame.b(), nativeGetFrame.c(), nativeGetFrame.getWidth(), nativeGetFrame.getHeight(), nativeGetFrame.d() ? 1 : 2, nativeGetFrame.e() ? 2 : 1);
|
|
} finally {
|
|
nativeGetFrame.dispose();
|
|
}
|
|
}
|
|
|
|
public void finalize() {
|
|
nativeFinalize();
|
|
}
|
|
|
|
@Override // c.f.j.a.b.c
|
|
public c.f.j.a.a.c g(long j, int i, b bVar) {
|
|
c.f.j.m.b.a();
|
|
AnimatableValueParser.j(Boolean.valueOf(j != 0));
|
|
return nativeCreateFromNativeMemory(j, i);
|
|
}
|
|
|
|
@Override // c.f.j.a.a.c
|
|
public int getHeight() {
|
|
return nativeGetHeight();
|
|
}
|
|
|
|
@Override // c.f.j.a.a.c
|
|
public int getWidth() {
|
|
return nativeGetWidth();
|
|
}
|
|
|
|
@Override // c.f.j.a.a.c
|
|
public int[] h() {
|
|
return nativeGetFrameDurations();
|
|
}
|
|
|
|
@Override // c.f.j.a.a.c
|
|
public int i() {
|
|
return nativeGetSizeInBytes();
|
|
}
|
|
}
|