[sksg] More inval fixes
Backpedal on node/reval-time-determined damage: nodes cannot control
the invalidation order, and shared descendants may be revalidated before
a particular ancestor gets to query their state - thus making any
decisions based on that invalid.
Instead, apply damage suppression at invalidation time, based on node
type/traits. Node types which don't generate direct damage are marked
as such, and the invalidation logic bubbles damage past them, until it
finds a valid damage receiver.
Nodes which currently suppress damage:
- PaintNode (and subclasses)
- GeometryNode (and subclasses)
- Matrix
TBR=
Change-Id: I843e683e64cb6253d8c26d8397c44d02a7d6026f
Reviewed-on: https://skia-review.googlesource.com/91421
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
diff --git a/experimental/sksg/geometry/SkSGRect.cpp b/experimental/sksg/geometry/SkSGRect.cpp
index 0184dac..532a604 100644
--- a/experimental/sksg/geometry/SkSGRect.cpp
+++ b/experimental/sksg/geometry/SkSGRect.cpp
@@ -19,11 +19,10 @@
canvas->drawRect(fRect, paint);
}
-Node::RevalidationResult Rect::onRevalidate(InvalidationController*, const SkMatrix&) {
- SkASSERT(this->hasSelfInval());
+SkRect Rect::onRevalidate(InvalidationController*, const SkMatrix&) {
+ SkASSERT(this->hasInval());
- // Geometry does not contribute damage directly.
- return { fRect, Damage::kBlockSelf };
+ return fRect;
}
SkPath Rect::onAsPath() const {
@@ -38,11 +37,10 @@
canvas->drawRRect(fRRect, paint);
}
-Node::RevalidationResult RRect::onRevalidate(InvalidationController*, const SkMatrix&) {
- SkASSERT(this->hasSelfInval());
+SkRect RRect::onRevalidate(InvalidationController*, const SkMatrix&) {
+ SkASSERT(this->hasInval());
- // Geometry does not contribute damage directly.
- return { fRRect.getBounds(), Damage::kBlockSelf };
+ return fRRect.getBounds();
}
SkPath RRect::onAsPath() const {