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

Side by Side Diff: ui/gfx/android/java_bitmap.h

Issue 10958058: JavaBitmap class JNI clean up, add new functionality (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: rebase, correct gyp sort order Created 8 years, 2 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef UI_GFX_ANDROID_JAVA_BITMAP_H_ 5 #ifndef UI_GFX_ANDROID_JAVA_BITMAP_H_
6 #define UI_GFX_ANDROID_JAVA_BITMAP_H_ 6 #define UI_GFX_ANDROID_JAVA_BITMAP_H_
7 7
8 #include "base/android/scoped_java_ref.h" 8 #include "base/android/scoped_java_ref.h"
9 #include "ui/gfx/size.h" 9 #include "ui/gfx/size.h"
10 10
11 class SkBitmap; 11 class SkBitmap;
12 12
13 namespace gfx { 13 namespace gfx {
14 14
15 // This class wraps a JNI AndroidBitmap object to make it easier to use. It 15 // This class wraps a JNI AndroidBitmap object to make it easier to use. It
16 // handles locking and unlocking of the underlying pixels, along with wrapping 16 // handles locking and unlocking of the underlying pixels, along with wrapping
17 // various JNI methods. 17 // various JNI methods.
18 UI_EXPORT class JavaBitmap { 18 UI_EXPORT class JavaBitmap {
19 public: 19 public:
20 explicit JavaBitmap(jobject bitmap); 20 explicit JavaBitmap(jobject bitmap);
21 ~JavaBitmap(); 21 ~JavaBitmap();
22 22
23 void* pixels() { return pixels_; } 23 inline void* pixels() { return pixels_; }
24 gfx::Size Size() const; 24 inline const gfx::Size& size() const { return size_; }
25 // Formats are in android/bitmap.h; e.g. ANDROID_BITMAP_FORMAT_RGBA_8888 25 // Formats are in android/bitmap.h; e.g. ANDROID_BITMAP_FORMAT_RGBA_8888
26 int Format() const; 26 inline int format() const { return format_; }
27 uint32_t Stride() const; 27 inline uint32_t stride() const { return stride_; }
28 28
29 private: 29 private:
30 jobject bitmap_; 30 jobject bitmap_;
31 void* pixels_; 31 void* pixels_;
32 gfx::Size size_;
33 int format_;
34 uint32_t stride_;
32 35
33 DISALLOW_COPY_AND_ASSIGN(JavaBitmap); 36 DISALLOW_COPY_AND_ASSIGN(JavaBitmap);
34 }; 37 };
35 38
36 base::android::ScopedJavaLocalRef<jobject> CreateJavaBitmap( 39 base::android::ScopedJavaLocalRef<jobject> CreateJavaBitmap(
37 const gfx::Size& size); 40 const gfx::Size& size);
38 41
39 base::android::ScopedJavaLocalRef<jobject> ConvertToJavaBitmap( 42 base::android::ScopedJavaLocalRef<jobject> ConvertToJavaBitmap(
40 const SkBitmap* skbitmap); 43 const SkBitmap* skbitmap);
41 44
45 SkBitmap CreateSkBitmapFromResource(const char* name);
46
42 } // namespace gfx 47 } // namespace gfx
43 48
44 #endif // UI_GFX_ANDROID_JAVA_BITMAP_H_ 49 #endif // UI_GFX_ANDROID_JAVA_BITMAP_H_
OLDNEW
« no previous file with comments | « ui/android/java/src/org/chromium/ui/gfx/BitmapHelper.java ('k') | ui/gfx/android/java_bitmap.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698