diff --git a/DEPS b/DEPS index 767f9a6147..eacca98f6a 100644 --- a/DEPS +++ b/DEPS @@ -115,7 +115,7 @@ deps = { 'src': 'https://github.com/flutter/buildroot.git' + '@' + '2c41cfc742586b44984595960fc161c30252d8d6', 'src/flutter/impeller': - Var('github_git') + '/flutter/impeller' + '@' + 'c833f7de604f5c4298216494fb7b7ff378353601', + Var('github_git') + '/flutter/impeller' + '@' + '380e45d7f27c6815638287c99fbb0a0b136fd861', # Fuchsia compatibility # diff --git a/engine/src/flutter/ci/licenses_golden/licenses_flutter b/engine/src/flutter/ci/licenses_golden/licenses_flutter index f77e5485d2..c6e4391d42 100644 --- a/engine/src/flutter/ci/licenses_golden/licenses_flutter +++ b/engine/src/flutter/ci/licenses_golden/licenses_flutter @@ -478,8 +478,6 @@ FILE: ../../../flutter/impeller/display_list/display_list_playground.cc FILE: ../../../flutter/impeller/display_list/display_list_playground.h FILE: ../../../flutter/impeller/display_list/display_list_unittests.cc FILE: ../../../flutter/impeller/docs/shader_pipeline.png -FILE: ../../../flutter/impeller/entity/contents/clear_contents.cc -FILE: ../../../flutter/impeller/entity/contents/clear_contents.h FILE: ../../../flutter/impeller/entity/contents/clip_contents.cc FILE: ../../../flutter/impeller/entity/contents/clip_contents.h FILE: ../../../flutter/impeller/entity/contents/content_context.cc diff --git a/engine/src/flutter/display_list/display_list_ops.h b/engine/src/flutter/display_list/display_list_ops.h index ab549013fe..5a6f9f98dc 100644 --- a/engine/src/flutter/display_list/display_list_ops.h +++ b/engine/src/flutter/display_list/display_list_ops.h @@ -894,6 +894,12 @@ struct DrawDisplayListOp final : DLOp { void dispatch(Dispatcher& dispatcher) const { dispatcher.drawDisplayList(display_list); } + + DisplayListCompare equals(const DrawDisplayListOp* other) const { + return display_list->Equals(other->display_list) + ? DisplayListCompare::kEqual + : DisplayListCompare::kNotEqual; + } }; // 4 byte header + 8 payload bytes + an aligned pointer take 24 bytes diff --git a/engine/src/flutter/display_list/display_list_paint.h b/engine/src/flutter/display_list/display_list_paint.h index c23d94a198..70006d43ee 100644 --- a/engine/src/flutter/display_list/display_list_paint.h +++ b/engine/src/flutter/display_list/display_list_paint.h @@ -103,6 +103,12 @@ class DlPaint { return *this; } + uint8_t getAlpha() const { return color_.argb >> 24; } + DlPaint& setAlpha(uint8_t alpha) { + color_.argb = alpha << 24 | (color_.argb & 0x00FFFFFF); + return *this; + } + DlBlendMode getBlendMode() const { return static_cast(blendMode_); } diff --git a/engine/src/flutter/display_list/display_list_paint_unittests.cc b/engine/src/flutter/display_list/display_list_paint_unittests.cc index fcea32e455..1885dfd0b5 100644 --- a/engine/src/flutter/display_list/display_list_paint_unittests.cc +++ b/engine/src/flutter/display_list/display_list_paint_unittests.cc @@ -16,6 +16,7 @@ TEST(DisplayListPaint, ConstructorDefaults) { EXPECT_FALSE(paint.isDither()); EXPECT_FALSE(paint.isInvertColors()); EXPECT_EQ(paint.getColor(), DlColor{0xFF000000}); + EXPECT_EQ(paint.getAlpha(), 0xFF); EXPECT_EQ(paint.getBlendMode(), DlBlendMode::kDefaultMode); EXPECT_EQ(paint.getDrawStyle(), DlDrawStyle::kDefaultStyle); EXPECT_EQ(paint.getStrokeCap(), DlStrokeCap::kDefaultCap); @@ -38,6 +39,7 @@ TEST(DisplayListPaint, ConstructorDefaults) { EXPECT_NE(paint, DlPaint().setDither(true)); EXPECT_NE(paint, DlPaint().setInvertColors(true)); EXPECT_NE(paint, DlPaint().setColor(DlColor(0xFF00FF00))); + EXPECT_NE(paint, DlPaint().setAlpha(0x7f)); EXPECT_NE(paint, DlPaint().setBlendMode(DlBlendMode::kDstIn)); EXPECT_NE(paint, DlPaint().setDrawStyle(DlDrawStyle::kStrokeAndFill)); EXPECT_NE(paint, DlPaint().setStrokeCap(DlStrokeCap::kRound)); @@ -65,6 +67,7 @@ TEST(DisplayListPaint, ChainingConstructor) { .setDither(true) // .setInvertColors(true) // .setColor({0xFF00FF00}) // + .setAlpha(0x7F) // .setBlendMode(DlBlendMode::kLuminosity) // .setDrawStyle(DlDrawStyle::kStrokeAndFill) // .setStrokeCap(DlStrokeCap::kSquare) // @@ -81,7 +84,8 @@ TEST(DisplayListPaint, ChainingConstructor) { EXPECT_TRUE(paint.isAntiAlias()); EXPECT_TRUE(paint.isDither()); EXPECT_TRUE(paint.isInvertColors()); - EXPECT_EQ(paint.getColor(), DlColor{0xFF00FF00}); + EXPECT_EQ(paint.getColor(), DlColor{0x7F00FF00}); + EXPECT_EQ(paint.getAlpha(), 0x7F); EXPECT_EQ(paint.getBlendMode(), DlBlendMode::kLuminosity); EXPECT_EQ(paint.getDrawStyle(), DlDrawStyle::kStrokeAndFill); EXPECT_EQ(paint.getStrokeCap(), DlStrokeCap::kSquare); diff --git a/engine/src/flutter/flow/layers/display_list_layer.cc b/engine/src/flutter/flow/layers/display_list_layer.cc index e44d57b608..7e3e2f4214 100644 --- a/engine/src/flutter/flow/layers/display_list_layer.cc +++ b/engine/src/flutter/flow/layers/display_list_layer.cc @@ -160,12 +160,10 @@ void DisplayListLayer::Paint(PaintContext& context) const { AutoCachePaint save_paint(context); int restore_count = context.leaf_nodes_builder->getSaveCount(); if (save_paint.paint() != nullptr) { - context.leaf_nodes_builder->setAttributesFromPaint( - *save_paint.paint(), DisplayListOpFlags::kSaveLayerWithPaintFlags); - context.leaf_nodes_builder->saveLayer(&paint_bounds(), true); + DlPaint paint = DlPaint().setAlpha(save_paint.paint()->getAlpha()); + context.leaf_nodes_builder->saveLayer(&paint_bounds(), &paint); } - display_list()->RenderTo(context.leaf_nodes_builder, - context.inherited_opacity); + context.leaf_nodes_builder->drawDisplayList(display_list_.skia_object()); context.leaf_nodes_builder->restoreToCount(restore_count); } else { display_list()->RenderTo(context.leaf_nodes_canvas, diff --git a/engine/src/flutter/flow/layers/display_list_layer_unittests.cc b/engine/src/flutter/flow/layers/display_list_layer_unittests.cc index 7796d586f6..79fd8d7dc9 100644 --- a/engine/src/flutter/flow/layers/display_list_layer_unittests.cc +++ b/engine/src/flutter/flow/layers/display_list_layer_unittests.cc @@ -131,6 +131,10 @@ TEST_F(DisplayListLayerTest, SimpleDisplayListOpacityInheritance) { opacity_layer->Preroll(context, SkMatrix::I()); EXPECT_TRUE(opacity_layer->children_can_accept_opacity()); + DisplayListBuilder child_builder; + child_builder.drawRect(picture_bounds); + auto child_display_list = child_builder.Build(); + auto save_layer_bounds = picture_bounds.makeOffset(layer_offset.fX, layer_offset.fY); auto opacity_integral_matrix = @@ -159,7 +163,7 @@ TEST_F(DisplayListLayerTest, SimpleDisplayListOpacityInheritance) { expected_builder.setColor(opacity_alpha << 24); expected_builder.saveLayer(&save_layer_bounds, true); /* display_list contents */ { // - expected_builder.drawRect(picture_bounds); + expected_builder.drawDisplayList(child_display_list); } expected_builder.restore(); } @@ -200,6 +204,11 @@ TEST_F(DisplayListLayerTest, IncompatibleDisplayListOpacityInheritance) { opacity_layer->Preroll(context, SkMatrix::I()); EXPECT_FALSE(opacity_layer->children_can_accept_opacity()); + DisplayListBuilder child_builder; + child_builder.drawRect(picture1_bounds); + child_builder.drawRect(picture2_bounds); + auto child_display_list = child_builder.Build(); + auto display_list_bounds = picture1_bounds; display_list_bounds.join(picture2_bounds); auto save_layer_bounds = @@ -231,8 +240,7 @@ TEST_F(DisplayListLayerTest, IncompatibleDisplayListOpacityInheritance) { expected_builder.transformReset(); expected_builder.transform(layer_offset_integral_matrix); #endif - expected_builder.drawRect(picture1_bounds); - expected_builder.drawRect(picture2_bounds); + expected_builder.drawDisplayList(child_display_list); } expected_builder.restore(); }