OLD | NEW |
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 <jni.h> | 8 #include <jni.h> |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 | 10 |
(...skipping 23 matching lines...) Expand all Loading... |
34 ~JavaBitmap(); | 34 ~JavaBitmap(); |
35 | 35 |
36 inline void* pixels() { return pixels_; } | 36 inline void* pixels() { return pixels_; } |
37 inline const void* pixels() const { return pixels_; } | 37 inline const void* pixels() const { return pixels_; } |
38 inline const gfx::Size& size() const { return size_; } | 38 inline const gfx::Size& size() const { return size_; } |
39 // Formats are in android/bitmap.h; e.g. ANDROID_BITMAP_FORMAT_RGBA_8888 | 39 // Formats are in android/bitmap.h; e.g. ANDROID_BITMAP_FORMAT_RGBA_8888 |
40 inline int format() const { return format_; } | 40 inline int format() const { return format_; } |
41 inline uint32_t stride() const { return stride_; } | 41 inline uint32_t stride() const { return stride_; } |
42 inline int byte_count() const { return byte_count_; } | 42 inline int byte_count() const { return byte_count_; } |
43 | 43 |
44 // Registers methods with JNI and returns true if succeeded. | |
45 static bool RegisterJavaBitmap(JNIEnv* env); | |
46 | |
47 private: | 44 private: |
48 jobject bitmap_; | 45 jobject bitmap_; |
49 void* pixels_; | 46 void* pixels_; |
50 gfx::Size size_; | 47 gfx::Size size_; |
51 int format_; | 48 int format_; |
52 uint32_t stride_; | 49 uint32_t stride_; |
53 int byte_count_; | 50 int byte_count_; |
54 | 51 |
55 DISALLOW_COPY_AND_ASSIGN(JavaBitmap); | 52 DISALLOW_COPY_AND_ASSIGN(JavaBitmap); |
56 }; | 53 }; |
(...skipping 14 matching lines...) Expand all Loading... |
71 // Converts |bitmap| to an SkBitmap of the same size and format. | 68 // Converts |bitmap| to an SkBitmap of the same size and format. |
72 // Note: |jbitmap| is assumed to be non-null, non-empty and of format RGBA_8888. | 69 // Note: |jbitmap| is assumed to be non-null, non-empty and of format RGBA_8888. |
73 GFX_EXPORT SkBitmap CreateSkBitmapFromJavaBitmap(const JavaBitmap& jbitmap); | 70 GFX_EXPORT SkBitmap CreateSkBitmapFromJavaBitmap(const JavaBitmap& jbitmap); |
74 | 71 |
75 // Returns a Skia color type value for the requested input java Bitmap.Config. | 72 // Returns a Skia color type value for the requested input java Bitmap.Config. |
76 GFX_EXPORT SkColorType ConvertToSkiaColorType(jobject jbitmap_config); | 73 GFX_EXPORT SkColorType ConvertToSkiaColorType(jobject jbitmap_config); |
77 | 74 |
78 } // namespace gfx | 75 } // namespace gfx |
79 | 76 |
80 #endif // UI_GFX_ANDROID_JAVA_BITMAP_H_ | 77 #endif // UI_GFX_ANDROID_JAVA_BITMAP_H_ |
OLD | NEW |