aboutsummaryrefslogtreecommitdiffhomepage
path: root/experimental/sksg/SkSGInvalidationController.cpp
blob: 81a3376bf674b9919be0d74d361e268a32c03463 (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
/*
 * Copyright 2017 Google Inc.
 *
 * Use of this source code is governed by a BSD-style license that can be
 * found in the LICENSE file.
 */

#include "SkSGInvalidationController.h"

#include "SkRect.h"
#include "SkTLazy.h"

namespace sksg {

InvalidationController::InvalidationController() : fBounds(SkRect::MakeEmpty()) {}

void InvalidationController::inval(const SkRect& r, const SkMatrix& ctm) {
    if (r.isEmpty()) {
        return;
    }

    SkTCopyOnFirstWrite<SkRect> rect(r);

    if (!ctm.isIdentity()) {
        ctm.mapRect(rect.writable());
    }

    fRects.push(*rect);
    fBounds.join(*rect);
}

} // namespace sksg