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
14#include <vector>
15
16struct SkRect;
17
18namespace sksg {
19
20/**
21 * Receiver for invalidation events.
22 *
23 * Tracks dirty regions for repaint.
24 */
25class InvalidationController {
26public:
27 InvalidationController();
28 InvalidationController(const InvalidationController&) = delete;
29 InvalidationController& operator=(const InvalidationController&) = delete;
30
31 void inval(const SkRect&, const SkMatrix& ctm = SkMatrix::I());
32
33 const SkRect& bounds() const { return fBounds; }
34
35 auto begin() const { return fRects.cbegin(); }
36 auto end() const { return fRects.cend(); }
37
38 void reset();
39
40private:
41 std::vector<SkRect> fRects;
42 SkRect fBounds;
43};
44
45} // namespace sksg
46
47#endif // SkSGInvalidationController_DEFINED
48