Skip to content

Commit a142372

Browse files
authored
Rounded Rect Blur Benchmark: Made the number of circles a fixed number (flutter#149323)
This will make the results more comparable across devices. ## Pre-launch Checklist - [x] I read the [Contributor Guide] and followed the process outlined there for submitting PRs. - [x] I read the [Tree Hygiene] wiki page, which explains my responsibilities. - [x] I read and followed the [Flutter Style Guide], including [Features we expect every widget to implement]. - [x] I signed the [CLA]. - [x] I listed at least one issue that this PR fixes in the description above. - [x] I updated/added relevant documentation (doc comments with `///`). - [x] I added new tests to check the change I am making, or this PR is [test-exempt]. - [x] I followed the [breaking change policy] and added [Data Driven Fixes] where supported. - [x] All existing and new tests are passing. If you need help, consider asking for advice on the #hackers-new channel on [Discord]. <!-- Links --> [Contributor Guide]: https://github.com/flutter/flutter/wiki/Tree-hygiene#overview [Tree Hygiene]: https://github.com/flutter/flutter/wiki/Tree-hygiene [test-exempt]: https://github.com/flutter/flutter/wiki/Tree-hygiene#tests [Flutter Style Guide]: https://github.com/flutter/flutter/wiki/Style-guide-for-Flutter-repo [Features we expect every widget to implement]: https://github.com/flutter/flutter/wiki/Style-guide-for-Flutter-repo#features-we-expect-every-widget-to-implement [CLA]: https://cla.developers.google.com/ [flutter/tests]: https://github.com/flutter/tests [breaking change policy]: https://github.com/flutter/flutter/wiki/Tree-hygiene#handling-breaking-changes [Discord]: https://github.com/flutter/flutter/wiki/Chat [Data Driven Fixes]: https://github.com/flutter/flutter/wiki/Data-driven-Fixes
1 parent d89ae48 commit a142372

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

dev/benchmarks/macrobenchmarks/lib/src/rrect_blur.dart

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@ class RRectBlur extends StatefulWidget {
1111
const RRectBlur({super.key});
1212

1313
@override
14-
State<RRectBlur> createState() => _DrawPointsPageState();
14+
State<RRectBlur> createState() => _RRectBlurPageState();
1515
}
1616

17-
class _DrawPointsPageState extends State<RRectBlur>
17+
class _RRectBlurPageState extends State<RRectBlur>
1818
with SingleTickerProviderStateMixin {
1919
late final AnimationController controller;
2020
double tick = 0.0;
@@ -73,7 +73,8 @@ class PointsPainter extends CustomPainter {
7373
}
7474
final double halfHeight = size.height / 2.0;
7575
const double freq = 0.25;
76-
for (int i = 0; i < size.width / 10; ++i) {
76+
const int circleCount = 40;
77+
for (int i = 0; i < circleCount; ++i) {
7778
final double radius =
7879
25 * cos(i + (1.0 * 2.0 * 3.1415 * tick) / 60.0) +
7980
25;
@@ -84,8 +85,9 @@ class PointsPainter extends CustomPainter {
8485
final double yval =
8586
halfHeight * sin(i + (freq * 2.0 * 3.1415 * tick) / 60.0) +
8687
halfHeight;
88+
final double xval = (i.toDouble() / circleCount) * size.width;
8789
canvas.drawCircle(
88-
Offset(10.0 * i, yval),
90+
Offset(xval, yval),
8991
50,
9092
paint..color = kColors[i % kColors.length],
9193
);

0 commit comments

Comments
 (0)