summaryrefslogtreecommitdiffstats
path: root/libs/hwui/DisplayListRenderer.h
diff options
context:
space:
mode:
authorRomain Guy <romainguy@google.com>2012-02-21 18:32:32 -0800
committerRomain Guy <romainguy@google.com>2012-02-21 18:32:32 -0800
commit96ebc6b5097ab73eef45e094241e444f4c21bfcc (patch)
treeb01b3d09326092131154faa7a42058d026ad5d00 /libs/hwui/DisplayListRenderer.h
parent30c46ad519c127a92f2bd3ca1dc1eab9da6ac165 (diff)
downloadframeworks_base-96ebc6b5097ab73eef45e094241e444f4c21bfcc.zip
frameworks_base-96ebc6b5097ab73eef45e094241e444f4c21bfcc.tar.gz
frameworks_base-96ebc6b5097ab73eef45e094241e444f4c21bfcc.tar.bz2
Only copy paths, paints and shaders when we need to.
Change-Id: Iba7a9c92c865f698821b6ff7bc4f502659642ac1
Diffstat (limited to 'libs/hwui/DisplayListRenderer.h')
-rw-r--r--libs/hwui/DisplayListRenderer.h9
1 files changed, 6 insertions, 3 deletions
diff --git a/libs/hwui/DisplayListRenderer.h b/libs/hwui/DisplayListRenderer.h
index 6dd47be..90a7145 100644
--- a/libs/hwui/DisplayListRenderer.h
+++ b/libs/hwui/DisplayListRenderer.h
@@ -462,7 +462,8 @@ private:
SkPath* pathCopy = mPathMap.valueFor(path);
if (pathCopy == NULL || pathCopy->getGenerationID() != path->getGenerationID()) {
pathCopy = new SkPath(*path);
- mPathMap.add(path, pathCopy);
+ // replaceValueFor() performs an add if the entry doesn't exist
+ mPathMap.replaceValueFor(path, pathCopy);
mPaths.add(pathCopy);
}
@@ -478,7 +479,8 @@ private:
SkPaint* paintCopy = mPaintMap.valueFor(paint);
if (paintCopy == NULL || paintCopy->getGenerationID() != paint->getGenerationID()) {
paintCopy = new SkPaint(*paint);
- mPaintMap.add(paint, paintCopy);
+ // replaceValueFor() performs an add if the entry doesn't exist
+ mPaintMap.replaceValueFor(paint, paintCopy);
mPaints.add(paintCopy);
}
@@ -520,7 +522,8 @@ private:
// TODO: We also need to handle generation ID changes in compose shaders
if (shaderCopy == NULL || shaderCopy->getGenerationId() != shader->getGenerationId()) {
shaderCopy = shader->copy();
- mShaderMap.add(shader, shaderCopy);
+ // replaceValueFor() performs an add if the entry doesn't exist
+ mShaderMap.replaceValueFor(shader, shaderCopy);
mShaders.add(shaderCopy);
Caches::getInstance().resourceCache.incrementRefcount(shaderCopy);
}