summaryrefslogtreecommitdiff
path: root/libs/hwui/PathCache.cpp
diff options
context:
space:
mode:
author John Reck <jreck@google.com> 2016-08-22 15:13:01 -0700
committer John Reck <jreck@google.com> 2016-08-22 15:13:01 -0700
commit4a3b0c7587dc995e00ed4e7d7ed61544f7715d2c (patch)
tree2b476e8f9b1e0a6b7d9461045468aa50cc89f1c0 /libs/hwui/PathCache.cpp
parent2a739b4fabc0b221c88764cc4263375e7d507512 (diff)
parent24e38ab322a0c396df1c6fe95f3f427d85cd5da1 (diff)
resolve merge conflicts of 24e38ab to stage-aosp-master
Change-Id: I25844e17d2d6371ed786833c756051d19d0abec4
Diffstat (limited to 'libs/hwui/PathCache.cpp')
-rw-r--r--libs/hwui/PathCache.cpp7
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++;
}
///////////////////////////////////////////////////////////////////////////////