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