2017-12-19 17:21:02 +00:00
|
|
|
/*
|
|
|
|
* 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"
|
2017-12-29 00:24:07 +00:00
|
|
|
#include "SkTLazy.h"
|
2017-12-19 17:21:02 +00:00
|
|
|
|
|
|
|
namespace sksg {
|
|
|
|
|
2018-01-03 21:17:29 +00:00
|
|
|
InvalidationController::InvalidationController() : fBounds(SkRect::MakeEmpty()) {}
|
2017-12-19 17:21:02 +00:00
|
|
|
|
2017-12-29 00:24:07 +00:00
|
|
|
void InvalidationController::inval(const SkRect& r, const SkMatrix& ctm) {
|
2018-01-03 21:17:29 +00:00
|
|
|
if (r.isEmpty()) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2017-12-29 00:24:07 +00:00
|
|
|
SkTCopyOnFirstWrite<SkRect> rect(r);
|
|
|
|
|
2017-12-30 17:39:11 +00:00
|
|
|
if (!ctm.isIdentity()) {
|
|
|
|
ctm.mapRect(rect.writable());
|
2017-12-29 00:24:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
fRects.push(*rect);
|
2018-01-03 21:17:29 +00:00
|
|
|
fBounds.join(*rect);
|
2017-12-19 17:21:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
} // namespace sksg
|