diff options
author | Mike Reed <reed@google.com> | 2010-03-05 17:42:30 -0500 |
---|---|---|
committer | Mike Reed <reed@google.com> | 2010-03-08 08:53:23 -0500 |
commit | 76d1e01d5e65c4631c827831e98ad4e300d99eab (patch) | |
tree | 04b3cd4637ef340332d1bb9c38d85c93949e4909 /graphics/java | |
parent | 43dcdb2ec5aaad592e16555f9b5ddc037fa71902 (diff) | |
download | frameworks_base-76d1e01d5e65c4631c827831e98ad4e300d99eab.zip frameworks_base-76d1e01d5e65c4631c827831e98ad4e300d99eab.tar.gz frameworks_base-76d1e01d5e65c4631c827831e98ad4e300d99eab.tar.bz2 |
hidden api sameAs() to compare the pixels of 2 bitmaps for equality
Diffstat (limited to 'graphics/java')
-rw-r--r-- | graphics/java/android/graphics/Bitmap.java | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/graphics/java/android/graphics/Bitmap.java b/graphics/java/android/graphics/Bitmap.java index 5aa88b0..7ca3741 100644 --- a/graphics/java/android/graphics/Bitmap.java +++ b/graphics/java/android/graphics/Bitmap.java @@ -972,6 +972,19 @@ public final class Bitmap implements Parcelable { } /** + * Given another bitmap, return true if it has the same dimensions, config, + * and pixel data as this bitmap. If any of those differ, return false. + * If other is null, return false. + * + * @hide (just needed internally right now) + */ + public boolean sameAs(Bitmap other) { + return this == other || + (other != null && + nativeSameAs(mNativeBitmap, other.mNativeBitmap)); + } + + /** * 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. @@ -1042,6 +1055,7 @@ public final class Bitmap implements Parcelable { private static native void nativePrepareToDraw(int nativeBitmap); private static native void nativeSetHasAlpha(int nBitmap, boolean hasAlpha); + private static native boolean nativeSameAs(int nb0, int nb1); /* package */ final int ni() { return mNativeBitmap; |