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

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

Issue 2293573002: Add tinted static UI resource cache (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix text color when cache is full Created 4 years, 3 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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.content.Context; 7 import android.content.Context;
8 import android.content.res.Resources; 8 import android.content.res.Resources;
9 import android.graphics.Bitmap; 9 import android.graphics.Bitmap;
10 import android.graphics.Rect; 10 import android.graphics.Rect;
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 } 160 }
161 161
162 Rect padding = resource.getPadding(); 162 Rect padding = resource.getPadding();
163 Rect aperture = resource.getAperture(); 163 Rect aperture = resource.getAperture();
164 164
165 nativeOnResourceReady(mNativeResourceManagerPtr, resType, resId, resourc e.getBitmap(), 165 nativeOnResourceReady(mNativeResourceManagerPtr, resType, resId, resourc e.getBitmap(),
166 padding.left, padding.top, padding.right, padding.bottom, 166 padding.left, padding.top, padding.right, padding.bottom,
167 aperture.left, aperture.top, aperture.right, aperture.bottom); 167 aperture.left, aperture.top, aperture.right, aperture.bottom);
168 } 168 }
169 169
170 /**
171 * Clear the cache of tinted assets that the native manager holds.
172 */
173 public void clearTintedResourceCache() {
174 if (mNativeResourceManagerPtr == 0) return;
175 nativeClearTintedResourceCache(mNativeResourceManagerPtr);
176 }
177
170 private void saveMetadataForLoadedResource(int resType, int resId, Resource resource) { 178 private void saveMetadataForLoadedResource(int resType, int resId, Resource resource) {
171 SparseArray<LayoutResource> bucket = mLoadedResources.get(resType); 179 SparseArray<LayoutResource> bucket = mLoadedResources.get(resType);
172 if (bucket == null) { 180 if (bucket == null) {
173 bucket = new SparseArray<LayoutResource>(); 181 bucket = new SparseArray<LayoutResource>();
174 mLoadedResources.put(resType, bucket); 182 mLoadedResources.put(resType, bucket);
175 } 183 }
176 bucket.put(resId, new LayoutResource(mPxToDp, resource)); 184 bucket.put(resId, new LayoutResource(mPxToDp, resource));
177 } 185 }
178 186
179 @CalledByNative 187 @CalledByNative
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
219 227
220 private native void nativeOnResourceReady(long nativeResourceManagerImpl, in t resType, 228 private native void nativeOnResourceReady(long nativeResourceManagerImpl, in t resType,
221 int resId, Bitmap bitmap, int paddingLeft, int paddingTop, int paddi ngRight, 229 int resId, Bitmap bitmap, int paddingLeft, int paddingTop, int paddi ngRight,
222 int paddingBottom, int apertureLeft, int apertureTop, int apertureRi ght, 230 int paddingBottom, int apertureLeft, int apertureTop, int apertureRi ght,
223 int apertureBottom); 231 int apertureBottom);
224 private native void nativeOnCrushedSpriteResourceReady(long nativeResourceMa nagerImpl, 232 private native void nativeOnCrushedSpriteResourceReady(long nativeResourceMa nagerImpl,
225 int bitmapResId, Bitmap bitmap, int[][] frameRects, int unscaledSpri teWidth, 233 int bitmapResId, Bitmap bitmap, int[][] frameRects, int unscaledSpri teWidth,
226 int unscaledSpriteHeight, float scaledSpriteWidth, float scaledSprit eHeight); 234 int unscaledSpriteHeight, float scaledSpriteWidth, float scaledSprit eHeight);
227 private native void nativeOnCrushedSpriteResourceReloaded(long nativeResourc eManagerImpl, 235 private native void nativeOnCrushedSpriteResourceReloaded(long nativeResourc eManagerImpl,
228 int bitmapResId, Bitmap bitmap); 236 int bitmapResId, Bitmap bitmap);
237 private native void nativeClearTintedResourceCache(long nativeResourceManage rImpl);
229 238
230 } 239 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698