/src/skia/modules/sksg/src/SkSGInvalidationController.cpp
Line | Count | Source (jump to first uncovered line) |
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 | | #include "modules/sksg/include/SkSGInvalidationController.h" |
9 | | |
10 | | #include "include/core/SkRect.h" |
11 | | #include "src/core/SkTLazy.h" |
12 | | |
13 | | namespace sksg { |
14 | | |
15 | 0 | InvalidationController::InvalidationController() : fBounds(SkRect::MakeEmpty()) {} |
16 | | |
17 | 0 | void InvalidationController::inval(const SkRect& r, const SkMatrix& ctm) { |
18 | 0 | if (r.isEmpty()) { |
19 | 0 | return; |
20 | 0 | } |
21 | | |
22 | 0 | SkTCopyOnFirstWrite<SkRect> rect(r); |
23 | |
|
24 | 0 | if (!ctm.isIdentity()) { |
25 | 0 | ctm.mapRect(rect.writable()); |
26 | 0 | } |
27 | |
|
28 | 0 | fRects.push_back(*rect); |
29 | 0 | fBounds.join(*rect); |
30 | 0 | } |
31 | | |
32 | 0 | void InvalidationController::reset() { |
33 | 0 | fRects.clear(); |
34 | 0 | fBounds.setEmpty(); |
35 | 0 | } |
36 | | |
37 | | } // namespace sksg |