Skip to content

[CP] [Impeller] Fix stroke cap drawing not correct #124176

@luckysmg

Description

@luckysmg

issue_link

#119810

Commit Hash

24fd06e

Target

stable

pr_link

flutter/engine#39481

Impacted Users

For user using impeller to draw path

Impact Description

Impact when user uses impeller to draw stroke path. Without this patch they will see a one-side cap, which is not expected

Workaround

Seems no workaround.

Risk

low

Test Coverage

yes

Validation Steps

Using impeller to draw a stroke path, and set the cap to StrokeCap.round, expected to see both side cap rendering is good.

void main() {
  runApp(CustomPaint(
    painter: MyPainter(),
  ));
}

class MyPainter extends CustomPainter {
  @override
  void paint(Canvas canvas, Size size) {
    Paint paint = Paint()
      ..color = Colors.red
      ..strokeWidth = 20
      ..strokeCap = StrokeCap.round;
    canvas.drawLine(const Offset(100, 100), const Offset(200, 100), paint);
  }

  @override
  bool shouldRepaint(covariant CustomPainter oldDelegate) {
    return true;
  }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    cp: reviewCherry-picks in the review queue

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions