discord-jadx/app/src/main/java/com/facebook/animated/gif/GifImage.java
2021-07-28 09:39:21 +02:00

167 lines
3.8 KiB
Java

package com.facebook.animated.gif;
import c.f.d.d.c;
import c.f.j.a.a.d;
import c.f.j.d.b;
import c.f.m.n.a;
import com.airbnb.lottie.parser.AnimatableValueParser;
import java.nio.ByteBuffer;
@c
public class GifImage implements c.f.j.a.a.c, c.f.j.a.b.c {
public static volatile boolean a;
@c
private long mNativeContext;
@c
public GifImage() {
}
@c
public GifImage(long j) {
this.mNativeContext = j;
}
public static synchronized void j() {
synchronized (GifImage.class) {
if (!a) {
a = true;
a.c("gifimage");
}
}
}
@c
private static native GifImage nativeCreateFromDirectByteBuffer(ByteBuffer byteBuffer, int i, boolean z2);
@c
private static native GifImage nativeCreateFromFileDescriptor(int i, int i2, boolean z2);
@c
private static native GifImage nativeCreateFromNativeMemory(long j, int i, int i2, boolean z2);
@c
private native void nativeDispose();
@c
private native void nativeFinalize();
@c
private native int nativeGetDuration();
@c
private native GifFrame nativeGetFrame(int i);
@c
private native int nativeGetFrameCount();
@c
private native int[] nativeGetFrameDurations();
@c
private native int nativeGetHeight();
@c
private native int nativeGetLoopCount();
@c
private native int nativeGetSizeInBytes();
@c
private native int nativeGetWidth();
@c
private native boolean nativeIsAnimated();
@Override // c.f.j.a.a.c
public int a() {
return nativeGetFrameCount();
}
@Override // c.f.j.a.a.c
public int b() {
int nativeGetLoopCount = nativeGetLoopCount();
if (nativeGetLoopCount == -1) {
return 1;
}
if (nativeGetLoopCount != 0) {
return nativeGetLoopCount + 1;
}
return 0;
}
@Override // c.f.j.a.b.c
public c.f.j.a.a.c c(ByteBuffer byteBuffer, b bVar) {
j();
byteBuffer.rewind();
return nativeCreateFromDirectByteBuffer(byteBuffer, bVar.f429c, false);
}
@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 false;
}
@Override // c.f.j.a.a.c
public c.f.j.a.a.b f(int i) {
int i2;
GifFrame nativeGetFrame = nativeGetFrame(i);
try {
int b = nativeGetFrame.b();
int c2 = nativeGetFrame.c();
int width = nativeGetFrame.getWidth();
int height = nativeGetFrame.getHeight();
int d = nativeGetFrame.d();
if (d != 0) {
if (d != 1) {
i2 = 3;
if (d == 2) {
i2 = 2;
} else if (d == 3) {
}
return new c.f.j.a.a.b(i, b, c2, width, height, 1, i2);
}
}
i2 = 1;
return new c.f.j.a.a.b(i, b, c2, width, height, 1, i2);
} 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) {
j();
AnimatableValueParser.j(Boolean.valueOf(j != 0));
return nativeCreateFromNativeMemory(j, i, bVar.f429c, false);
}
@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();
}
}