diff options
Diffstat (limited to 'libs/hwui/PathCache.cpp')
-rw-r--r-- | libs/hwui/PathCache.cpp | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/libs/hwui/PathCache.cpp b/libs/hwui/PathCache.cpp index b58785a6bd04..04d07dbbee8a 100644 --- a/libs/hwui/PathCache.cpp +++ b/libs/hwui/PathCache.cpp @@ -92,10 +92,13 @@ void PathCache::setMaxSize(uint32_t maxSize) { /////////////////////////////////////////////////////////////////////////////// void PathCache::operator()(PathCacheEntry& path, PathTexture*& texture) { - const uint32_t size = texture->width * texture->height; - mSize -= size; - if (texture) { + const uint32_t size = texture->width * texture->height; + mSize -= size; + + PATH_LOGD("PathCache::callback: delete path: name, size, mSize = %d, %d, %d", + texture->id, size, mSize); + glDeleteTextures(1, &texture->id); delete texture; } @@ -107,12 +110,18 @@ void PathCache::operator()(PathCacheEntry& path, PathTexture*& texture) { void PathCache::remove(SkPath* path) { Mutex::Autolock _l(mLock); + // TODO: Linear search... + Vector<uint32_t> pathsToRemove; for (uint32_t i = 0; i < mCache.size(); i++) { if (mCache.getKeyAt(i).path == path) { - mCache.removeAt(i); + pathsToRemove.push(i); } } + + for (size_t i = 0; i < pathsToRemove.size(); i++) { + mCache.removeAt(pathsToRemove.itemAt(i)); + } } PathTexture* PathCache::get(SkPath* path, SkPaint* paint) { @@ -188,6 +197,8 @@ PathTexture* PathCache::addTexture(const PathCacheEntry& entry, if (size < mMaxSize) { mLock.lock(); mSize += size; + PATH_LOGD("PathCache::get: create path: name, size, mSize = %d, %d, %d", + texture->id, size, mSize); mCache.put(entry, texture); mLock.unlock(); } else { |