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

Unified Diff: ui/android/java/src/org/chromium/ui/resources/ResourceManager.java

Issue 2798123002: Remove crushed sprite resource and layer (Closed)
Patch Set: Rebase and fix my nits Created 3 years, 8 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 side-by-side diff with in-line comments
Download patch
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 c0905e1a61716a4ad672a280a42e4721c40d2314..403e92b5aa11c376c0044350a9e3c0e38fc65160 100644
--- a/ui/android/java/src/org/chromium/ui/resources/ResourceManager.java
+++ b/ui/android/java/src/org/chromium/ui/resources/ResourceManager.java
@@ -18,8 +18,6 @@ import org.chromium.ui.resources.ResourceLoader.ResourceLoaderCallback;
import org.chromium.ui.resources.dynamics.BitmapDynamicResource;
import org.chromium.ui.resources.dynamics.DynamicResource;
import org.chromium.ui.resources.dynamics.DynamicResourceLoader;
-import org.chromium.ui.resources.sprites.CrushedSpriteResource;
-import org.chromium.ui.resources.sprites.CrushedSpriteResourceLoader;
import org.chromium.ui.resources.statics.StaticResourceLoader;
import org.chromium.ui.resources.system.SystemResourceLoader;
@@ -33,7 +31,6 @@ public class ResourceManager implements ResourceLoaderCallback {
private final SparseArray<ResourceLoader> mResourceLoaders = new SparseArray<ResourceLoader>();
private final SparseArray<SparseArray<LayoutResource>> mLoadedResources =
new SparseArray<SparseArray<LayoutResource>>();
- private final CrushedSpriteResourceLoader mCrushedSpriteResourceLoader;
private final float mPxToDp;
@@ -51,14 +48,13 @@ public class ResourceManager implements ResourceLoaderCallback {
AndroidResourceType.DYNAMIC_BITMAP, this));
registerResourceLoader(
new SystemResourceLoader(AndroidResourceType.SYSTEM, this, minScreenSideLength));
- mCrushedSpriteResourceLoader = new CrushedSpriteResourceLoader(this, resources);
mNativeResourceManagerPtr = staticResourceManagerPtr;
}
/**
* Creates an instance of a {@link ResourceManager}.
- * @param WindowAndroid A {@link WindowAndroid} instance to fetch a {@link Context}
+ * @param windowAndroid A {@link WindowAndroid} instance to fetch a {@link Context}
* and thus grab {@link Resources} from.
* @param staticResourceManagerPtr A pointer to the native component of this class.
* @return A new instance of a {@link ResourceManager}.
@@ -141,23 +137,9 @@ public class ResourceManager implements ResourceLoaderCallback {
public void onResourceLoaded(int resType, int resId, Resource resource) {
if (resource == null || resource.getBitmap() == null) return;
- if (resType != AndroidResourceType.CRUSHED_SPRITE) {
- saveMetadataForLoadedResource(resType, resId, resource);
- }
+ saveMetadataForLoadedResource(resType, resId, resource);
if (mNativeResourceManagerPtr == 0) return;
- if (resType == AndroidResourceType.CRUSHED_SPRITE) {
- if (resource.getBitmap() != null) {
- CrushedSpriteResource crushedResource = (CrushedSpriteResource) resource;
- nativeOnCrushedSpriteResourceReady(mNativeResourceManagerPtr, resId,
- crushedResource.getBitmap(), crushedResource.getFrameRectangles(),
- crushedResource.getUnscaledSpriteWidth(),
- crushedResource.getUnscaledSpriteHeight(),
- crushedResource.getScaledSpriteWidth(),
- crushedResource.getScaledSpriteHeight());
- }
- return;
- }
nativeOnResourceReady(mNativeResourceManagerPtr, resType, resId, resource.getBitmap(),
resource.createNativeResource());
@@ -207,20 +189,6 @@ public class ResourceManager implements ResourceLoaderCallback {
}
@CalledByNative
- private void crushedSpriteResourceRequested(int bitmapResId, int metatadataResId,
- boolean reloading) {
- if (reloading) {
- Bitmap bitmap = mCrushedSpriteResourceLoader.reloadResource(bitmapResId);
- if (bitmap != null) {
- nativeOnCrushedSpriteResourceReloaded(mNativeResourceManagerPtr, bitmapResId,
- bitmap);
- }
- } else {
- mCrushedSpriteResourceLoader.loadResource(bitmapResId, metatadataResId);
- }
- }
-
- @CalledByNative
private long getNativePtr() {
return mNativeResourceManagerPtr;
}
@@ -231,11 +199,6 @@ public class ResourceManager implements ResourceLoaderCallback {
private native void nativeOnResourceReady(long nativeResourceManagerImpl, int resType,
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);
- private native void nativeOnCrushedSpriteResourceReloaded(long nativeResourceManagerImpl,
- int bitmapResId, Bitmap bitmap);
private native void nativeRemoveResource(long nativeResourceManagerImpl, int resType,
int resId);
private native void nativeClearTintedResourceCache(long nativeResourceManagerImpl);
« no previous file with comments | « ui/android/BUILD.gn ('k') | ui/android/java/src/org/chromium/ui/resources/sprites/CrushedSpriteResource.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698