@@ -318,21 +318,6 @@ std::optional<Entity> BlendFilterContents::CreateForegroundAdvancedBlend(
318318
319319 auto contents = AnonymousContents::Make (render_proc, coverage_proc);
320320
321- // If there is pending opacity but it was not absorbed by this entity, we have
322- // to convert this back to a snapshot so it can be passed on. This generally
323- // implies that there is another filter about to run, so we'd perform this
324- // operation anyway.
325- auto potential_opacity = alpha.value_or (1.0 ) * dst_snapshot->opacity ;
326- if (!absorb_opacity && potential_opacity < 1.0 ) {
327- auto result_snapshot = contents->RenderToSnapshot (renderer, entity);
328- if (!result_snapshot.has_value ()) {
329- return std::nullopt ;
330- }
331- result_snapshot->opacity = potential_opacity;
332- return Entity::FromSnapshot (result_snapshot.value (), entity.GetBlendMode (),
333- entity.GetStencilDepth ());
334- }
335-
336321 Entity sub_entity;
337322 sub_entity.SetContents (std::move (contents));
338323 sub_entity.SetStencilDepth (entity.GetStencilDepth ());
@@ -472,21 +457,6 @@ std::optional<Entity> BlendFilterContents::CreateForegroundPorterDuffBlend(
472457
473458 auto contents = AnonymousContents::Make (render_proc, coverage_proc);
474459
475- // If there is pending opacity but it was not absorbed by this entity, we have
476- // to convert this back to a snapshot so it can be passed on. This generally
477- // implies that there is another filter about to run, so we'd perform this
478- // operation anyway.
479- auto potential_opacity = alpha.value_or (1.0 ) * dst_snapshot->opacity ;
480- if (!absorb_opacity && potential_opacity < 1.0 ) {
481- auto result_snapshot = contents->RenderToSnapshot (renderer, entity);
482- if (!result_snapshot.has_value ()) {
483- return std::nullopt ;
484- }
485- result_snapshot->opacity = potential_opacity;
486- return Entity::FromSnapshot (result_snapshot.value (), entity.GetBlendMode (),
487- entity.GetStencilDepth ());
488- }
489-
490460 Entity sub_entity;
491461 sub_entity.SetContents (std::move (contents));
492462 sub_entity.SetStencilDepth (entity.GetStencilDepth ());
@@ -685,7 +655,8 @@ std::optional<Entity> BlendFilterContents::RenderFilter(
685655 }
686656
687657 if (blend_mode_ <= Entity::kLastPipelineBlendMode ) {
688- if (inputs.size () == 1 && foreground_color_.has_value ()) {
658+ if (inputs.size () == 1 && foreground_color_.has_value () &&
659+ GetAbsorbOpacity ()) {
689660 return CreateForegroundPorterDuffBlend (
690661 inputs[0 ], renderer, entity, coverage, foreground_color_.value (),
691662 blend_mode_, GetAlpha (), GetAbsorbOpacity ());
@@ -695,7 +666,8 @@ std::optional<Entity> BlendFilterContents::RenderFilter(
695666 }
696667
697668 if (blend_mode_ <= Entity::kLastAdvancedBlendMode ) {
698- if (inputs.size () == 1 && foreground_color_.has_value ()) {
669+ if (inputs.size () == 1 && foreground_color_.has_value () &&
670+ GetAbsorbOpacity ()) {
699671 return CreateForegroundAdvancedBlend (
700672 inputs[0 ], renderer, entity, coverage, foreground_color_.value (),
701673 blend_mode_, GetAlpha (), GetAbsorbOpacity ());
0 commit comments