diff options
author | Romain Guy <romainguy@google.com> | 2011-02-08 11:58:06 -0800 |
---|---|---|
committer | Romain Guy <romainguy@google.com> | 2011-02-08 11:58:06 -0800 |
commit | 366a84056c9a695ee6702d9d30bf9f3b521ba7cc (patch) | |
tree | abf4501b8e25b8814c64b8067a37e51e5dfbafb0 /graphics | |
parent | ab3e04c0d16a0b41f6251322999a273678094f47 (diff) | |
download | frameworks_base-366a84056c9a695ee6702d9d30bf9f3b521ba7cc.zip frameworks_base-366a84056c9a695ee6702d9d30bf9f3b521ba7cc.tar.gz frameworks_base-366a84056c9a695ee6702d9d30bf9f3b521ba7cc.tar.bz2 |
Expose several useful Bitmap APIs.
Bug #3408073
Bitmap.setHasAlpha() in particular is very useful for applications that use
ARGB_8888 bitmaps but want/need to benefit from an extra speed boost.
Change-Id: I73d081b7e43bd725baffd1a9892c72d8729816f7
Diffstat (limited to 'graphics')
-rw-r--r-- | graphics/java/android/graphics/Bitmap.java | 24 |
1 files changed, 11 insertions, 13 deletions
diff --git a/graphics/java/android/graphics/Bitmap.java b/graphics/java/android/graphics/Bitmap.java index c7ae2cf..bd903da 100644 --- a/graphics/java/android/graphics/Bitmap.java +++ b/graphics/java/android/graphics/Bitmap.java @@ -200,8 +200,6 @@ public final class Bitmap implements Parcelable { * check if a bitmap has changed. * * @return The current generation ID for this bitmap. - * - * @hide */ public int getGenerationId() { return nativeGenerationId(mNativeBitmap); @@ -752,7 +750,7 @@ public final class Bitmap implements Parcelable { } // Scale by tdensity / sdensity, rounding up. - return ( (size * tdensity) + (sdensity >> 1) ) / sdensity; + return ((size * tdensity) + (sdensity >> 1)) / sdensity; } /** @@ -790,14 +788,12 @@ public final class Bitmap implements Parcelable { /** * Tell the bitmap if all of the pixels are known to be opaque (false) * or if some of the pixels may contain non-opaque alpha values (true). - * Note, for some configs (e.g. RGB_565) this call is ignore, since it does - * not support per-pixel alpha values. + * Note, for some configs (e.g. RGB_565) this call is ignored, since it + * does not support per-pixel alpha values. * * This is meant as a drawing hint, as in some cases a bitmap that is known * to be opaque can take a faster drawing case than one that may have * non-opaque per-pixel alpha values. - * - * @hide */ public void setHasAlpha(boolean hasAlpha) { nativeSetHasAlpha(mNativeBitmap, hasAlpha); @@ -1066,13 +1062,9 @@ 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)); + return this == other || (other != null && nativeSameAs(mNativeBitmap, other.mNativeBitmap)); } /** @@ -1099,7 +1091,13 @@ public final class Bitmap implements Parcelable { @Override public void finalize() { - nativeDestructor(mNativeBitmap); + try { + super.finalize(); + } catch (Throwable t) { + // Ignore + } finally { + nativeDestructor(mNativeBitmap); + } } } |