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

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: Code changed as per review comments. 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
« ui/gfx/android/java_bitmap.h ('K') | « ui/gfx/android/java_bitmap.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..f3e56c729766275367db02607deda6810380f8b0 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,25 @@ SkBitmap CreateSkBitmapFromResource(const char* name, gfx::Size size) {
bitmap, skia::ImageOperations::RESIZE_BOX, size.width(), size.height());
}
+SkBitmap::Config ConvertToSkiaConfig(jobject bitmap_config)
+{
bulach 2014/02/17 10:33:58 nit: put { in the previous line
sivag 2014/02/18 16:06:22 Done.
+ int jbitmap_config =
+ static_cast<int>(Java_BitmapHelper_bitmapConfig(
bulach 2014/02/17 10:33:58 I think the static_cast is not needed..
sivag 2014/02/18 16:06:22 Done.
+ AttachCurrentThread(),
+ bitmap_config));
+
+ switch(jbitmap_config) {
+ case JavaBitmap::BITMAP_CONFIG_ALPHA_8:
+ return SkBitmap::kA8_Config;
+ case JavaBitmap::BITMAP_CONFIG_ARGB_4444:
+ return SkBitmap::kARGB_4444_Config;
+ case JavaBitmap::BITMAP_CONFIG_ARGB_8888:
+ return SkBitmap::kARGB_8888_Config;
+ case JavaBitmap::BITMAP_CONFIG_RGB_565:
+ return SkBitmap::kRGB_565_Config;
+ default:
+ return SkBitmap::kNo_Config;
+ }
+}
+
} // namespace gfx
« ui/gfx/android/java_bitmap.h ('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