[Impeller] Emulate Skia's SK_LEGACY_IGNORE_DRAW_VERTICES_BLEND_WITH_NO_SHADER in drawVertices (flutter/engine#40893)

[Impeller] Emulate Skia's SK_LEGACY_IGNORE_DRAW_VERTICES_BLEND_WITH_NO_SHADER in drawVertices
This commit is contained in:
Jason Simmons 2023-04-04 07:32:18 -07:00 committed by GitHub
parent c34b9d9a73
commit ae08695e6d

View File

@ -470,6 +470,13 @@ void Canvas::DrawTextFrame(const TextFrame& text_frame,
void Canvas::DrawVertices(const std::shared_ptr<VerticesGeometry>& vertices,
BlendMode blend_mode,
const Paint& paint) {
// Override the blend mode with kDestination in order to match the behavior
// of Skia's SK_LEGACY_IGNORE_DRAW_VERTICES_BLEND_WITH_NO_SHADER flag, which
// is enabled when the Flutter engine builds Skia.
if (paint.color_source_type == Paint::ColorSourceType::kColor) {
blend_mode = BlendMode::kDestination;
}
Entity entity;
entity.SetTransformation(GetCurrentTransformation());
entity.SetStencilDepth(GetStencilDepth());