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 "ui/gfx/size.h" | 12 #include "ui/gfx/size.h" |
12 | 13 |
13 class SkBitmap; | |
14 | |
15 namespace gfx { | 14 namespace gfx { |
16 | 15 |
17 // This class wraps a JNI AndroidBitmap object to make it easier to use. It | 16 // This class wraps a JNI AndroidBitmap object to make it easier to use. It |
18 // handles locking and unlocking of the underlying pixels, along with wrapping | 17 // handles locking and unlocking of the underlying pixels, along with wrapping |
19 // various JNI methods. | 18 // various JNI methods. |
20 class GFX_EXPORT JavaBitmap { | 19 class GFX_EXPORT JavaBitmap { |
21 public: | 20 public: |
22 explicit JavaBitmap(jobject bitmap); | 21 explicit JavaBitmap(jobject bitmap); |
23 ~JavaBitmap(); | 22 ~JavaBitmap(); |
24 | 23 |
(...skipping 19 matching lines...) Expand all Loading... | |
44 GFX_EXPORT base::android::ScopedJavaLocalRef<jobject> ConvertToJavaBitmap( | 43 GFX_EXPORT base::android::ScopedJavaLocalRef<jobject> ConvertToJavaBitmap( |
45 const SkBitmap* skbitmap); | 44 const SkBitmap* skbitmap); |
46 | 45 |
47 GFX_EXPORT SkBitmap CreateSkBitmapFromJavaBitmap(JavaBitmap& jbitmap); | 46 GFX_EXPORT SkBitmap CreateSkBitmapFromJavaBitmap(JavaBitmap& jbitmap); |
48 | 47 |
49 // If the resource loads successfully, it will be resized to |size|. | 48 // If the resource loads successfully, it will be resized to |size|. |
50 // Note: If the source resource is smaller than |size|, quality may suffer. | 49 // Note: If the source resource is smaller than |size|, quality may suffer. |
51 GFX_EXPORT SkBitmap CreateSkBitmapFromResource(const char* name, | 50 GFX_EXPORT SkBitmap CreateSkBitmapFromResource(const char* name, |
52 gfx::Size size); | 51 gfx::Size size); |
53 | 52 |
53 // Returns a string value for the requested input i.e java Bitmap.Config. | |
54 GFX_EXPORT base::android::ScopedJavaLocalRef<jstring> | |
vivekg
2014/02/13 17:09:46
This API need not be exposed to others. You could
| |
55 ConvertBitmapConfigToString(jobject bitmap_config); | |
56 | |
57 // Returns a Skia config value for the requested input java Bitmap.Config. | |
58 GFX_EXPORT SkBitmap::Config ConvertToSkiaConfig(jobject bitmap_config); | |
59 | |
54 } // namespace gfx | 60 } // namespace gfx |
55 | 61 |
56 #endif // UI_GFX_ANDROID_JAVA_BITMAP_H_ | 62 #endif // UI_GFX_ANDROID_JAVA_BITMAP_H_ |
OLD | NEW |