diff --git a/impeller/entity/contents/filters/blend_filter_contents.cc b/impeller/entity/contents/filters/blend_filter_contents.cc index 287ec60ee3628..7ab6aa9b3e01f 100644 --- a/impeller/entity/contents/filters/blend_filter_contents.cc +++ b/impeller/entity/contents/filters/blend_filter_contents.cc @@ -357,21 +357,10 @@ std::optional BlendFilterContents::CreateForegroundPorterDuffBlend( BlendMode blend_mode, std::optional alpha, bool absorb_opacity) const { - auto dst_snapshot = - input->GetSnapshot("ForegroundPorterDuffBlend", renderer, entity); - if (!dst_snapshot.has_value()) { - return std::nullopt; - } - if (blend_mode == BlendMode::kClear) { return std::nullopt; } - if (blend_mode == BlendMode::kDestination) { - return Entity::FromSnapshot(dst_snapshot, entity.GetBlendMode(), - entity.GetStencilDepth()); - } - if (blend_mode == BlendMode::kSource) { auto contents = std::make_shared(); contents->SetGeometry(Geometry::MakeRect(coverage)); @@ -384,6 +373,17 @@ std::optional BlendFilterContents::CreateForegroundPorterDuffBlend( return foreground_entity; } + auto dst_snapshot = + input->GetSnapshot("ForegroundPorterDuffBlend", renderer, entity); + if (!dst_snapshot.has_value()) { + return std::nullopt; + } + + if (blend_mode == BlendMode::kDestination) { + return Entity::FromSnapshot(dst_snapshot, entity.GetBlendMode(), + entity.GetStencilDepth()); + } + RenderProc render_proc = [foreground_color, coverage, dst_snapshot, blend_mode, absorb_opacity, alpha]( const ContentContext& renderer,