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 | 9 |
10 #include "base/android/scoped_java_ref.h" | 10 #include "base/android/scoped_java_ref.h" |
11 #include "third_party/skia/include/core/SkBitmap.h" | 11 #include "third_party/skia/include/core/SkBitmap.h" |
12 #include "ui/gfx/size.h" | 12 #include "ui/gfx/size.h" |
13 | 13 |
14 namespace gfx { | 14 namespace gfx { |
15 | 15 |
16 // Define Bitmap Config values like BITMAP_CONFIG_ARGB_8888 in a | 16 // Define Bitmap Config values like BITMAP_CONFIG_ARGB_8888 in a |
17 // way that ensures they're always the same than their Java counterpart. | 17 // way that ensures they're always the same than their Java counterpart. |
18 | 18 |
19 enum BitmapConfig { | 19 enum BitmapConfig { |
Yaron
2014/08/20 05:52:02
What about files that have multiple enums defined?
Yaron
2014/08/20 05:52:02
Shouldn't this be BitmapFormat? I guess that's ort
mkosiba (inactive)
2014/09/02 16:00:57
Done.
| |
20 #define DEFINE_BITMAP_CONFIG(x, y) BITMAP_##x = y, | 20 BITMAP_FORMAT_NO_CONFIG, |
21 #include "bitmap_config_list.h" | 21 BITMAP_FORMAT_ALPHA_8, |
22 #undef DEFINE_BITMAP_CONFIG | 22 BITMAP_FORMAT_ARGB_4444, |
23 BITMAP_FORMAT_ARGB_8888, | |
24 BITMAP_FORMAT_RGB_565, | |
23 }; | 25 }; |
24 | 26 |
25 // This class wraps a JNI AndroidBitmap object to make it easier to use. It | 27 // This class wraps a JNI AndroidBitmap object to make it easier to use. It |
26 // handles locking and unlocking of the underlying pixels, along with wrapping | 28 // handles locking and unlocking of the underlying pixels, along with wrapping |
27 // various JNI methods. | 29 // various JNI methods. |
28 class GFX_EXPORT JavaBitmap { | 30 class GFX_EXPORT JavaBitmap { |
29 public: | 31 public: |
30 explicit JavaBitmap(jobject bitmap); | 32 explicit JavaBitmap(jobject bitmap); |
31 ~JavaBitmap(); | 33 ~JavaBitmap(); |
32 | 34 |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
73 // Converts |bitmap| to an SkBitmap of the same size and format. | 75 // Converts |bitmap| to an SkBitmap of the same size and format. |
74 // Note: |jbitmap| is assumed to be non-null, non-empty and of format RGBA_8888. | 76 // Note: |jbitmap| is assumed to be non-null, non-empty and of format RGBA_8888. |
75 GFX_EXPORT SkBitmap CreateSkBitmapFromJavaBitmap(const JavaBitmap& jbitmap); | 77 GFX_EXPORT SkBitmap CreateSkBitmapFromJavaBitmap(const JavaBitmap& jbitmap); |
76 | 78 |
77 // Returns a Skia color type value for the requested input java Bitmap.Config. | 79 // Returns a Skia color type value for the requested input java Bitmap.Config. |
78 GFX_EXPORT SkColorType ConvertToSkiaColorType(jobject jbitmap_config); | 80 GFX_EXPORT SkColorType ConvertToSkiaColorType(jobject jbitmap_config); |
79 | 81 |
80 } // namespace gfx | 82 } // namespace gfx |
81 | 83 |
82 #endif // UI_GFX_ANDROID_JAVA_BITMAP_H_ | 84 #endif // UI_GFX_ANDROID_JAVA_BITMAP_H_ |
OLD | NEW |