aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/GrSoftwarePathRenderer.cpp
diff options
context:
space:
mode:
authorGravatar Brian Osman <brianosman@google.com>2017-09-26 14:05:19 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-09-26 19:07:46 +0000
commite9242ca695a390445690cb32f67eedef85f54099 (patch)
tree6d828ae00ec453214755f581ae751e35809d8586 /src/gpu/GrSoftwarePathRenderer.cpp
parent832b222efbc3f42cf74633a19c5a4a74bc929719 (diff)
Invalidate textures cached by SW path renderer when paths go away
Bug: skia: Change-Id: Icfc2f1bd57c0cf7be54469b6d86cbd436b59155d Reviewed-on: https://skia-review.googlesource.com/51201 Reviewed-by: Greg Daniel <egdaniel@google.com> Commit-Queue: Brian Osman <brianosman@google.com>
Diffstat (limited to 'src/gpu/GrSoftwarePathRenderer.cpp')
-rw-r--r--src/gpu/GrSoftwarePathRenderer.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/gpu/GrSoftwarePathRenderer.cpp b/src/gpu/GrSoftwarePathRenderer.cpp
index 8b509082c8..9f876f1213 100644
--- a/src/gpu/GrSoftwarePathRenderer.cpp
+++ b/src/gpu/GrSoftwarePathRenderer.cpp
@@ -200,6 +200,18 @@ private:
GrAA fAA;
};
+// When the SkPathRef genID changes, invalidate a corresponding GrResource described by key.
+class PathInvalidator : public SkPathRef::GenIDChangeListener {
+public:
+ explicit PathInvalidator(const GrUniqueKey& key) : fMsg(key) {}
+private:
+ GrUniqueKeyInvalidatedMessage fMsg;
+
+ void onChange() override {
+ SkMessageBus<GrUniqueKeyInvalidatedMessage>::Post(fMsg);
+ }
+};
+
}
////////////////////////////////////////////////////////////////////////////////
@@ -344,6 +356,7 @@ bool GrSoftwarePathRenderer::onDrawPath(const DrawPathArgs& args) {
if (useCache) {
SkASSERT(proxy->origin() == kTopLeft_GrSurfaceOrigin);
fResourceProvider->assignUniqueKeyToProxy(maskKey, proxy.get());
+ args.fShape->addGenIDChangeListener(new PathInvalidator(maskKey));
}
}
if (inverseFilled) {