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 "SkMatrix.h"
12 #include "SkTDArray.h"
13 #include "SkTypes.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 : public SkNoncopyable {
25 public:
26     InvalidationController();
27 
28     void inval(const SkRect&, const SkMatrix& ctm = SkMatrix::I());
29 
30     const SkRect& bounds() const { return fBounds;        }
31     const SkRect*  begin() const { return fRects.begin(); }
32     const SkRect*    end() const { return fRects.end();   }
33 
34 private:
35     SkTDArray<SkRect> fRects;
36     SkRect            fBounds;
37 
38     typedef SkNoncopyable INHERITED;
39 };
40 
41 } // namespace sksg
42 
43 #endif // SkSGInvalidationController_DEFINED
44