-
Notifications
You must be signed in to change notification settings - Fork 28.6k
[Impeller] incorrect Z order in drawRawPoints. #160343
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Possibly related, some of my users have also reported bad z-order drawing: This is a normal BottomSheet overlaid on top of a custom chart widget. The widget is drawing a bunch of lines and text, but weirdly only the dots break the Z order. The dots are drawn using canvas.drawPoints(PointMode.points, offsets, _outerPaint);
canvas.drawPoints(PointMode.points, offsets, _centerPaint); Disabling impeller on Android solved the issue. |
the issue appears on iphone as well so if disabling impeller helped then impeller is probably the issue. If I remember correctly android moved to impeller on the latest upgrade. |
Okay good news, I cannot repro this at ToT - which likely means it was fixed sometime between when the release was cut and now. We just have to bisect a bit to figure out if it can be cherry picked. |
also if you look closely at the first screenshot you can see that the first few points don't seem to overlap the ModalSheet. Only after the first few points it starts to draw over |
I was able to recreate the issue in the example by adding more points to the list import 'dart:ui';
import 'package:flutter/foundation.dart';
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',
home: Scaffold(
appBar: AppBar(
),
body: LayoutBuilder(builder: (context, constraints) {
return SizedBox(
height: constraints.maxHeight,
width: constraints.maxWidth,
child: CustomPaint(
isComplex: true,
painter: LinePainter(
),
),
);
}),
floatingActionButton: FloatingActionButton(
backgroundColor: Colors.black,
elevation: 4,
shape: const RoundedRectangleBorder(
borderRadius: BorderRadius.all(Radius.circular(16.0)),
),
onPressed: () {},
child: const Icon(Icons.add),
),
),
);
}
}
class LinePainter extends CustomPainter {
@override
void paint(Canvas canvas, Size size) {
Paint paint = Paint()
..color = Colors.red
..strokeWidth = 5;
final linePoints = Float32List.fromList([7.135585E26,
656.5495,
0.48672,
656.5495,
0.48672,
656.5495,
0.8232686,
656.5495,
0.8232686,
656.5495,
1.2351086,
656.5495,
1.2351086,
656.5495,
1.6539428,
656.5495,
1.6539428,
656.5495,
2.0600228,
656.5495,
2.0600228,
656.5495,
4258.3555,
656.5495,
7.135585E26,
656.5495,
0.48672,
656.5495,
0.48672,
656.5495,
0.8232686,
656.5495,
0.8232686,
656.5495,
1.2351086,
656.5495,
1.2351086,
656.5495,
1.6539428,
656.5495,
1.6539428,
656.5495,
2.0600228,
656.5495,
2.0600228,
656.5495,
4258.3555,
656.5495,
7.135585E26,
656.5495,
0.48672,
656.5495,
0.48672,
656.5495,
0.8232686,
656.5495,
0.8232686,
656.5495,
1.2351086,
656.5495,
1.2351086,
656.5495,
1.6539428,
656.5495,
1.6539428,
656.5495,
2.0600228,
656.5495,
2.0600228,
656.5495,
4258.3555,
656.5495,
7.135585E26,
656.5495,
0.48672,
656.5495,
0.48672,
656.5495,
0.8232686,
656.5495,
0.8232686,
656.5495,
1.2351086,
656.5495,
1.2351086,
656.5495,
1.6539428,
656.5495,
1.6539428,
656.5495,
2.0600228,
656.5495,
2.0600228,
656.5495,
4258.3555,
656.5495,
300, 0
]);
final linePoints2 = Float32List.fromList([300,0,300,1000]);
final linePoints1 =Float32List.fromList([1,1,800,1500]);
canvas.drawRawPoints(PointMode.lines, linePoints, paint);
canvas.drawRawPoints(PointMode.lines, linePoints1, paint);
canvas.drawRawPoints(PointMode.lines, linePoints2, paint);
}
@override
bool shouldRepaint(covariant CustomPainter oldDelegate) {
return true;
}
}
|
This still looks like its working for me on master channel? I'm aware this isn't working on the stable channel and I'm looking into a cherry pick. |
I was able to test some combinations:
Unfortunately I'm not able to test the master channel on iOS but given that it seems to have been a general impeller bug and it's fixed on Android, I'm assuming it's the same for all platforms. EDIT: I just noticed that there there was a hotfix on stable to 3.27.1, it does not fix the issue on Android impeller. |
The fix for this was flutter/engine#56494 , looking into making a cherry pick. |
Closing the issue since its fixed, the cherry pick request tracks merging that to stable. |
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of |
Uh oh!
There was an error while loading. Please reload this page.
Steps to reproduce
run the code on android or ios.
the issue seems to be if the float32List has too many numbers. Drawing linePoints without the numbers between the 2 comments results in the expected outcome. Drawing only linePoints1 and linePoints2 also works correctly
this bug seems to occur only on 3.27.0. when downgrading to 3.24.4 the bug does not occur.
Expected results
all lines should be drawn under the FloatingActionButton like in the picture below.
Actual results
some of the lines are drawn over the FloatingActionButton. This happens when drawRawPoints needs to draw a line with a lot of points. Also based on when this line is drawn different lines get drawn above the button.
Code sample
Code sample
Screenshots or Video
Screenshots / Video demonstration
https://github.com/user-attachments/assets/f9ff045f-6491-41e7-84c9-ec45d5051c99Logs
Logs
[Paste your logs here]
Flutter Doctor output
Doctor output
The text was updated successfully, but these errors were encountered: