Repository: flutter
Issue: Canvas.drawVertices does not use anti-aliasing
Labels: engine,c: rendering,e: web_canvaskit,has reproducible steps,P3,found in release: 2.0,team-engine,triaged-engine

The drawVertices method does not use any anti-aliasing, even when it is enabled in the Paint settings.

## Steps to Reproduce

1. Draw a set of vertices with drawVertices.
2. Draw the same set using drawPath with Path.addPolygon.
3. Use the same Paint for both methods.

**Expected results:**
Both drawings should be anti-aliased.

**Actual results:**
The drawing of drawVertices is not anti-aliased.

<details>
  <summary>Logs</summary>
flutter analyze

```
Analyzing vertices_test...
No issues found! (ran in 2.1s)
```

flutter doctor -v

```
[√] Flutter (Channel dev, 2.1.0-10.0.pre, on Microsoft Windows [Version 10.0.19042.844], locale en-US)
    • Flutter version 2.1.0-10.0.pre at d:\Developer\flutter
    • Framework revision cc9b78fc5c (8 days ago), 2021-02-25 13:26:03 -0800
    • Engine revision a252ec09b7
    • Dart version 2.13.0 (build 2.13.0-77.0.dev)

[√] Android toolchain - develop for Android devices (Android SDK version 30.0.1)
    • Android SDK at D:\Developer\Android\SDK
    • Platform android-30, build-tools 30.0.1
    • ANDROID_SDK_ROOT = D:\Developer\Android\SDK
    • Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01)
    • All Android licenses accepted.

[√] Chrome - develop for the web
    • Chrome at C:\Program Files (x86)\Google\Chrome\Application\chrome.exe

[√] Visual Studio - develop for Windows (Visual Studio Community 2019 16.8.5)
    • Visual Studio at C:\Program Files (x86)\Microsoft Visual Studio\2019\Community
    • Visual Studio Community 2019 version 16.8.31005.135
    • Windows 10 SDK version 10.0.18362.0

[√] Android Studio (version 4.1.0)
    • Android Studio at C:\Program Files\Android\Android Studio
    • Flutter plugin can be installed from:
       https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
       https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01)

[√] VS Code, 64-bit edition (version 1.52.1)
    • VS Code at C:\Program Files\Microsoft VS Code
    • Flutter extension version 3.19.0

[√] Connected device (3 available)
    • Windows (desktop) • windows • windows-x64    • Microsoft Windows [Version 10.0.19042.844]
    • Chrome (web)      • chrome  • web-javascript • Google Chrome 89.0.4389.72
    • Edge (web)        • edge    • web-javascript • Microsoft Edge 88.0.705.81

• No issues found!
```

</details>

<details>
  <summary>Sample Code</summary>

```dart
import 'dart:math';
import 'dart:ui';

import 'package:flutter/material.dart';

void main() {
  runApp(MyApp());
}

enum PaintMethod {
  /// Path uses Path.addPolygon to draw a path.
  path,

  /// Vertices uses the drawVertices method. No anti-aliasing is applied.
  vertices,
}

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Vertex Test',
      theme: ThemeData(primarySwatch: Colors.blue),
      home: MyHomePage(
        shape: [
          /// Creates a 15 sided polygon
          for (int i = 0; i < 16; i++)
            Offset(50, 50) + Offset.fromDirection(2 * pi * (i / 15), 30),
        ],
      ),
    );
  }
}

class MyHomePage extends StatefulWidget {
  MyHomePage({Key? key, this.shape = const []}) : super(key: key);

  /// The shape to be painted.
  final List<Offset> shape;

  @override
  _MyHomePageState createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  /// The method to use when painting.
  PaintMethod method = PaintMethod.path;

  void setMethod(PaintMethod value) => setState(() => method = value);

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text('Vertex Test'),
      ),
      body: Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: <Widget>[
            Expanded(
              child: CustomPaint(
                painter: VertexPainter(widget.shape, method),
                child: Container(),
              ),
            ),
            Row(
              children: [
                Radio<PaintMethod>(
                  value: PaintMethod.path,
                  groupValue: method,
                  onChanged: (v) => setMethod(v!),
                ),
                Expanded(child: Text('Path')),
                Radio<PaintMethod>(
                  value: PaintMethod.vertices,
                  groupValue: method,
                  onChanged: (v) => setMethod(v!),
                ),
                Expanded(child: Text('Vertices')),
              ],
            )
          ],
        ),
      ),
    );
  }
}

class VertexPainter extends CustomPainter {
  const VertexPainter(this.positions, this.method);

  /// Positions should be between (0,0) and (100,100)
  final List<Offset> positions;

  /// The method to use when painting
  final PaintMethod method;

  @override
  void paint(Canvas canvas, Size size) {
    canvas.save();
    canvas.scale(size.width / 100, size.height / 100);
    final paint = Paint()
      ..color = Colors.red
      ..style = PaintingStyle.fill
      ..isAntiAlias = true;

    switch (method) {
      case PaintMethod.path:
        canvas.drawPath(Path()..addPolygon(positions, false), paint);
        break;
      case PaintMethod.vertices:
        canvas.drawVertices(
          Vertices(VertexMode.triangleFan, positions),
          BlendMode.srcOver,
          paint,
        );
    }
    canvas.restore();
  }

  @override
  bool shouldRepaint(VertexPainter old) =>
      old.positions != positions || old.method != method;
}

```

</details>

<details>
  <summary>Screenshots</summary>
These screenshots are from the sample code above.

### Full Drawing
| drawPath | drawVertices |
| --- | --- |
| ![antialiasing-path](https://user-images.githubusercontent.com/14063628/110218035-586c6a80-7e6c-11eb-8dcb-13dc6595e73f.png) | ![antialiasing-vertices](https://user-images.githubusercontent.com/14063628/110218041-5e624b80-7e6c-11eb-88c9-25c2bf3cc477.png) |

### Cropped
| drawPath | drawVertices |
| --- | --- |
| ![antialiasing-path-crop](https://user-images.githubusercontent.com/14063628/110218122-b436f380-7e6c-11eb-872b-5e4a256d455e.png) | ![antialiasing-vertices-crop](https://user-images.githubusercontent.com/14063628/110218124-b7ca7a80-7e6c-11eb-959b-13b1378c693e.png) |

</details>