aboutsummaryrefslogtreecommitdiffhomepage
path: root/experimental/sksg/SkSGInvalidationController.cpp
blob: 114d724d1ce1d3c08d87c9939295a7827a08074c (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
/*
 * 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() {}

void InvalidationController::inval(const SkRect& r, const SkMatrix& ctm) {
    SkTCopyOnFirstWrite<SkRect> rect(r);

    if (!ctm.isIdentity() && !ctm.mapRect(rect.writable())) {
        *rect.writable() = SkRect::MakeLTRB(SK_ScalarMin, SK_ScalarMin, SK_ScalarMax, SK_ScalarMax);
    }

    fRects.push(*rect);
}

} // namespace sksg