-
Notifications
You must be signed in to change notification settings - Fork 29.8k
Closed
flutter/engine
#54817Labels
e: impellerImpeller rendering backend issues and features requestsImpeller rendering backend issues and features requeststeam-engineOwned by Engine teamOwned by Engine team
Description
Steps to reproduce
When using the Impeller engine, even if a line with a stroke width less than 1 is drawn using CustomPainter or SVG, it does not become thinner than a certain threshold (probably 1px). This might be related to anti-aliasing. In the traditional Skia engine, it is rendered without any visual issues.
Expected results
Traditional Skia engine output:
It is rendered without any visual issues.
Actual results
New Impeller engine output:
The stroke widths of the grid lines are not properly distinguishable.
Code sample
Code sample
import 'dart:math';
import 'package:flutter/gestures.dart';
import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart';
String createSvg() {
var svg = '<svg width="200" height="200" xmlns="http://www.w3.org/2000/svg">';
for (int i = 0; i <= 200; i += 5) {
var strokeWidth = 0.025;
if (i % 25 == 0) {
if (i % 100 == 0) {
strokeWidth = 0.5;
} else {
strokeWidth = 0.1;
}
}
svg +=
'<line x1="$i" y1="0" x2="$i" y2="200" stroke="black" stroke-width="$strokeWidth" />\n';
svg +=
'<line x1="0" y1="$i" x2="200" y2="$i" stroke="black" stroke-width="$strokeWidth" />\n';
}
svg += '</svg>';
return svg;
}
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
home: SvgZoomExample(),
);
}
}
class SvgZoomExample extends StatefulWidget {
@override
_SvgZoomExampleState createState() => _SvgZoomExampleState();
}
class _SvgZoomExampleState extends State<SvgZoomExample> {
double _scale = 1.0;
void _onPointerSignal(PointerSignalEvent event) {
if (event is PointerScrollEvent) {
setState(() {
_scale *= pow(2.0, event.scrollDelta.dy * -0.001);
_scale = _scale.clamp(0.1, 10.0);
});
}
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('SVG Zoom Example'),
),
body: Listener(
behavior: HitTestBehavior.opaque,
onPointerSignal: _onPointerSignal,
child: Center(
child: Transform.scale(
scale: _scale,
child: SvgPicture.string(
createSvg(),
width: 200,
height: 200,
),
),
),
),
);
}
}Test Environment
Test Environment
macOS, iOS, AndroidFlutter Doctor output
Doctor output
[✓] Flutter (Channel stable, 3.24.1, on macOS 14.6.1 23G93 darwin-arm64, locale ko-KR)
• Flutter version 3.24.1 on channel stable at /Users/tyndall.log/Documents/flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 5874a72aa4 (7 days ago), 2024-08-20 16:46:00 -0500
• Engine revision c9b9d5780d
• Dart version 3.5.1
• DevTools version 2.37.2
[!] Android toolchain - develop for Android devices (Android SDK version 35.0.0)
• Android SDK at /Users/tyndall.log/Library/Android/sdk
• Platform android-35, build-tools 35.0.0
• Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 17.0.11+0-17.0.11b1207.24-11852314)
! Some Android licenses not accepted. To resolve this, run: flutter doctor --android-licenses
[✓] Xcode - develop for iOS and macOS (Xcode 15.4)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Build 15F31d
• CocoaPods version 1.15.2
[✓] Chrome - develop for the web
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
[✓] Android Studio (version 2024.1)
• 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.11+0-17.0.11b1207.24-11852314)
[✓] VS Code (version 1.92.2)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 3.94.0
[✓] Connected device (3 available)
• macOS (desktop) • macos • darwin-arm64 • macOS 14.6.1 23G93 darwin-arm64
• Mac Designed for iPad (desktop) • mac-designed-for-ipad • darwin • macOS 14.6.1 23G93 darwin-arm64
• Chrome (web) • chrome • web-javascript • Google Chrome 127.0.6533.122
[✓] Network resources
• All expected network resources are available.
! Doctor found issues in 1 category.Metadata
Metadata
Assignees
Labels
e: impellerImpeller rendering backend issues and features requestsImpeller rendering backend issues and features requeststeam-engineOwned by Engine teamOwned by Engine team



