Loading core/jni/android/graphics/Bitmap.cpp +8 −0 Original line number Diff line number Diff line Loading @@ -1188,6 +1188,13 @@ static jboolean Bitmap_sameAs(JNIEnv* env, jobject, jlong bm0Handle, return JNI_TRUE; } static jlong Bitmap_refPixelRef(JNIEnv* env, jobject, jlong bitmapHandle) { LocalScopedBitmap bitmap(bitmapHandle); SkPixelRef* pixelRef = bitmap->pixelRef(); SkSafeRef(pixelRef); return reinterpret_cast<jlong>(pixelRef); } static void Bitmap_prepareToDraw(JNIEnv* env, jobject, jlong bitmapPtr) { LocalScopedBitmap bitmapHandle(bitmapPtr); if (!bitmapHandle.valid()) return; Loading Loading @@ -1257,6 +1264,7 @@ static const JNINativeMethod gBitmapMethods[] = { { "nativeCopyPixelsFromBuffer", "(JLjava/nio/Buffer;)V", (void*)Bitmap_copyPixelsFromBuffer }, { "nativeSameAs", "(JJ)Z", (void*)Bitmap_sameAs }, { "nativeRefPixelRef", "(J)J", (void*)Bitmap_refPixelRef }, { "nativePrepareToDraw", "(J)V", (void*)Bitmap_prepareToDraw }, { "nativeGetAllocationByteCount", "(J)I", (void*)Bitmap_getAllocationByteCount }, }; Loading graphics/java/android/graphics/Bitmap.java +11 −0 Original line number Diff line number Diff line Loading @@ -1654,6 +1654,16 @@ public final class Bitmap implements Parcelable { nativePrepareToDraw(mNativePtr); } /** * Refs the underlying SkPixelRef and returns a pointer to it. * * @hide * */ public final long refSkPixelRef() { checkRecycled("Can't refSkPixelRef on a recycled bitmap!"); return nativeRefPixelRef(mNativePtr); } //////////// native methods private static native Bitmap nativeCreate(int[] colors, int offset, Loading Loading @@ -1710,6 +1720,7 @@ public final class Bitmap implements Parcelable { private static native boolean nativeHasMipMap(long nativeBitmap); private static native void nativeSetHasMipMap(long nativeBitmap, boolean hasMipMap); private static native boolean nativeSameAs(long nativeBitmap0, long nativeBitmap1); private static native long nativeRefPixelRef(long nativeBitmap); private static native void nativePrepareToDraw(long nativeBitmap); private static native int nativeGetAllocationByteCount(long nativeBitmap); } Loading
core/jni/android/graphics/Bitmap.cpp +8 −0 Original line number Diff line number Diff line Loading @@ -1188,6 +1188,13 @@ static jboolean Bitmap_sameAs(JNIEnv* env, jobject, jlong bm0Handle, return JNI_TRUE; } static jlong Bitmap_refPixelRef(JNIEnv* env, jobject, jlong bitmapHandle) { LocalScopedBitmap bitmap(bitmapHandle); SkPixelRef* pixelRef = bitmap->pixelRef(); SkSafeRef(pixelRef); return reinterpret_cast<jlong>(pixelRef); } static void Bitmap_prepareToDraw(JNIEnv* env, jobject, jlong bitmapPtr) { LocalScopedBitmap bitmapHandle(bitmapPtr); if (!bitmapHandle.valid()) return; Loading Loading @@ -1257,6 +1264,7 @@ static const JNINativeMethod gBitmapMethods[] = { { "nativeCopyPixelsFromBuffer", "(JLjava/nio/Buffer;)V", (void*)Bitmap_copyPixelsFromBuffer }, { "nativeSameAs", "(JJ)Z", (void*)Bitmap_sameAs }, { "nativeRefPixelRef", "(J)J", (void*)Bitmap_refPixelRef }, { "nativePrepareToDraw", "(J)V", (void*)Bitmap_prepareToDraw }, { "nativeGetAllocationByteCount", "(J)I", (void*)Bitmap_getAllocationByteCount }, }; Loading
graphics/java/android/graphics/Bitmap.java +11 −0 Original line number Diff line number Diff line Loading @@ -1654,6 +1654,16 @@ public final class Bitmap implements Parcelable { nativePrepareToDraw(mNativePtr); } /** * Refs the underlying SkPixelRef and returns a pointer to it. * * @hide * */ public final long refSkPixelRef() { checkRecycled("Can't refSkPixelRef on a recycled bitmap!"); return nativeRefPixelRef(mNativePtr); } //////////// native methods private static native Bitmap nativeCreate(int[] colors, int offset, Loading Loading @@ -1710,6 +1720,7 @@ public final class Bitmap implements Parcelable { private static native boolean nativeHasMipMap(long nativeBitmap); private static native void nativeSetHasMipMap(long nativeBitmap, boolean hasMipMap); private static native boolean nativeSameAs(long nativeBitmap0, long nativeBitmap1); private static native long nativeRefPixelRef(long nativeBitmap); private static native void nativePrepareToDraw(long nativeBitmap); private static native int nativeGetAllocationByteCount(long nativeBitmap); }