From ae08695e6db672ce7fd83569b32bdeb70e826ae0 Mon Sep 17 00:00:00 2001 From: Jason Simmons Date: Tue, 4 Apr 2023 07:32:18 -0700 Subject: [PATCH] [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 --- engine/src/flutter/impeller/aiks/canvas.cc | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/engine/src/flutter/impeller/aiks/canvas.cc b/engine/src/flutter/impeller/aiks/canvas.cc index 0a76ed99950..b3a08312a2f 100644 --- a/engine/src/flutter/impeller/aiks/canvas.cc +++ b/engine/src/flutter/impeller/aiks/canvas.cc @@ -470,6 +470,13 @@ void Canvas::DrawTextFrame(const TextFrame& text_frame, void Canvas::DrawVertices(const std::shared_ptr& 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());