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
f10f79f8
Commit
f10f79f8
authored
Jan 12, 2016
by
Adam Barth
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1196 from abarth/rm_layer_bounds
Stop passing bogus bounds to SceneBuilder
parents
e20ec39b
d2c22a49
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
39 deletions
+16
-39
layer.dart
packages/flutter/lib/src/rendering/layer.dart
+11
-32
object.dart
packages/flutter/lib/src/rendering/object.dart
+5
-7
No files found.
packages/flutter/lib/src/rendering/layer.dart
View file @
f10f79f8
...
...
@@ -103,27 +103,16 @@ abstract class Layer {
/// A composited layer containing a [Picture]
class
PictureLayer
extends
Layer
{
PictureLayer
({
Offset
offset:
Offset
.
zero
,
this
.
paintBounds
})
PictureLayer
({
Offset
offset:
Offset
.
zero
})
:
super
(
offset:
offset
);
/// The rectangle in this layer's coodinate system that bounds the recording
///
/// The paint bounds are used to decide how much graphics memory to allocate
/// when rasterizing this layer.
Rect
paintBounds
;
/// The picture recorded for this layer
///
/// The picture's coodinate system matches this layer's coodinate system
ui
.
Picture
picture
;
void
addToScene
(
ui
.
SceneBuilder
builder
,
Offset
layerOffset
)
{
builder
.
addPicture
(
offset
+
layerOffset
,
picture
,
paintBounds
);
}
void
debugDescribeSettings
(
List
<
String
>
settings
)
{
super
.
debugDescribeSettings
(
settings
);
settings
.
add
(
'paintBounds:
$paintBounds
'
);
builder
.
addPicture
(
offset
+
layerOffset
,
picture
);
}
}
...
...
@@ -132,22 +121,22 @@ class PictureLayer extends Layer {
class
PerformanceOverlayLayer
extends
Layer
{
PerformanceOverlayLayer
({
Offset
offset:
Offset
.
zero
,
this
.
paintBounds
,
this
.
overlayRect
,
this
.
optionsMask
,
this
.
rasterizerThreshold
})
:
super
(
offset:
offset
);
/// The rectangle in this layer's coodinate system that
bounds the recording
Rect
paintBounds
;
/// The rectangle in this layer's coodinate system that
the overlay should occupy.
Rect
overlayRect
;
/// A mask specifying the statistics to display
/// A mask specifying the statistics to display
.
final
int
optionsMask
;
final
int
rasterizerThreshold
;
void
addToScene
(
ui
.
SceneBuilder
builder
,
Offset
layerOffset
)
{
assert
(
optionsMask
!=
null
);
builder
.
addPerformanceOverlay
(
optionsMask
,
paintBounds
.
shift
(
offset
+
layerOffset
));
builder
.
addPerformanceOverlay
(
optionsMask
,
overlayRect
.
shift
(
offset
+
layerOffset
));
builder
.
setRasterizerTracingThreshold
(
rasterizerThreshold
);
}
}
...
...
@@ -296,11 +285,7 @@ class ClipRectLayer extends ContainerLayer {
/// A composite layer that clips its children using a rounded rectangle
class
ClipRRectLayer
extends
ContainerLayer
{
ClipRRectLayer
({
Offset
offset:
Offset
.
zero
,
this
.
bounds
,
this
.
clipRRect
})
:
super
(
offset:
offset
);
/// Unused
Rect
bounds
;
// TODO(abarth): Remove.
ClipRRectLayer
({
Offset
offset:
Offset
.
zero
,
this
.
clipRRect
})
:
super
(
offset:
offset
);
/// The rounded-rect to clip in the parent's coordinate system
ui
.
RRect
clipRRect
;
...
...
@@ -309,25 +294,20 @@ class ClipRRectLayer extends ContainerLayer {
void
addToScene
(
ui
.
SceneBuilder
builder
,
Offset
layerOffset
)
{
Offset
childOffset
=
offset
+
layerOffset
;
builder
.
pushClipRRect
(
clipRRect
.
shift
(
childOffset
)
,
bounds
.
shift
(
childOffset
)
);
builder
.
pushClipRRect
(
clipRRect
.
shift
(
childOffset
));
addChildrenToScene
(
builder
,
childOffset
);
builder
.
pop
();
}
void
debugDescribeSettings
(
List
<
String
>
settings
)
{
super
.
debugDescribeSettings
(
settings
);
settings
.
add
(
'bounds:
$bounds
'
);
settings
.
add
(
'clipRRect:
$clipRRect
'
);
}
}
/// A composite layer that clips its children using a path
class
ClipPathLayer
extends
ContainerLayer
{
ClipPathLayer
({
Offset
offset:
Offset
.
zero
,
this
.
bounds
,
this
.
clipPath
})
:
super
(
offset:
offset
);
/// Unused
Rect
bounds
;
// TODO(abarth): Remove.
ClipPathLayer
({
Offset
offset:
Offset
.
zero
,
this
.
clipPath
})
:
super
(
offset:
offset
);
/// The path to clip in the parent's coordinate system
Path
clipPath
;
...
...
@@ -336,14 +316,13 @@ class ClipPathLayer extends ContainerLayer {
void
addToScene
(
ui
.
SceneBuilder
builder
,
Offset
layerOffset
)
{
Offset
childOffset
=
offset
+
layerOffset
;
builder
.
pushClipPath
(
clipPath
.
shift
(
childOffset
)
,
bounds
.
shift
(
childOffset
)
);
builder
.
pushClipPath
(
clipPath
.
shift
(
childOffset
));
addChildrenToScene
(
builder
,
childOffset
);
builder
.
pop
();
}
void
debugDescribeSettings
(
List
<
String
>
settings
)
{
super
.
debugDescribeSettings
(
settings
);
settings
.
add
(
'bounds:
$bounds
'
);
settings
.
add
(
'clipPath:
$clipPath
'
);
}
}
...
...
packages/flutter/lib/src/rendering/object.dart
View file @
f10f79f8
...
...
@@ -152,7 +152,7 @@ class PaintingContext {
void
_startRecording
()
{
assert
(!
_isRecording
);
_currentLayer
=
new
PictureLayer
(
paintBounds:
_paintBounds
);
_currentLayer
=
new
PictureLayer
();
_recorder
=
new
ui
.
PictureRecorder
();
_canvas
=
new
Canvas
(
_recorder
,
_paintBounds
);
_containerLayer
.
append
(
_currentLayer
);
...
...
@@ -188,7 +188,7 @@ class PaintingContext {
void
pushPerformanceOverlay
(
Offset
offset
,
int
optionsMask
,
int
rasterizerThreshold
,
Size
size
)
{
_stopRecordingIfNeeded
();
PerformanceOverlayLayer
performanceOverlayLayer
=
new
PerformanceOverlayLayer
(
paintBounds
:
new
Rect
.
fromLTWH
(
0.0
,
0.0
,
size
.
width
,
size
.
height
),
overlayRect
:
new
Rect
.
fromLTWH
(
0.0
,
0.0
,
size
.
width
,
size
.
height
),
optionsMask:
optionsMask
,
rasterizerThreshold:
rasterizerThreshold
);
...
...
@@ -224,16 +224,14 @@ class PaintingContext {
void
pushClipRRect
(
bool
needsCompositing
,
Offset
offset
,
Rect
bounds
,
ui
.
RRect
clipRRect
,
PaintingContextCallback
painter
)
{
if
(
needsCompositing
)
{
_stopRecordingIfNeeded
();
ClipRRectLayer
clipLayer
=
new
ClipRRectLayer
(
bounds:
bounds
,
clipRRect:
clipRRect
);
ClipRRectLayer
clipLayer
=
new
ClipRRectLayer
(
clipRRect:
clipRRect
);
_appendLayer
(
clipLayer
,
offset
);
PaintingContext
childContext
=
new
PaintingContext
.
_
(
clipLayer
,
bounds
);
painter
(
childContext
,
Offset
.
zero
);
childContext
.
_stopRecordingIfNeeded
();
}
else
{
canvas
.
saveLayer
(
bounds
.
shift
(
offset
),
_disableAntialias
);
// TODO(abarth): Remove this translation once RRect.shift works again.
canvas
.
translate
(
offset
.
dx
,
offset
.
dy
);
canvas
.
clipRRect
(
clipRRect
);
canvas
.
clipRRect
(
clipRRect
.
shift
(
offset
));
painter
(
this
,
Offset
.
zero
);
canvas
.
restore
();
}
...
...
@@ -247,7 +245,7 @@ class PaintingContext {
void
pushClipPath
(
bool
needsCompositing
,
Offset
offset
,
Rect
bounds
,
Path
clipPath
,
PaintingContextCallback
painter
)
{
if
(
needsCompositing
)
{
_stopRecordingIfNeeded
();
ClipPathLayer
clipLayer
=
new
ClipPathLayer
(
bounds:
bounds
,
clipPath:
clipPath
);
ClipPathLayer
clipLayer
=
new
ClipPathLayer
(
clipPath:
clipPath
);
_appendLayer
(
clipLayer
,
offset
);
PaintingContext
childContext
=
new
PaintingContext
.
_
(
clipLayer
,
bounds
);
painter
(
childContext
,
Offset
.
zero
);
...
...
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