From 7b8b75892400745f39bb8d5b5d539091bcfb1e1e Mon Sep 17 00:00:00 2001 From: Romain Guy Date: Thu, 24 Feb 2011 19:52:37 -0800 Subject: Remove the right entries from the cache when a GC happens. Change-Id: I4649b18c4721a5511a404299e771e675c843407b --- libs/hwui/PathCache.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'libs/hwui/PathCache.cpp') diff --git a/libs/hwui/PathCache.cpp b/libs/hwui/PathCache.cpp index 0f22bea48009..367c6275c711 100644 --- a/libs/hwui/PathCache.cpp +++ b/libs/hwui/PathCache.cpp @@ -44,7 +44,9 @@ void PathCache::remove(SkPath* path) { mCache.setOnEntryRemovedListener(NULL); for (size_t i = 0; i < pathsToRemove.size(); i++) { - mCache.removeAt(pathsToRemove.itemAt(i)); + // This will work because pathsToRemove is sorted + // and because the cache is a sorted keyed vector + mCache.removeAt(pathsToRemove.itemAt(i) - i); } mCache.setOnEntryRemovedListener(this); } -- cgit v1.2.3-59-g8ed1b