| 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" |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 private: | 42 private: |
| 43 jobject bitmap_; | 43 jobject bitmap_; |
| 44 void* pixels_; | 44 void* pixels_; |
| 45 gfx::Size size_; | 45 gfx::Size size_; |
| 46 int format_; | 46 int format_; |
| 47 uint32_t stride_; | 47 uint32_t stride_; |
| 48 | 48 |
| 49 DISALLOW_COPY_AND_ASSIGN(JavaBitmap); | 49 DISALLOW_COPY_AND_ASSIGN(JavaBitmap); |
| 50 }; | 50 }; |
| 51 | 51 |
| 52 // Allocates a Java-backed bitmap (android.graphics.Bitmap) with the given size |
| 53 // and configuration. |
| 54 GFX_EXPORT base::android::ScopedJavaLocalRef<jobject> CreateJavaBitmap( |
| 55 int width, |
| 56 int height, |
| 57 SkBitmap::Config bitmap_config); |
| 58 |
| 52 GFX_EXPORT base::android::ScopedJavaLocalRef<jobject> ConvertToJavaBitmap( | 59 GFX_EXPORT base::android::ScopedJavaLocalRef<jobject> ConvertToJavaBitmap( |
| 53 const SkBitmap* skbitmap); | 60 const SkBitmap* skbitmap); |
| 54 | 61 |
| 55 GFX_EXPORT SkBitmap CreateSkBitmapFromJavaBitmap(JavaBitmap& jbitmap); | 62 GFX_EXPORT SkBitmap CreateSkBitmapFromJavaBitmap(JavaBitmap& jbitmap); |
| 56 | 63 |
| 57 // If the resource loads successfully, it will be resized to |size|. | 64 // If the resource loads successfully, it will be resized to |size|. |
| 58 // Note: If the source resource is smaller than |size|, quality may suffer. | 65 // Note: If the source resource is smaller than |size|, quality may suffer. |
| 59 GFX_EXPORT SkBitmap CreateSkBitmapFromResource(const char* name, | 66 GFX_EXPORT SkBitmap CreateSkBitmapFromResource(const char* name, |
| 60 gfx::Size size); | 67 gfx::Size size); |
| 61 | 68 |
| 62 // Returns a Skia config value for the requested input java Bitmap.Config. | 69 // Returns a Skia config value for the requested input java Bitmap.Config. |
| 63 GFX_EXPORT SkBitmap::Config ConvertToSkiaConfig(jobject bitmap_config); | 70 GFX_EXPORT SkBitmap::Config ConvertToSkiaConfig(jobject bitmap_config); |
| 64 | 71 |
| 65 } // namespace gfx | 72 } // namespace gfx |
| 66 | 73 |
| 67 #endif // UI_GFX_ANDROID_JAVA_BITMAP_H_ | 74 #endif // UI_GFX_ANDROID_JAVA_BITMAP_H_ |
| OLD | NEW |