1 /* 2 * Copyright 2017 Google Inc. 3 * 4 * Use of this source code is governed by a BSD-style license that can be 5 * found in the LICENSE file. 6 */ 7 8 #ifndef SkSGInvalidationController_DEFINED 9 #define SkSGInvalidationController_DEFINED 10 11 #include "include/core/SkMatrix.h" 12 #include "include/core/SkTypes.h" 13 #include "include/private/SkTDArray.h" 14 15 struct SkRect; 16 17 namespace sksg { 18 19 /** 20 * Receiver for invalidation events. 21 * 22 * Tracks dirty regions for repaint. 23 */ 24 class InvalidationController { 25 public: 26 InvalidationController(); 27 InvalidationController(const InvalidationController&) = delete; 28 InvalidationController& operator=(const InvalidationController&) = delete; 29 30 void inval(const SkRect&, const SkMatrix& ctm = SkMatrix::I()); 31 bounds()32 const SkRect& bounds() const { return fBounds; } begin()33 const SkRect* begin() const { return fRects.begin(); } end()34 const SkRect* end() const { return fRects.end(); } 35 36 void reset(); 37 38 private: 39 SkTDArray<SkRect> fRects; 40 SkRect fBounds; 41 }; 42 43 } // namespace sksg 44 45 #endif // SkSGInvalidationController_DEFINED 46