Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
F
Front-End
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
abdullh.alsoleman
Front-End
Commits
7462c4a6
Unverified
Commit
7462c4a6
authored
Oct 06, 2022
by
alanwutang11
Committed by
GitHub
Oct 06, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
shader warm up with canvaskit and corresponding test (#113060)
parent
e99fc8e5
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
33 additions
and
1 deletion
+33
-1
constants.dart
packages/flutter/lib/src/foundation/constants.dart
+3
-0
shader_warm_up.dart
packages/flutter/lib/src/painting/shader_warm_up.dart
+1
-1
shader_warm_up_test.dart
packages/flutter/test/painting/shader_warm_up_test.dart
+29
-0
No files found.
packages/flutter/lib/src/foundation/constants.dart
View file @
7462c4a6
...
...
@@ -69,3 +69,6 @@ const double precisionErrorTolerance = 1e-10;
/// A constant that is true if the application was compiled to run on the web.
const
bool
kIsWeb
=
bool
.
fromEnvironment
(
'dart.library.js_util'
);
/// A constant that is true if the application is using canvasKit
const
bool
isCanvasKit
=
bool
.
fromEnvironment
(
'FLUTTER_WEB_USE_SKIA'
);
packages/flutter/lib/src/painting/shader_warm_up.dart
View file @
7462c4a6
...
...
@@ -87,7 +87,7 @@ abstract class ShaderWarmUp {
await
warmUpOnCanvas
(
canvas
);
final
ui
.
Picture
picture
=
recorder
.
endRecording
();
assert
(
debugCaptureShaderWarmUpPicture
(
picture
));
if
(!
kIsWeb
)
{
// Picture.toImage is not yet implemented on the web.
if
(!
kIsWeb
||
isCanvasKit
)
{
// Picture.toImage is not yet implemented on the web.
final
TimelineTask
shaderWarmUpTask
=
TimelineTask
();
shaderWarmUpTask
.
start
(
'Warm-up shader'
);
try
{
...
...
packages/flutter/test/painting/shader_warm_up_test.dart
0 → 100644
View file @
7462c4a6
// 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/foundation.dart'
;
import
'package:flutter/widgets.dart'
;
import
'package:flutter_test/flutter_test.dart'
;
Future
<
void
>
main
()
async
{
test
(
'ShaderWarmUp'
,
()
{
final
FakeShaderWarmUp
shaderWarmUp
=
FakeShaderWarmUp
();
PaintingBinding
.
shaderWarmUp
=
shaderWarmUp
;
debugCaptureShaderWarmUpImage
=
expectAsync1
((
ui
.
Image
image
)
=>
true
);
WidgetsFlutterBinding
.
ensureInitialized
();
expect
(
shaderWarmUp
.
ranWarmUp
,
true
);
},
skip:
kIsWeb
&&
!
isCanvasKit
);
// [intended] Testing only for canvasKit
}
class
FakeShaderWarmUp
extends
ShaderWarmUp
{
bool
ranWarmUp
=
false
;
@override
Future
<
bool
>
warmUpOnCanvas
(
ui
.
Canvas
canvas
)
{
ranWarmUp
=
true
;
return
Future
<
bool
>.
delayed
(
Duration
.
zero
,
()
=>
true
);
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment