diff options
author | Chris Craik <ccraik@google.com> | 2015-05-11 18:23:09 -0700 |
---|---|---|
committer | Chris Craik <ccraik@google.com> | 2015-05-11 19:10:24 -0700 |
commit | 42455fc9182cfe0c9f91c77712541888ca61df9e (patch) | |
tree | 27f204481411d3674a4642360f1a54a9840b2024 /libs/hwui/PathCache.cpp | |
parent | 0a775ce9801f03071d1e9bcc177d79e6fe350702 (diff) | |
download | frameworks_base-42455fc9182cfe0c9f91c77712541888ca61df9e.zip frameworks_base-42455fc9182cfe0c9f91c77712541888ca61df9e.tar.gz frameworks_base-42455fc9182cfe0c9f91c77712541888ca61df9e.tar.bz2 |
Remove usage of Texture::cleanup in PathCache
bug:21039605
Was causing double-deletes, is unneeded.
Change-Id: I5c0a21d076fae7039d777ca09b21492f97fea98b
Diffstat (limited to 'libs/hwui/PathCache.cpp')
-rw-r--r-- | libs/hwui/PathCache.cpp | 37 |
1 files changed, 12 insertions, 25 deletions
diff --git a/libs/hwui/PathCache.cpp b/libs/hwui/PathCache.cpp index 74964f6..8f5fea3 100644 --- a/libs/hwui/PathCache.cpp +++ b/libs/hwui/PathCache.cpp @@ -142,7 +142,7 @@ PathCache::PathCache(): char property[PROPERTY_VALUE_MAX]; if (property_get(PROPERTY_PATH_CACHE_SIZE, property, nullptr) > 0) { INIT_LOGD(" Setting %s cache size to %sMB", name, property); - setMaxSize(MB(atof(property))); + mMaxSize = MB(atof(property)); } else { INIT_LOGD(" Using default %s cache size of %.2fMB", name, DEFAULT_PATH_CACHE_SIZE); } @@ -172,13 +172,6 @@ uint32_t PathCache::getMaxSize() { return mMaxSize; } -void PathCache::setMaxSize(uint32_t maxSize) { - mMaxSize = maxSize; - while (mSize > mMaxSize) { - mCache.removeOldest(); - } -} - /////////////////////////////////////////////////////////////////////////////// // Callbacks /////////////////////////////////////////////////////////////////////////////// @@ -267,24 +260,18 @@ void PathCache::generateTexture(const PathDescription& entry, SkBitmap* bitmap, PathTexture* texture, bool addToCache) { generateTexture(*bitmap, texture); + // Note here that we upload to a texture even if it's bigger than mMaxSize. + // Such an entry in mCache will only be temporary, since it will be evicted + // immediately on trim, or on any other Path entering the cache. uint32_t size = texture->width * texture->height; - if (size < mMaxSize) { - mSize += size; - PATH_LOGD("PathCache::get/create: name, size, mSize = %d, %d, %d", - texture->id, size, mSize); - if (mDebugEnabled) { - ALOGD("Shape created, size = %d", size); - } - if (addToCache) { - mCache.put(entry, texture); - } - } else { - // It's okay to add a texture that's bigger than the cache since - // we'll trim the cache later when addToCache is set to false - if (!addToCache) { - mSize += size; - } - texture->cleanup = true; + mSize += size; + PATH_LOGD("PathCache::get/create: name, size, mSize = %d, %d, %d", + texture->id, size, mSize); + if (mDebugEnabled) { + ALOGD("Shape created, size = %d", size); + } + if (addToCache) { + mCache.put(entry, texture); } } |