77#include " impeller/entity/contents/contents.h"
88#include " impeller/entity/contents/texture_contents.h"
99#include " impeller/entity/entity_pass.h"
10+ #include " impeller/geometry/color.h"
1011#include " impeller/geometry/path_builder.h"
1112
1213namespace impeller {
@@ -72,6 +73,8 @@ bool OpacityPeepholePassDelegate::CanElide() {
7273// |EntityPassDelgate|
7374bool OpacityPeepholePassDelegate::CanCollapseIntoParentPass (
7475 EntityPass* entity_pass) {
76+ // OpacityPeepholePassDelegate will only get used if the pass's blend mode is
77+ // SourceOver, so no need to check here.
7578 if (paint_.color .alpha <= 0.0 || paint_.color .alpha >= 1.0 ||
7679 paint_.image_filter .has_value () || paint_.color_filter .has_value ()) {
7780 return false ;
@@ -97,7 +100,7 @@ bool OpacityPeepholePassDelegate::CanCollapseIntoParentPass(
97100 auto had_subpass = entity_pass->IterateUntilSubpass (
98101 [&all_coverages, &all_can_accept](Entity& entity) {
99102 auto contents = entity.GetContents ();
100- if (!contents-> CanInheritOpacity (entity )) {
103+ if (!entity. CanInheritOpacity ()) {
101104 all_can_accept = false ;
102105 return false ;
103106 }
@@ -119,7 +122,7 @@ bool OpacityPeepholePassDelegate::CanCollapseIntoParentPass(
119122 }
120123 auto alpha = paint_.color .alpha ;
121124 entity_pass->IterateUntilSubpass ([&alpha](Entity& entity) {
122- entity.GetContents ()-> SetInheritedOpacity (alpha);
125+ entity.SetInheritedOpacity (alpha);
123126 return true ;
124127 });
125128 return true ;
0 commit comments