Permalink
Browse files

Merge "Add WEBP to the list of Image formats that support Compression."

  • Loading branch information...
2 parents f458d5f + 2305ac9 commit 4fea5373d350f5d855408ffaa41206b8fa743c55 Jean-Baptiste Queru committed with Android Code Review Jun 24, 2011
Showing with 7 additions and 3 deletions.
  1. +5 −2 core/jni/android/graphics/Bitmap.cpp
  2. +2 −1 graphics/java/android/graphics/Bitmap.java
View
7 core/jni/android/graphics/Bitmap.cpp
@@ -261,7 +261,8 @@ static void Bitmap_recycle(JNIEnv* env, jobject, SkBitmap* bitmap) {
// These must match the int values in Bitmap.java
enum JavaEncodeFormat {
kJPEG_JavaEncodeFormat = 0,
- kPNG_JavaEncodeFormat = 1
+ kPNG_JavaEncodeFormat = 1,
+ kWEBP_JavaEncodeFormat = 2
};
static bool Bitmap_compress(JNIEnv* env, jobject clazz, SkBitmap* bitmap,
@@ -276,6 +277,9 @@ static bool Bitmap_compress(JNIEnv* env, jobject clazz, SkBitmap* bitmap,
case kPNG_JavaEncodeFormat:
fm = SkImageEncoder::kPNG_Type;
break;
+ case kWEBP_JavaEncodeFormat:
+ fm = SkImageEncoder::kWEBP_Type;
+ break;
default:
return false;
}
@@ -626,4 +630,3 @@ int register_android_graphics_Bitmap(JNIEnv* env)
return android::AndroidRuntime::registerNativeMethods(env, kClassPathName,
gBitmapMethods, SK_ARRAY_COUNT(gBitmapMethods));
}
-
View
3 graphics/java/android/graphics/Bitmap.java
@@ -546,7 +546,8 @@ public static Bitmap createBitmap(int colors[], int width, int height, Config co
*/
public enum CompressFormat {
JPEG (0),
- PNG (1);
+ PNG (1),
+ WEBP (2);
CompressFormat(int nativeInt) {
this.nativeInt = nativeInt;

0 comments on commit 4fea537

Please sign in to comment.