Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ enabled_branches:
- dev
- beta
- stable
- flutter-2.8-candidate.6

platform_properties:
linux:
Expand Down
3 changes: 2 additions & 1 deletion flow/layers/physical_shape_layer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@ void PhysicalShapeLayer::Diff(DiffContext* context, const Layer* old_layer) {

context->AddLayerBounds(bounds);

if (context->PushCullRect(bounds)) {
// Only push cull rect if there is clip.
if (clip_behavior_ == Clip::none || context->PushCullRect(bounds)) {
DiffChildren(context, prev);
}
context->SetLayerPaintRegion(this, context->CurrentSubtreeRegion());
Expand Down
39 changes: 39 additions & 0 deletions flow/layers/physical_shape_layer_unittests.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

#include "flutter/flow/layers/physical_shape_layer.h"

#include "flutter/flow/testing/diff_context_test.h"
#include "flutter/flow/testing/layer_test.h"
#include "flutter/flow/testing/mock_layer.h"
#include "flutter/fml/macros.h"
Expand Down Expand Up @@ -350,5 +351,43 @@ TEST_F(PhysicalShapeLayerTest, Readback) {
EXPECT_TRUE(ReadbackResult(context, save_layer, reader, true));
}

using PhysicalShapeLayerDiffTest = DiffContextTest;

TEST_F(PhysicalShapeLayerDiffTest, NoClipPaintRegion) {
MockLayerTree tree1;
const SkPath layer_path = SkPath().addRect(SkRect::MakeXYWH(0, 0, 100, 100));
auto layer =
std::make_shared<PhysicalShapeLayer>(SK_ColorGREEN, SK_ColorBLACK,
0.0f, // elevation
layer_path, Clip::none);

const SkPath layer_path2 =
SkPath().addRect(SkRect::MakeXYWH(200, 200, 200, 200));
auto layer2 = std::make_shared<MockLayer>(layer_path2);
layer->Add(layer2);
tree1.root()->Add(layer);

auto damage = DiffLayerTree(tree1, MockLayerTree());
EXPECT_EQ(damage.frame_damage, SkIRect::MakeLTRB(0, 0, 400, 400));
}

TEST_F(PhysicalShapeLayerDiffTest, ClipPaintRegion) {
MockLayerTree tree1;
const SkPath layer_path = SkPath().addRect(SkRect::MakeXYWH(0, 0, 100, 100));
auto layer =
std::make_shared<PhysicalShapeLayer>(SK_ColorGREEN, SK_ColorBLACK,
0.0f, // elevation
layer_path, Clip::hardEdge);

const SkPath layer_path2 =
SkPath().addRect(SkRect::MakeXYWH(200, 200, 200, 200));
auto layer2 = std::make_shared<MockLayer>(layer_path2);
layer->Add(layer2);
tree1.root()->Add(layer);

auto damage = DiffLayerTree(tree1, MockLayerTree());
EXPECT_EQ(damage.frame_damage, SkIRect::MakeLTRB(0, 0, 100, 100));
}

} // namespace testing
} // namespace flutter