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
da8b340c
Unverified
Commit
da8b340c
authored
Mar 07, 2019
by
liyuqian
Committed by
GitHub
Mar 07, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Quick fix for shader warm up (#28951)
Fix issues in
https://github.com/flutter/flutter/pull/28687
parent
440ce8fd
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
8 deletions
+5
-8
shader_warm_up.dart
packages/flutter/lib/src/painting/shader_warm_up.dart
+5
-8
No files found.
packages/flutter/lib/src/painting/shader_warm_up.dart
View file @
da8b340c
...
...
@@ -67,8 +67,6 @@ abstract class ShaderWarmUp {
/// Trigger draw operations on a given canvas to warm up GPU shader
/// compilation cache.
///
/// Parameter [image] is to be used for drawImage related operations.
///
/// To decide which draw operations to be added to your custom warm up
/// process, try capture an skp using `flutter screenshot --observatory-
/// port=<port> --type=skia` and analyze it with https://debugger.skia.org.
...
...
@@ -90,7 +88,7 @@ abstract class ShaderWarmUp {
final
ui
.
Picture
picture
=
recorder
.
endRecording
();
final
TimelineTask
shaderWarmUpTask
=
TimelineTask
();
shaderWarmUpTask
.
start
(
'Warm-up shader'
);
picture
.
toImage
(
size
.
width
.
ceil
(),
size
.
height
.
ceil
()).
then
((
ui
.
Image
_
)
{
picture
.
toImage
(
size
.
width
.
ceil
(),
size
.
height
.
ceil
()).
then
((
ui
.
Image
image
)
{
shaderWarmUpTask
.
finish
();
});
}
...
...
@@ -184,10 +182,9 @@ class DefaultShaderWarmUp extends ShaderWarmUp {
..
layout
(
const
ui
.
ParagraphConstraints
(
width:
60.0
));
canvas
.
drawParagraph
(
paragraph
,
const
ui
.
Offset
(
20.0
,
20.0
));
// Construct an image for drawImage related operations
const
int
imageWidth
=
4
0
;
const
int
imageHeight
=
4
0
;
const
int
imageWidth
=
1
0
;
const
int
imageHeight
=
1
0
;
final
Uint8List
pixels
=
Uint8List
.
fromList
(
List
<
int
>.
generate
(
imageWidth
*
imageHeight
*
4
,
(
int
i
)
=>
i
%
4
<
2
?
0x00
:
0xFF
,
// opaque blue
...
...
@@ -201,9 +198,9 @@ class DefaultShaderWarmUp extends ShaderWarmUp {
final
ui
.
Rect
srcRect
=
ui
.
Rect
.
fromLTWH
(
0.0
,
0.0
,
image
.
width
.
toDouble
(),
image
.
height
.
toDouble
());
canvas
.
drawImage
(
image
,
const
ui
.
Offset
(
20.0
,
20.0
),
ui
.
Paint
());
canvas
.
translate
(
80.0
,
0.0
);
canvas
.
drawImageRect
(
image
,
srcRect
,
ui
.
Rect
.
fromLTWH
(
20.0
,
20.0
,
20.0
,
20.0
),
paints
[
0
]);
canvas
.
drawImageRect
(
image
,
srcRect
,
ui
.
Rect
.
fromLTWH
(
20.0
,
20.0
,
imageWidth
*
0.6
,
imageWidth
*
0.6
),
paints
[
0
]);
canvas
.
translate
(
80.0
,
0.0
);
canvas
.
drawImageRect
(
image
,
srcRect
,
ui
.
Rect
.
fromLTWH
(
10.0
,
10.0
,
60.0
,
60.0
),
paints
[
0
]);
canvas
.
drawImageRect
(
image
,
srcRect
,
ui
.
Rect
.
fromLTWH
(
10.0
,
10.0
,
imageWidth
*
1.5
,
imageWidth
*
1.5
),
paints
[
0
]);
canvas
.
restore
();
completer
.
complete
();
});
...
...
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