diff options
Diffstat (limited to 'libs/hwui/PathCache.cpp')
-rw-r--r-- | libs/hwui/PathCache.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/libs/hwui/PathCache.cpp b/libs/hwui/PathCache.cpp index 1c298b16154d..eb606cb037e9 100644 --- a/libs/hwui/PathCache.cpp +++ b/libs/hwui/PathCache.cpp @@ -182,7 +182,8 @@ static SkBitmap* drawPath(const SkPath* path, const SkPaint* paint, PathTexture* PathCache::PathCache() : mCache(LruCache<PathDescription, PathTexture*>::kUnlimitedCapacity) , mSize(0) - , mMaxSize(Properties::pathCacheSize) { + , mMaxSize(Properties::pathCacheSize) + , mTexNum(0) { mCache.setOnEntryRemovedListener(this); GLint maxTextureSize; @@ -238,6 +239,7 @@ void PathCache::removeTexture(PathTexture* texture) { "the cache in an inconsistent state", size); } mSize -= size; + mTexNum--; } PATH_LOGD("PathCache::delete name, size, mSize = %d, %d, %d", @@ -262,7 +264,7 @@ void PathCache::purgeCache(uint32_t width, uint32_t height) { } void PathCache::trim() { - while (mSize > mMaxSize) { + while (mSize > mMaxSize || mTexNum > DEFAULT_PATH_TEXTURE_CAP) { mCache.removeOldest(); } } @@ -310,6 +312,7 @@ void PathCache::generateTexture(SkBitmap& bitmap, Texture* texture) { ATRACE_NAME("Upload Path Texture"); texture->upload(bitmap); texture->setFilter(GL_LINEAR); + mTexNum++; } /////////////////////////////////////////////////////////////////////////////// |