aboutsummaryrefslogtreecommitdiffhomepage
path: root/experimental/sksg/SkSGInvalidationController.h
blob: df3857c1feae94303de39ad90de982f0aca6810f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
/*
 * Copyright 2017 Google Inc.
 *
 * Use of this source code is governed by a BSD-style license that can be
 * found in the LICENSE file.
 */

#ifndef SkSGInvalidationController_DEFINED
#define SkSGInvalidationController_DEFINED

#include "SkMatrix.h"
#include "SkTDArray.h"
#include "SkTypes.h"

struct SkRect;

namespace sksg {

/**
 * Receiver for invalidation events.
 *
 * Tracks dirty regions for repaint.
 */
class InvalidationController : public SkNoncopyable {
public:
    InvalidationController();

    void inval(const SkRect&, const SkMatrix& ctm = SkMatrix::I());

    const SkRect& bounds() const { return fBounds;        }
    const SkRect*  begin() const { return fRects.begin(); }
    const SkRect*    end() const { return fRects.end();   }

private:
    SkTDArray<SkRect> fRects;
    SkRect            fBounds;

    typedef SkNoncopyable INHERITED;
};

} // namespace sksg

#endif // SkSGInvalidationController_DEFINED