OLD | NEW |
---|---|
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "media/capture/video/android/photo_capabilities.h" | 5 #include "media/capture/video/android/photo_capabilities.h" |
6 | 6 |
7 #include "base/android/jni_android.h" | 7 #include "base/android/jni_android.h" |
8 #include "base/android/jni_array.h" | 8 #include "base/android/jni_array.h" |
9 #include "base/android/jni_string.h" | 9 #include "base/android/jni_string.h" |
10 #include "jni/PhotoCapabilities_jni.h" | 10 #include "jni/PhotoCapabilities_jni.h" |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
138 } | 138 } |
139 | 139 |
140 PhotoCapabilities::AndroidMeteringMode PhotoCapabilities::getWhiteBalanceMode() | 140 PhotoCapabilities::AndroidMeteringMode PhotoCapabilities::getWhiteBalanceMode() |
141 const { | 141 const { |
142 DCHECK(!object_.is_null()); | 142 DCHECK(!object_.is_null()); |
143 return static_cast<AndroidMeteringMode>( | 143 return static_cast<AndroidMeteringMode>( |
144 Java_PhotoCapabilities_getWhiteBalanceMode(AttachCurrentThread(), | 144 Java_PhotoCapabilities_getWhiteBalanceMode(AttachCurrentThread(), |
145 object_)); | 145 object_)); |
146 } | 146 } |
147 | 147 |
148 PhotoCapabilities::AndroidFillLightMode PhotoCapabilities::getFillLightMode() | 148 std::vector<PhotoCapabilities::AndroidFillLightMode> |
149 const { | 149 PhotoCapabilities::getFillLightModes() const { |
150 DCHECK(!object_.is_null()); | 150 DCHECK(!object_.is_null()); |
151 return static_cast<AndroidFillLightMode>( | 151 |
152 Java_PhotoCapabilities_getFillLightMode(AttachCurrentThread(), object_)); | 152 JNIEnv* env = AttachCurrentThread(); |
153 std::vector<AndroidFillLightMode> modes; | |
154 static_assert( | |
155 std::is_same<int, | |
156 std::underlying_type<AndroidFillLightMode>::type>::value, | |
157 "AndroidFillLightMode underlying type should be int"); | |
158 | |
159 base::android::ScopedJavaLocalRef<jintArray> jni_modes = | |
160 Java_PhotoCapabilities_getFillLightModes(env, object_); | |
161 if (!jni_modes.obj()) | |
162 return modes; | |
163 base::android::JavaIntArrayToIntVector( | |
164 env, jni_modes.obj(), reinterpret_cast<std::vector<int>*>(&modes)); | |
Reilly Grant (use Gerrit)
2017/03/31 20:13:09
base::android::ScopedJavaLocalRef<jintArray> jni_m
mcasas
2017/03/31 21:14:47
Done.
| |
165 return modes; | |
166 } | |
167 | |
168 bool PhotoCapabilities::getTorch() const { | |
169 DCHECK(!object_.is_null()); | |
170 return Java_PhotoCapabilities_getTorch(AttachCurrentThread(), object_); | |
153 } | 171 } |
154 | 172 |
155 bool PhotoCapabilities::getRedEyeReduction() const { | 173 bool PhotoCapabilities::getRedEyeReduction() const { |
156 DCHECK(!object_.is_null()); | 174 DCHECK(!object_.is_null()); |
157 return Java_PhotoCapabilities_getRedEyeReduction(AttachCurrentThread(), | 175 return Java_PhotoCapabilities_getRedEyeReduction(AttachCurrentThread(), |
158 object_); | 176 object_); |
159 } | 177 } |
160 | 178 |
161 int PhotoCapabilities::getMinColorTemperature() const { | 179 int PhotoCapabilities::getMinColorTemperature() const { |
162 DCHECK(!object_.is_null()); | 180 DCHECK(!object_.is_null()); |
(...skipping 13 matching lines...) Expand all Loading... | |
176 AttachCurrentThread(), object_); | 194 AttachCurrentThread(), object_); |
177 } | 195 } |
178 | 196 |
179 int PhotoCapabilities::getStepColorTemperature() const { | 197 int PhotoCapabilities::getStepColorTemperature() const { |
180 DCHECK(!object_.is_null()); | 198 DCHECK(!object_.is_null()); |
181 return Java_PhotoCapabilities_getStepColorTemperature(AttachCurrentThread(), | 199 return Java_PhotoCapabilities_getStepColorTemperature(AttachCurrentThread(), |
182 object_); | 200 object_); |
183 } | 201 } |
184 | 202 |
185 } // namespace media | 203 } // namespace media |
OLD | NEW |