diff --git a/libs/hwui/OpenGLRenderer.cpp b/libs/hwui/OpenGLRenderer.cpp index 8c3603b153b97..12c4607130caa 100644 --- a/libs/hwui/OpenGLRenderer.cpp +++ b/libs/hwui/OpenGLRenderer.cpp @@ -2255,12 +2255,15 @@ void OpenGLRenderer::drawPath(const SkPath* path, const SkPaint* paint) { PathTexture* texture = mCaches.pathCache.get(path, paint); if (!texture) return; - const AutoTexture autoCleanup(texture); const float x = texture->left - texture->offset; const float y = texture->top - texture->offset; drawPathTexture(texture, x, y, paint); + + if (texture->cleanup) { + mCaches.pathCache.remove(path, paint); + } mDirty = true; } diff --git a/libs/hwui/PathCache.cpp b/libs/hwui/PathCache.cpp index fd9ab1847f0d5..06ea55ad2eacc 100644 --- a/libs/hwui/PathCache.cpp +++ b/libs/hwui/PathCache.cpp @@ -396,6 +396,13 @@ PathTexture* PathCache::get(const SkPath* path, const SkPaint* paint) { return texture; } +void PathCache::remove(const SkPath* path, const SkPaint* paint) +{ + PathDescription entry(kShapePath, paint); + entry.shape.path.mGenerationID = path->getGenerationID(); + mCache.remove(entry); +} + void PathCache::precache(const SkPath* path, const SkPaint* paint) { if (!Caches::getInstance().tasks.canRunTasks()) { return; diff --git a/libs/hwui/PathCache.h b/libs/hwui/PathCache.h index 31f8d35533759..302e9f8569043 100644 --- a/libs/hwui/PathCache.h +++ b/libs/hwui/PathCache.h @@ -202,6 +202,7 @@ public: PathTexture* getArc(float width, float height, float startAngle, float sweepAngle, bool useCenter, const SkPaint* paint); PathTexture* get(const SkPath* path, const SkPaint* paint); + void remove(const SkPath* path, const SkPaint* paint); /** * Removes the specified path. This is meant to be called from threads