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
3890af64
Unverified
Commit
3890af64
authored
Mar 20, 2018
by
xster
Committed by
GitHub
Mar 20, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add debug disable flags for various performance affecting layers (#15548)
parent
27ac523e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
46 additions
and
14 deletions
+46
-14
debug.dart
packages/flutter/lib/src/rendering/debug.dart
+20
-0
layer.dart
packages/flutter/lib/src/rendering/layer.dart
+26
-14
No files found.
packages/flutter/lib/src/rendering/debug.dart
View file @
3890af64
...
...
@@ -111,6 +111,26 @@ bool debugCheckIntrinsicSizes = false;
/// * The discussion at [RendererBinding.drawFrame].
bool
debugProfilePaintsEnabled
=
false
;
/// Setting to true will cause all clipping effects from the layer tree to be ignored.
///
/// Can be used to debug whether objects being clipped are painting excessively
/// in clipped areas. Can also be used to check whether excessive use of clipping
/// is affecting performance.
bool
debugDisableClipLayers
=
false
;
/// Setting to true will cause all physical modeling effects, such as shadows
/// from elevations, from the layer tree to be ignored.
///
/// Can be used to check whether excessive use of physical models is affecting
/// performance.
bool
debugDisablePhysicalShapeLayers
=
false
;
/// Setting to true will cause all opacity effects to be ignored.
///
/// An optimization to not paint the child at all when opacity is 0 will still
/// remain. Can be used to check whether excessive use of opacity effects is
/// affecting performance.
bool
debugDisableOpacityLayers
=
false
;
void
_debugDrawDoubleRect
(
Canvas
canvas
,
Rect
outerRect
,
Rect
innerRect
,
Color
color
)
{
final
Path
path
=
new
Path
()
...
...
packages/flutter/lib/src/rendering/layer.dart
View file @
3890af64
...
...
@@ -10,6 +10,8 @@ import 'package:flutter/foundation.dart';
import
'package:flutter/painting.dart'
;
import
'package:vector_math/vector_math_64.dart'
;
import
'debug.dart'
;
/// A composited layer.
///
/// During painting, the render tree generates a tree of composited layers that
...
...
@@ -531,9 +533,11 @@ class ClipRectLayer extends ContainerLayer {
@override
void
addToScene
(
ui
.
SceneBuilder
builder
,
Offset
layerOffset
)
{
builder
.
pushClipRect
(
clipRect
.
shift
(
layerOffset
));
if
(!
debugDisableClipLayers
)
builder
.
pushClipRect
(
clipRect
.
shift
(
layerOffset
));
addChildrenToScene
(
builder
,
layerOffset
);
builder
.
pop
();
if
(!
debugDisableClipLayers
)
builder
.
pop
();
}
@override
...
...
@@ -559,9 +563,11 @@ class ClipRRectLayer extends ContainerLayer {
@override
void
addToScene
(
ui
.
SceneBuilder
builder
,
Offset
layerOffset
)
{
builder
.
pushClipRRect
(
clipRRect
.
shift
(
layerOffset
));
if
(!
debugDisableClipLayers
)
builder
.
pushClipRRect
(
clipRRect
.
shift
(
layerOffset
));
addChildrenToScene
(
builder
,
layerOffset
);
builder
.
pop
();
if
(!
debugDisableClipLayers
)
builder
.
pop
();
}
@override
...
...
@@ -587,9 +593,11 @@ class ClipPathLayer extends ContainerLayer {
@override
void
addToScene
(
ui
.
SceneBuilder
builder
,
Offset
layerOffset
)
{
builder
.
pushClipPath
(
clipPath
.
shift
(
layerOffset
));
if
(!
debugDisableClipLayers
)
builder
.
pushClipPath
(
clipPath
.
shift
(
layerOffset
));
addChildrenToScene
(
builder
,
layerOffset
);
builder
.
pop
();
if
(!
debugDisableClipLayers
)
builder
.
pop
();
}
}
...
...
@@ -664,9 +672,11 @@ class OpacityLayer extends ContainerLayer {
@override
void
addToScene
(
ui
.
SceneBuilder
builder
,
Offset
layerOffset
)
{
builder
.
pushOpacity
(
alpha
);
if
(!
debugDisableOpacityLayers
)
builder
.
pushOpacity
(
alpha
);
addChildrenToScene
(
builder
,
layerOffset
);
builder
.
pop
();
if
(!
debugDisableOpacityLayers
)
builder
.
pop
();
}
@override
...
...
@@ -778,13 +788,15 @@ class PhysicalModelLayer extends ContainerLayer {
@override
void
addToScene
(
ui
.
SceneBuilder
builder
,
Offset
layerOffset
)
{
builder
.
pushPhysicalShape
(
path:
clipPath
.
shift
(
layerOffset
),
elevation:
elevation
,
color:
color
,
);
if
(!
debugDisablePhysicalShapeLayers
)
builder
.
pushPhysicalShape
(
path:
clipPath
.
shift
(
layerOffset
),
elevation:
elevation
,
color:
color
,
);
addChildrenToScene
(
builder
,
layerOffset
);
builder
.
pop
();
if
(!
debugDisablePhysicalShapeLayers
)
builder
.
pop
();
}
@override
...
...
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