forked from flutter/plugins
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[devicelab] track performance of animated image filter (#115850)
* [devicelab] track performance of animated image filter * ++ * make animations repeat and add dispose * make duration more consistently 10sec
- Loading branch information
1 parent
f777c9f
commit dfa3d33
Showing
11 changed files
with
146 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
75 changes: 75 additions & 0 deletions
75
dev/benchmarks/macrobenchmarks/lib/src/animated_complex_image_filtered.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
// Copyright 2014 The Flutter Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
import 'dart:ui' as ui; | ||
import 'package:flutter/material.dart'; | ||
|
||
// Various tests to verify that Animated image filtered layers do not | ||
// dirty children even without explicit repaint boundaries. These intentionally use | ||
// text to ensure we don't measure the opacity peephole case. | ||
class AnimatedComplexImageFiltered extends StatefulWidget { | ||
const AnimatedComplexImageFiltered({ super.key }); | ||
|
||
@override | ||
State<AnimatedComplexImageFiltered> createState() => _AnimatedComplexImageFilteredState(); | ||
} | ||
|
||
class _AnimatedComplexImageFilteredState extends State<AnimatedComplexImageFiltered> with SingleTickerProviderStateMixin { | ||
late final AnimationController controller = AnimationController(vsync: this, duration: const Duration(milliseconds: 5000)); | ||
late final Animation<double> animation = controller.drive(Tween<double>(begin: 0.0, end: 1.0)); | ||
ui.ImageFilter imageFilter = ui.ImageFilter.blur(); | ||
|
||
@override | ||
void initState() { | ||
super.initState(); | ||
controller.repeat(); | ||
animation.addListener(() { | ||
setState(() { | ||
imageFilter = ui.ImageFilter.blur(sigmaX: animation.value * 5, sigmaY: animation.value * 5); | ||
}); | ||
}); | ||
} | ||
|
||
@override | ||
void dispose() { | ||
controller.dispose(); | ||
super.dispose(); | ||
} | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return MaterialApp( | ||
home: Scaffold( | ||
body: ListView( | ||
children: <Widget>[ | ||
for (int i = 0; i < 20; i++) | ||
ImageFiltered( | ||
imageFilter: imageFilter, | ||
child: Center( | ||
child: Transform.scale(scale: 1.01, child: const ModeratelyComplexWidget()), | ||
), | ||
), | ||
], | ||
), | ||
), | ||
); | ||
} | ||
} | ||
|
||
class ModeratelyComplexWidget extends StatelessWidget { | ||
const ModeratelyComplexWidget({ super.key }); | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return const Material( | ||
elevation: 10, | ||
clipBehavior: Clip.hardEdge, | ||
child: ListTile( | ||
leading: Icon(Icons.abc, size: 24), | ||
title: DecoratedBox(decoration: BoxDecoration(color: Colors.red), child: Text('Hello World')), | ||
trailing: FlutterLogo(), | ||
), | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
dev/benchmarks/macrobenchmarks/test/animated_complex_image_filtered_perf_e2e.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// Copyright 2014 The Flutter Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
import 'package:macrobenchmarks/common.dart'; | ||
|
||
import 'util.dart'; | ||
|
||
void main() { | ||
macroPerfTestE2E( | ||
'animated_complex_image_filtered_perf', | ||
kAnimatedComplexImageFilteredPerfRouteName, | ||
pageDelay: const Duration(seconds: 1), | ||
duration: const Duration(seconds: 10), | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
dev/devicelab/bin/tasks/animated_complex_image_filtered_perf__e2e_summary.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
// Copyright 2014 The Flutter Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
import 'dart:async'; | ||
|
||
import 'package:flutter_devicelab/framework/devices.dart'; | ||
import 'package:flutter_devicelab/framework/framework.dart'; | ||
import 'package:flutter_devicelab/tasks/perf_tests.dart'; | ||
|
||
Future<void> main() async { | ||
deviceOperatingSystem = DeviceOperatingSystem.android; | ||
await task(createAnimatedComplexImageFilteredPerfE2ETest()); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters