summaryrefslogtreecommitdiffstats
path: root/libs
diff options
context:
space:
mode:
authorRomain Guy <romainguy@google.com>2012-02-23 17:11:49 -0800
committerAndroid (Google) Code Review <android-gerrit@google.com>2012-02-23 17:11:49 -0800
commit34c55d30858cba1e58c38e7d8e175d25cf0b33c4 (patch)
tree294243c9567c20654005186e3d72c66f804d0c16 /libs
parent5d3bc7d3e4d0d43428a81e9807f49a35e69ae018 (diff)
parent4bcb7467a174ed03a67b0c62950c555813ddf00d (diff)
downloadframeworks_base-34c55d30858cba1e58c38e7d8e175d25cf0b33c4.zip
frameworks_base-34c55d30858cba1e58c38e7d8e175d25cf0b33c4.tar.gz
frameworks_base-34c55d30858cba1e58c38e7d8e175d25cf0b33c4.tar.bz2
Merge "Only recreate path textures when necessary"
Diffstat (limited to 'libs')
-rw-r--r--libs/hwui/DisplayListRenderer.h1
-rw-r--r--libs/hwui/PathCache.cpp5
2 files changed, 6 insertions, 0 deletions
diff --git a/libs/hwui/DisplayListRenderer.h b/libs/hwui/DisplayListRenderer.h
index 90a7145..4a299c6 100644
--- a/libs/hwui/DisplayListRenderer.h
+++ b/libs/hwui/DisplayListRenderer.h
@@ -462,6 +462,7 @@ private:
SkPath* pathCopy = mPathMap.valueFor(path);
if (pathCopy == NULL || pathCopy->getGenerationID() != path->getGenerationID()) {
pathCopy = new SkPath(*path);
+ pathCopy->setSourcePath(path);
// replaceValueFor() performs an add if the entry doesn't exist
mPathMap.replaceValueFor(path, pathCopy);
mPaths.add(pathCopy);
diff --git a/libs/hwui/PathCache.cpp b/libs/hwui/PathCache.cpp
index e09c243..e363b73 100644
--- a/libs/hwui/PathCache.cpp
+++ b/libs/hwui/PathCache.cpp
@@ -83,6 +83,11 @@ void PathCache::clearGarbage() {
}
PathTexture* PathCache::get(SkPath* path, SkPaint* paint) {
+ const SkPath* sourcePath = path->getSourcePath();
+ if (sourcePath && sourcePath->getGenerationID() == path->getGenerationID()) {
+ path = const_cast<SkPath*>(sourcePath);
+ }
+
PathCacheEntry entry(path, paint);
PathTexture* texture = mCache.get(entry);