Skip to content

[Impeller] DrawArc with line from Center has "pointy end" - deviation from Skia #148323

@flo80

Description

@flo80

Steps to reproduce

Custom Painter, drawing arc with center: canvas.drawArc(rect, 0, math.pi * 2, true, color);
(tested on macos)

Expected results

skia: perfect circle closing up
image

Actual results

impeller: line end has "pointy" end
image

Code sample

Code sample
import 'package:flutter/material.dart';
import 'dart:math' as math;

void main() {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        body: Padding(
          padding: const EdgeInsets.all(8.0),
          child: Column(
            children: [
              Expanded(
                child: Stack(
                  children: [
                    Container(color: Colors.black),
                    const Center(
                      child: Padding(
                        padding: EdgeInsets.only(top: 20.0),
                        child: SizedBox(
                          height: 500,
                          width: 500,
                          child: CustomPaint(painter: _InconsistentRenderingExample(width: 3.0)),
                        ),
                      ),
                    ),
                  ],
                ),
              ),
            ],
          ),
        ),
      ),
    );
  }
}

class _InconsistentRenderingExample extends CustomPainter {
  final double width;

  const _InconsistentRenderingExample({this.width = 2.0});

  @override
  void paint(Canvas canvas, Size size) {
    final center = Offset(size.width / 2, size.height / 2);
    final rect = Rect.fromCenter(center: center, width: size.width, height: size.height);

    var color = Paint()
      ..color = Colors.white
      ..strokeWidth = width
      ..style = PaintingStyle.stroke;

    canvas.drawArc(rect, 0, math.pi * 2, true, color);
  }

  @override
  bool shouldRepaint(covariant _InconsistentRenderingExample oldDelegate) => true;
}

Screenshots or Video

No response

Logs

No response

Flutter Doctor output

Doctor output
[✓] Flutter (Channel stable, 3.19.5, on macOS 14.4.1 23E224 darwin-arm64, locale en-AT)
    • Flutter version 3.19.5 on channel stable at /Users/florian/Developer/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 300451adae (7 weeks ago), 2024-03-27 21:54:07 -0500
    • Engine revision e76c956498
    • Dart version 3.3.3
    • DevTools version 2.31.1

[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
    • Android SDK at /Users/florian/Library/Android/sdk
    • Platform android-33, build-tools 34.0.0
    • Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 17.0.6+0-17.0.6b802.4-9586694)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 15.4)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 15F31d
    • CocoaPods version 1.14.3

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2022.2)
    • Android Studio at /Applications/Android Studio.app/Contents
    • 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 17.0.6+0-17.0.6b802.4-9586694)

[✓] VS Code (version 1.89.0)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.88.0

[✓] Connected device (3 available)
    • F (mobile)      • 00008110-000640A11187801E • ios            • iOS 17.4.1 21E236
    • macOS (desktop) • macos                     • darwin-arm64   • macOS 14.4.1 23E224
      darwin-arm64
    • Chrome (web)    • chrome                    • web-javascript • Google Chrome 124.0.6367.158

[✓] Network resources
    • All expected network resources are available.

• No issues found!

Metadata

Metadata

Assignees

Labels

P1High-priority issues at the top of the work listc: renderingUI glitches reported at the engine/skia or impeller rendering levele: impellerImpeller rendering backend issues and features requestsengineflutter/engine related. See also e: labels.found in release: 3.22Found to occur in 3.22has reproducible stepsThe issue has been confirmed reproducible and is ready to work onslimpellerEngine binary size reduction. go/slimpellerteam-engineOwned by Engine teamtriaged-engineTriaged by Engine team

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions