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

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: 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
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..d817a9e09d600bbf57551362fcd21e97dbed0cd1 100644
--- a/ui/gfx/android/java_bitmap.h
+++ b/ui/gfx/android/java_bitmap.h
@@ -8,17 +8,26 @@
#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 "base/android/bitmap_config_list.h"
Yaron 2014/02/19 18:26:14 Why is this in base? It's only used in ui and seem
sivag 2014/02/20 17:13:59 Can you please advice over this 1. i changed as b
+#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.
class GFX_EXPORT JavaBitmap {
public:
+
bulach 2014/02/19 12:42:58 nit: remove extra \n
explicit JavaBitmap(jobject bitmap);
~JavaBitmap();
@@ -51,6 +60,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);
danakj 2014/02/19 15:42:31 name this JavaConfigToSkiaConfig()?
+
} // namespace gfx
#endif // UI_GFX_ANDROID_JAVA_BITMAP_H_

Powered by Google App Engine
This is Rietveld 408576698