39 private final long nativeRef;
40 private final AtomicBoolean destroyed =
new AtomicBoolean(
false);
42 private CppProxy(
long nativeRef)
44 if (nativeRef == 0)
throw new RuntimeException(
"nativeRef is zero");
45 this.nativeRef = nativeRef;
48 private native
void nativeDestroy(
long nativeRef);
49 public void _djinni_private_destroy()
51 boolean destroyed = this.destroyed.getAndSet(
true);
52 if (!destroyed) nativeDestroy(this.nativeRef);
54 protected void finalize() throws java.lang.Throwable
56 _djinni_private_destroy();
63 public android.graphics.Bitmap decodeRegion(
Rectangle rect,
int sampleSize)
65 assert !this.destroyed.get() :
"trying to use a destroyed object";
66 return native_decodeRegion(this.nativeRef, rect, sampleSize);
68 private native android.graphics.Bitmap native_decodeRegion(
long _nativeRef,
Rectangle rect,
int sampleSize);