Skip to content

[Impeller] When the stroke width is equal to the diameter of the circle, the result of the drawn arc is incorrect #133032

@ColdPaleLight

Description

@ColdPaleLight

Is there an existing issue for this?

Steps to reproduce

run the sample code on master channel

Expected results

The center point of the arc is displayed correctly

Actual results

The center point of the arc is displayed incorrectly

Code sample

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

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

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

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        colorSchemeSeed: Colors.deepPurple,
        useMaterial3: true,
      ),
      home: const MyWidget(),
    );
  }
}

class MyWidget extends StatefulWidget {
  const MyWidget({super.key});

  @override
  State<MyWidget> createState() => _MyWidgetState();
}

class _MyWidgetState extends State<MyWidget>
    with SingleTickerProviderStateMixin {
  @override
  void initState() {
    super.initState();
  }

  @override
  void dispose() {
    // controller.dispose();
    super.dispose();
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: CustomPaint(
        size: Size(MediaQuery.of(context).size.width,
            MediaQuery.of(context).size.width),
        painter: MyPaint(),
      ),
    );
  }
}

class MyPaint extends CustomPainter {

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

    var paint = Paint()
      ..color = Colors.orangeAccent
      ..style = PaintingStyle.stroke;
    paint.strokeWidth = 1;
    canvas.drawRect(Rect.fromCenter(center: center, width: 200, height: 200), paint);
    paint.strokeWidth = 200;
    paint.color = Colors.blue;
    canvas.drawArc(Rect.fromCenter(center: center, width: 200, height: 200), 0, 1.5,  false, paint);
  }

  @override
  bool shouldRepaint(MyPaint oldDelegate) => false;
}

Screenshots or Video

Screenshots / Video demonstration
expected actual

Logs

Logs
[Paste your logs here]

Flutter Doctor output

Doctor output
[✓] Flutter (Channel main, 3.14.0-9.0.pre.26, on macOS 13.3.1 22E261 darwin-arm64, locale zh-Hans-CN)
    • Flutter version 3.14.0-9.0.pre.26 on channel main at /Users/bytedance/Develop/upstream/flutter
    • Upstream repository [email protected]:flutter/flutter.git
    • Framework revision 5b20988483 (3 hours ago), 2023-08-22 01:26:25 -0400
    • Engine revision 454e0e35f8
    • Dart version 3.2.0 (build 3.2.0-94.0.dev)
    • DevTools version 2.26.1
    • Pub download mirror https://dart-pub.byted.org

[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.0)
    • Android SDK at /Users/bytedance/Library/Android/sdk
    • Platform android-33, build-tools 33.0.0
    • ANDROID_HOME = /Users/bytedance/Library/Android/sdk
    • Java binary at: /Applications/Android Studio.app/Contents/jre/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 11.0.13+0-b1751.21-8125866)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 14.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 14B47b
    • CocoaPods version 1.12.1

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

[✓] Android Studio (version 2021.3)
    • 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 11.0.13+0-b1751.21-8125866)

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

[✓] Connected device (3 available)
    • iPhone SE (2nd generation) (mobile) • 00008030-0018042E2E46802E • ios            • iOS 15.0 19A346
    • macOS (desktop)                     • macos                     • darwin-arm64   • macOS 13.3.1 22E261 darwin-arm64
    • Chrome (web)                        • chrome                    • web-javascript • Google Chrome 116.0.5845.96

[✓] 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.13Found to occur in 3.13found in release: 3.14Found to occur in 3.14has reproducible stepsThe issue has been confirmed reproducible and is ready to work onr: fixedIssue is closed as already fixed in a newer versionteam-engineOwned by Engine teamtriaged-engineTriaged by Engine team

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions