55 private final long nativeRef;
56 private final AtomicBoolean destroyed =
new AtomicBoolean(
false);
58 private CppProxy(
long nativeRef)
60 if (nativeRef == 0)
throw new RuntimeException(
"nativeRef is zero");
61 this.nativeRef = nativeRef;
64 private native
void nativeDestroy(
long nativeRef);
65 public void _djinni_private_destroy()
67 boolean destroyed = this.destroyed.getAndSet(
true);
68 if (!destroyed) nativeDestroy(this.nativeRef);
70 protected void finalize() throws java.lang.Throwable
72 _djinni_private_destroy();
79 public android.graphics.Bitmap decodeRegion(
Rectangle rect,
float sampleSize)
81 assert !this.destroyed.get() :
"trying to use a destroyed object";
82 return native_decodeRegion(this.nativeRef, rect, sampleSize);
84 private native android.graphics.Bitmap native_decodeRegion(
long _nativeRef,
Rectangle rect,
float sampleSize);