[sksg] Fix setVisible() invalidation

Changes in visibility should generate damage.

TBR=
Change-Id: Ide7b660719b86bc9843d3dcfebeb6e39076879fb
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/229279
Reviewed-by: Florin Malita <fmalita@chromium.org>
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
This commit is contained in:
Florin Malita 2019-07-23 09:48:04 -04:00 committed by Skia Commit-Bot
parent e9ad99884e
commit 0ae324c528
2 changed files with 14 additions and 0 deletions

View File

@ -29,6 +29,11 @@ bool RenderNode::isVisible() const {
}
void RenderNode::setVisible(bool v) {
if (v == this->isVisible()) {
return;
}
this->invalidate();
fNodeFlags = v ? (fNodeFlags & ~kInvisible_Flag)
: (fNodeFlags | kInvisible_Flag);
}

View File

@ -326,6 +326,15 @@ static void inval_test3(skiatest::Reporter* reporter) {
&damage);
}
{
// Visibility change -> full inval.
group->setVisible(false);
std::vector<SkRect> damage = { { 50, 75, 350, 175} };
check_inval(reporter, root,
SkRect::MakeLTRB(50, 75, 350, 175),
SkRect::MakeLTRB(50, 75, 350, 175),
&damage);
}
}
static void inval_group_remove(skiatest::Reporter* reporter) {