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

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

Issue 10823094: Add bitmap utils for Chrome on Android (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Address review comments Created 8 years, 4 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
« no previous file with comments | « ui/gfx/android/gfx_jni_registrar.cc ('k') | ui/gfx/android/java_bitmap.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gfx/android/java_bitmap.h
diff --git a/ui/gfx/android/java_bitmap.h b/ui/gfx/android/java_bitmap.h
new file mode 100644
index 0000000000000000000000000000000000000000..40f0058441d35a74fbbfc7fca513887b0d05003e
--- /dev/null
+++ b/ui/gfx/android/java_bitmap.h
@@ -0,0 +1,44 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef UI_GFX_ANDROID_JAVA_BITMAP_H_
+#define UI_GFX_ANDROID_JAVA_BITMAP_H_
+
+#include "base/android/scoped_java_ref.h"
+#include "ui/gfx/size.h"
+
+class SkBitmap;
+
+namespace gfx {
+
+// 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.
+UI_EXPORT class JavaBitmap {
+ public:
+ explicit JavaBitmap(jobject bitmap);
+ ~JavaBitmap();
+
+ void* pixels() { return pixels_; }
+ gfx::Size Size() const;
+ // Formats are in android/bitmap.h; e.g. ANDROID_BITMAP_FORMAT_RGBA_8888
+ int Format() const;
+ uint32_t Stride() const;
+
+ private:
+ jobject bitmap_;
+ void* pixels_;
+
+ DISALLOW_COPY_AND_ASSIGN(JavaBitmap);
+};
+
+base::android::ScopedJavaLocalRef<jobject> CreateJavaBitmap(
+ const gfx::Size& size);
+
+base::android::ScopedJavaLocalRef<jobject> ConvertToJavaBitmap(
+ const SkBitmap* skbitmap);
+
+} // namespace gfx
+
+#endif // UI_GFX_ANDROID_JAVA_BITMAP_H_
« no previous file with comments | « ui/gfx/android/gfx_jni_registrar.cc ('k') | ui/gfx/android/java_bitmap.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698