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

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

Issue 157033007: API to Convert Java Bitmap Config to SkBitmap::Config (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Adding webview dependecy build changes. 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.h
diff --git a/ui/gfx/android/java_bitmap.h b/ui/gfx/android/java_bitmap.h
index 9d1e4432cb7dcafaed425e7b20159b82875f3b31..cb1077d73e2ca49f6c8af26c8a107bda67398d6c 100644
--- a/ui/gfx/android/java_bitmap.h
+++ b/ui/gfx/android/java_bitmap.h
@@ -8,12 +8,20 @@
#include <jni.h>
#include "base/android/scoped_java_ref.h"
+#include "third_party/skia/include/core/SkBitmap.h"
#include "ui/gfx/size.h"
-class SkBitmap;
-
namespace gfx {
+// Define Bitmap Config values like BITMAP_CONFIG_ARGB_8888 in a
+// way that ensures they're always the same than their Java counterpart.
+
+enum BitmapConfig {
+#define DEFINE_BITMAP_CONFIG(x, y) BITMAP_##x = y,
+#include "bitmap_config_list.h"
+#undef DEFINE_BITMAP_CONFIG
+};
+
// This class wraps a JNI AndroidBitmap object to make it easier to use. It
// handles locking and unlocking of the underlying pixels, along with wrapping
// various JNI methods.
@@ -51,6 +59,9 @@ GFX_EXPORT SkBitmap CreateSkBitmapFromJavaBitmap(JavaBitmap& jbitmap);
GFX_EXPORT SkBitmap CreateSkBitmapFromResource(const char* name,
gfx::Size size);
+// Returns a Skia config value for the requested input java Bitmap.Config.
+GFX_EXPORT SkBitmap::Config ConvertToSkiaConfig(jobject bitmap_config);
+
} // namespace gfx
#endif // UI_GFX_ANDROID_JAVA_BITMAP_H_

Powered by Google App Engine
This is Rietveld 408576698