| 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 |
|
| 12 |
namespace sksg { |
| 13 |
|
| 14 |
InvalidationController::InvalidationController() : fBounds(SkRect::MakeEmpty()) {} |
| 15 |
|
| 16 |
void InvalidationController::inval(const SkRect& r, const SkMatrix& ctm) { |
| 17 |
if (r.isEmpty()) { |
| 18 |
return; |
| 19 |
} |
| 20 |
|
| 21 |
SkRect rect = ctm.mapRect(r); |
| 22 |
|
| 23 |
fRects.push_back(rect); |
| 24 |
fBounds.join(rect); |
| 25 |
} |
| 26 |
|
| 27 |
void InvalidationController::reset() { |
| 28 |
fRects.clear(); |
| 29 |
fBounds.setEmpty(); |
| 30 |
} |
| 31 |
|
| 32 |
} // namespace sksg |