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 "SkSGInvalidationController.h"
9 
10 #include "SkRect.h"
11 #include "SkTLazy.h"
12 
13 namespace sksg {
14 
InvalidationController()15 InvalidationController::InvalidationController() : fBounds(SkRect::MakeEmpty()) {}
16 
inval(const SkRect & r,const SkMatrix & ctm)17 void InvalidationController::inval(const SkRect& r, const SkMatrix& ctm) {
18     if (r.isEmpty()) {
19         return;
20     }
21 
22     SkTCopyOnFirstWrite<SkRect> rect(r);
23 
24     if (!ctm.isIdentity()) {
25         ctm.mapRect(rect.writable());
26     }
27 
28     fRects.push_back(*rect);
29     fBounds.join(*rect);
30 }
31 
32 } // namespace sksg
33