summaryrefslogtreecommitdiffstats
path: root/libs/hwui/TessellationCache.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'libs/hwui/TessellationCache.cpp')
-rw-r--r--libs/hwui/TessellationCache.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/libs/hwui/TessellationCache.cpp b/libs/hwui/TessellationCache.cpp
index 1e38f9e..1d6b7cc 100644
--- a/libs/hwui/TessellationCache.cpp
+++ b/libs/hwui/TessellationCache.cpp
@@ -380,12 +380,15 @@ void TessellationCache::precacheShadows(const Matrix4* drawTransform, const Rect
const Vector3& lightCenter, float lightRadius) {
ShadowDescription key(casterPerimeter, drawTransform);
+ if (mShadowCache.get(key)) return;
sp<ShadowTask> task = new ShadowTask(drawTransform, localClip, opaque,
casterPerimeter, transformXY, transformZ, lightCenter, lightRadius);
if (mShadowProcessor == NULL) {
mShadowProcessor = new ShadowProcessor(Caches::getInstance());
}
- mShadowProcessor->add(task);
+ if (!mShadowProcessor->add(task)) {
+ mShadowProcessor->process(task);
+ }
task->incStrong(NULL); // not using sp<>s, so manually ref while in the cache
mShadowCache.put(key, task.get());
@@ -421,7 +424,9 @@ TessellationCache::Buffer* TessellationCache::getOrCreateBuffer(
if (mProcessor == NULL) {
mProcessor = new TessellationProcessor(Caches::getInstance());
}
- mProcessor->add(task);
+ if (!mProcessor->add(task)) {
+ mProcessor->process(task);
+ }
mCache.put(entry, buffer);
}
return buffer;