Loading core/jni/android/graphics/BitmapFactory.cpp +4 −27 Original line number Diff line number Diff line Loading @@ -79,18 +79,15 @@ jstring getMimeTypeString(JNIEnv* env, SkImageDecoder::Format format) { } static bool optionsPurgeable(JNIEnv* env, jobject options) { return options != NULL && env->GetBooleanField(options, gOptions_purgeableFieldID); return options != NULL && env->GetBooleanField(options, gOptions_purgeableFieldID); } static bool optionsShareable(JNIEnv* env, jobject options) { return options != NULL && env->GetBooleanField(options, gOptions_shareableFieldID); return options != NULL && env->GetBooleanField(options, gOptions_shareableFieldID); } static bool optionsJustBounds(JNIEnv* env, jobject options) { return options != NULL && env->GetBooleanField(options, gOptions_justBoundsFieldID); return options != NULL && env->GetBooleanField(options, gOptions_justBoundsFieldID); } static SkPixelRef* installPixelRef(SkBitmap* bitmap, SkStream* stream, Loading Loading @@ -119,8 +116,7 @@ static jobject doDecode(JNIEnv* env, SkStream* stream, jobject padding, SkBitmap::Config prefConfig = SkBitmap::kARGB_8888_Config; bool doDither = true; bool isMutable = false; bool isPurgeable = forcePurgeable || (allowPurgeable && optionsPurgeable(env, options)); bool isPurgeable = forcePurgeable || (allowPurgeable && optionsPurgeable(env, options)); bool preferQualityOverSpeed = false; jobject javaBitmap = NULL; Loading Loading @@ -437,23 +433,6 @@ static jbyteArray nativeScaleNinePatch(JNIEnv* env, jobject, jbyteArray chunkObj return chunkObject; } static void nativeSetDefaultConfig(JNIEnv* env, jobject, int nativeConfig) { SkBitmap::Config config = static_cast<SkBitmap::Config>(nativeConfig); // these are the only default configs that make sense for codecs right now static const SkBitmap::Config gValidDefConfig[] = { SkBitmap::kRGB_565_Config, SkBitmap::kARGB_8888_Config, }; for (size_t i = 0; i < SK_ARRAY_COUNT(gValidDefConfig); i++) { if (config == gValidDefConfig[i]) { SkImageDecoder::SetDeviceConfig(config); break; } } } static jboolean nativeIsSeekable(JNIEnv* env, jobject, jobject fileDescriptor) { jint descriptor = jniGetFDFromFileDescriptor(env, fileDescriptor); return ::lseek64(descriptor, 0, SEEK_CUR) != -1 ? JNI_TRUE : JNI_FALSE; Loading Loading @@ -487,8 +466,6 @@ static JNINativeMethod gMethods[] = { (void*)nativeScaleNinePatch }, { "nativeSetDefaultConfig", "(I)V", (void*)nativeSetDefaultConfig }, { "nativeIsSeekable", "(Ljava/io/FileDescriptor;)Z", (void*)nativeIsSeekable Loading graphics/java/android/graphics/BitmapFactory.java +0 −24 Original line number Diff line number Diff line Loading @@ -595,30 +595,6 @@ public class BitmapFactory { return decodeFileDescriptor(fd, null, null); } /** * Set the default config used for decoding bitmaps. This config is * presented to the codec if the caller did not specify a preferred config * in their call to decode... * * The default value is chosen by the system to best match the device's * screen and memory constraints. * * @param config The preferred config for decoding bitmaps. If null, then * a suitable default is chosen by the system. * * @hide - only called by the browser at the moment, but should be stable * enough to expose if needed */ public static void setDefaultConfig(Bitmap.Config config) { if (config == null) { // pick this for now, as historically it was our default. // However, if we have a smarter algorithm, we can change this. config = Bitmap.Config.RGB_565; } nativeSetDefaultConfig(config.nativeInt); } private static native void nativeSetDefaultConfig(int nativeConfig); private static native Bitmap nativeDecodeStream(InputStream is, byte[] storage, Rect padding, Options opts); private static native Bitmap nativeDecodeFileDescriptor(FileDescriptor fd, Loading Loading
core/jni/android/graphics/BitmapFactory.cpp +4 −27 Original line number Diff line number Diff line Loading @@ -79,18 +79,15 @@ jstring getMimeTypeString(JNIEnv* env, SkImageDecoder::Format format) { } static bool optionsPurgeable(JNIEnv* env, jobject options) { return options != NULL && env->GetBooleanField(options, gOptions_purgeableFieldID); return options != NULL && env->GetBooleanField(options, gOptions_purgeableFieldID); } static bool optionsShareable(JNIEnv* env, jobject options) { return options != NULL && env->GetBooleanField(options, gOptions_shareableFieldID); return options != NULL && env->GetBooleanField(options, gOptions_shareableFieldID); } static bool optionsJustBounds(JNIEnv* env, jobject options) { return options != NULL && env->GetBooleanField(options, gOptions_justBoundsFieldID); return options != NULL && env->GetBooleanField(options, gOptions_justBoundsFieldID); } static SkPixelRef* installPixelRef(SkBitmap* bitmap, SkStream* stream, Loading Loading @@ -119,8 +116,7 @@ static jobject doDecode(JNIEnv* env, SkStream* stream, jobject padding, SkBitmap::Config prefConfig = SkBitmap::kARGB_8888_Config; bool doDither = true; bool isMutable = false; bool isPurgeable = forcePurgeable || (allowPurgeable && optionsPurgeable(env, options)); bool isPurgeable = forcePurgeable || (allowPurgeable && optionsPurgeable(env, options)); bool preferQualityOverSpeed = false; jobject javaBitmap = NULL; Loading Loading @@ -437,23 +433,6 @@ static jbyteArray nativeScaleNinePatch(JNIEnv* env, jobject, jbyteArray chunkObj return chunkObject; } static void nativeSetDefaultConfig(JNIEnv* env, jobject, int nativeConfig) { SkBitmap::Config config = static_cast<SkBitmap::Config>(nativeConfig); // these are the only default configs that make sense for codecs right now static const SkBitmap::Config gValidDefConfig[] = { SkBitmap::kRGB_565_Config, SkBitmap::kARGB_8888_Config, }; for (size_t i = 0; i < SK_ARRAY_COUNT(gValidDefConfig); i++) { if (config == gValidDefConfig[i]) { SkImageDecoder::SetDeviceConfig(config); break; } } } static jboolean nativeIsSeekable(JNIEnv* env, jobject, jobject fileDescriptor) { jint descriptor = jniGetFDFromFileDescriptor(env, fileDescriptor); return ::lseek64(descriptor, 0, SEEK_CUR) != -1 ? JNI_TRUE : JNI_FALSE; Loading Loading @@ -487,8 +466,6 @@ static JNINativeMethod gMethods[] = { (void*)nativeScaleNinePatch }, { "nativeSetDefaultConfig", "(I)V", (void*)nativeSetDefaultConfig }, { "nativeIsSeekable", "(Ljava/io/FileDescriptor;)Z", (void*)nativeIsSeekable Loading
graphics/java/android/graphics/BitmapFactory.java +0 −24 Original line number Diff line number Diff line Loading @@ -595,30 +595,6 @@ public class BitmapFactory { return decodeFileDescriptor(fd, null, null); } /** * Set the default config used for decoding bitmaps. This config is * presented to the codec if the caller did not specify a preferred config * in their call to decode... * * The default value is chosen by the system to best match the device's * screen and memory constraints. * * @param config The preferred config for decoding bitmaps. If null, then * a suitable default is chosen by the system. * * @hide - only called by the browser at the moment, but should be stable * enough to expose if needed */ public static void setDefaultConfig(Bitmap.Config config) { if (config == null) { // pick this for now, as historically it was our default. // However, if we have a smarter algorithm, we can change this. config = Bitmap.Config.RGB_565; } nativeSetDefaultConfig(config.nativeInt); } private static native void nativeSetDefaultConfig(int nativeConfig); private static native Bitmap nativeDecodeStream(InputStream is, byte[] storage, Rect padding, Options opts); private static native Bitmap nativeDecodeFileDescriptor(FileDescriptor fd, Loading