Remove extra premultiply from solid stroke/fill (flutter/engine#124)

This commit is contained in:
Brandon DeRosier
2022-04-13 16:40:46 -07:00
committed by Dan Field
parent 3ff34b1e73
commit 313f17df31
2 changed files with 5 additions and 5 deletions

View File

@@ -16,12 +16,12 @@ std::shared_ptr<Contents> Paint::CreateContentsForEntity() const {
switch (style) {
case Style::kFill: {
auto solid_color = std::make_shared<SolidColorContents>();
solid_color->SetColor(color.Premultiply());
solid_color->SetColor(color);
return solid_color;
}
case Style::kStroke: {
auto solid_stroke = std::make_shared<SolidStrokeContents>();
solid_stroke->SetColor(color.Premultiply());
solid_stroke->SetColor(color);
solid_stroke->SetStrokeSize(stroke_width);
solid_stroke->SetStrokeMiter(stroke_miter);
solid_stroke->SetStrokeCap(stroke_cap);

View File

@@ -50,7 +50,7 @@ TEST_F(EntityTest, ThreeStrokesInOnePath) {
Entity entity;
entity.SetPath(path);
auto contents = std::make_unique<SolidStrokeContents>();
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<SolidStrokeContents>();
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<SolidStrokeContents>();
contents->SetColor(Color::Red().Premultiply());
contents->SetColor(Color::Red());
contents->SetStrokeSize(width);
contents->SetStrokeCap(cap);
contents->SetStrokeJoin(join);