28 fNode->fFlags &= ~fFlag;
32 bool wasSet()
const {
return fWasSet; }
40#define TRAVERSAL_GUARD \
41 ScopedFlag traversal_guard(this, kInTraversal_Flag); \
42 if (traversal_guard.wasSet()) \
46 : fInvalObserver(nullptr)
48 , fInvalTraits(invalTraits)
49 ,
fFlags(kInvalidated_Flag)
53 if (fFlags & kObserverArray_Flag) {
63 if (!(node->fFlags & kObserverArray_Flag)) {
64 if (!node->fInvalObserver) {
65 node->fInvalObserver =
this;
69 auto observers =
new std::vector<Node*>();
70 observers->reserve(2);
71 observers->push_back(node->fInvalObserver);
73 node->fInvalObserverArray = observers;
74 node->fFlags |= kObserverArray_Flag;
79 node->fInvalObserverArray->end(),
this) == node->fInvalObserverArray->end());
81 node->fInvalObserverArray->push_back(
this);
86 if (!(node->fFlags & kObserverArray_Flag)) {
87 SkASSERT(node->fInvalObserver ==
this);
88 node->fInvalObserver =
nullptr;
92 SkDEBUGCODE(
const auto origSize = node->fInvalObserverArray->size());
93 node->fInvalObserverArray->erase(
std::remove(node->fInvalObserverArray->begin(),
94 node->fInvalObserverArray->end(),
this),
95 node->fInvalObserverArray->end());
96 SkASSERT(node->fInvalObserverArray->size() == origSize - 1);
99template <
typename Func>
100void Node::forEachInvalObserver(Func&& func)
const {
101 if (fFlags & kObserverArray_Flag) {
116 if (this->
hasInval() && (!damageBubbling || (fFlags & kDamage_Flag))) {
123 fFlags |= kDamage_Flag;
124 damageBubbling =
false;
127 fFlags |= kInvalidated_Flag;
129 forEachInvalObserver([&](
Node* observer) {
141 const auto generate_damage =
143 if (!generate_damage) {
148 const auto prev_bounds =
fBounds;
153 ic->
inval(prev_bounds, ctm);
159 fFlags &= ~(kInvalidated_Flag | kDamage_Flag);
SkDEBUGCODE(SK_SPI) SkThreadID SkGetThreadID()
int find(T *array, int N, T item)
void inval(const SkRect &, const SkMatrix &ctm=SkMatrix::I())
ScopedFlag(Node *node, uint32_t flag)
const SkRect & revalidate(InvalidationController *, const SkMatrix &)
void observeInval(const sk_sp< Node > &)
void unobserveInval(const sk_sp< Node > &)
std::vector< Node * > * fInvalObserverArray
void invalidate(bool damage=true)
Node(uint32_t invalTraits)
virtual SkRect onRevalidate(InvalidationController *, const SkMatrix &ctm)=0
FlutterSemanticsFlag flag