Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit 8bd048a

Browse files
committed
Break clear color counting when we come across a subpass element
1 parent 57e5d42 commit 8bd048a

File tree

2 files changed

+25
-2
lines changed

2 files changed

+25
-2
lines changed

impeller/aiks/testing/context_mock.cc

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
// Copyright 2013 The Flutter Authors. All rights reserved.
2+
// Use of this source code is governed by a BSD-style license that can be
3+
// found in the LICENSE file.
4+
5+
#include "impeller/aiks/testing/context_mock.h"
6+
#include <memory>
7+
8+
namespace impeller {
9+
namespace testing {
10+
11+
std::shared_ptr<ContextMock> ContextMock::Make() {
12+
return std::make_shared<::testing::NiceMock<ContextMock>>();
13+
}
14+
15+
} // namespace testing
16+
17+
} // namespace impeller

impeller/entity/entity_pass.cc

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -971,7 +971,9 @@ bool EntityPass::OnRender(
971971
// everything and disrupt the optimization.
972972
!backdrop_filter_proc_;
973973

974-
// Count the number of elements eaten by the clear color optimization.
974+
// Count the number of elements eaten by the clear color optimization. Break
975+
// it down in terms of opaque and translucent elements so that we can skip
976+
// over these entities when applying the clear color optimization.
975977
size_t opaque_clear_entity_count = 0;
976978
size_t translucent_clear_entity_count = 0;
977979
if (should_collapse_clear_colors) {
@@ -985,10 +987,14 @@ bool EntityPass::OnRender(
985987
} else {
986988
translucent_clear_entity_count++;
987989
}
990+
// We've found an entity that replaces the whole background color of
991+
// this layer, so continue counting.
988992
continue;
989993
}
990-
break;
991994
}
995+
// We came across an element that doesn't replace the background color of
996+
// this layer, so stop counting.
997+
break;
992998
}
993999
}
9941000

0 commit comments

Comments
 (0)