OLD | NEW |
(Empty) | |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "ui/android/resources/resource_factory.h" |
| 6 |
| 7 #include "jni/ResourceFactory_jni.h" |
| 8 #include "ui/android/resources/nine_patch_resource.h" |
| 9 #include "ui/gfx/geometry/rect.h" |
| 10 |
| 11 using base::android::JavaParamRef; |
| 12 |
| 13 namespace ui { |
| 14 |
| 15 bool RegisterResourceFactory(JNIEnv* env) { |
| 16 return RegisterNativesImpl(env); |
| 17 } |
| 18 |
| 19 jlong CreateBitmapResource(JNIEnv* env, const JavaParamRef<jclass>& clazz) { |
| 20 return reinterpret_cast<intptr_t>(new Resource()); |
| 21 } |
| 22 |
| 23 jlong CreateNinePatchBitmapResource(JNIEnv* env, |
| 24 const JavaParamRef<jclass>& clazz, |
| 25 jint padding_left, |
| 26 jint padding_top, |
| 27 jint padding_right, |
| 28 jint padding_bottom, |
| 29 jint aperture_left, |
| 30 jint aperture_top, |
| 31 jint aperture_right, |
| 32 jint aperture_bottom) { |
| 33 gfx::Rect padding(padding_left, padding_top, padding_right - padding_left, |
| 34 padding_bottom - padding_top); |
| 35 gfx::Rect aperture(aperture_left, aperture_top, |
| 36 aperture_right - aperture_left, |
| 37 aperture_bottom - aperture_top); |
| 38 return reinterpret_cast<intptr_t>(new NinePatchResource(padding, aperture)); |
| 39 } |
| 40 |
| 41 } // namespace ui |
OLD | NEW |