Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(74)

Side by Side Diff: ui/android/resources/resource_factory.cc

Issue 2746483003: ui/android: Fix Resource meta-data sharing with ResourceManager. (Closed)
Patch Set: jni Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ui/android/resources/resource_factory.h ('k') | ui/android/resources/resource_manager.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(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
OLDNEW
« no previous file with comments | « ui/android/resources/resource_factory.h ('k') | ui/android/resources/resource_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698