Index: ui/gfx/android/bitmap_android.h |
diff --git a/ui/gfx/android/bitmap_android.h b/ui/gfx/android/bitmap_android.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..d23fcfe370afdbbc747b597813e23ec7aa115841 |
--- /dev/null |
+++ b/ui/gfx/android/bitmap_android.h |
@@ -0,0 +1,42 @@ |
+// 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_BITMAP_ANDROID_H_ |
+#define UI_GFX_BITMAP_ANDROID_H_ |
+ |
+#include "base/android/scoped_java_ref.h" |
+#include "ui/gfx/size.h" |
+ |
+class SkBitmap; |
+ |
+using base::android::ScopedJavaLocalRef; |
sky
2012/08/03 17:15:36
No using in headers.
Jesse Greenwald
2012/08/03 20:10:06
Done.
|
+ |
+namespace gfx { |
+ |
+class AutoLockJavaBitmap { |
nilesh
2012/08/03 04:52:36
Please add a class level comment.
sky
2012/08/03 17:15:36
Do you need to export this class?
sky
2012/08/03 17:15:36
Filename should match class name.
Jesse Greenwald
2012/08/03 20:10:06
Done.
|
+ public: |
+ AutoLockJavaBitmap(jobject bitmap); |
sky
2012/08/03 17:15:36
explicit
Jesse Greenwald
2012/08/03 20:10:06
Done.
|
+ ~AutoLockJavaBitmap(); |
+ |
+ void* pixels() const { return pixels_; } |
sky
2012/08/03 17:15:36
Generally its bad practice to return a non-const p
Jesse Greenwald
2012/08/03 20:10:06
Done - change it so that it's not a const function
|
+ gfx::Size size() const; |
sky
2012/08/03 17:15:36
unix_hacker_style function names are intended for
Jesse Greenwald
2012/08/03 20:10:06
Done.
|
+ // 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(AutoLockJavaBitmap); |
+}; |
+ |
+base::android::ScopedJavaLocalRef<jobject> CreateJavaBitmap( |
+ const gfx::Size& size); |
+ |
+ScopedJavaLocalRef<jobject> ConvertToJavaBitmap(const SkBitmap* skbitmap); |
+ |
+} // namespace gfx |
+ |
+#endif // UI_GFX_BITMAP_ANDROID_H_ |