Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 366a8405 authored by Romain Guy's avatar Romain Guy
Browse files

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
parent ab3e04c0
Loading
Loading
Loading
Loading
+37 −0
Original line number Diff line number Diff line
@@ -76419,6 +76419,17 @@
 visibility="public"
>
</method>
<method name="getGenerationId"
 return="int"
 abstract="false"
 native="false"
 synchronized="false"
 static="false"
 final="false"
 deprecated="not deprecated"
 visibility="public"
>
</method>
<method name="getHeight"
 return="int"
 abstract="false"
@@ -76636,6 +76647,19 @@
 visibility="public"
>
</method>
<method name="sameAs"
 return="boolean"
 abstract="false"
 native="false"
 synchronized="false"
 static="false"
 final="false"
 deprecated="not deprecated"
 visibility="public"
>
<parameter name="other" type="android.graphics.Bitmap">
</parameter>
</method>
<method name="setDensity"
 return="void"
 abstract="false"
@@ -76649,6 +76673,19 @@
<parameter name="density" type="int">
</parameter>
</method>
<method name="setHasAlpha"
 return="void"
 abstract="false"
 native="false"
 synchronized="false"
 static="false"
 final="false"
 deprecated="not deprecated"
 visibility="public"
>
<parameter name="hasAlpha" type="boolean">
</parameter>
</method>
<method name="setPixel"
 return="void"
 abstract="false"
+11 −13
Original line number Diff line number Diff line
@@ -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);
@@ -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,9 +1091,15 @@ public final class Bitmap implements Parcelable {

        @Override
        public void finalize() {
            try {
                super.finalize();
            } catch (Throwable t) {
                // Ignore
            } finally {
                nativeDestructor(mNativeBitmap);
            }
        }
    }

    //////////// native methods