| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 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 | 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 package org.chromium.ui.resources; | 5 package org.chromium.ui.resources; |
| 6 | 6 |
| 7 import android.graphics.Rect; | 7 import android.graphics.Rect; |
| 8 | 8 |
| 9 import org.chromium.base.annotations.JNINamespace; | 9 import org.chromium.base.annotations.JNINamespace; |
| 10 import org.chromium.ui.resources.statics.NinePatchData; | 10 import org.chromium.ui.resources.statics.NinePatchData; |
| 11 | 11 |
| 12 /** | 12 /** |
| 13 * A utility class for creating native resources. | 13 * A utility class for creating native resources. |
| 14 */ | 14 */ |
| 15 @JNINamespace("ui") | 15 @JNINamespace("ui") |
| 16 public class ResourceFactory { | 16 public class ResourceFactory { |
| 17 public static long createBitmapResource(NinePatchData ninePatchData) { | 17 public static long createBitmapResource(NinePatchData ninePatchData) { |
| 18 return ninePatchData == null ? nativeCreateBitmapResource() | 18 return ninePatchData == null ? nativeCreateBitmapResource() |
| 19 : createNinePatchBitmapResource(ninePatchDa
ta.getPadding(), | 19 : createNinePatchBitmapResource(ninePatchDa
ta.getPadding(), |
| 20 ninePatchData.getAperture()); | 20 ninePatchData.getAperture()); |
| 21 } | 21 } |
| 22 | 22 |
| 23 // Make this private in https://codereview.chromium.org/2752693003/ | 23 private static long createNinePatchBitmapResource(Rect padding, Rect apertur
e) { |
| 24 public static long createNinePatchBitmapResource(Rect padding, Rect aperture
) { | |
| 25 return nativeCreateNinePatchBitmapResource(padding.left, padding.top, pa
dding.right, | 24 return nativeCreateNinePatchBitmapResource(padding.left, padding.top, pa
dding.right, |
| 26 padding.bottom, aperture.left, aperture.top, aperture.right, ape
rture.bottom); | 25 padding.bottom, aperture.left, aperture.top, aperture.right, ape
rture.bottom); |
| 27 } | 26 } |
| 28 | 27 |
| 29 private static native long nativeCreateBitmapResource(); | 28 private static native long nativeCreateBitmapResource(); |
| 30 private static native long nativeCreateNinePatchBitmapResource(int paddingLe
ft, int paddingTop, | 29 private static native long nativeCreateNinePatchBitmapResource(int paddingLe
ft, int paddingTop, |
| 31 int paddingRight, int paddingBottom, int apertureLeft, int apertureT
op, | 30 int paddingRight, int paddingBottom, int apertureLeft, int apertureT
op, |
| 32 int apertureRight, int apertureBottom); | 31 int apertureRight, int apertureBottom); |
| 33 } | 32 } |
| OLD | NEW |