Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(249)

Unified Diff: ui/gfx/android/java_bitmap.cc

Issue 157033007: API to Convert Java Bitmap Config to SkBitmap::Config (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Auto generation of Bitmap Format enum in Java and C++. Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..10d1fe21bafd72281d7f46beb96f0deaf3518acd 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
« ui/android/java/src/org/chromium/ui/gfx/BitmapHelper.java ('K') | « ui/gfx/android/java_bitmap.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698