Loading api/current.xml +11 −0 Original line number Diff line number Diff line Loading @@ -47001,6 +47001,17 @@ visibility="public" > </method> <method name="prepareToDraw" return="void" abstract="false" native="false" synchronized="false" static="false" final="false" deprecated="not deprecated" visibility="public" > </method> <method name="recycle" return="void" abstract="false" core/jni/android/graphics/Bitmap.cpp +30 −24 Original line number Diff line number Diff line Loading @@ -519,6 +519,11 @@ static void Bitmap_copyPixelsFromBuffer(JNIEnv* env, jobject, } } static void Bitmap_prepareToDraw(JNIEnv* env, jobject, SkBitmap* bitmap) { bitmap->lockPixels(); bitmap->unlockPixels(); } /////////////////////////////////////////////////////////////////////////////// #include <android_runtime/AndroidRuntime.h> Loading Loading @@ -552,7 +557,8 @@ static JNINativeMethod gBitmapMethods[] = { { "nativeCopyPixelsToBuffer", "(ILjava/nio/Buffer;)V", (void*)Bitmap_copyPixelsToBuffer }, { "nativeCopyPixelsFromBuffer", "(ILjava/nio/Buffer;)V", (void*)Bitmap_copyPixelsFromBuffer } (void*)Bitmap_copyPixelsFromBuffer }, { "nativePrepareToDraw", "(I)V", (void*)Bitmap_prepareToDraw } }; #define kClassPathName "android/graphics/Bitmap" Loading graphics/java/android/graphics/Bitmap.java +62 −44 Original line number Diff line number Diff line Loading @@ -16,14 +16,14 @@ package android.graphics; import android.os.Parcelable; import android.os.Parcel; import android.os.Parcelable; import java.io.OutputStream; import java.nio.Buffer; import java.nio.ByteBuffer; import java.nio.ShortBuffer; import java.nio.IntBuffer; import java.io.OutputStream; import java.nio.ShortBuffer; public final class Bitmap implements Parcelable { /** Loading Loading @@ -917,6 +917,22 @@ public final class Bitmap implements Parcelable { return bm; } /** * Rebuilds any caches associated with the bitmap that are used for * drawing it. In the case of purgeable bitmaps, this call will attempt to * ensure that the pixels have been decoded. * If this is called on more than one bitmap in sequence, the priority is * given in LRU order (i.e. the last bitmap called will be given highest * priority). * * For bitmaps with no associated caches, this call is effectively a no-op, * and therefore is harmless. */ public void prepareToDraw() { nativePrepareToDraw(mNativeBitmap); } @Override protected void finalize() throws Throwable { try { nativeDestructor(mNativeBitmap); Loading Loading @@ -969,6 +985,8 @@ public final class Bitmap implements Parcelable { int nativePaint, int[] offsetXY); private static native void nativePrepareToDraw(int nativeBitmap); /* package */ final int ni() { return mNativeBitmap; } Loading Loading
api/current.xml +11 −0 Original line number Diff line number Diff line Loading @@ -47001,6 +47001,17 @@ visibility="public" > </method> <method name="prepareToDraw" return="void" abstract="false" native="false" synchronized="false" static="false" final="false" deprecated="not deprecated" visibility="public" > </method> <method name="recycle" return="void" abstract="false"
core/jni/android/graphics/Bitmap.cpp +30 −24 Original line number Diff line number Diff line Loading @@ -519,6 +519,11 @@ static void Bitmap_copyPixelsFromBuffer(JNIEnv* env, jobject, } } static void Bitmap_prepareToDraw(JNIEnv* env, jobject, SkBitmap* bitmap) { bitmap->lockPixels(); bitmap->unlockPixels(); } /////////////////////////////////////////////////////////////////////////////// #include <android_runtime/AndroidRuntime.h> Loading Loading @@ -552,7 +557,8 @@ static JNINativeMethod gBitmapMethods[] = { { "nativeCopyPixelsToBuffer", "(ILjava/nio/Buffer;)V", (void*)Bitmap_copyPixelsToBuffer }, { "nativeCopyPixelsFromBuffer", "(ILjava/nio/Buffer;)V", (void*)Bitmap_copyPixelsFromBuffer } (void*)Bitmap_copyPixelsFromBuffer }, { "nativePrepareToDraw", "(I)V", (void*)Bitmap_prepareToDraw } }; #define kClassPathName "android/graphics/Bitmap" Loading
graphics/java/android/graphics/Bitmap.java +62 −44 Original line number Diff line number Diff line Loading @@ -16,14 +16,14 @@ package android.graphics; import android.os.Parcelable; import android.os.Parcel; import android.os.Parcelable; import java.io.OutputStream; import java.nio.Buffer; import java.nio.ByteBuffer; import java.nio.ShortBuffer; import java.nio.IntBuffer; import java.io.OutputStream; import java.nio.ShortBuffer; public final class Bitmap implements Parcelable { /** Loading Loading @@ -917,6 +917,22 @@ public final class Bitmap implements Parcelable { return bm; } /** * Rebuilds any caches associated with the bitmap that are used for * drawing it. In the case of purgeable bitmaps, this call will attempt to * ensure that the pixels have been decoded. * If this is called on more than one bitmap in sequence, the priority is * given in LRU order (i.e. the last bitmap called will be given highest * priority). * * For bitmaps with no associated caches, this call is effectively a no-op, * and therefore is harmless. */ public void prepareToDraw() { nativePrepareToDraw(mNativeBitmap); } @Override protected void finalize() throws Throwable { try { nativeDestructor(mNativeBitmap); Loading Loading @@ -969,6 +985,8 @@ public final class Bitmap implements Parcelable { int nativePaint, int[] offsetXY); private static native void nativePrepareToDraw(int nativeBitmap); /* package */ final int ni() { return mNativeBitmap; } Loading