Make BitmapFactory.Options API Changes

This changes the documentation for inPreferQualityOverSpeed,
inDither, and requestCancelDecode().

These changes are a result of modifying the backends of
BitmapFactory and BitmapRegionDecoder to be faster, higher quality,
and to use standard libraries.

BUG:26266063
BUG:25556965
Change-Id: I9008fd276a38c737e242bcc6930ffe4e36d9fd1d
This commit is contained in:
Matt Sarett
2015-12-18 13:07:01 -05:00
parent ca9c0d428a
commit 5e2496bcee
5 changed files with 28 additions and 30 deletions

View File

@ -11252,14 +11252,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;

View File

@ -11613,14 +11613,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;

View File

@ -11252,14 +11252,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;

View File

@ -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));
}

View File

@ -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();
}
}