Index: ui/gfx/android/java_bitmap.cc |
diff --git a/ui/gfx/android/java_bitmap.cc b/ui/gfx/android/java_bitmap.cc |
index fba158ec7b320ca7fdcbcf2539a677e2c8fcd07f..b7a0f5add151a0fdf52872b6bf6363bb191256f8 100644 |
--- a/ui/gfx/android/java_bitmap.cc |
+++ b/ui/gfx/android/java_bitmap.cc |
@@ -10,7 +10,6 @@ |
#include "base/logging.h" |
#include "jni/BitmapHelper_jni.h" |
#include "skia/ext/image_operations.h" |
-#include "third_party/skia/include/core/SkBitmap.h" |
#include "ui/gfx/size.h" |
using base::android::AttachCurrentThread; |
@@ -102,4 +101,22 @@ SkBitmap CreateSkBitmapFromResource(const char* name, gfx::Size size) { |
bitmap, skia::ImageOperations::RESIZE_BOX, size.width(), size.height()); |
} |
+SkBitmap::Config ConvertToSkiaConfig(jobject bitmap_config) { |
+ int jbitmap_config = |
+ Java_BitmapHelper_bitmapConfig(AttachCurrentThread(), bitmap_config); |
+ switch (jbitmap_config) { |
+ case BITMAP_FORMAT_ALPHA_8: |
+ return SkBitmap::kA8_Config; |
+ case BITMAP_FORMAT_ARGB_4444: |
+ return SkBitmap::kARGB_4444_Config; |
+ case BITMAP_FORMAT_ARGB_8888: |
+ return SkBitmap::kARGB_8888_Config; |
+ case BITMAP_FORMAT_RGB_565: |
+ return SkBitmap::kRGB_565_Config; |
+ case BITMAP_FORMAT_NO_CONFIG: |
+ default: |
+ return SkBitmap::kNo_Config; |
+ } |
+} |
+ |
} // namespace gfx |