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

Commit e3b8f255 authored by Matt Sarett's avatar Matt Sarett Committed by Android (Google) Code Review
Browse files

Merge "Make BitmapFactory.Options API Changes"

parents 46ca2828 5e2496bc
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -11271,14 +11271,14 @@ package android.graphics {
  public static class BitmapFactory.Options {
    ctor public BitmapFactory.Options();
    method public void requestCancelDecode();
    method public deprecated void requestCancelDecode();
    field public android.graphics.Bitmap inBitmap;
    field public int inDensity;
    field public boolean inDither;
    field public deprecated boolean inDither;
    field public deprecated boolean inInputShareable;
    field public boolean inJustDecodeBounds;
    field public boolean inMutable;
    field public boolean inPreferQualityOverSpeed;
    field public deprecated boolean inPreferQualityOverSpeed;
    field public android.graphics.Bitmap.Config inPreferredConfig;
    field public boolean inPremultiplied;
    field public deprecated boolean inPurgeable;
+3 −3
Original line number Diff line number Diff line
@@ -11631,14 +11631,14 @@ package android.graphics {
  public static class BitmapFactory.Options {
    ctor public BitmapFactory.Options();
    method public void requestCancelDecode();
    method public deprecated void requestCancelDecode();
    field public android.graphics.Bitmap inBitmap;
    field public int inDensity;
    field public boolean inDither;
    field public deprecated boolean inDither;
    field public deprecated boolean inInputShareable;
    field public boolean inJustDecodeBounds;
    field public boolean inMutable;
    field public boolean inPreferQualityOverSpeed;
    field public deprecated boolean inPreferQualityOverSpeed;
    field public android.graphics.Bitmap.Config inPreferredConfig;
    field public boolean inPremultiplied;
    field public deprecated boolean inPurgeable;
+3 −3
Original line number Diff line number Diff line
@@ -11271,14 +11271,14 @@ package android.graphics {
  public static class BitmapFactory.Options {
    ctor public BitmapFactory.Options();
    method public void requestCancelDecode();
    method public deprecated void requestCancelDecode();
    field public android.graphics.Bitmap inBitmap;
    field public int inDensity;
    field public boolean inDither;
    field public deprecated boolean inDither;
    field public deprecated boolean inInputShareable;
    field public boolean inJustDecodeBounds;
    field public boolean inMutable;
    field public boolean inPreferQualityOverSpeed;
    field public deprecated boolean inPreferQualityOverSpeed;
    field public android.graphics.Bitmap.Config inPreferredConfig;
    field public boolean inPremultiplied;
    field public deprecated boolean inPurgeable;
+0 −10
Original line number Diff line number Diff line
@@ -587,10 +587,6 @@ static jobject nativeDecodeByteArray(JNIEnv* env, jobject, jbyteArray byteArray,
    return doDecode(env, stream.release(), NULL, options);
}

static void nativeRequestCancel(JNIEnv*, jobject joptions) {
    // Deprecated
}

static jboolean nativeIsSeekable(JNIEnv* env, jobject, jobject fileDescriptor) {
    jint descriptor = jniGetFDFromFileDescriptor(env, fileDescriptor);
    return ::lseek64(descriptor, 0, SEEK_CUR) != -1 ? JNI_TRUE : JNI_FALSE;
@@ -630,10 +626,6 @@ static const JNINativeMethod gMethods[] = {
    },
};

static const JNINativeMethod gOptionsMethods[] = {
    {   "requestCancel", "()V", (void*)nativeRequestCancel }
};

int register_android_graphics_BitmapFactory(JNIEnv* env) {
    jclass options_class = FindClassOrDie(env, "android/graphics/BitmapFactory$Options");
    gOptions_bitmapFieldID = GetFieldIDOrDie(env, options_class, "inBitmap",
@@ -665,8 +657,6 @@ int register_android_graphics_BitmapFactory(JNIEnv* env) {
    gInsetStruct_constructorMethodID = GetMethodIDOrDie(env, gInsetStruct_class, "<init>",
                                                        "(IIIIIIIIFIF)V");

    android::RegisterMethodsOrDie(env, "android/graphics/BitmapFactory$Options",
                                  gOptionsMethods, NELEM(gOptionsMethods));
    return android::RegisterMethodsOrDie(env, "android/graphics/BitmapFactory",
                                         gMethods, NELEM(gMethods));
}
+19 −11
Original line number Diff line number Diff line
@@ -163,8 +163,11 @@ public class BitmapFactory {
        public boolean inPremultiplied;

        /**
         * If dither is true, the decoder will attempt to dither the decoded
         * image.
         * @deprecated As of {@link android.os.Build.VERSION_CODES#N}, this is
         * ignored.
         *
         * In {@link android.os.Build.VERSION_CODES#M} and below, if dither is
         * true, the decoder will attempt to dither the decoded image.
         */
        public boolean inDither;

@@ -308,7 +311,11 @@ public class BitmapFactory {
        public boolean inInputShareable;

        /**
         * If inPreferQualityOverSpeed is set to true, the decoder will try to
         * @deprecated As of {@link android.os.Build.VERSION_CODES#N}, this is
         * ignored.  The output will always be high quality.
         *
         * In {@link android.os.Build.VERSION_CODES#M} and below, if
         * inPreferQualityOverSpeed is set to true, the decoder will try to
         * decode the reconstructed image to a higher quality even at the
         * expense of the decoding speed. Currently the field only affects JPEG
         * decode, in the case of which a more accurate, but slightly slower,
@@ -347,8 +354,6 @@ public class BitmapFactory {
         */
        public byte[] inTempStorage;

        private native void requestCancel();

        /**
         * Flag to indicate that cancel has been called on this object.  This
         * is useful if there's an intermediary that wants to first decode the
@@ -359,16 +364,19 @@ public class BitmapFactory {
        public boolean mCancel;

        /**
         *  This can be called from another thread while this options object is
         *  inside a decode... call. Calling this will notify the decoder that
         *  it should cancel its operation. This is not guaranteed to cancel
         *  the decode, but if it does, the decoder... operation will return
         *  null, or if inJustDecodeBounds is true, will set outWidth/outHeight
         *  @deprecated As of {@link android.os.Build.VERSION_CODES#N}, this
         *  will not affect the decode, though it will still set mCancel.
         *
         *  In {@link android.os.Build.VERSION_CODES#M} and below, if this can
         *  be called from another thread while this options object is inside
         *  a decode... call. Calling this will notify the decoder that it
         *  should cancel its operation. This is not guaranteed to cancel the
         *  decode, but if it does, the decoder... operation will return null,
         *  or if inJustDecodeBounds is true, will set outWidth/outHeight
         *  to -1
         */
        public void requestCancelDecode() {
            mCancel = true;
            requestCancel();
        }
    }