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 #include "ui/gfx/android/java_bitmap.h" | 5 #include "ui/gfx/android/java_bitmap.h" |
6 | 6 |
7 #include <android/bitmap.h> | 7 #include <android/bitmap.h> |
8 | 8 |
9 #include "base/android/jni_string.h" | 9 #include "base/android/jni_string.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
11 #include "jni/BitmapHelper_jni.h" | 11 #include "jni/BitmapHelper_jni.h" |
12 #include "ui/gfx/geometry/size.h" | 12 #include "ui/gfx/geometry/size.h" |
13 | 13 |
14 using base::android::AttachCurrentThread; | 14 using base::android::AttachCurrentThread; |
15 using base::android::ConvertUTF8ToJavaString; | 15 using base::android::ConvertUTF8ToJavaString; |
| 16 using base::android::ScopedJavaLocalRef; |
16 | 17 |
17 namespace gfx { | 18 namespace gfx { |
18 | 19 |
19 JavaBitmap::JavaBitmap(jobject bitmap) | 20 JavaBitmap::JavaBitmap(jobject bitmap) |
20 : bitmap_(bitmap), | 21 : bitmap_(bitmap), |
21 pixels_(NULL) { | 22 pixels_(NULL) { |
22 int err = AndroidBitmap_lockPixels(AttachCurrentThread(), bitmap_, &pixels_); | 23 int err = AndroidBitmap_lockPixels(AttachCurrentThread(), bitmap_, &pixels_); |
23 DCHECK(!err); | 24 DCHECK(!err); |
24 DCHECK(pixels_); | 25 DCHECK(pixels_); |
25 | 26 |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
124 return kN32_SkColorType; | 125 return kN32_SkColorType; |
125 case BITMAP_FORMAT_RGB_565: | 126 case BITMAP_FORMAT_RGB_565: |
126 return kRGB_565_SkColorType; | 127 return kRGB_565_SkColorType; |
127 case BITMAP_FORMAT_NO_CONFIG: | 128 case BITMAP_FORMAT_NO_CONFIG: |
128 default: | 129 default: |
129 return kUnknown_SkColorType; | 130 return kUnknown_SkColorType; |
130 } | 131 } |
131 } | 132 } |
132 | 133 |
133 } // namespace gfx | 134 } // namespace gfx |
OLD | NEW |