Index: include/core/SkPathRef.h |
diff --git a/include/core/SkPathRef.h b/include/core/SkPathRef.h |
index ae8945de0880f5182bed21f2560cea0040ca70b5..238c30075f31f9ac9a36bbc746632434d5249042 100644 |
--- a/include/core/SkPathRef.h |
+++ b/include/core/SkPathRef.h |
@@ -180,19 +180,7 @@ public: |
*/ |
static void Rewind(SkAutoTUnref<SkPathRef>* pathRef); |
- virtual ~SkPathRef() { |
- SkDEBUGCODE(this->validate();) |
- sk_free(fPoints); |
- |
- SkDEBUGCODE(fPoints = NULL;) |
- SkDEBUGCODE(fVerbs = NULL;) |
- SkDEBUGCODE(fVerbCnt = 0x9999999;) |
- SkDEBUGCODE(fPointCnt = 0xAAAAAAA;) |
- SkDEBUGCODE(fPointCnt = 0xBBBBBBB;) |
- SkDEBUGCODE(fGenerationID = 0xEEEEEEEE;) |
- SkDEBUGCODE(fEditorsAttached = 0x7777777;) |
- } |
- |
+ virtual ~SkPathRef(); |
int countPoints() const { SkDEBUGCODE(this->validate();) return fPointCnt; } |
int countVerbs() const { SkDEBUGCODE(this->validate();) return fVerbCnt; } |
int countWeights() const { SkDEBUGCODE(this->validate();) return fConicWeights.count(); } |
@@ -251,6 +239,14 @@ public: |
*/ |
uint32_t genID() const; |
+ struct GenIDChangeListener { |
+ virtual ~GenIDChangeListener() {} |
+ virtual void onChange() = 0; |
+ }; |
+ |
+ void addGenIDChangeListener(GenIDChangeListener* listener); |
+ void removeGenIDChangeListener(GenIDChangeListener* listener); |
reed1
2015/07/28 21:02:55
are there any callers for remove? we don't offer t
|
+ |
SkDEBUGCODE(void validate() const;) |
private: |
@@ -428,6 +424,8 @@ private: |
return fPoints; |
} |
+ void callGenIDChangeListeners(); |
+ |
enum { |
kMinSize = 256, |
}; |
@@ -452,6 +450,8 @@ private: |
mutable uint32_t fGenerationID; |
SkDEBUGCODE(int32_t fEditorsAttached;) // assert that only one editor in use at any time. |
+ SkTDArray<GenIDChangeListener*> fGenIDChangeListeners; // pointers are owned |
+ |
friend class PathRefTest_Private; |
typedef SkRefCnt INHERITED; |
}; |