From 313f17df317492594dc553d419339d42063cd7a8 Mon Sep 17 00:00:00 2001 From: Brandon DeRosier Date: Wed, 13 Apr 2022 16:40:46 -0700 Subject: [PATCH] Remove extra premultiply from solid stroke/fill (flutter/engine#124) --- engine/src/flutter/impeller/aiks/paint.cc | 4 ++-- engine/src/flutter/impeller/entity/entity_unittests.cc | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/engine/src/flutter/impeller/aiks/paint.cc b/engine/src/flutter/impeller/aiks/paint.cc index ac1f712908..46a14b5ab3 100644 --- a/engine/src/flutter/impeller/aiks/paint.cc +++ b/engine/src/flutter/impeller/aiks/paint.cc @@ -16,12 +16,12 @@ std::shared_ptr Paint::CreateContentsForEntity() const { switch (style) { case Style::kFill: { auto solid_color = std::make_shared(); - solid_color->SetColor(color.Premultiply()); + solid_color->SetColor(color); return solid_color; } case Style::kStroke: { auto solid_stroke = std::make_shared(); - solid_stroke->SetColor(color.Premultiply()); + solid_stroke->SetColor(color); solid_stroke->SetStrokeSize(stroke_width); solid_stroke->SetStrokeMiter(stroke_miter); solid_stroke->SetStrokeCap(stroke_cap); diff --git a/engine/src/flutter/impeller/entity/entity_unittests.cc b/engine/src/flutter/impeller/entity/entity_unittests.cc index b3cc1d0dfd..11f12e6043 100644 --- a/engine/src/flutter/impeller/entity/entity_unittests.cc +++ b/engine/src/flutter/impeller/entity/entity_unittests.cc @@ -50,7 +50,7 @@ TEST_F(EntityTest, ThreeStrokesInOnePath) { Entity entity; entity.SetPath(path); auto contents = std::make_unique(); - contents->SetColor(Color::Red().Premultiply()); + contents->SetColor(Color::Red()); contents->SetStrokeSize(5.0); entity.SetContents(std::move(contents)); ASSERT_TRUE(OpenPlaygroundHere(entity)); @@ -80,7 +80,7 @@ TEST_F(EntityTest, TriangleInsideASquare) { Entity entity; entity.SetPath(path); auto contents = std::make_unique(); - contents->SetColor(Color::Red().Premultiply()); + contents->SetColor(Color::Red()); contents->SetStrokeSize(20.0); entity.SetContents(std::move(contents)); @@ -123,7 +123,7 @@ TEST_F(EntityTest, StrokeCapAndJoinTest) { Path path, SolidStrokeContents::Cap cap, SolidStrokeContents::Join join) { auto contents = std::make_unique(); - contents->SetColor(Color::Red().Premultiply()); + contents->SetColor(Color::Red()); contents->SetStrokeSize(width); contents->SetStrokeCap(cap); contents->SetStrokeJoin(join);