Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.
Merged
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
13 changes: 8 additions & 5 deletions flow/layers/physical_shape_layer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,13 @@ void PhysicalShapeLayer::Paint(PaintContext& context) const {
SkColorGetA(color_) != 0xff, device_pixel_ratio_);
}

// Call drawPath without clip if possible for better performance.
SkPaint paint;
paint.setColor(color_);
if (clip_behavior_ != Clip::antiAliasWithSaveLayer) {
context.canvas.drawPath(path_, paint);
}

int saveCount = context.canvas.save();
switch (clip_behavior_) {
case Clip::hardEdge:
Expand All @@ -103,11 +110,7 @@ void PhysicalShapeLayer::Paint(PaintContext& context) const {
break;
}

SkPaint paint;
paint.setColor(color_);
if (clip_behavior_ == Clip::none) {
context.canvas.drawPath(path_, paint);
} else {
if (clip_behavior_ == Clip::antiAliasWithSaveLayer) {
// If we want to avoid the bleeding edge artifact
// (https://github.com/flutter/flutter/issues/18057#issue-328003931)
// using saveLayer, we have to call drawPaint instead of drawPath as
Expand Down