Chromium Code Reviews| Index: ui/android/java/src/org/chromium/ui/resources/ResourceManager.java |
| diff --git a/ui/android/java/src/org/chromium/ui/resources/ResourceManager.java b/ui/android/java/src/org/chromium/ui/resources/ResourceManager.java |
| index 0063df238bfba00a270a4019cd13bac8aef9f173..a995a5c2b8cd1168fe8b46aae3b4c39296debb85 100644 |
| --- a/ui/android/java/src/org/chromium/ui/resources/ResourceManager.java |
| +++ b/ui/android/java/src/org/chromium/ui/resources/ResourceManager.java |
| @@ -86,6 +86,15 @@ public class ResourceManager implements ResourceLoaderCallback { |
| return new ResourceManager(resources, minScreenSideLength, staticResourceManagerPtr); |
| } |
| + public static long createBitmapResource() { |
|
David Trainor- moved to gerrit
2017/03/14 18:31:52
Maybe these should live on the resources. I admit
Khushal
2017/03/15 01:50:06
Actually, how about just making NinePatchData publ
Khushal
2017/03/16 19:01:44
I moved it to a separate class. Cleaner.
|
| + return nativeCreateBitmapResource(); |
| + } |
| + |
| + public static long createNinePatchBitmapResource(Rect padding, Rect aperture) { |
| + return nativeCreateNinePatchBitmapResource(padding.left, padding.top, padding.right, |
| + padding.bottom, aperture.left, aperture.top, aperture.right, aperture.bottom); |
| + } |
| + |
| /** |
| * @return A reference to the {@link DynamicResourceLoader} that provides |
| * {@link DynamicResource} objects to this class. |
| @@ -159,12 +168,8 @@ public class ResourceManager implements ResourceLoaderCallback { |
| return; |
| } |
| - Rect padding = resource.getPadding(); |
| - Rect aperture = resource.getAperture(); |
| - |
| nativeOnResourceReady(mNativeResourceManagerPtr, resType, resId, resource.getBitmap(), |
| - padding.left, padding.top, padding.right, padding.bottom, |
| - aperture.left, aperture.top, aperture.right, aperture.bottom); |
| + resource.createNativeResource()); |
| } |
| @Override |
| @@ -234,9 +239,7 @@ public class ResourceManager implements ResourceLoaderCallback { |
| } |
| private native void nativeOnResourceReady(long nativeResourceManagerImpl, int resType, |
| - int resId, Bitmap bitmap, int paddingLeft, int paddingTop, int paddingRight, |
| - int paddingBottom, int apertureLeft, int apertureTop, int apertureRight, |
| - int apertureBottom); |
| + int resId, Bitmap bitmap, long nativeResource); |
| private native void nativeOnCrushedSpriteResourceReady(long nativeResourceManagerImpl, |
| int bitmapResId, Bitmap bitmap, int[][] frameRects, int unscaledSpriteWidth, |
| int unscaledSpriteHeight, float scaledSpriteWidth, float scaledSpriteHeight); |
| @@ -246,4 +249,8 @@ public class ResourceManager implements ResourceLoaderCallback { |
| int resId); |
| private native void nativeClearTintedResourceCache(long nativeResourceManagerImpl); |
| + private static native long nativeCreateBitmapResource(); |
| + private static native long nativeCreateNinePatchBitmapResource(int paddingLeft, int paddingTop, |
| + int paddingRight, int paddingBottom, int apertureLeft, int apertureTop, |
| + int apertureRight, int apertureBottom); |
| } |